Thanks Terry for your reply.
1. Zoom out Issue:
Assume I have 2 graphs - MagGraph and PhaseGraph, I tried to sync 2 graphs on x-axis range, here is the code fragment.
// Zoom Event Handlers
private void MagGraph_Zoom(object sender, NationalInstruments.UI.ActionEventArgs e)
{
if (bPhaseZoom)
{
bPhaseZoom = false;
bMagZoom = false;
double xmin = this.magXAxis.Range.Minimum;
double xmax = this.magXAxis.Range.Maximum;
this.phaseGraph.ZoomXY(this.PhasePlot, xmin, ymin, xmax - xmin, ymax - ymin);
}
else
{
bPhaseZoom = true;
bMagZoom = true;
}
}
private void PhaseGraph_Zoom(object sender, NationalInstruments.UI.ActionEventArgs e)
{
if (bMagZoom)
{
bMagZoom = false;
bPhaseZoom = false;
double xmin = this.phaseXAxis.Range.Minimum;
double xmax = this.phaseXAxis.Range.Maximum;
this.magGraph.ZoomXY(this.MagPlot, xmin, ymin, xmax - xmin, ymax - ymin);
}
else
{
bMagZoom = true;
bPhaseZoom = true;
}
}
With these 2 functions, zoom in and out from any of the graphs are fine. However, I have to add another function to allow the user to change the x-axis range manually (set xaxis.interactionmode to be EditRange.). Here is the function.
// Range Change Event Handler
void phaseXAxis_RangeChanged(object sender, System.EventArgs e)
{
this.magXAxis.Range = this.phaseXAxis.Range;
}
In this function, I have set magXAxis.Range = this.phaseXAxis.Range so the X-Axis of MagGraph will sync with PhaseGraph. By the way, I am hiding the XAxis for MagGraph so the user can only change phase graph axis. That is why there is only one Range Changed Handler. After I added this function, the Zoom out sometime stop working correctly. For example, if I zoom in from phase graph and zoom out from phase graph, the mag graph doesn't revert back to original state.
2.
For the axes question, I haven't been able to
duplicate this behavior. After you change the X-axis, you are able to
shift-click on the graph to zoom out? Do you see this behavior if you
do not zoom in before changing the axis?
To duplicate this behavior, set the axis.interactionmode = EditRange. Then click on the X-axis label and change it to a different number. Now do Shift+right mouse click, you will see the X-Axis range reverts to previous value. There is no zoom in is performed before changing the axis.
I am looking forward to hearing from you again.