General Discussions
Change text color for Analog Status tag

Is there a way to change the color of the text based on some set-points for data coming from an Analog Status tag? I'm thinking you would use the "Text Change (4 state)" widget, but I can't figure out how to set the values for the different states.

For example, I would like it to always show the tag value, but change from blue when it's below 110.0 to green between 110.0 and 120.0, and red when it's above 120.0.

Thanks,
Justin

Is there a way to change the color of the text based on some set-points for data coming from an Analog Status tag? I'm thinking you would use the "Text Change (4 state)" widget, but I can't figure out how to set the values for the different states. For example, I would like it to always show the tag value, but change from blue when it's below 110.0 to green between 110.0 and 120.0, and red when it's above 120.0. Thanks, Justin

Hey Justin, the simplest way to do this is probably to draw the value as text using the numeric value widget, once in each color. Then put the relevant expression in the opacity setting for each colored text:

Where [<sampleStatus>] is your tag name.

For the Blue Text:

[<sampleStatus>] < 110 ?
1 : 0

For the Green Text:

[<sampleStatus>] >= 110 & [<sampleStatus>] < 120 ?
1 : 0

For the Red Text:

[<sampleStatus>] >= 120 ?
1 : 0

If you need more help with this, please follow up with us.

Hey Justin, the simplest way to do this is probably to draw the value as text using the numeric value widget, once in each color. Then put the relevant expression in the opacity setting for each colored text: Where [&lt;sampleStatus&gt;] is your tag name. For the Blue Text: ```` [&lt;sampleStatus&gt;] &lt; 110 ? 1 : 0 ```` For the Green Text: ```` [&lt;sampleStatus&gt;] &gt;= 110 &amp; [&lt;sampleStatus&gt;] &lt; 120 ? 1 : 0 ```` For the Red Text: ```` [&lt;sampleStatus&gt;] &gt;= 120 ? 1 : 0 ```` If you need more help with this, please follow up with us.

Trihedral Engineering Ltd.

That works, thanks for the help!

In the meantime, I added the ladder logic in the PLC to turn on one of three outputs depending on that temperature. Then I used those tags in the opacity settings of three different indicator lights stacked on top of each other to turn them on or off according to those tags. Seemed to work fine, but I think your solution is more elegant. Although the other way I did it, I would have those PLC outputs available to use with physical lights on location, so I might keep them anyway.

Thanks again,
Justin

That works, thanks for the help! In the meantime, I added the ladder logic in the PLC to turn on one of three outputs depending on that temperature. Then I used those tags in the opacity settings of three different indicator lights stacked on top of each other to turn them on or off according to those tags. Seemed to work fine, but I think your solution is more elegant. Although the other way I did it, I would have those PLC outputs available to use with physical lights on location, so I might keep them anyway. Thanks again, Justin
184
2
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft