Text colour change, enumeration

Hello,

I’m trying to create some text in a rectangle and I would like that the colour change basing on the value.

I’ve been trying to use the enumeration function but I can’t get it to work.
I create the enumeration and then I use it with table or a “number” function. I can’t let it work.

I follow the manual guide step by step.

Any help would be very appreciated.

Thank a lot in advance!

First, what kind of UI control did you use? Only Text, Image, and Grid have a Color Channel. It will not work with Simple Indicator UI control.

I’m attaching an example project showing how to change the color of the text.
You can use Channel Simulator to test. Please set n_state to 0, 1, 2 to show different colors of the text.

enumerationColorChange.adu (5.7 KB)

Hello,
Thanks for the answer.

I tried with text so far so I understand the procedure.

I tried your file and it works, but how do I “attach” the n_state to the value of a sensor? And, is it possible to create a scale?

Example : AIR TEMPERATURE 0-10 yellow ; 10-30 green ; 30-50 red

Thank you

[EDITED: updated the screenshot and the attached file]
Sure. You need to create an additional table. And put a table name in the Color Channel of a Text.

enumerationColorChange3.adu (5.7 KB)

This is what I already tried to do. It seems correct but the colour doesn’t change as the ecu.ambientAirTemp (channel we are using for example) value change.

I can’t attach my file, so I made a screenshoot.

What do I miss?

You need to be connected to the real ADU device.
You are not able to simulate it the Client.

Please try on the real ADU and it should work.

Ok, I will try on the ADU then.

Thanks Jan!

1 Like

wow, always wondered, how should i get this function, thanks!

OK, I tried it out, and it’s not really working.
I was using ecu.clt as example. The Color channel only does 0-1, 1 is always red, 0 is white (or maybe the set color of the text).
What am I missing? The above table is just a 0-1 function, the additional values don’t change the colors, and the color obviously has only 1 shade. the above table is misleading, as it let’s you configure a whole range with a color range, but the results on ADU is just a 0-1 red color function.
Any tips?

Did you try to use my example file?
You can change the n_state from the Channel Simulator.

If you want to use a Table as an input for the Color Channel you need a real ADU device.

i tried it on ADU, but now I checked your example file.
I see how it works now, but it’s a very weird and inefficent way of doing things.

Define a table, which gives you a value for your input channel, than assign an enumeration to those values, and the enumeration is the only thing, which can have color values. well…

specially given how limited the number of enumeration items and functions in memory are.

Still, thanks!
Now i understand, but IMHO the color channel logic needs a big overhaul