07-05-2023 10:40 AM
Hello,
I'll try to explain as best as possible given I'm a novice in LV. The code for the state machine project along with some example data is attached below in the zip file. I'll always refer to the first tab named 'RingDown Times' regarding the problem described below.
The logic of the code is following: If the binary is True, the plot should appear once the user hits the plot button. The colour of the resulting plots should follow the values of the colour box of the corresponding data path. This is how it looks like in the front panel:
There is apparently no problem if all the booleans are True. The problem becomes apparent if one or several of them are false. E.g. in the example below, the first boolean is False. Notice how the plot changes:
The colour of the plots seems to have shifted by one i.e. the plot which is supposed to be red, is now black, and so on and so forth. Notice that the colour of the last plot is supposed to be pink, but it's green instead.
I'd appreciate if someone can explain me the reason for this. Any suggestion to correct it is most welcome.
I've coded it in LV2021 community version.
Solved! Go to Solution.
07-05-2023 12:23 PM
(Please use zip for attachments. Nobody should be forced to download extra software just to open your attachments!)
You are changing the order of the data. Why not keep plotting all, but change the visibility of each plot based on the boolean?
07-05-2023 12:25 PM
Sorry!
Zip file attached!
07-05-2023 12:53 PM
"You are changing the order of the data. "
I am not sure how I'm changing the order of the data. Can you please elaborate.
"Why not keep plotting all, but change the visibility of each plot based on the boolean?"
I imagine you are referring to property node -> Graph -> Plot Legend Visible : passing a boolean based on the visibility desire. I played with the idea. Problem arises when the boolean for the last plot is false. In that case the legend box disappears entirely.
Again, I might be misunderstanding your suggestions. I'd appreciate you could add a code snippet along with your suggestion. This will be helpful given I'm still new to LV
07-05-2023 12:56 PM
it looks like when you unselect the signal, the data being plotted does not have the first dataset to be plotted, this explains why the shift.
As ity was suggested you can use a function called propery node( from the block diagram, right click on the plot) and select CREATE PROPERTY Node,
then you can select the active plot and VISIBLE.
07-05-2023 01:00 PM - edited 07-05-2023 01:03 PM
Your "active plot" is based on [i] and increments unconditionally. You might want to use an integer in a shift register (init with zero!) that only increments in the true case.
Now you can leave the FALSE case empty, except for wiring the integer across:
07-05-2023 02:26 PM
Hello!
Thank you! It works perfectly. I've attached the .zip file of the project below. I've also added the Plot Legend Number property to keep the front end legend box consistent with the # of selected files. Here is a snap shot of the result: