ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CWGraph1.ChartY(chartVals, 1, False)

I want to generates an array of four points and plots these points to the chart.
I knew the following activeX CWGraph can do that, but I am using waveformGraph
Does waveformGraph has the similar property something like
    waveformGraph.PlotYAppend(charVals, 1, false); ??????
       
--------------------- following activeX is working, but I am using waveformGraph ---------

Private Sub ChartMultiple_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChartMultiple.Click
        Dim i, j As Integer
        Dim rand As Random
        Dim chartVals(3) As Double

        rand = New Random()

        For i = 0 To 29
            For j = 0 To 3
                chartVals(j) = rand.NextDouble + j
            Next
            ' Use "false" as the third parameter to plot one point to each plot
            CWGraph1.ChartY(chartVals, 1, False)
        Next

End Sub

--------------------- waveformGraph does NOT work properly ----------------------

       private void ChartMultiple_Click(object sender, EventArgs e)
        {
            double[] chartVals = new double[4];
            Random rand = new Random();
            for (int i = 0; i < 29; i++)
            {
                for (int j = 0; j < 3; j++) {
                    chartVals[j] = rand.NextDouble() + j;
                }
                waveformGraph1.PlotYAppend(chartVals, 1, ??????);
                // or use waveformGraph1.PlotY(chartVals);
            }
        }



Thanks
Matt
0 Kudos
Message 1 of 3
(3,970 Views)

Hi Matt,

You have a couple of options here which include:

- First, you could always have several waveformPlot objects and called the
PlotY or PlotYAppend (depending if you wanting charting or plotting behavior) on those waveformPlot objects. This is shown in the PlotsVsCharts shipping example (<MeasurementStudioVS2005>\DotNet\Examples\UI\WIndowsForms\Graph\ directory) and I have attached a screenshot of that example ("Plots vs Charts.jpg")

- Use the
waveformGraph.PlotYAppendMultiple or PlotYMultiple methods which plots a 2D array of y values with the default data orientation against the default starting x value.  Check out the Plotting example (same directory as mentioned above) that plots several objects at once (see attached "Plotting.jpg" snapshot). 

Honestly, since it appears you are just staring out, I would check out that whole Graph directory as there are lots of examples to go off of. I would also strongly encourage you to check out the Using the Measurement Studio Windows Forms Scatter and Waveform Graph .NET Controls help topic in the NI Measurement Studio Help.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 3
(3,964 Views)
Forgot to attach the images.

Best Regards,
Jonathan N.
National Instruments
Download All
0 Kudos
Message 3 of 3
(3,961 Views)