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

chart refresh destroy crosshair tooltip and zoom selection

4 Answers 196 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 04 Oct 2018, 02:55 PM

Hello,

I have a realtime chart with refresh every second. After the refresh the crosshair tooltip and zoom selection (with left mouse key) are gone. See http://dojo.telerik.com/uTEseYiz

I want to keep the croshair tooltip visible and the chart should be zoomable. Now the user must complete the zoom action before the next refresh occurs.

Regards,

Peter

 

 

4 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 04 Oct 2018, 03:55 PM

Hello,

in http://dojo.telerik.com/uTEseYiz/3 is an updated version with correct label formatting and the update function at beginnung:

function update() {
     var data = chart.options.series[0].data;
     for (i = 0; i < 1 / dt; i++) { // add data for 1 sec at end
         t0ms += dt * 1000;
         data.splice(0, 1);
         data.push(getSample());
     }
     SetGrid();
     chart.refresh();
     setTimeout(update, 1000);
 }

 

It is possible to check, if the chart is in zoom selection mode? Then don't call chart.refresh() would be a solution for the zoom problem?

And it is possible to get the status of the crosshair line+tooltip and restore it after refresh?

Peter

0
Tsvetina
Telerik team
answered on 08 Oct 2018, 11:37 AM
Hello Peter,

Currently, the Chart does not have events related to zooming in and out using selection, so it is not possible to tell if the Chart is currently being zoomed using selection. An alternative approach to allow zooming with a Chart using realtime updates would be to render the zoom UI outside the Chart, for example zoom in and zoom out buttons, like shown in this example:
http://dojo.telerik.com/@tsveti/ePETOQeC 

As for the crosshair, it can be shown only internally by the Chart at this point, so restoring it at the position where it was last shown before the Chart refresh is not possible. I am sorry for the inconvenience caused by this.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 08 Oct 2018, 12:08 PM

Hello Tsvetina,

A possible zoom solution is to set a variable 'inzoom' by zoomStart and zoomEnd events. http://dojo.telerik.com/oHUwocUb

var inzoom = false;
function update() {
        ...
        if (!inzoom)
            chart.refresh();
        ...
    }
...
function createChart() {
        $("#chart").kendoChart({
            ...
           zoomStart: function(e) {
                inzoom=true;
            },
            zoomEnd: function(e) {
                inzoom=false;
            }
        });

Regards,

Peter

 

 

0
Tsvetina
Telerik team
answered on 08 Oct 2018, 12:45 PM
Hi Peter,

Thank you for sharing your solution.

I tried this, too, but it turns out I had a wrong configuration, which prevented the events from firing and I wrongly assumed they would work only with mouse wheel zoom.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Charts
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or