Based on the selection of dropdownlist item, I would need to query the database with the selected item and display the results as chart.
Could anyone please point me to the example url
A simple way to do change the query is to trigger a read on the data source of the chart: @(Html.Kendo().Chart<MyModel>()
.Name("chart")
.DataSource(ds => ds.Read(read => read.Action("Read", "Home")))
.Series(series => {
series.Column(model => model.Value).Name("Series 1");
})
.CategoryAxis(axis => axis
.Categories(model => model.Year)
)
)
Here we're hitting the controller with additional data that can contain for example our filter criteria.
It's accessible as regular parameters on the action: [HttpPost]
public ActionResult _SpainElectricityProduction(string myData)
{
return Json(...);
}
The chart will be updated with the new data as returned from the action.
Notice that we can't change series definitions or chart options directly.
Such updates concerns only the data source and the series data.
I hope this helps.
Regards,
T. Tsonev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.