# Change Colour in Circle Pointer

**URL:** <https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659>\
**Category:** Dashboard\
**Created:** [17 December 2020 15:38 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659 "2020-12-17T15:38:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mario](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@Mario](https://discourse.nodered.org/u/Mario)\
**Post date:** [17 December 2020 15:38 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/1 "2020-12-17T15:38:29Z")

</div>

Hi there,

I have a circle pointer that I want to turn green for value 1 and red for value 2. My function is not really correct, but it shows what it is all about.

What do I have to do to make it work?

![Unbenannt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39bc2ff637ba6fbc19f4c9142b89d29333426403.png)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [17 December 2020 15:41 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/2 "2020-12-17T15:41:14Z")

</div>

Time to learn a bit about JavaScript syntax maybe

> **[JavaScript if else else if](https://www.w3schools.com/js/js_if_else.asp)**

---

<div class="post-metadata">

**Author:** ![Mario](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@Mario](https://discourse.nodered.org/u/Mario)\
**Post date:** [17 December 2020 17:55 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/3 "2020-12-17T17:55:58Z")

</div>

My question is more related to the transfer of the color changes for the pie chart. I think it won't work the way I do it.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [17 December 2020 21:23 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/4 "2020-12-17T21:23:38Z")

</div>

The Circle pointer is unknown therm. The pie chart has no options for colors to change on fly. The `seg1` and `seg2` may be options for the `gauge` node. So your question is a bit unclear. May be it will be more clear if you share the flow.

---

<div class="post-metadata">

**Author:** ![Mario](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@Mario](https://discourse.nodered.org/u/Mario)\
**Post date:** [23 December 2020 16:03 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/5 "2020-12-23T16:03:48Z")

</div>

It's not correct, but it shows what I'm getting at.

```auto
[{"id":"6d7768a7.9344f8","type":"function","z":"7438b086.86847","name":"make Var 1 global","func":"global.set(\"Var1\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":160,"wires":[["9044ab07.888a38"]]},{"id":"1b7feb56.a414b5","type":"function","z":"7438b086.86847","name":"make Var 2 global","func":"global.set(\"Var2\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":240,"wires":[["9044ab07.888a38"]]},{"id":"9044ab07.888a38","type":"function","z":"7438b086.86847","name":"Green or Red","func":"m1 = global.get(\"Var1\");\nm2 = global.get(\"Var2\");\n\nif (m1 < m2)\n{\n msg = {ui_control:{seg1}}\n}\nelse\n{\n msg = {ui_control:{seg2}}\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":200,"wires":[["b18ff93b.f84dc8"]]},{"id":"587c1c9e.d9adc4","type":"ui_numeric","z":"7438b086.86847","name":"","label":"Var 1","tooltip":"","group":"2f1d871c.11a448","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":1,"x":190,"y":160,"wires":[["6d7768a7.9344f8"]]},{"id":"d2745846.e08b78","type":"ui_numeric","z":"7438b086.86847","name":"","label":"Var 2","tooltip":"","group":"2f1d871c.11a448","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":1,"x":190,"y":240,"wires":[["1b7feb56.a414b5"]]},{"id":"b18ff93b.f84dc8","type":"ui_gauge","z":"7438b086.86847","name":"","group":"2f1d871c.11a448","order":2,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#ca3838","#ca3838"],"seg1":"","seg2":"","x":990,"y":200,"wires":[]},{"id":"2bf1b55d.9b85aa","type":"ui_numeric","z":"7438b086.86847","name":"","label":"Value","tooltip":"","group":"2f1d871c.11a448","order":3,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":1,"x":750,"y":300,"wires":[["b18ff93b.f84dc8"]]},{"id":"2f1d871c.11a448","type":"ui_group","name":"Default","tab":"d8883c99.f756c","order":1,"disp":true,"width":"6","collapse":false},{"id":"d8883c99.f756c","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 January 2021 16:03 UTC](https://discourse.nodered.org/t/change-colour-in-circle-pointer/37659/6 "2021-01-22T16:03:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
