Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Resize plot to changing X Axis Max Value

Hello,
 
I have a CNiGraph on which I draw a waveform using the cursor position. When I draw this waveform the X Axis has a max range value. Later I have the option of changing this max range value on the X Axis, while the Y Axis max value has to remain fix, the same value. Do you know if there is a possibility to resize the plot to the new max range value of the X Axis? By this I mean, if the max X value is bigger, then the plot to expand; if the max X valus is smaller, then the plot to compress. Like a sort of zoom, but only related to the X Axis.
Is this possible?
 
Thanks,
Alexandra
0 Kudos
Message 1 of 4
(5,214 Views)
Hey Alexandra,

How are you changing your maximum value for the X Axis?  If you change the actual minimum and maximum for the X Axis, it should automatically update on the graph.  I have pasted some simple pseudo code below.  Hope this helps!

CNiAxis xAxis = m_myGraph.Axes.Item("XAxis");
xAxis.Minimum = 1;
xAxis.Maximum = 5;
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 2 of 4
(5,193 Views)
Hello Pat, The problem isn't with setting the min and max value on the graph. Because I can do that, with a code similar to yours. What I want is something like this: if I draw a graph on a X axis that ranges from 0 to 10, and then I set the X max value to 20, then I want the graph to expand, to be refitted, redistributed to fit from 0 to 20; or if I set the X max value to 5, the graph to "compress" and fit from 0 to 5, not just a zoom to the part of the graph between 0 and 5, but the entire graph to be refitted to the new value range of the X axis. Any ideas? Alexandra
0 Kudos
Message 3 of 4
(5,181 Views)
Hey Alexandra,

Are your points evenly distributed and which method are you using to plot your data?  If you use the PlotY method, there is an option to select the xFirst and xIncrement which determine the first point the graph is plotted to and the distance between each point on the X axis.  This will allow you to select where the plot starts and how many points it spans on the X axis.  I believe this should solve your problem.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 4 of 4
(5,167 Views)