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

Cannot Pan/Zoom chart with Dynamic Series

4 Answers 128 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 26 Mar 2015, 09:02 PM
I have a graph displayed, and data is set/added dynamically to the series list. I have setup a Dojo with the basic scenario of the issue using MVVM.

 When I try manually to modify the displayed range, the graph updates, but the new series is lost (probably because the ._redraw function destroys the DOM and recreates it inside the .setOptions function). I tried adding the new series and using .refresh() instead of .redraw(), but that doesn't seem to help.

I tried to implement a second method to accomplish this by filtering through the DataSource, but that seems to remove all the points, but keeps the series in the list.

The amount of data that will be presented will be in the tens-to-hundreds of thousands of datapoints to navigate though. Thanks for any insight!

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 31 Mar 2015, 06:00 AM
Hello Sunny,

I have updated your dojo and it now works: http://dojo.telerik.com/@korchev/IbasA. Check the new zoomIn method:

      zoomIn: function (kEvt) {
        //Try to zoom in on Frequency range 
        var options = this.kChart.options,
            ranges = {
              xAxis: {
                min: options.xAxis.min + 0.5,
                max: options.xAxis.max - 0.5
              }
            };
        
        

        $.extend(true, this.kChart.options, ranges);
        this.kChart.redraw();
        this.numSeries();
      }

The problem was that the setOptions method replaces all options and to avoid that you need to merge the new ones with the existing ones via $.extend.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sunny
Top achievements
Rank 1
answered on 31 Mar 2015, 08:39 PM
Atanas,

I guess I took the API docs for its word when it stated:
setOptions
Sets the widget options. Changes are cumulative.

Meaning that the settings weren't reset. Thank you!
0
Sunny
Top achievements
Rank 1
answered on 01 Apr 2015, 01:32 PM
What about my second method?

Is there a alternate way to make it work by filtering the DataSource?

Thanks!
0
Atanas Korchev
Telerik team
answered on 02 Apr 2015, 08:07 AM
Hello Sunny,

Filtering the data source will reduce the number of items in the data source. Is this what you want to achieve? This will change the chart data range and potentially show a completely different chart. Setting the xAsix min and max will scale the chart.

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