LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the color of a temperature graph based on the temperature

I currently have a VI that reads the temperature of a thermocouple in a lab. Is it possible to have the graph have different colors for different regions (ie, normal white for 20-40 and then red for >40 and <20)? The methods I have tried changed the entire graph to only one color. 

0 Kudos
Message 1 of 5
(2,679 Views)

The first thing that comes to mind is an intensity graph...

It takes a 2d array as input and graphs z(i,j) where i and j are the indices of the value in your array. You can then customize the color bar in a variety of ways (ie. discrete or continuous) both by manipulating the graph itself or with a property node. see link below:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019MoUSAU

 

however this only works for 2d stuff. If you have a 1d array, you could create a second line of zeros or whatever but that isn't a good clean solution.

 

I'm sure altenbach will be around soon enough to give a better answer

Message 2 of 5
(2,648 Views)

Another option is to automatically split your input data into multiple series, where each series is its own color. It won't give you a smooth gradient, but it'd let you do what you want. Exporting data from the plot might be a bit of a pain as well.

 

(The above would be a great use for a QControl!)

0 Kudos
Message 3 of 5
(2,642 Views)

It can be done but does require a bit of code to accomplish that end goal. Standby for a word salad to describe how it can be done.

 

We can use "extra" plots that are hidden in the plot legend stuffed down at the bottom out of sight. Think of the "extra" plots as the part of the plot that is out of range. Set their color to red to flag the out of range.

 

As the data comes in each value that will be plotted has to be evaluated if it is in-range or not. Depending on that evaluation the readings are either included for plotting (when in range) or replaced with NaN to effective "lift the pen" for that plot.

 

At the same time the out of range values will be used in the "extra" plot.

 

So for each plotted channel you will have two plots, one for in-range and another for out of range. If all of the reading are in-range the "extra" plot will be of the same length as the normal but all of the values will be "NaN".

 

If they are all out of range then the normal plot will be all "NaN" and the "extra" plot will have all of the readings. 

 

Now if you get past that work there is only one "detail" that can you attend to which is connecting the gap that will be visible after a good reading and before a bad reading.  That can be covered by using the last good point as the first point in the bad plot and vise versa.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 5
(2,622 Views)

@Jewsus wrote:

The first thing that comes to mind is an intensity graph...
...

I'm sure altenbach will be around soon enough to give a better answer


Funny you should mention...

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=132312#M132312

0 Kudos
Message 5 of 5
(2,610 Views)