This is a migrated thread and some comments may be shown as answers.

chart display based on dropdown selected item

1 Answer 212 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Rajendra asked on 11 Nov 2014, 10:21 AM
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

1 Answer, 1 is accepted

Sort by
T. Tsonev
Telerik team
answered on 13 Nov 2014, 08:22 AM

You should first take a look at the Binding to remote data demo.

A simple way to do change the query is to trigger a read on the data source of the 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)

<button id="filter">Filter</button>
    $("#filter").click(function () {
        var chart = $("#chart").getKendoChart();{
            myData: "foo"

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:
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.

T. Tsonev

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.

Asked by
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question