Event on zoom applied
NSV-dev opened this issue · 2 comments
I need to make realtime smooth chart, but points add only ~once a second(depends on server-side), so i can't use built in realtime
.
I made interval to solve this problem
setInterval(() => {
var time = Date.now() - this.startTime;
this.charts.forEach(c => {
c.chart.options.xRange = { min: time - 60000, max: time };
c.chart.update();
});
}, 1000 / fps);
To use zoom
I need to kill this interval and set it when user clicks button.
To do it I need to listen for event called on zoom changed/aplied
Is there any way to listen for such event or another way of solving my problem?
P.S. While exploring the code base I found onScaleUpdated
in ChartZoom but I don't know how to reach it
I think you cannot reach onScaleUpdated
currently. But as you can see:
TimeChart/src/plugins/chartZoom.ts
Lines 44 to 49 in 9818092
xRange
would be reset to null
on this event. Maybe you can check if it is null before updating the xRange
.
I will consider exposing this event in the next version.
Thanks for quick answer. And thanks for this briliant library)