LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating bar char color with changing temperature values

Solved!
Go to solution

hello everyone. I am actually reading a temperature sensor and plotting the data as a bar chart. I am acquiring the data every second and present them in a bar chart. the challenge  is to show different color on the bar chart as the temperature goes from safe to dangerous.when the reading are safe the chart should be red, when fair the chart should be orange and when dangerous red.I am using Labview 2012.I need to get started as I am actually learning the software.

 

looking forward for hearing from you guys.

Yannstephen

0 Kudos
Message 1 of 10
(5,086 Views)

Hi Yann,

 

you can either change the color of the (whole) plot or you can use three plots (green, orange, red).

When using 3 plots you can use NaN values to fill the "unused" plots...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(5,082 Views)

Hi Yannstephen,

 

You can cuomize your graph/chart as you want. It is little trickey.

You can get such charts in NI discussion forums. (UI Design Community etc.)

Attached is the one I made it for you.

Right click the graph and look into the properties.

 

Regards,

Yogesh Redemptor

 

Regards,
Yogesh Redemptor
0 Kudos
Message 3 of 10
(5,070 Views)

thank you for you answere Yogesh_Redemptor. but what i need is a bar graph where each bar represent a specific sensor reading which color changes as the value display is safe(green), close to dangerous(orange),dangerous(red).

i have attached a picture of what i am trying to explain. thank you for looking at it.

 

Yannstephen.

 

 

0 Kudos
Message 4 of 10
(5,047 Views)

The code below is an example of changing the line color on a graph. The High Limit control is the max value that is set on the Front Panel, but can easily be replaced by a constant of your choice. The other input - Temperature - is where your data comes in. The comparison determines the color to apply to the Temperature plot by using a Property Node with a selector function.

 

Property Node Graph Example.png

 

This snippet can be directly imported into your project if you're running LabVIEW 2013 by clicking and dragging it into your block diagram. 

 

For more information on property nodes, visit our help at ni.com/support or click here.

 

-Nate

 

Nathan Murphy
0 Kudos
Message 5 of 10
(5,035 Views)

thank you Sir for taking that much time to answer. i was working arounf the code you posted and was able to simulate a signal that i converted to array on compare each value to limit and then assign the color to it.nut i would to use three different color. i thinking i using a range instead of a value but i am not quit sure on how to implement it on labview. what  is something like (if(temp >0 and temp < 25; then safe graph shows green);(else if temp >25 and temp < 70 acceptable,show graph orange) else(temp> 70, danger , show graph red). 

i have attached the piece of code i manage to get correct.

thank you for taking a look

 

Yannstephen

0 Kudos
Message 6 of 10
(4,997 Views)
Solution
Accepted by topic author yannstephen

Using a range to define a set value is something that comes up fairly often. Below are two solutions that can apply to you. The first uses logic operators and will work as intended.

 

Tri-State Color Selection.png

 

However there are downsides to consider: What happens if you decide to add more ranges that have different meanings? This solution does not scale well, and will become very cumbersome to maintain. The second solution addresses this issue by using a Case Structure. Note that the case structure only accepts integer values in the selector terminal. You can read up on the implemented workaround here.

 

Case Selection Using Floating Point.png

 

Hope this helps!

 

-Nate

Nathan Murphy
0 Kudos
Message 7 of 10
(4,984 Views)

Thank you for this post. the first method was actually fine to implement and i was able to get right. however i dont really understand what is going on in second method though i want to give it a try can be more explicit.i actually get something working yesterday using formula node(i could code the condition as in C) and case structure.i have attachthe code i have.sorry for this question again, i considered you have answered my question.

 

YannStephenSmiley HappySmiley Happy

0 Kudos
Message 8 of 10
(4,961 Views)

In the second method Nathan is using a case structure to specify the ranges. This means you can add more specific statuses (word?) in future by simply creating a new case. In the example shown, "75001..", the dots mean "this value and anything greater". Similarly having the dots before means less than, and between two values will execute the case for any value in between. 

 

He also scales by 1000 as the case selector only accepts integer values, so scaling preserves your decimal places. 

 

0 Kudos
Message 9 of 10
(4,946 Views)

thank you very much for the Add ons man. i use  the property node to update the color of the graph using this method.and got it right.

thanks everyone for the assist i can now think of adding more channel reading to the graphs.Smiley Happy

0 Kudos
Message 10 of 10
(4,923 Views)