# Dashboard Gauge - programatically change the 'Units'

**URL:** <https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840>\
**Category:** Dashboard\
**Created:** [9 May 2024 15:53 UTC](https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840 "2024-05-09T15:53:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeyd0407](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@mikeyd0407](https://discourse.nodered.org/u/mikeyd0407)\
**Post date:** [9 May 2024 15:53 UTC](https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840/1 "2024-05-09T15:53:50Z")

</div>

Hi Everyone,

I'm looking for a way to programatically change the 'Units' field in my flow. For example I wan't to be able to change the Units from 'BAR' to 'PSI' depending on my end device configuration.

I looked at modifying the parameter through the msg.ui.control properites  
([[node-red-dashboard/config-fields.md at master · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md)]), but the 'Units' field is not listed as a modifiable property through this implimentation.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/8508d86df5a77e66648367ee8ea63f7598faeaf4.png)

Any help will be appreciated on how I might change the Units on the fly (maybe it can be done throught CSS?)

Many thanks

Michael

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 May 2024 16:06 UTC](https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840/2 "2024-05-09T16:06:09Z")

</div>

If you read the sidebar help text it says

> The label can also be set by a message property by setting the field to the name of the property, for example `{{msg.topic}}` .

This also applies to value format and unit input fields. So you can feed in any msg property you wish, and dynamically populate the fields.  
e,g

```auto
[{"id":"3a8b88d5c2d8e8c5","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"units","v":"BARS","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":610,"y":4520,"wires":[["a1150a35d5b13b55"]]},{"id":"a1150a35d5b13b55","type":"ui_gauge","z":"d1395164b4eec73e","name":"","group":"4f791fdc1745d3d9","order":3,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"{{msg.units}}","format":"{{value}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":790,"y":4520,"wires":[]},{"id":"6ea8cae4f7759baa","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"units","v":"PSI","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"40","payloadType":"num","x":610,"y":4560,"wires":[["a1150a35d5b13b55"]]},{"id":"4f791fdc1745d3d9","type":"ui_group","name":"micro","tab":"c954274bbed7292e","order":1,"disp":false,"width":"18","collapse":false,"className":""},{"id":"c954274bbed7292e","type":"ui_tab","name":"Solar","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![mikeyd0407](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@mikeyd0407](https://discourse.nodered.org/u/mikeyd0407)\
**Post date:** [10 May 2024 07:03 UTC](https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840/3 "2024-05-10T07:03:28Z")

</div>

Hi E1cid,

Many thanks for the solution - much appreciated, work a treat.

Thanks

Michael

---

<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:** [24 May 2024 07:03 UTC](https://discourse.nodered.org/t/dashboard-gauge-programatically-change-the-units/87840/4 "2024-05-24T07:03:50Z")

</div>

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