Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I, during Runtime, change the range in a Waveform Graph Plot so that I see the values within that range as they are being plotted?

I have a C# application and I want to Plot say a wave in a WaveFormGraph component and display the values between a changing Range in Real time. For instance, the first plot could be 0 to 100 in time. I then may want to change the range so that I display only Range 100 to 1000 and then 1000 to 2000 and so on.  What is the best way of achieving this? I can change the ranges OK but my plot line vanishes after the second range change.
0 Kudos
Message 1 of 11
(7,021 Views)

Hi,

Thanks for your post. If you are using measurement studio, i'm wondering what version you are working with? I am assuming you have looked at autoscaling the axis, but it is this not suitable? I gather from what you have described that you are continuously plotting points on a CWGraph. 

Do you want for example the x axis scale to resize in its range once the plots reach the end of the plotting area? or
Do you want to display on the graph the first 100 plots on scale 0-100 and then the next 100 plots on scale of 100-200 etc?

You may need to look at whether charts are more suitable instead of graphs!

There are two things that you can look at here. First, you can configure the number of data points in the chart history of the graph by going to the Graph tab in the property pages, change the Chart history option from Automatic to Fixed, and change the fixed value from 200 to 1000, for example. Alternatively, you can configure the range of the axis by going to the Axes tab in the property pages, select the axis that you want to configure, uncheck Auto scale, and set the Minimum and Maximum properties to what you want the range of the axis to be.

Perhaps the values are not appearing in the plot area because the plots are not appropriate for the scale range? It might be helpful if maybe you could attach your code / source file for me to look at.

I hope this helps!

All the best

Kurt

0 Kudos
Message 2 of 11
(6,950 Views)
In LabVIEW, one can double click the y-axis and enter in a new maximum range.  My technicians would like to be able to do this in Visual Basic.  I have tried to following code to no avail because range.maximum is a read only property...

wfgTemperature.YAxes.Item(0).Range.Maximum = InputBox("Enter maximum range: ", "User Input", 1000)

Is is possible to change at runtime without auto-scaling?
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 3 of 11
(6,805 Views)
You need to create a new Range object and assign it to the YAxis.Range property. We imposed this restriction to avoid introducing order dependencies when you set the Minimum and Maximum properties.
 
Your code will look something like the following:
wfgTemperature.YAxes.Item(0).Range = new Range(wfgTemperature.YAxes.Item(0).Range.Minimum, InputBox("Enter maximum range: ", "User Input", 1000))
 
0 Kudos
Message 4 of 11
(6,799 Views)
That works.  Thanks!

How can I bind a series to yaxis(0) or yaxis(1)?
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 5 of 11
(6,797 Views)
If you have Measurement Studio 8.0 and above, you can also set the InteractionMode property of the graph to include EditRange like this:

wfgTemperature.InteractionMode = wfgTemperature.InteractionMode | NationalInstruments.UI.GraphInteractionModes.EditRange;

With this, you will be able to double click on the minimum and maximum values of the all axis ranges (just like in LabVIEW) to edit them and pan the plot area at runtime. If you would like more fine-grained control over which axes have this behavior, then you can set the InteractionMode property of the axis (available on both x and y axes) itself to the appropriate value.

Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 6 of 11
(6,790 Views)
Please can you elaborate more on what you mean by "bind a series to yaxis(0) or yaxis(1)"?

Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 7 of 11
(6,790 Views)
Series 1 is referenced by the left y axis while series 2 is referenced by the y axis because series 1 can be any range from 0-700 and series 2 can be any range between 0-100.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 8 of 11
(6,786 Views)
do I need to include a library to instantiate a Range object?  I've tried, but my app won't recognize the type Range. 



I need this solution in a hurry =(



Thanks in advance.
0 Kudos
Message 9 of 11
(6,246 Views)

Range is defined in the NationalInstruments.UI.dll assembly.

The fully-qualified name of the class is NationalInstruments.UI.Range.

 

0 Kudos
Message 10 of 11
(6,218 Views)