From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

XY Graph Custom Control to Display Bargraph values

Solved!
Go to solution

Hi all, 

First time posting on the forums, but I have read many others and have found them very helpful. 

 

I'm writing an interface for a pressure scanner, and I have a very particular bar graph in mind. On the X-axis of the graph, I have an auto scaling of the pressure response based upon the largest pressure value read by the scanner. The Y-axis corresponds to the 16 channels from the pressure scanner. My goal is to have the corresponding pressure value next to the appropriate channel (in a professional/visually appealing manner, ie not what I did in the screenshot). I want this value to update when the bar graph updates (at about 5 Hz). What you are seeing in the screenshot is the values from the scanner which I have unbundled and displayed in an array overlapping the the XY Graph. Is there a better or cleaner way to do this with a custom control?

 

Any thoughts or suggestions would be a big help.

Download All
0 Kudos
Message 1 of 11
(3,967 Views)

Why not just use a vertical 1D array of horizontal progress bars or similar?

You can even show the digital display, eliminating the extra indicators.

You can even make the container and frames transparent for a cleaner look. 

 

(an old example is shown here, just with horizontal elements)

 

0 Kudos
Message 2 of 11
(3,917 Views)

@altenbach wrote:

Why not just use a vertical 1D array of horizontal progress bars or similar?

You can even show the digital display, eliminating the extra indicators.

You can even make the container and frames transparent for a cleaner look. 

 

(an old example is shown here, just with horizontal elements)

 


That same thought crossed my mind but I could not figure out how to get the fill to work correctly for both positive and negative numbers without getting complicated, adding sliders and adjusting the fill options to adapt for negative numbers.

 

What you showed there is a an array of clusters ?

 

Alternatively an cluster of clusters is another option where the names will line up nicely with the indicator.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 11
(3,907 Views)

Also please attach your VI, there are serious beginner mistakes and race conditions.

 

Why do you need to reinit the stop boolean 5x/second? depending on the execution order between reading the local variable and executing that node, your VI can never be stopped. What does the subVI do? How often do you need to set the scale max&min? Why do some wires go right-to-left? Where does the data of the local variables come from?

 

0 Kudos
Message 4 of 11
(3,904 Views)

@Ben wrote:

What you showed there is a an array of clusters ?

 


Here we use cluster because each element also has a label string. You can use a plain array instead.

Yes, the fill seems a bit tricky. You could use two sliders. Maybe you could add two bars next to each other, one for negative and one for positive values and calculate the right values.

 

Of course another option would be a picture indicator where you can freely draw any boxes and text you want. The image creation could be isolated to a simple subVI based on the data (data in, image out).

0 Kudos
Message 5 of 11
(3,899 Views)

Note that this question is about the graph control, not about how the VI stops or how often I need to set the scale.

 

The data from the local variable comes from a TCP Read which grabs the binary data from the pressure scanner, and a DLL converts it to a CSV. The SubVI parses and compares the values which outputs to the case structure for graph scaling.

The pressure scanner can scan at rates up to 500Hz. The bargraph is to display data updated at a reasonable rate for a person, and not every frame of data is important to the graph. 

 

Please see my initial request about the graph control. 

0 Kudos
Message 6 of 11
(3,892 Views)

I appreciate the solution, and I stumbled into this before. However, I am dealing with positive and negative numbers which I see as a downfall to the progress bars. For the user's benefit I went with the bar graph as it seems like a more intuitive visual aid. 

0 Kudos
Message 7 of 11
(3,889 Views)

Your VI is a bit too messy for me to study, but here is an example how you could deal with positive and negative values.

 

I assume the x-scale is fixed, so you need to set that to your liking (currently -10..10).

 

There is a bit of a kludge if the value is zero because the fill to above/below does not work if all three sliders are zero (we get full fill instead of no fill). I have not studied if element reordering would fix it.

 

You could easily make the array element an outer cluster and add another numeric indicator as a second element to show the value (first element is the slider cluster). 

 

0 Kudos
Message 8 of 11
(3,876 Views)

Your attached VI is similar to what my original bar graph program does. I need a graphical display with the bars AND their current numeric values in a way that could be visually appealing. 

0 Kudos
Message 9 of 11
(3,870 Views)
Solution
Accepted by topic author aanderson

Yes, here's the suggested modification.

 

 

Download All
Message 10 of 11
(3,857 Views)