02-02-2021 01:16 PM
Hello,
Using vb.net in VS2010 with Measurement Studio 2013 in a windows forms project.
I have used a graph control in multiple projects where the X axis is set to strip chart mode and I have a single Y axis and a single plot defined in the properties box. I am able to plot the data for a large number of plots simultaneously without having to manually add plots to the plots collection.
Here is how I typically do this:
Dim Plotarray(25,0) as double
Dim i as Integer
For i = 0 to 24
Plotarray(i,0) = some data
Next
WaveformGraphstatic.PlotYAppendMultiple(Plotarray)
It appears that plots are automatically assigned a color and are all associated with the first Y axis. This saves a lot of work by not having to manually choose colors for each plot. However, I want to be able to associate certain plots with a specific Y axis( I have 2 in a new project). Without having to manually add a lot of plots to the plot collection (and choose colors and choose Y axis associations), is there a way to associate these "automatic" plots with a specific Y axis?
Thanks
06-18-2021 07:53 AM - edited 06-18-2021 07:55 AM
I will try to help.
The WaveformGraph has a YAxis object collection and each YAxis in the collectiion can be associated to one or more WaveformPlot objects. To do this using the properties pane, open the Plot collection and then view/edit the properties of the required WaveformPlot.
(Note that each waveformPlot in the collection will automatically have a differnent colour, though you can also change it).
You can set the associated YAxis by name. The selectable YAxis names will be the names of the YAxis objects contained in the WaveformGraph.YAxis object collection. The YAxis object collection can also be setup using the properties pane.
Alternatively, you should be able to set the associated YAxis programatically, in C# for example:
waveformGraph1.Plots[0].YAxis = waveformGraph1.YAxes[0];
Or if the required waveformPlot was has the name waveformPlot1 and the YAxis has the name yAxis1, then simply:
waveFormPlot1.YAxis = yAxis1;
I suspect that you need to setup both the required YAxis objects and WaveformPlot objects, before adding the data using PlotYAppendMultiple().