# Gauge sectors change in dashboard

**URL:** <https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017>\
**Category:** Dashboard\
**Created:** [11 April 2019 09:19 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017 "2019-04-11T09:19:53Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [11 April 2019 09:19 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/1 "2019-04-11T09:19:53Z")

</div>

The Gauge sectors can be set from the dashboard?  
The gaude can be divided into three parts with different colours and I have numeric nodes for the maximum an minimum values. And I want to change the sectors depending on the numeric values.  
 ![maximo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/10b4d10d67bdda5fbb1dd7565a3be05fc91f31a7.png) ![minimo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3158817236d23957efcca1893f68d2747c3b84c3.png)  
 ![gauge](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d049b1f81f6104244e7f294868c939db8724878d.png)  
I have written this command in the sectors= {{flow.get("minimo")}}

---

<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:** [11 April 2019 10:03 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/2 "2019-04-11T10:03:14Z")

</div>

It can be done by sending `ui_control` property to gauge with `msg`

```auto
msg.ui_control = {seg1:30,seg2:80}
msg.payload = Math.floor(Math.random()*100)

return msg;

```

> <https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md>

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [11 April 2019 10:35 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/3 "2019-04-11T10:35:23Z")

</div>

but this looks that is for changing the max and th min of the gauge and I want to have that form 0 to 100. The values that i want to change are the limits of the sectors that are the colours

---

<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:** [11 April 2019 10:42 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/4 "2019-04-11T10:42:01Z")

</div>

Not really. For min and max if you need to change them you need to send

`msg.ui_control = {min:30,max:80}`

or you can send them all together

`msg.ui_control = {min:10, max:80, seg1:30, seg2:60}`

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [11 April 2019 10:44 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/5 "2019-04-11T10:44:59Z")

</div>

This need i do to send it from a function node? I don´t get which nodes do I need to use

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [11 April 2019 10:48 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/6 "2019-04-11T10:48:17Z")

</div>

Do you have any example of this??

---

<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:** [11 April 2019 10:53 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/7 "2019-04-11T10:53:40Z")

</div>

Let's do it another way. You will do the flow and share it then we help at the point where you stuck.

You can use `function` node or `change` node to send`ui_control` property as part of `msg`.

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [16 April 2019 07:31 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/8 "2019-04-16T07:31:12Z")

</div>

![sectors](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2672faa78dbce5b0db7fe5d922216cb3cccd0926.png)  
I tried to do this way but it doesn´t work. Then in the gaude sector I wrote {{toprange}}.

---

<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:** [16 April 2019 08:58 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/9 "2019-04-16T08:58:53Z")

</div>

as @hotnipi has already shown you you need to set msg.ui\_control - for example  
`msg.ui_control = {min:10, max:80, seg1:30, seg2:60}`  
In your case maybe change that change node to  
set msg.ui\_control.seg2 flow.rangetop

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [16 April 2019 09:05 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/10 "2019-04-16T09:05:23Z")

</div>

and where do I need to write those values\<?

---

<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:** [16 April 2019 09:20 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/11 "2019-04-16T09:20:08Z")

</div>

Here is example by using the `change` node

`[{"id":"1d637a9e.5d87c5","type":"change","z":"b02a69cb.a920e8","name":"","rules":[{"t":"set","p":"ui_control.seg1","pt":"msg","to":"low_segment_value","tot":"flow"},{"t":"set","p":"ui_control.seg2","pt":"msg","to":"high_segment_value","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":400,"wires":[["63a3e8c0.edea48"]]},{"id":"87a05219.c3cc5","type":"inject","z":"b02a69cb.a920e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":400,"wires":[["1d637a9e.5d87c5"]]},{"id":"63a3e8c0.edea48","type":"debug","z":"b02a69cb.a920e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":680,"y":400,"wires":[]}]`

Note, that values must be stored in flow before you can use change node this way. If values can not be found, the properties will not be created.

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [16 April 2019 09:31 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/12 "2019-04-16T09:31:12Z")

</div>

so the ui\_control node I don´t need to use it as it apperas in your example?  
and in the gaude what do I need to write in you 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:** [16 April 2019 09:35 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/13 "2019-04-16T09:35:36Z")

</div>

the `ui_control` we are talking about is property of `msg` object . Not a node  
For gauge you will need to specify some default values for sectors. Use numeric values.

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [16 April 2019 09:39 UTC](https://discourse.nodered.org/t/gauge-sectors-change-in-dashboard/10017/14 "2019-04-16T09:39:12Z")

</div>

thank you very much to both now it is working correctly. You help me a lot and I think that I learn a lot
