LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keep the same plot color for a multiple XY graph

Solved!
Go to solution

Hi everyone, 

I want to plot the last 5 plots on the same XY graph with differents colors. For this I am using a shift register. Using shift registers makes the plot colors change. 

ex: 

Imagine I choose plot 1 to be red,  plot 2  orange and plot 3 yellow ( XY graph properties )

 

when I start the VI this is what happpens 

 First iteration plot: red

----------

Second iteration plot: red

first iteration plot: orange

----------

third iteration plot :red

Second iteration plot: orange

first iteration plot: yellow

 

The shift register makes the plot shift to the bottom making the new plot always in red. 

what if I want the plot to keep the same color even if they are shifded? ( first iteration plot always in red and the second in orange ... )

 

Thanks in advance,

 

 

 

 

0 Kudos
Message 1 of 10
(4,154 Views)

Use Replace Array Subset to replace a plot.  Use the i and Quotient & Remainder to determine which plot to replace.  This eliminates the need for shifting.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(4,134 Views)

Attach your VI so we can see how you are building things into the shift register..

 

My guess is that you are using build array and putting the new plots at the beginning of the array rather than the end.

0 Kudos
Message 3 of 10
(4,129 Views)

Hello,

Here is an exemple of the VI I have right now.

Regards,

F

0 Kudos
Message 4 of 10
(4,050 Views)

You made that much more complicated than it needed to be the way you were using multiple shift registers with history.  It was bascially like I was thinking where you wree building the arrays backwards.

 

Just use Build Array on the graph data and a single shift register.  See attached.

 

Also, when you run a while loop N number of times, you should be using a For Loop

 

(PS.  It helps to put data into the controls as default so that all we have to do is click the run button and see stuff happen.  Your empty array meant nothing happened when I first tried your VI.)

 

Download All
Message 5 of 10
(4,043 Views)

Oh that is nice..

Thanks very much.. ...How can I fix the plot number to 5 please?

 

Regards,

F

0 Kudos
Message 6 of 10
(4,035 Views)

I don't understand what you are asking for.

0 Kudos
Message 7 of 10
(4,031 Views)

I only want to plot the last 5 graphs..

For exemple: if I generate a 6th plot, it will overwrite the first

                        If I generate a 7th plot, it will overwrite the second ......

 

The main thing is to have 5 plots max! Thanks in advance.

 

F

 

 

0 Kudos
Message 8 of 10
(4,022 Views)
Solution
Accepted by topic author feriel0209

Then initialize an array of 5 plots.  Use Replace Array Subset to replace each plot in order.

 

Download All
Message 9 of 10
(4,018 Views)

Thanks, this is what I need :Smiley Happy

F

 

0 Kudos
Message 10 of 10
(4,009 Views)