Question

I'm implementing a scatter plot using the MS Chart Control .NET 3.5, WinForms, C#. My x-axis data is DateTime and noticed I couldn't zoom in smaller than a resolution of 1 day, despite setting the ScaleView as follows:

chart1.ChartAreas["MyChart"].AxisX.ScaleView.MinSize = 4;
chart1.ChartAreas["MyChart"].AxisX.ScaleView.MinSizeType = DateTimeIntervalType.Hours;

Has anyone else had this issue? Any ideas?

Was it helpful?

Solution

Figured this out... perhaps I didn't RTFM close enough, but it wasn't obvious from the interactive demo.

Set

chart1.ChartAreas["MyChart"].CursorX.Interval = 0;

and then it allowed me to zoom along the x-axis just fine.

OTHER TIPS

Works Great ! Very handy and mandatory if you want to have smooth Zooming behavior.
Didn't stumble upon it, though I did RTFM :-)

However, if you handle doubles or floats instead of integer based types (such as hours or days), setting the interval to Zero may be a little bit extreme : While zooming, you will end up having overly precise labels such as 2,907343253253235

A good combination is to use these two properties :

chartArea1.AxisY.ScaleView.MinSize = 0;
chartArea1.CursorY.Interval = 0.001;

this way you can zoom as much as you want, while still controlling precision at a reasonable level

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top