LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control colors and point style in XY graph with many curves?

I've written a VI that generates a family of curves and throws them all up onto a single XY graph. But I want to have the data plotted as points and lines, not just lines, and I want them all plotted in the same color.

I created a Property Node for the XY Graph object and set the point style with that. But it only changed the style on the first of the 20 or so curves.

In the end, I had to expand the legend to show 30 plots, and change them all by hand. Very tedious, and only works if the user never specifies more than 30 plots....

I tried putting the desired point style value inside the while loop that creates the individual curves, putting the property node outside, and enabling i
ndexing on the tunnel. It didn't work, but at least seemed to have the same Zen as making the multiplot xy graph.
0 Kudos
Message 1 of 4
(3,489 Views)
You must change activeplot to make each plot change it's color or point style, the first plot will be 0 activeplot, and so on, so while loop should work, but first you must wire activeplot before setting any property.
Hope this helps
0 Kudos
Message 2 of 4
(3,489 Views)
Create a property node for the graph and select firstly the property 'Plot', wiring to it an index (zero based) to the plot on which to operate.
After this, add all the elements you want to modify (plot style, line style, line color...) on the selected plot and wire the appropriate constants or variables to them.

I attach a simple example for it.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 4
(3,489 Views)
Additional to the previous responses, plots must exist to be able to specify
their properties. They can be brought into existence by expanding the legend
as already discovered. However it is not practical to make a legend
containing many hundreds of plots in order to set the plot types in advance.

Plot types can be changed once the data is plotted, but this results in ugly
refreshing.

A more elegant way is to pre-load the graph with empty plots; an array of
clusters that each simply contain a pair of uninitialised arrays is
adequate. Make the array as many elements long as you need to define plots
for and write it to the XY graph. You can then modify the settings at will.
If the settings do not change between program runs, you can do all this
messing about
, then set the current XY plot as default, save it and you can
get rid of all the initialisation.

Note that once this is done, deleting plots- for instance by writing an
array that is shorter than the predefined number of plots- will probably
lose the settings of the "higher up" plots. You need to make sure you always
write the correct number of plots even if many are empty.

Roberto Bozzolo wrote in message
news:506500000005000000F42C0000-991728092000@quiq.com...
> Create a property node for the graph and select firstly the property
> 'Plot', wiring to it an index (zero based) to the plot on which to
> operate.
> After this, add all the elements you want to modify (plot style, line
> style, line color...) on the selected plot and wire the appropriate
> constants or variables to them.
>
> I attach a simple example for it.
>
> Roberto
0 Kudos
Message 4 of 4
(3,489 Views)