Discussion:
using graphs in measurement studio
(too old to reply)
MrNice
21 years ago
Permalink
I have written in multiple languages, and this ‘easy’ ‘user friendly’
software package has left me completely stumped. How on earth do you
put data in to a graph and display it????? Can someone please show me
code examples of firstly how to shove an entire array of numbers into
a graph in VB.net using the new Measurement Studio and secondly how I
could update a graph plot with a next acquired sample. Please help
Elton Wells
21 years ago
Permalink
Are you using the Measurement .NET Windows Forms controls or interop
wrappers for the ActiveX controls? If you are using the .NET Windows
Forms controls, you can use the following methods to plot data:

<ul>
<li>WaveformPlot.PlotX</li>
<li>WaveformPlot.PlotXAppend</li>
<li>WaveformPlot.PlotY</li>
<li>WaveformPlot.PlotYAppend</li>
<li>WaveformGraph.PlotX</li>
<li>WaveformGraph.PlotXAppend</li>
<li>WaveformGraph.PlotXAppendMultiple</li>
<li>WaveformGraph.PlotXMultiple</li>
<li>WaveformGraph.PlotY</li>
<li>WaveformGraph.PlotYAppend</li>
<li>WaveformGraph.PlotYAppendMultiple</li>
<li>WaveformGraph.PlotYMultiple</li>
<li>ScatterPlot.PlotXY</li>
<li>ScatterPlot.PlotXYAppend</li>
<li>ScatterGraph.PlotXY</li>
<li>ScatterGraph.PlotXYAppend</li>
<li>ScatterGraph.PlotXYAppendMultiple</li>
<li>ScatterGraph.PlotXYMultiple</li>
<li>ScatterGraph.PlotYXAppendMultiple</li>
<li>ScatterGraph.PlotYXMultiple</li>
</ul>

Also, see the "Creating Measurement Studio Strip Charts, Scope Charts,
and Graphs" conceptual topic in the reference, particularly the
"Plotting and Charting" section. In your case, it sounds like you
would want to use the WaveformPlot.PlotYAppend method since you want
to plot an array of data and then later append additional acquired
samples. For an example, create a new VB.NET project, add a
WaveformGraph to the form, add a button, double-click the button, and
here's the code to add 5 random data points every time you click the
button:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles Button1.Click
Dim data(4) As Double
Dim rnd As Random = New Random

For i As Integer = 0 To 4
data(i) = rnd.NextDouble() * 10
Next

WaveformPlot1.PlotYAppend(data)
End Sub

If you are using the Measurement Studio ActiveX controls, you can use
the following to plot data:

<ul>
<li>CWGraph.ChartXvsY</li>
<li>CWGraph.ChartXY</li>
<li>CWGraph.ChartY</li>
<li>CWGraph.PlotXvsY</li>
<li>CWGraph.PlotXY</li>
<li>CWGraph.PlotY</li>
<li>CWPlot.ChartXvsY</li>
<li>CWPlot.ChartXY</li>
<li>CWPlot.ChartY</li>
<li>CWPlot.PlotXvsY</li>
<li>CWPlot.PlotXY</li>
<li>CWPlot.PlotY</li>
</ul>

In your case, it sounds like you might want to use the ChartY methods.
Here's the sample example as above, but with the ActiveX interop
wrapper around CWGraph instead:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles Button1.Click
Dim data(4) As Double
Dim rnd As Random = New Random

For i As Integer = 0 To 4
data(i) = rnd.NextDouble() * 10
Next

AxCWGraph1.ChartY(data)
End Sub

Just out of curiosity, where did you intuitively look for this? What
on the controls or documentation would have made this easier?

- Elton
MrNice
21 years ago
Permalink
I am using the full Visual Studio .NET professional and the
Measurement Studio Enteprise Edition

