Minimum Interval DateTimeAxis

Hi,

I want to limit the zooming on my DateTimeAxis to 24h. The user should not be able to zoom futher than 24h.
The range of my axis is always superior than 24h but the length can change (24h to 50 days).

How can I limit the zoom at 24 hours ?

Thanks

1 Reply

DV Divya Venkatesan Syncfusion Team April 24, 2018 11:27 AM UTC

Torrent, 
 
Thanks for contacting Syncfusion support.                  
 
Your requirement can be achieved by using zooming events of chart to limit the zooming on the axis. Please refer the below code snippets. 
 
Code snippet for hooking the events [C#]: 
Chart.ZoomStart+= Chart_ZoomStart; 
Chart.ZoomDelta+= Chart_ZoomDelta; 
Chart.ZoomEnd+= Chart_ZoomEnd; 
 
Code snippet of events [C#]: 
void Chart_ZoomStart(object sender, Syncfusion.SfChart.XForms.ChartZoomStartEventArgs e) 
{ 
    if (e.CurrentZoomFactor < 0.5) 
    { 
        e.Cancel = true; 
    } 
} 
 
void Chart_ZoomDelta(object sender, Syncfusion.SfChart.XForms.ChartZoomDeltaEventArgs e) 
{ 
    if (e.CurrentZoomFactor < 0.5) 
       { 
           e.Cancel = true; 
    } 
} 
 
void Chart_ZoomEnd(object sender, Syncfusion.SfChart.XForms.ChartZoomEventArgs e) 
{ 
    if (e.CurrentZoomFactor < 0.5) 
       { 
        e.Axis.ZoomFactor = 0.5; 
    } 
} 
 
We have prepared a sample for this which can be downloaded from the following link. 
 
 
You can refer the following user guide link to know more about zooming events. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Divya Venkatesan 
 


Loader.
Up arrow icon