unarity
unarity

Reputation: 2445

Kendo line chart - switch between series

I am making simple line chart in kendo. Something like this demo http://demos.telerik.com/kendo-ui/dataviz/line-charts/index.html.

I also have mulitple series as on example(India,World etc...).

My question is, is there way to allow that only one serie is active on chart.

Series behave like checkbox button(I can have one or more active) and I want them to behave as radio button so only one serie can be active.

Upvotes: 0

Views: 949

Answers (2)

bgio
bgio

Reputation: 1

You can do this with a button. Haven't tried it with a radio button.

$("#ButtonName").kendoButton({
click: function (e) {
var varname = $("#chartName").data("kendoChart")                    
kendodatasourcename.filter(
{ field: "fieldName", operator: "eq", value: "filteredvaluefromyourdataset" })

Upvotes: 0

Petur Subev
Petur Subev

Reputation: 20233

The short answer is No. You cannot modify the legend in anyway to achieve such behavior. However you can use radio buttons separately and update the options of the chart - such as the series.

Here is a small JsBin example:

  $("input[type=radio]").click(function(){

    var clickedOn = $(this).val();
    var data = $.grep(series, function(val){ 

      return val.name == clickedOn;
    })[0];

    chart.setOptions({series:[
      {
        name: clickedOn,
            data: data.data
      }
    ]})
  })

Upvotes: 1

Related Questions