Within the visual basic .NET framework I am trying to use the
waveformPlot form the MeasurementStudio.NET tools. Before you showed
the above example I had not even got my code to compile (or whatever
VB does) let alone run. With the WaveformPlot1.PlotYAppend(data)
command I have finally plotted data!!!!

Where would I find "Creating Measurement Studio Strip Charts, Scope
Charts, and Graphs" document. if it is on the website it is extremeley
well hidden even from its own search engine. Does this specifically
talk about VB .NET and measurement studio

All the other application notes seem to refer to the old VB6 and
measurement studio because the talk about CWGraph which seems to be
only available on MeasurementStudio C++ tools.

Using Measurement Studio ActiveX controls I wouldn't even know where
to start, there is no AxCWGraph on any toolbar.

If NI could just stick an example of exactly how to use VB.NET with
measurement studio on displaying data and the various options
available and stick it for all to see on the measurement studio home
page it would be great.

I write in over ten different languages and scripts and fluent in two
of them. It worries me that I can't even find the front door let alone
open it.
Elton Wells
21 years ago
Permalink
<i>"Where would I find "Creating Measurement Studio Strip Charts,
Scope Charts, and Graphs" document. if it is on the website it is
extremeley well hidden even from its own search engine. Does this
specifically talk about VB .NET and measurement studio"</i>

You can find this topic, as well as several other conceptual topics
about the Measurement Studio .NET features with VB.NET/C#, in the
Measurement Studio help that installs with Measurement Studio. You
can find this help in two ways:

<ul>
<li><b>Integrated into VS.ET 2003/MSDN Help</b> - Go to the table of
contents, then the "NI Measurement Studio Help" node.</li>
<li><b>Measurement Studio standalone help</b> - Go to the Start Menu,
then Programs-&gt;National Instruments-&gt;Measurement Studio 7.1 for
VS.NET 2003-&gt;Measurement Studio Documentation</li>
</ul>

Once you're in the table of contents, you can find the topic above by
navigating to:

- NI Measurement Studio Help
- NI Measurement Studio .NET Class Library
- Using the Measurement Studio .NET Class Libraries
- Using the Measurement Studio Windows Forms .NET Controls
- Using the Measurement Studio Graph .NET Controls

The topic above is the second link in the list. If you have
Measurement Studio 7.1 installed, <a
href="ms-help://NI.MeasurementStudio/NINETConcept/static/Using_NINETGraph.html">this
link</a> will take you directly there.

<i>"Using Measurement Studio ActiveX controls I wouldn't even know
where to start, there is no AxCWGraph on any toolbar."</a>

AxCWGraph is the name of the interop wrapper that is automatically
generated by VS.NET when you add CWGraph to your project, so you won't
see it in the toolbox. WaveformGraph/ScatterGraph is what you should
use in .NET applications if you have Measurement Studio 7.0 or higher.
I only mentioned CWGraph because this was posted to the Measurement
Studio for Visual Basic forum instead of the <a
href="http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=8&RFORMNUMBER=3&RHIDETAG=TRUE&UCATEGORY_0=_342&UCATEGORY_S=0">Measurement
Studio for Visual Studio .NET</a> forum, so it wasn't clear if you
were using the Measurement Studio .NET controls or the Measurement
Studio ActiveX controls.

<i>"If NI could just stick an example of exactly how to use VB.NET
with measurement studio on displaying data and the various options
available and stick it for all to see on the measurement studio home
page it would be great."</a>

There are several examples that are installed with Measurement Studio
7.1. If you installed Measurement Studio to the default location, you
can find this examples at:

Program Files
National Instruments
MeasurementStudioVS2003
DotNET
Examples
UI
Graph

<i>"I write in over ten different languages and scripts and fluent in
two of them. It worries me that I can't even find the front door let
alone open it."</i>

I can understand how this could difficult if you were not aware of the
Measurement Studio help and examples. Is it easier now that you know
about this content that installed with Measurement Studio? If not,
what else do you feel is missing?

- Elton

Loading...