# Dynamic Gauge Values

**URL:** https://discourse.nodered.org/t/dynamic-gauge-values/98928
**Category:** Dashboard
**Created:** [3 September 2025 15:09 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928 "2025-09-03T15:09:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![tomsutton529-rgb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomsutton529-rgb/32/103124_2.png) [@tomsutton529-rgb](https://discourse.nodered.org/u/tomsutton529-rgb)
#### Post date: [3 September 2025 15:09 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/1 "2025-09-03T15:09:06Z")

</div>

Ive a dashboard that is pulling data in via OPC UA. Mainly numbers from vibration readings.

I have a gauge that displays the current vibration reading. Every vibration reading has an alarm level, which is represented in the gauge by each segment. Can the value of each segment be changed from a number stored in a global variable?

ive read that this is possible, but i am not sure how its achieved.

Thanks

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [3 September 2025 15:20 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/2 "2025-09-03T15:20:53Z")

</div>

Welcome to the forum @tomsutton529-rgb

Which dashboard (and version) are you using?

You can tell from Manage Palette (under the hamburger menu).  
So for example I have @flowfuse/node-red-dashboard v1.26.0 and node-red-dashboard v3.6.6:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6e5263beb63ed2887b07136b150e9e8aea0bf33.png)

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [3 September 2025 15:53 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/3 "2025-09-03T15:53:43Z")

</div>

I'm using Dashboard D1 (the old version) to display my home energy readings.

 ![dynamic_dashboard](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b14ee19d5724127ba4d25225516e8509e7586259.png)  
The current and power displays are dynamic as in this flow.  
 ![dynamic_flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/62438d3c83cbeb802e9d944f537afb49a2daa55a.png)  
As an example, here's the JS in the function node labelled 'Dynamically alter Current'

```auto
var current = msg.payload.ENERGY.Current;

flow.set("current",current);
current = current.toFixed(2);

var max = 3;
var min = 0;

if (current > 20) {
    max = 40;
    min = 20;
}
else if (current > 15) {
    max = 20;
    min = 15;
}
else if (current > 10) {
    max = 15;
    min = 10;
}
else if (current > 5) {
    max = 10;
    min = 5;
}
else if (current > 1) {
    max = 5;
    min = 1;
}
else if (current > 0) {
    max = 1;
    min = 0;
}
else {
    max=500;
    min=0;
}
msg = {payload:current,ui_control:{min:min,max:max},topic:"Current"};
return msg;

```

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [3 September 2025 16:24 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/4 "2025-09-03T16:24:37Z")

</div>

Don't you find that confusing Dave?

The gauge is supposed to be a visual representation of the data, but if the following data point falls into a higher criteria band, visually the gauge could fall, instead of increasing (because the scale would have changed).

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [3 September 2025 17:01 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/5 "2025-09-03T17:01:06Z")

</div>

I started-off with the 'wattage' scale that goes from zero to 20,000 watts. As it was difficult to 'see' the low-value readings, I made it dynamic. Then thought... "I'll apply that to current readings also"

---

<div class="post-metadata">

### Author: ![tomsutton529-rgb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomsutton529-rgb/32/103124_2.png) [@tomsutton529-rgb](https://discourse.nodered.org/u/tomsutton529-rgb)
#### Post date: [3 September 2025 18:48 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/6 "2025-09-03T18:48:26Z")

</div>

Hi,

Please see my flow below, the change in alarm has been detected and is shown as a global variable on the right, so I am pleased that bit seems to be working.

The flow is probably a mess compared to others but I can sort that at a later date.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/a/4ae5a1df89a9a3a5e456f57ccd89be9328524018.png)

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

---

<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: [3 October 2025 18:48 UTC](https://discourse.nodered.org/t/dynamic-gauge-values/98928/7 "2025-10-03T18:48:58Z")

</div>

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