We have events which can be very useful here.
BeforePanning event for the view triggers right before the actual panning operation happens. Inside the event you could check the new axis values, for instance if minimum is below zero, and act accordingly. You can actually cancel the panning by setting e.Cancel to true.
Code: Select all
_chart.ViewXY.BeforePanning += ViewXY_BeforePanning;
private void ViewXY_BeforePanning(object sender, BeforePanningXYEventArgs e)
{
if (e.XRanges[0].NewMin < 0)
e.Cancel = true;
}
Code: Select all
_chart.ViewXY.BeforeZooming += ViewXY_BeforeZooming;
private void ViewXY_BeforeZooming(object sender, BeforeZoomingXYEventArgs e)
{
if (e.XRanges[0].NewMin < 0)
_chart.ViewXY.XAxes[0].Minimum = 0;
}
Hope this is helpful.
Kind regards,
Lasse