Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

using graphs in measurement studio

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
0 Kudos
Message 1 of 5
(9,052 Views)
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:


  • WaveformPlot.PlotX

  • WaveformPlot.PlotXAppend

  • WaveformPlot.PlotY

  • WaveformPlot.PlotYAppend

  • WaveformGraph.PlotX

  • WaveformGraph.PlotXAppend

  • WaveformGraph.PlotXAppendMultiple

  • WaveformGraph.PlotXMultiple

  • WaveformGraph.PlotY

  • WaveformGraph.PlotYAppend

  • WaveformGraph.PlotYAppendMultiple

  • WaveformGraph.PlotYMultiple

  • ScatterPlot.PlotXY

  • ScatterPlot.PlotXYAppend

  • ScatterGraph.PlotXY

  • ScatterGraph.PlotXYAppend

  • ScatterGraph.PlotXYAppendMultiple

  • ScatterGraph.PlotXYMultiple

  • ScatterGraph.PlotYXAppendMultiple

  • ScatterGraph.PlotYXMultiple



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:


  • CWGraph.ChartXvsY

  • CWGraph.ChartXY

  • CWGraph.ChartY

  • CWGraph.PlotXvsY

  • CWGraph.PlotXY

  • CWGraph.PlotY

  • CWPlot.ChartXvsY

  • CWPlot.ChartXY

  • CWPlot.ChartY

  • CWPlot.PlotXvsY

  • CWPlot.PlotXY

  • CWPlot.PlotY



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
0 Kudos
Message 2 of 5
(9,052 Views)
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.
0 Kudos
Message 3 of 5
(9,052 Views)
"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"

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:


  • Integrated into VS.ET 2003/MSDN Help - Go to the table of contents, then the "NI Measurement Studio Help" node.

  • Measurement Studio standalone help - Go to the Start Menu, then Programs->National Instruments->Measurement Studio 7.1 for VS.NET 2003->Measurement Studio Documentation



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, this link will take you directly there.

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

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 Measurement Studio for Visual Studio .NET forum, so it wasn't clear if you were using the Measurement Studio .NET controls or the Measurement Studio ActiveX controls.

"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."

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 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 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
0 Kudos
Message 4 of 5
(9,052 Views)

I would think a sample of code in the help file for each one of the properties and methods for each measurment studio device would be extremely helpful, it would save me hours of time searching on the internet. Case in point where can I get a VB 6.0 example of the CWgraph1.item(1).PlotXvsY and the PlotXY code? It would be nice if you had and example of it in the help file so that I could just copy and paste it in my existing code then massage it to my needs.

0 Kudos
Message 5 of 5
(7,819 Views)