LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Lifting pen" on XY graph

I'm trying to make a "lift pen" effect on my XY graph. I'm using an array of cluster with 2 numeric indicators (X and Y) for the line plot. I want to change the line color or erase the plot when the Z is lowered below 0. Then, when I increase the value of Z until it is above 0, I want the line to turn back to the previous color before lowering the Z. (without changing the color or affecting the line color of when the Z is below 0). so basically I want to make a single line with two different colors (one may overlay the other one). or maybe a line that can have a gap (lifted pen) when the Z is below 0 (like it is invisible), then a new line (with the same color as the one before the gap) will be plotted after the Z is increased above 0 (visible). is it possible to do that?

 

btw I made a simple block diagram that is like a sub vi or miniature program from the actual one. the X value will be added by 1 after pressing the OK button.

0 Kudos
Message 1 of 5
(2,511 Views)

First of all, get rid of the race conditions! *

 

Graph the same data twice and skip the data of the top plot (using NaN value) to show the bottom.

 

*blatant over-use of local variables. You are reading from and writing to the "array" local in parallel, but the outcome critically depends on the order. Bad! Also, your sequence structure is not needed if the rest is wired correctly. What determines your loop rate? Please attach your actual VI. Your "insert into array" can be replaced by "built array". No need to get the size. Your x-values seem to have a dx=1 and are equally spaced (guessing, not seeing the entire code!). A plain waveform graph would be sufficient. Your loop cannot be stopped.

 

0 Kudos
Message 2 of 5
(2,506 Views)

@altenbach wrote:

First of all, get rid of the race conditions! *

 

Graph the same data twice and skip the data of the top plot (using NaN value) to show the bottom.

 

*blatant over-use of local variables. You are reading from and writing to the "array" local in parallel, but the outcome critically depends on the order. Bad! Also, your sequence structure is not needed if the rest is wired correctly. What determines your loop rate? Please attach your actual VI. Your "insert into array" can be replaced by "built array". No need to get the size. Your x-values seem to have a dx=1 and are equally spaced (guessing, not seeing the entire code!). A plain waveform graph would be sufficient. Your loop cannot be stopped.

 


 

wow thanks, and really am sorry. I am new to this so I can't really catch a few things like NaN value. but thanks a lot, your suggestions may help me to learn how to do it better. btw I am still ending the loop by pressing the abort execution button since the graph would only be plotted if the OK button is pressed. I'll attach the actual VI.

0 Kudos
Message 3 of 5
(2,462 Views)

Attached is a modified version of your VI that fixes the newbie problems of local variables, race conditions, CPU burning infinite loops, sequence structures, and using the wrong array manipulation functions.

0 Kudos
Message 4 of 5
(2,445 Views)

@RavensFan wrote:

Attached is a modified version of your VI that fixes the newbie problems of local variables, race conditions, CPU burning infinite loops, sequence structures, and using the wrong array manipulation functions.


I think that "Wait For Front Panel Activity is better than waiting for a specific amount of time.

And when I don't need the output of the right shift-reg, I prefer to use a feedback node.

I also added code to switch to a NaN when z < 0.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 5
(2,420 Views)