Text colour change, enumeration


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)

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!