Dashboard 2.0 gauge

Hello,

I want to set the gauge segment colors via function but cannot get it to work.
This is my code:

msg.ui_update = 
{"segments" : 
    [
        { color: "blue", from: 0 },
        { color: "green", from: 15 },
        { color: "red", from: 35 }
    ]
};

What am I doing wrong?

And:

According to google this should work but it causes an error:

msg.ui_update.segments = [
  { color: "red", from: 0 },
  { color: "blue", from: 10 },
  { color: "green", from: 20 }
]

thanks for your help.

It is always helpful to include the error - however I imagine this one fails because ui_update is undefined. i.e. add msg.ui_update = {} on the line before so that ui_update is an object.


That looks ok, but what are you doing with it? Do you return the msg? have you checked with a debug node that the msg contains the "right stuff"? did you wire it into the gauge node? Have you tried sending a new value along with it in the payload?

Hello Steve.

Thanks for your help

msg.ui_update = {} solved my problem.

cheers,

Bernard.