# Gauge color slow to change

**URL:** <https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition80\
**Created:** [December 9, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361 "2020-12-09T21:58:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [December 9, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/1 "2020-12-09T21:58:54Z")

</div>

Perhaps this isn’t the best way to handle this. I have a gauge, I pass in the bounds and colors into a script

def UpdateGauge(gauge, Bound1, Bound2, Color1, Color2, Color3):  
if gauge.props.value \> Bound2:  
gauge.props.arc.color = Color3  
elif gauge.props.value \> Bound1:  
gauge.props.arc.color = Color2  
else:  
gauge.props.arc.color = Color1

This function runs whenever the value, maxValue or any of the 2 bounds change with with a change script. Any thoughts on this? It can be anywhere from instant to like 30 seconds.  
Sometimes the color is black, which is never even an option.Thx, jake

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 9, 2020, 10:33pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/2 "2020-12-09T22:33:43Z")

</div>

This sounds like an ideal use for a map transform:  
[https://docs.inductiveautomation.com/display/DOC81/Map+Transform#MapTransform-ExpressiontoColor](https://docs.inductiveautomation.com/display/DOC81/Map+Transform#MapTransform-ExpressiontoColor)

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [December 9, 2020, 10:42pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/3 "2020-12-09T22:42:21Z")

</div>

Looks interesting, I’ll check it out.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [December 9, 2020, 10:46pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/4 "2020-12-09T22:46:39Z")

</div>

So I have another place this will work, but not in this case. There’s 3 values that will change the color. The value, bounds1 and bounds2, I didn’t see a away to map one prop to another.Thx, jake

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 9, 2020, 11:04pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/5 "2020-12-09T23:04:43Z")

</div>

Oh, I see - you’re passing in dynamic bounds as well. I would say, in general, avoiding the change script is probably going to be better for performance. Could you maybe do an expression transform on `gauge.props.arc.color` directly? There’s a lot of ways to skin this cat, but one way would be something like:  
`binEnum({gauge.props.value} > {Bound2}, {gauge.props.value} > {Bound1})` - that will return a 0, 1, or 2 that you could feed into a map transform. The referenced properties should be automatically wired up, so no need for a change script to re-run the binding, and the logic is also separated from the colors.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [December 9, 2020, 11:10pm UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/6 "2020-12-09T23:10:54Z")

</div>

I’ll try that.Thx, jake

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [December 10, 2020, 5:41am UTC](https://forum.inductiveautomation.com/t/gauge-color-slow-to-change/41361/7 "2020-12-10T05:41:18Z")

</div>

Works like a charm now, I used the if(exp, true, false) function and just imbedded if’s to mimic my original function, mapped that 2 a sudo color index that’s mapped to the rgb. Thanks for the help.
