06-07-2012 08:23 AM
I am trying to link the x axes of many ScatterGraphs together and was wondering how to revert the graphs back to their original plotted view after a user has performed many zoom, pan and axis range chages. Basically how do you perform an autoscale on an axis without having to undo each operation individually. In the older activex graphing controls there was an AutoScaleNow function that performed this operation.
Also, how do you undo a range change that was performed through code? If you interactively change a range it appears that SHIFT-RIGHT CLICK will undo the operation. If the range change event is captured and applied to the other graphs it cannot be undone.
Solved! Go to Solution.
06-08-2012 09:20 AM
Use ScatterGraph.ResetZoomPan( ) to undo all of the zoom, pan, and range change operations in a scattergraph. This will undo range changes made in the UI, but not range changes made through code. For range changes in code, you will have to handle the undo operations yourself. You could store the initial ranges and revert back to those when necessary. Or you can force a re-AutoScale by changing the axis scale mode as shown below:
scatterGraph1.XAxes[0].Mode = NationalInstruments.UI.AxisMode.Fixed; scatterGraph1.XAxes[0].Mode = NationalInstruments.UI.AxisMode.AutoScaleLoose; scatterGraph1.YAxes[0].Mode = NationalInstruments.UI.AxisMode.Fixed; scatterGraph1.YAxes[0].Mode = NationalInstruments.UI.AxisMode.AutoScaleLoose;
06-10-2012 12:35 PM
Thanks for your help. I was able to revert the chart back to the original scaling with this method.