Given a chart in which the X-Axis represents seconds, ranging from 0 to 300
If I want to make sure the minimum zoom is on a 1 second boundary, I presume I would set the MinZoomFactorX = 1.0 / 300.0
Then, during the chartControl1_VisibleRangeChanged event,
I attempt to adjust the ZoomFactor to keep it on a 1 second boundary:
double xZoomFactor = chartControl1.PrimaryXAxis.ZoomFactor;
if (xZoomFactor != 1)
//convert xZoom into seconds
double xZoom = xZoomFactor* _totalSpan.TotalSeconds;
//now, lop to even amounts
int xZoomEven = (int) Math.Round(xZoom, 0);
if (xZoomEven != xZoom)
chartControl1.PrimaryXAxis.ZoomFactor = xZoomEven / _totalSpan.TotalSeconds;
Doing these 2 things (setting hte ZoomFactor and the minzoom) should, in theory keep my graph from showing fractional portions.
However, when I zoom way in , say between points 90 and 120, what I end up with may actually be something like 88.4 to 119.3, exactly what I''m trying to avoid.
In other words: I want to make sure that zooms are on, at the very minimum a 1 second (whole number) boundary.
I am NOT interested in just setting the format to "0", as this causes the graph values to repeat when zoomed way in (like 87, 87, 88, 89 when the first two values are really 87.4, 87.9, etc...)
I DO want the graph to be positioned / zoomed in set minumum intervals.
ALSO, let''s say I want the boundary to be at 5 second intervals, instead of 1 second intervals, like when a user zooms in to the 60-90 range, how would I do that? Setting the MinMax range and using a 5 second interval does NOT help, because the graph , when zoomed, may show something like 1.1, 6.1, etc...
And the ZoomedRange and VisibleRange properties are READ ONLY!!!!
Does this make sense? I''ll provide an example if necessary.