# Dynamic label in gauge node

**URL:** <https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068>\
**Category:** Dashboard\
**Created:** [9 July 2019 09:29 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068 "2019-07-09T09:29:47Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![niboto](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@niboto](https://discourse.nodered.org/u/niboto)\
**Post date:** [9 July 2019 09:29 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/1 "2019-07-09T09:29:47Z")

</div>

Hello I am trying to set dynamically the label of some gauges by injecting a string (i.e. "mylabel") in a, msg.topic using a change node. It is not working. Can someone provide a simple example with an inject node + change node + gauge node and modifying the label in gauge node?

note a succeed to change value, and gauge ranges too but not the label.

thanks a million.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [9 July 2019 09:44 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/2 "2019-07-09T09:44:05Z")

</div>

What have you got `Label` set to in the Gauge nodes properties?

```auto
[{"id":"1c2d8063.ffd98","type":"ui_gauge","z":"66c7738a.9aedd4","name":"","group":"60dbb005.0de84","order":0,"width":0,"height":0,"gtype":"gage","title":"{{topic}}","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":556,"y":233,"wires":[]},{"id":"f2ad57c4.ab6818","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":143,"y":118,"wires":[["caa0fea4.2d07e"]]},{"id":"caa0fea4.2d07e","type":"change","z":"66c7738a.9aedd4","name":"10 nm","rules":[{"t":"set","p":"payload","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":326,"y":136,"wires":[["1c2d8063.ffd98"]]},{"id":"3183b7fe.17aea","type":"change","z":"66c7738a.9aedd4","name":"label1","rules":[{"t":"set","p":"topic","pt":"msg","to":"label1","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":318,"y":228,"wires":[["1c2d8063.ffd98"]]},{"id":"8c00a1bc.87b528","type":"change","z":"66c7738a.9aedd4","name":"Label2","rules":[{"t":"set","p":"topic","pt":"msg","to":"Label2","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":321,"y":324,"wires":[["1c2d8063.ffd98"]]},{"id":"16d2b4a6.7d73b3","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":155,"y":228,"wires":[["3183b7fe.17aea"]]},{"id":"1b719264.6c406e","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":173,"y":336,"wires":[["8c00a1bc.87b528"]]},{"id":"60dbb005.0de84","type":"ui_group","z":"","name":"control","tab":"1d3f043a.f4b0d4","order":1,"disp":true,"width":"6","collapse":false},{"id":"1d3f043a.f4b0d4","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

```

---

<div class="post-metadata">

**Author:** ![niboto](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@niboto](https://discourse.nodered.org/u/niboto)\
**Post date:** [9 July 2019 13:04 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/3 "2019-07-09T13:04:44Z")

</div>

Hello, thanks for the example which is perfectly working. I could get my flow working now.  
thank you.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [9 July 2019 13:32 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/4 "2019-07-09T13:32:48Z")

</div>

pretty sure the solution is in post 2 not post 3...😆

---

<div class="post-metadata">

**Author:** ![niboto](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@niboto](https://discourse.nodered.org/u/niboto)\
**Post date:** [9 July 2019 13:44 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/5 "2019-07-09T13:44:32Z")

</div>

sorry for "solution" in post 3. My mistake.

another question, how to set automatically "units" field in gauge. I tried by sending a json {"unit":"celcuis"} in topic and I set the units field in gauge to be {{unit}} (I tried {{topic.unit}} too}}  
but it is not working. do you have any ideas?

---

<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:** [9 July 2019 16:02 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/6 "2019-07-09T16:02:35Z")

</div>

As far I know, there is no any legal way to change units field on fly.

---

<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:** [9 July 2019 16:17 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/7 "2019-07-09T16:17:42Z")

</div>

And again, I was wrong 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/087118a21388baeb1836b625604816a6de887298.png)

---

<div class="post-metadata">

**Author:** ![vishalnodered](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vishalnodered](https://discourse.nodered.org/u/vishalnodered)\
**Post date:** [6 January 2021 17:03 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/8 "2021-01-06T17:03:11Z")

</div>

I added the label setting in the below image

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a5f4e4a009cb111c729c8dbeace3c375dee749a.jpeg)

Do I have to change some setting in below screen also as changes are not reflecting in the dashboard.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/eefc874d5ca2455f8f8cfcc9876dc8e11bafecf1.jpeg)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 January 2021 17:14 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/9 "2021-01-06T17:14:20Z")

