ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot a filled box under a waveform plot?

Solved!
Go to solution

Hello all,

 

I have a 3000 point waveform graph showing a series of peaks.  For one of these peaks, for which I know the starting and ending indices, I would like to programmatically draw a filled box under the waveform on the graph, to highlight it's position.  I can't figure out if there is a way to do this.

 

I have figured out how to draw cursors at the begin and end, but ultimately I do this for multiple peaks, and the forest of cursors rapidly becomes confusing.  A simple shaded box would work far better.

 

Any ideas?

 

Many thanks in advance,

 

RipRock99 

0 Kudos
Message 1 of 8
(4,257 Views)

Hi RipRock,

 

which LV version do you use?

 

2 options come to my mind:

- make the background of thegraph transparent, puta picture indicator behind it and draw rectangle here (suitable for older LV versions)

- use the possibility to put pictures "into" the graph and draw rectangles here (for LV8+ AFAIK, property PlotImages [Front, Middle, Back])

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(4,253 Views)

is it something like this

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 8
(4,237 Views)
Thanks for the idea - will check it out shortly.  I am using LV 8.5.1 (soon to be replaced on my system with LV 2009).
0 Kudos
Message 4 of 8
(4,226 Views)

Whoops - OK - I can't see the 8.6 vi.  Can you downgrade it to 8.5.1 or take a picture of it?

 

Thanks!

 

 

0 Kudos
Message 5 of 8
(4,224 Views)

Hi RipRock,

 

now you know why I asked for the LV version in the first place Smiley Wink

 

Attached is the VI in LV8.5. It uses the plot fill option to fill to -Inf, an easy option to check for you!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(4,199 Views)
Solution
Accepted by RipRock99

Big Thanks GerdW!

 

The LV code was very close to what I wanted to do, and was easy to use to determine how to make my code produce the result I sought.  Basically, I added another waveform to my graph, using my known x-indices to set the Y values for the areas I wanted to be gray as +infinity, and the leaving the remainder at = -infinity.  I then plotted this second graph on top of the original waveform, and used the property node to set the fill flag to -infinity.

 

This doesn't answer the general question of how to draw a filled box with known coordinates on a graph, but this does solve what I wanted to achieve!

 

Well done, and thanks,

 

RipRock99

 

PS:  I include a snapshot of the result, and a snapshot of the code used to set the property node programmatically.  I don't include my whole code as it is way complicated, and I would also need to add a big dataset.  Hope the pictures are enough to help anyone else referencing this board!

 

Download All
0 Kudos
Message 7 of 8
(4,177 Views)

Here are those links as inline images.  Apologies - I didn't quite see how to do this in the previous post.

 

Here is the property node code:

Picture 2.png

 

And here is the result:

 

Picture 3.png 

0 Kudos
Message 8 of 8
(4,171 Views)