Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Scatter Plots

The question is about C#/Meas Studio.    I need to plot 2 scatter plots (each has it's own X and Y arrays).
ScatterGraph.PlotXY(x,y)
plots one pair just fine.
Now, how can I add a plot with another pair of arrays x1,y1 to the same graph?

Thanx
0 Kudos
Message 1 of 7
(4,308 Views)
Hey Msush,
 
The plots are stored in collections of your ScatterGraph.  I don't have Measurement Studio right now but I'm sure it's something like this:
 
ScatterGraph.Plots.Add
ScatterGraph.Plots[0].PlotXY() //plots to first plot in collection
ScatterGraph.Plots[1].PlotXY() //plots to second plot in collection
 
Something like that.  You can find info on those functions in the help.  You can also manually add plots by right clicking your graph on the form and going to the plots collection from there.
 
Hope that gets you on the right track,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 7
(4,305 Views)
The sequence

ScatterGraph.Plots.Add
ScatterGraph.Plots[0].PlotXY() //plots to first plot in collection
ScatterGraph.Plots[1].PlotXY() //plots to second plot in collection

does not work in C# because
scatterGraph.Plots.Add(scatterPlot item)
requires an existing plot as an argument, there is no method
scatterGraph.Plots.Add().  without argument.

Any ideas?

Cheers,

0 Kudos
Message 3 of 7
(4,300 Views)
Right!!  As I said I do not have Measurement Studio so I don't know the exact prototypes.  In order to add a plot dynamically you will have to do something similar to those commands.
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 7
(4,298 Views)
Yes, there are many changes and what was easy in Measurement Studio 6 is implemented in a different way.  For sure, I have tried "something like this" for a while before writing here.  Is there someone who knows how to add plots in C#/Measurement Studio .Net?

Thanx
0 Kudos
Message 5 of 7
(4,295 Views)

Hi Msush,

Based on the earlier posts, I am not too sure of what you are asking. Therefore I will just make some general statements and then you can reply back based off of what I say.

So first off, the ScatterGraph can contain multiple plot objects.  During runtime, you will call the
ScatterPlotCollection.Add method to add additional plots to the graph plot collection.  Of course you need to have already created a ScatterPlot object since the Add method takes in a ScatterPlot item. So you would say something like:

myXYGraph.Plots.Add(myPlot);  // where myPlot is the newly created ScatterPlot object

Then to plot this new plot object, you would simply say something like:

myPlot.PlotXY(data1, data2);

If you had another plot, you could also say:

anotherPlot.PlotXY(data3, data4);

If both these plot objects were owned by the same graph object, they would both appear on the graph.

During design time you can set up your graph to have as many plots as you wish. To do this, right-click on the graph and select the Edit Plots... item.  Then add and configure plots.  Then during runtime, you would access the plots by saying:

myXYGraph.Plots[plotIndex].xxxx     // where plotIndex is the zero-based index of the plot entry in the collection.

Help any??

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 6 of 7
(4,284 Views)
Thank you!  

The problem was that this does not work:

            ScatterPlot p = new ScatterPlot();
            p.PlotXY(xArr, yArr);
            scatterGraph.Plots.Add(p);

whereas this works fine:

            ScatterPlot p = new ScatterPlot();
            scatterGraph.Plots.Add(p);
            p.PlotXY(xArr, yArr);

Cheers,


0 Kudos
Message 7 of 7
(4,278 Views)