I'm using MSChart and I want to enable zoom on the X Axis and once this is zoomed I want the Y Axis to auto zoom into a range appropriate for the data viewable.
Any assistance with the problem would be greatly appreciated!
Thanks
I'm using MSChart and I want to enable zoom on the X Axis and once this is zoomed I want the Y Axis to auto zoom into a range appropriate for the data viewable.
Any assistance with the problem would be greatly appreciated!
Thanks
The kind of zooming that you want to do cannot be automatically accomplished by MSChart. Once you have retrieved the 'Zoom-In' X-value range from the user, you need to write a little more code to reset the Y-axis scaling appropriately.
This works most easily if you are using a Line style of data series and your source data for that series is stored as a SortedList.
Once you have used something like the code above to get your minY and maxY, you can then use those values to reset the min and max Y-axis values on the ChartArea:
I was searching for a solution for a long time. I found this useful. Subscribe to AxisValueChanged event and use ScaleView to modify the view.
Microsoft have made available a whole range of samples for download. In the sample application there is one called Scrollable Appearance that seems to do what you want.
Scrollable Appearance http://img502.imageshack.us/img502/5172/zoomablechart.png
The user can select and area of the graph and it will zoom in. They can also move around using the scroll bars.
C# Sample code is included with the download.