Hi,
I've created a chart in ASP.NET MVC using the following code:
On a button click, I would like to refresh the chart with new data by either calling another Action or passing parameters into the current action. How do I do that?
I tried setDataSource and then redraw as shown below but its not working. Please help. Thanks!
I've created a chart in ASP.NET MVC using the following code:
@(Html.Kendo().Chart(Model)
.Name("Regions")
.Title("Regions")
.DataSource(ds =>
{
ds.Read(read => read.Action("GetClientRecordsCountByRegion", "Home"));
ds.Sort(sort => sort.Add(model => model.Region).Ascending());
}
)
.Series(series =>
{
series.Pie("TrademarkCount", "Region")
.Labels(lbl => lbl.Visible(true).Template("#= category #: #= value #")
.Align(ChartPieLabelsAlign.Circle)
.Position(ChartPieLabelsPosition.OutsideEnd));
})
)
I tried setDataSource and then redraw as shown below but its not working. Please help. Thanks!
function
refreshsource()
{
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
type:
"GET"
,
url:
"/Home/GetClientRecordsCountByRegionNew"
,
dataType:
"json"
}
}
});
var
chart = $(
"#Regions"
).data(
"kendoChart"
);
chart.setDataSource(dataSource);
chart.redraw();
}