Gauge with pointer centred

Hi

I'm looking for a gauge that will display solar panel information as to whether I'm drawing from the grid or the panel. I want zero to be the centre. If drawing from the grid, the gauge should move anticlockwise and clockwise when drawing from the panels. I've search for this without success.

Any suggestions?

I hesitate to ask, but have you tried setting the gauge minimum to a negative number and the maximum to a positive number?
Untitled 1

Untitled 2

OMG. I didn't think it was that simple.

Thanx muchly

Is there a way to get the colour to follow the needle, so that the colour goes from the zero position rather than the full left position?

You might be able to do that with node-red-contrib-ui-artless-gauge, not sure.

1 Like

To echo what @jbudd suggests,
here is an animated gif of my gauges going from positive to negative.
Take a few seconds to see the animation, these are real values and there is some normal latency.
demo-gauge-artless

You can use ui_control to hide needle and colour left right on positive or negative, on a ui-gauge set to donut.
e.g.

[{"id":"28100460.a4b09c","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":150,"y":2660,"wires":[["7bbe61b3.327768"]]},{"id":"7bbe61b3.327768","type":"function","z":"30af2d3e.d94ea2","name":"","func":"msg.ui_control = {\n    \"min\":0,\n    \"max\":100,\n    \"gtype\":\"donut\",\n    \"options\":{\n        \"donutStartAngle\":90,\n        \"pointer\":false,\n        \"levelColors\": [\"#00FF00\",\"#00FF00\",\"#00FF00\"]\n    }\n}\nlet display_degree = 360; // 360 or 180\nif(msg.payload > 0) {\n    msg.positive = \"+\";\n}else if(msg.payload < 0) {\n    msg.positive = \"-\";\n    msg.payload = Math.abs(msg.payload)\n    msg.ui_control.options.donutStartAngle = 450 - (msg.payload * (display_degree / msg.ui_control.max));\n    msg.ui_control.options.levelColors = [\"#ff0000\",\"#ff0000\",\"#ff0000\"];\n} else {\n    msg.positive = \"\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":2740,"wires":[["38e75ce6.317f3c","52b6d283.4a8ff4"]]},{"id":"3f8bf1b4.674f9e","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":130,"y":2740,"wires":[["7bbe61b3.327768"]]},{"id":"63673ae9.530344","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-15","payloadType":"num","x":110,"y":2800,"wires":[["7bbe61b3.327768"]]},{"id":"e90e283f.5e234","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-48","payloadType":"num","x":110,"y":2840,"wires":[["7bbe61b3.327768"]]},{"id":"f3569b41.944de8","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-100","payloadType":"num","x":130,"y":2880,"wires":[["7bbe61b3.327768"]]},{"id":"aaf2f9c0.686bb","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"55","payloadType":"num","x":130,"y":2700,"wires":[["7bbe61b3.327768"]]},{"id":"38e75ce6.317f3c","type":"ui_gauge","z":"30af2d3e.d94ea2","name":"","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"","format":"{{msg.positive}}{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":500,"y":2680,"wires":[]},{"id":"52b6d283.4a8ff4","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"ui_control","targetType":"msg","statusVal":"","statusType":"auto","x":350,"y":2580,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

2 Likes

so I hesitate to change my gauges.
I find this one very readable at a glance

Nice. What code change is needed to get the Gauge to function in this way but with the half circle shape that displays when you have 'gauge' rather than 'donut' selected,

Regards
John

It can not be done on gauge. Only works on donut and compass. You can force the donut and compass to do full circle left and rights or 90% of circle or any % you wished.

You could do this with the gauge, going from left to right for positive, and right to left for negative.

[{"id":"28100460.a4b09c","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":2660,"wires":[["7bbe61b3.327768"]]},{"id":"7bbe61b3.327768","type":"function","z":"30af2d3e.d94ea2","name":"","func":"msg.ui_control = {\n    \"min\":0,\n    \"max\":100, \n    \"gtype\":\"gauge\",\n    \"options\":{\n        \"gaugeColor\":\"#808080\",\n        \"pointer\":true,\n        \"levelColors\": [\"#00FF00\",\"#00FF00\",\"#00FF00\"]\n    }\n}\nif(msg.payload < 0) {\n    msg.ui_control.options.min = -100;\n    msg.ui_control.options.max = 0;\n    msg.ui_control.options.gaugeColor = \"#ff0000\";\n    msg.ui_control.options.levelColors = [\"#808080\",\"#808080\",\"#808080\"];\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":2740,"wires":[["52b6d283.4a8ff4","38e75ce6.317f3c"]]},{"id":"3f8bf1b4.674f9e","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":130,"y":2740,"wires":[["7bbe61b3.327768"]]},{"id":"63673ae9.530344","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-15","payloadType":"num","x":110,"y":2800,"wires":[["7bbe61b3.327768"]]},{"id":"e90e283f.5e234","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-48","payloadType":"num","x":110,"y":2840,"wires":[["7bbe61b3.327768"]]},{"id":"f3569b41.944de8","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-100","payloadType":"num","x":130,"y":2880,"wires":[["7bbe61b3.327768"]]},{"id":"aaf2f9c0.686bb","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"55","payloadType":"num","x":130,"y":2700,"wires":[["7bbe61b3.327768"]]},{"id":"52b6d283.4a8ff4","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"ui_control","targetType":"msg","statusVal":"","statusType":"auto","x":350,"y":2580,"wires":[]},{"id":"38e75ce6.317f3c","type":"ui_gauge","z":"30af2d3e.d94ea2","name":"","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":640,"y":2740,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

The same gauge receiving 55 and -48.

Or you can do this

[{"id":"28100460.a4b09c","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":2660,"wires":[["7bbe61b3.327768"]]},{"id":"7bbe61b3.327768","type":"function","z":"30af2d3e.d94ea2","name":"","func":"msg.ui_control = {\n    \"min\":-100,\n    \"max\":100, \n    \"gtype\":\"gauge\",\n    \"options\":{\n        \"gaugeColor\":\"#808080\",\n        \"pointer\":true,\n        \"levelColors\": [\"#00FF00\",\"#00FF00\",\"#00FF00\"]\n    }\n}\nif(msg.payload < 0) {\n    msg.ui_control.options.gaugeColor = \"#ff0000\";\n    msg.ui_control.options.levelColors = [\"#808080\",\"#808080\",\"#808080\"];\n}else if(msg.payload === 0){\n    msg.ui_control.options.gaugeColor = \"#808080\";\n    msg.ui_control.options.levelColors = [\"#808080\",\"#808080\",\"#808080\"];\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":2740,"wires":[["52b6d283.4a8ff4","38e75ce6.317f3c"]]},{"id":"3f8bf1b4.674f9e","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":130,"y":2740,"wires":[["7bbe61b3.327768"]]},{"id":"63673ae9.530344","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-15","payloadType":"num","x":110,"y":2800,"wires":[["7bbe61b3.327768"]]},{"id":"e90e283f.5e234","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-48","payloadType":"num","x":110,"y":2840,"wires":[["7bbe61b3.327768"]]},{"id":"f3569b41.944de8","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-100","payloadType":"num","x":130,"y":2880,"wires":[["7bbe61b3.327768"]]},{"id":"aaf2f9c0.686bb","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"55","payloadType":"num","x":130,"y":2700,"wires":[["7bbe61b3.327768"]]},{"id":"52b6d283.4a8ff4","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"ui_control","targetType":"msg","statusVal":"","statusType":"auto","x":350,"y":2580,"wires":[]},{"id":"38e75ce6.317f3c","type":"ui_gauge","z":"30af2d3e.d94ea2","name":"","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":640,"y":2740,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

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