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

Dynamically Bind Multiple Data Series with different scales to Line Chart

1 Answer 183 Views
Charts
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 2
George asked on 15 Dec 2012, 10:01 PM
I have followed the demo of "grouped" data and I can successfully get 3 dynamically loaded datasets to display on a line graph.  Hooray.  But each of the series should be using a different scale.  How can I map each series dynamically to different scales? 

Maybe there is someway to use the GroupNameTemplate syntax ("#group.value#") in the .Axis() setting to get it set correctly?  I've tried that but it's not working.

Maybe I should be using something other than Grouped data?

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 18 Dec 2012, 10:42 AM
Hello George,

You can achieve this as set the axes dynamically through the chart options and then call the redraw() method. For example:
var chart =  $("#chart").data("kendoChart");
var chartOptions = chart.options;
         
var valueAxis = $("#chart").data("kendoChart").options.valueAxis;   
      chartOptions.valueAxis = [];  
      chartOptions.valueAxis.push(valueAxis);
      chartOptions.valueAxis.push({});
      chartOptions.valueAxis.push({});
                                  
      chartOptions.valueAxis[0].name = "FirstSeries Axis";   
      chartOptions.series[0].axis = "FirstSeries Axis";
                     
      chartOptions.valueAxis[1].name = "SecondSeries Axis";
      chartOptions.series[1].axis = "SecondSeries Axis";
                     
      chartOptions.valueAxis[2].name = "ThirdSeries Axis";
      chartOptions.series[2].axis = "ThirdSeries Axis";
                         
      chart.redraw();

For convenience I attached a simple HTML page which demonstrates such approach in action.

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
George
Top achievements
Rank 2
Answers by
Iliana Dyankova
Telerik team
Share this question
or