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