Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WaveformGraph and maintaining zoom factors between waveform plots?

Hi Matt,

Thanks for the reply. It sounds like you understand what I am doing now.

Our display is essentially an oscilloscope style display rather than a strip-chart style display. The description of PlotYAppend leads me to believe that it will append any subsequent Y values to the display at the last X value determined by the X increment * the number of points plotted. This is why I chose to use the PlotY function in the first place.

If there is no way to plot at X=0 on each call to the plot function and maintain the "zoom" history, then I won't be able to use what you suggest. In fact, from what you have said, I'm not even sure that I can use the WaveformGraph component to accomplish what I need to do without "twiddling". What I am hoping for, assuming PlotYAppend will not plot at X=0 without clearing zoom history, is that the Graph.ZoomFactor property is somehow useable to reset the WaveformGraph back to a "non-zoomed" state. Barring that, I'll have to work with the axes as you suggest. However, since I have already determined that the zoom out does not fire an event in the specific context I am working with, I will probably have to try to intercept the mouse click message and twiddle with the axes settings.

All I need to do is zoom in/out on a "region of interest" in the XY plane irrespective of the data that is there - for all intents and purposes. It sounds like the zoom functionality, as implemented by NI, is intimately dependent on the data that is there. While I can understand the usefulness of zooming in on a region of strip-chart graph, it would also seem to me that the ability to zoom on an XY region indepently of any data that might be there would be something that is highly useful.

Is it possible to simply zoom in/out on a region when using PlotY to plot oscilloscope-style data? If so, is there sample code available for this?

Thanks again.

Best Regards,
Matthew

0 Kudos
Message 11 of 17
(2,742 Views)
Hi Matthew,
 
You are correct in your assumption about PlotYAppend in that it simply appends to the last x value and does not plot at X = 0.
 
It may not seem intuitive for your application, but the reason that PlotY (PlotXY and PlotWaveform follow the same pattern) clears the history is because technically you are plotting a completely new set of data. This works in applications where users plot different styles of data on the same graph over the course of the application.
 
We do not have any code that shows a workaround for this because it is expected behavior; however, a solution you could use would be to implement a stack that contains the axis and panning information and then catching the zoom out events and pushing or pulling information from the stack as necessary. It is not a perfect solution, but it should help you accomplish your goal.
 
Matt
NI
0 Kudos
Message 12 of 17
(2,739 Views)
Sorry to have taken so long to respond to this; I've been very busy.

I am willing to bet that I am not the only developer using NI development tools that would like to see the zoom in/zoom out functionality work when the graph control is being operated as it is in my case. I can also see where it would be useful (in our application and in other applications unlike ours) to zoom in to see a feature on an oscilloscope-like display.

What I have done was to implement an "auto-scale" function that rescales the graph axes to the minimums and maximums of the data currently displayed; it does not track zoom in or pan movements. This is sufficient for our needs.

Thanks again for your help.

Best Regards,
Matthew

Message Edited by MatthewZ on 11-08-2006 08:19 AM

0 Kudos
Message 13 of 17
(2,688 Views)
To address your second concern, when you "shift+right click" the graph treats it as a zoom (or pan) undo operation rather than a zoom or zoom out. In this case, the ZoomPanUndone event of the graph is raised instead of the Zoom event.
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 14 of 17
(2,676 Views)
Thanks for the reply, but we're using PlotY, not PlotYAppend. As has already been discussed in this thread, it does not work that way for successive useages of PlotY as each call to PlotY erases the zoom history. If you are aware of something we missed, please let us know.

Thanks again.

Best Regards,
Matthew



Message Edited by MatthewZ on 11-08-2006 12:35 PM

0 Kudos
Message 15 of 17
(2,672 Views)
Yes. You are correct. The interation stack is cleared when new data is plotted. From your initial post, it seemed that you were reporting that the Zoom event was not being raised when "shift+right clicking" at all even in between successive calls to PlotY. My bad.
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 16 of 17
(2,662 Views)
This reply comes long after the main part of this thread, I add it in case anyone else has the same problem here is my work around.
I am using PlotY and AutoScaleLoose. My lowest value will always be zero (X and Y axis, but could use Analysis.Math.ArrayOperation.GetMin for Y if needed). I know my highest X value will always be the length on my to plot input array (which may vary) and use Analysis.Math.ArrayOperation.GetMax to find my max Y value.
I create Range variables for each X and Y (ie private Range psdXRange; ) and on a Zoom event grab the axis range (ie psdXRange = xAxisPSD.Range; ) and set a bool flag to true (ie psdZoom = true; ). I use the PlotAreaMouseDown event to set the bool flag to false and allow full viewing (zooming out is not done).
In my plot function I check the bool flag and plot accordingly
if (psdZoom)
     xAxisPSD.Range = psdXRange;
else
     xAxisPSD.Range = new Range(0.0, (double)fullsignal.Length);
0 Kudos
Message 17 of 17
(2,105 Views)