LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I map a 1-d array of data to a color scale that goes from green to yellow to red?

I have attempted using an if else statement that takes pieces of the 0-255 range and maps them to different equations that follow the necessary curve. Hoping there is an easier way.
"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

0 Kudos
Message 1 of 7
(3,034 Views)
Create an array containing your color table once, then simply use "index array" using your data as index.

See attached example...
0 Kudos
Message 2 of 7
(3,033 Views)
Hi,
The key to this task is to have a range of 256 colors that go from green to red thru yellow. I have created such a 256 element array for you in the attaced vi (version 6.1). It was created using the tools I provided in another answer some time ago. I hope this helps. /Mikael
0 Kudos
Message 3 of 7
(3,033 Views)
I forgot to make the data default in the array (it is empty). Here it is again. Now hopefully with data in the array as well... 🙂
/Mikael
0 Kudos
Message 4 of 7
(3,033 Views)
Hi!

The slickest way to do this is with the property node. You can assign the color of the indicator using an RGB hexadecimal string. (there are hex to decimal conversions in the STRING toolbox.

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 5 of 7
(3,033 Views)