</div>

In the change node just set `msg.label` to "Hello" - then in the gauge set the Label field to `{{msg.label}}`

---

<div class="post-metadata">

**Author:** ![vishalnodered](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vishalnodered](https://discourse.nodered.org/u/vishalnodered)\
**Post date:** [6 January 2021 17:27 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/10 "2021-01-06T17:27:16Z")

</div>

Many thanks for your reply. I changed the settings as per the suggestion

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/1341e511d5d7b5b37d34c1f47bb80fdbfd9a87c8.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/8/d8202847678d48a48089d17246080d9f49dbe7f3.jpeg)  
but still the guage not showing any label.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fd05a8e048055dd955253e0baf2d7dcdfec1b435.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 January 2021 17:41 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/11 "2021-01-06T17:41:06Z")

</div>

which version of dashboard are you running - it was a fairly recent update.

---

<div class="post-metadata">

**Author:** ![vishalnodered](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vishalnodered](https://discourse.nodered.org/u/vishalnodered)\
**Post date:** [6 January 2021 17:43 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/12 "2021-01-06T17:43:38Z")

</div>

sir I am using 2.26.0

---

<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:** [6 January 2021 17:45 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/13 "2021-01-06T17:45:51Z")

</div>

Well, it doesn't work for me also. Tried pretty hard ...

---

<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:** [6 January 2021 18:44 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/14 "2021-01-06T18:44:52Z")

</div>

Well. It actually works but there is cases where it fails and after failure the label does not recover.  
One case were it fails is when you try to get value from non existent property within angular filters.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 January 2021 18:46 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/15 "2021-01-06T18:46:14Z")

</div>

Example ?

---

<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:** [6 January 2021 18:50 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/16 "2021-01-06T18:50:44Z")

</div>

Again wrong. It recovers. I had wires crossed too heavily already 😛  
But for sure, if value parsing fails then the label also will be missed. But who cares about the label if there is no value.  
So no case.

There is another interesting case with not hard failure, just may be confusing

```auto
[{"id":"fb505a25.7b7148","type":"inject","z":"e8af3254.77f7e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.2","topic":"","payload":"35","payloadType":"num","x":310,"y":80,"wires":[["dbaef54f.dc0428"]]},{"id":"149353d0.fc1d0c","type":"ui_gauge","z":"e8af3254.77f7e","name":"value","group":"60dbb005.0de84","order":2,"width":"6","height":"4","gtype":"gage","title":"{{title}}","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":730,"y":80,"wires":[]},{"id":"9a210679.f1fa88","type":"ui_gauge","z":"e8af3254.77f7e","name":"payload.something","group":"60dbb005.0de84","order":4,"width":"6","height":"4","gtype":"gage","title":"{{title}}","label":"units","format":"{{payload.something | number:2}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":750,"y":160,"wires":[]},{"id":"79aee4e1.59f08c","type":"inject","z":"e8af3254.77f7e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":160,"wires":[["bc76935f.f499e"]]},{"id":"bc76935f.f499e","type":"random","z":"e8af3254.77f7e","name":"","low":1,"high":10,"inte":"true","property":"payload","x":500,"y":160,"wires":[["9a210679.f1fa88","149353d0.fc1d0c"]]},{"id":"dbaef54f.dc0428","type":"change","z":"e8af3254.77f7e","name":"","rules":[{"t":"set","p":"title","pt":"msg","to":"ABC","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":80,"wires":[["149353d0.fc1d0c","9a210679.f1fa88"]]},{"id":"60dbb005.0de84","type":"ui_group","name":"control","tab":"1d3f043a.f4b0d4","order":1,"disp":true,"width":"6","collapse":false},{"id":"1d3f043a.f4b0d4","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

```

---

<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:** [6 January 2021 19:34 UTC](https://discourse.nodered.org/t/dynamic-label-in-gauge-node/13068/17 "2021-01-06T19:34:40Z")

</div>

Oh I forgot to clarify  
It works if you configure it like {{label}} not {{msg.label}}
