From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to achieve Graph background effect

Solved!
Go to solution

I came across this post: 

https://forums.ni.com/t5/LabVIEW/Waterfall-display/td-p/2754750?profile.language=en

when looking for ways to do waterfall plots:

AndrewMadry_2-1613036768519.png

 

Does anyone know how to do the effect on the top graph, showing a spectrum, where the area below the plot is shaded?
Setting the background plot image property could make a vertically shaded background pattern matching the Y axis.
But this wouldn't work to make the area above the plot line transparent. I can see that it would be possible by updating the background image, to match the plot, each iteration of writing to the graph, but that seems like a lot of overhead.
Any suggestions for how this effect might be achieved?

 

0 Kudos
Message 1 of 6
(1,326 Views)

Hi Andrew,

 

several options:

  • use the background image property of a graph and draw that image as needed
  • use a 2DPictureIndicator to draw the complete graph display on your own
  • use the IntensityGraph as suggested in your linked thread…
  • use one of the packages at VIPM, which offer advanced graph capabilities

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,324 Views)

Another option is to make multiple plots, and set the fill options of the plots.

 

So you'd have your data, and then a plot with either data - x or data/n. This plot will be below the data. Set the fill options to fill from data to the plot. Repeat for each color in the gradient.

 

I'd probably use the picture control, because I'm familiar with it. But this trick will be a lot simpler if you can get away with it. 

Graph Gradient.PNG

Message 3 of 6
(1,291 Views)

This effect is more like your posted image:

 

Graph Gradient2.PNG

 

The transparency is going to be difficult with this technique.

 

With the picture control background, coordinate conversion will be the difficult part..

 

Message 4 of 6
(1,288 Views)
Solution
Accepted by topic author AndrewMadry

Just for fun, here is my attempt at doing it with a background picture.

 

MIG_0-1613429137940.png

 

Message 5 of 6
(1,255 Views)

Thankyou for great suggestions. MIGs example achieves the exact effect!

But it seems it would be a bit of overhead particularly if the graph takes up a large number of pixels on the screen. But for small graph it should be fine. Wiebe's suggestion is a clever compromise.

 

I also tried an effect where a single background image is written, then an extra plot is added with fill to +Inf in black. This covers up the grid lines though, so it doesn't look as nice.

I added it to MIG's example - see attached.

0 Kudos
Message 6 of 6
(1,229 Views)