LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change color of the pots on the graph

Hello. I have some problem with showing plots on the graph.
I should show some plots on one graph in different colors. I am using attribute node to change color programmatically but than more plots I show more time it takes to update plots in new color. How can I make it faster?
Thanks Timur.
0 Kudos
Message 1 of 6
(2,251 Views)
Hi Timur,
Choose the colors before plotting something (either programmatically or at design time if your application does not require color change after plotting the graph)
Hope I understood your problem
0 Kudos
Message 2 of 6
(2,251 Views)
> Hello. I have some problem with showing plots on the graph.
> I should show some plots on one graph in different colors. I am using
> attribute node to change color programmatically but than more plots I
> show more time it takes to update plots in new color. How can I make
> it faster?

Two approaches to take and a couple things to watch for.
The graph has a property for the Active Plot. Setting this
larger than the number of plots in the data doesn't automatically
allocate plots for the graph.

You can grow the plot legend to preallocate plots, or wire data
that describes plots, even empty plots, and this will allocate
them.

Once you have plots, each time you change the color or other
attributes, the graph will typically redraw, and as you noted,
this can ta
ke some time if you have lots of plots or complicated
data.

If you plot very little data, such as a bunch of empty plots,
the redraws will take very little time, then write the data
to the graph.

If you have LV6, a newer way of doing this, which also works
with most other display intensive operations is to write to
the Deferred Updates property for the panel. Drop a property
node and choose the VI class. From this select the Panel
property. Wire this to another property node, and on the
list you will see a property for Deferring panel updates.
Set this to True, then update all of the plots regardless
of how much data is in them. Update any other properties
you like, then set the Deferred Updates to False to draw
the results in one pass.

Greg McKaskle
0 Kudos
Message 3 of 6
(2,251 Views)
I _HAD_ a similar problem and have spent half a day struggling with the guide offered by Greg McKaskle. For those in a similar position, I offer a more detailed solution:

I have a Digital Waveform Graph (LabView 6i) in which I want to speed up changes of several plot colours and names. Programmatically this is a three-stage process (which suits a Sequence Structure). First, updates of the Digital Waveform Graph are disabled. Second, the graph properties are updated within the program, but no changes are made to the displayed panel. Third, updates of the Digital Waveform Graph are enabled. It is during the last stage that the graph appears to update - quickly.

The second stage is assumed complete and working but slow. The first and last stages are added to accelerate the display process.

The first stage: create a property node for the Digital Waveform Graph (presumably other display intensive indicators may be changed similarly - I haven't tried) by right-mouse-click on the Digital Waveform Graph VI in the Diagram and select Create -> Property Node. Right click on this new property node, select Properties -> Owning VI to change the property accessed by the Digital Waveform Graph property node. Next use the Functions Palette to create a general property node (Functions Palette -> Application Control -> Property Node. Wire the output from the Digital Waveform Graph property node, 'Owning VI' property to the 'reference' input of the new general property node. The properties available from the property node change. Right click on this new property node, select Properties -> Front Panel. Create a second general property node as descried above. Wire the output of the first general property node Panel property to the 'reference' input of the new general property node. The properties available from the second general property node change. Right-click on this property node, select Properties -> Defer Panel Updates. This property must be set to input. This is done by Right-click and select Change To Write. Now wire a True boolean constant (Functions Palette -> Boolean -> True Constant) to the DeferPanUpdts input.

The second stage is already working of course.

The third stage is identical to the first, but a False boolean constant is wired to the DeferPanUpdts input.

Works a treat.
Richard.
0 Kudos
Message 4 of 6
(2,251 Views)
If you would like, you can wire the error pins of the various property
nodes rather than use a sequence.

Also, if you know that the digital graph is always located on the panel,
you can avoid a few property nodes. Getting the VI that owns the graph
is a more general solution and works well too. Additionally, notice
that the Defer Updates property is a Panel property. It is not specific
to graphs, but is intended to defer all updates to the panel.

Greg McKaskle

.... Programmatically this is
> a three-stage process (which suits a Sequence Structure). First,
> updates of the Digital Waveform Graph are disabled. Second, the graph
> properties are updated within the program, but no changes are made to
> the displayed panel. Third, updates of t
he Digital Waveform Graph are
> enabled. It is during the last stage that the graph appears to update
> - quickly.
>
0 Kudos
Message 5 of 6
(2,251 Views)
Greg,

Thanks for these further comments. You're right, of course. A sequence is not necessary. Personally, I'm not keen to use Sequence structures because one cannot see the 'whole picture' at a glance. It does have the benefit of hiding some detail, which is why I chose to use it in this case

Thanks also for pointing out that ALL panel updates are deferred while I need to set only the graph deferred. This is fairy logical I guess, because the Owning VI must control the whole panel and this fact may help me later.

I'm a relative newby to LabView, but have been programming for some time so have a different perspective and knowledge base, which can cloud my understanding at times.

Regards, Richard.
0 Kudos
Message 6 of 6
(2,251 Views)