Page 1 of 1
TeeChart NET for Blazor How to hook up a chart zoom event
Posted: Thu Aug 29, 2024 6:55 pm
by 15695569
Hello,
I am trying to implement a chart zoomed event in a blazor chart and cannot seem to get it working. Should I be using the TChart.Zoomed event in c# or does this need to be done somewhere in the <canvas> tag with javascript?
Re: TeeChart NET for Blazor How to hook up a chart zoom event
Posted: Fri Aug 30, 2024 9:19 am
by Marc
Hello,
OnZoom is a clientside Javascript event-method that can be defined using the CustomCode lines property for javascript in C#.
Example, modifying label format:
Code: Select all
Chart1.onzoom=function() {
var axis = Chart1.axes.bottom,
range = axis.maximum - axis.minimum;
if (range < 1000)
axis.labels.dateFormat = "H:M:s:L";
}
(taken from:
https://www.steema.com/files/public/tee ... tetime.htm)
or here linking axes between charts via the synchroAxes method:
Code: Select all
for(var t=0; t<charts.length; t++) {
charts[t].onzoom=synchroAxes;
charts[t].onscroll=synchroAxes;
charts[t].zoom.onreset=synchroZoomReset;
}
https://www.steema.com/files/public/tee ... charts.htm
Regards,
Marc Meumann