Chart color setting

Hi
I haven't been here for a long time. Everything on my system was working fine, and I had little time to devote to Node-RED.
When I had to make a change to the system, I realized that I was very (really very) behind and had to update everything from scratch.
Now everything works well enough, but with the new dashboard I have a problem that I can't fix despite having looked around for a possible solution.
How can I set the color of the line relating to the data for a specific topic to be fixed? Since I have multiple lines on the graph and I can't determine the order in which the data will arrive, how can I set this property? I would like hot water to be red and cold water to be blue, as I think is normal :slight_smile:
Thanks in advance.

I believe the colours are allocated according to the topic of messages received.

The first topic the chart sees gets the first colour defined in the config, the second gets the next, etc.

So if the first colour block in your config is red, you need to ensure that the first message the chart sees is for hot water.

Do you mean that it is no longer possible to set the color of the function with a property or with a specific action?
This is a step backward compared to the previous interface.

Are you saying that with the original dashboard it was possible to set the colour of the function with a property or with a specific action?

Perhaps you can post an example flow that does that?

I tried to recover the data from the old installation, but I'm encountering some problems. The image of the SD card I had made fails to mount.
I'm not entirely sure how I solved the problem back then, but I seem to remember sending a property with the data message, but that's just a guess. Keep in mind that the system was set up in early 2019 and then left untouched in that part. The Node-RED version was 0.9.x or maybe 1.x, and the interface was the UI, not the dashboard. I never updated anything until it was absolutely necessary.
I'll try again to recover the old data, and I hope I can do it.

I dare say we can help you get the new dashboard working if you share some sample data, your DB2 flow and a clear explanation of what it's not doing right.

At the moment you have to use the same technique as on the old dashboard. On startup send the node a message with a value of null for each series. That will define the colours.

If I can just get it fully working then you will be able to do this using msg.ui_update to set the chart options. This was introduced in v1.30.0 but there are a couple of issues still when you try to set the line colour. I am working on that at the moment.

1 Like

Thank you.
At the moment, everything is working well. The only problem (which is not so dramatic) is that sometimes after restarting, the boiler graphs showing the flow and return temperatures have colors that are not consistent with common sense. It's not worth making things too complicated, and I'm also considering putting a fixed dashboard somewhere, but that's still to be decided.
@Colin
I'm glad the issue is being addressed.

Anyway here the code of that flows

[{"id":"cca10742.5ba11","type":"inject","z":"86adfe0daa76ac95","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"900","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":163,"y":156,"wires":[["92a50e1e.a3adb"]]},{"id":"92a50e1e.a3adb","type":"http request","z":"86adfe0daa76ac95","name":"","method":"GET","ret":"txt","url":"http://192.168.1.211:80","tls":"","x":223,"y":256,"wires":[["2ab0705c.2adcf","ac1c7e4c.0fcb48","4d40890b.9cda08","496975f3.8ae23c"]]},{"id":"2ab0705c.2adcf","type":"string","z":"86adfe0daa76ac95","name":"","methods":[{"name":"between","params":[{"type":"str","value":"ml>"},{"type":"str","value":"<br"}]},{"name":"right","params":[{"type":"num","value":"39"}]},{"name":"replaceAll","params":[{"type":"str","value":"temp A"},{"type":"str","value":"Mandata"}]},{"name":"replaceAll","params":[{"type":"str","value":"temp B"},{"type":"str","value":"Ritorno"}]},{"name":"replaceAll","params":[{"type":"str","value":"temp C"},{"type":"str","value":"Estarna"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":403,"y":156,"wires":[["9b0bc3d0.922fc"]]},{"id":"a0018dc2.a890e","type":"file","z":"86adfe0daa76ac95","name":"","filename":"/home/mauro/logs/log_cald.txt","filenameType":"str","appendNewline":true,"createDir":true,"overwriteFile":"false","x":813,"y":156,"wires":[[]]},{"id":"ac1c7e4c.0fcb48","type":"string","z":"86adfe0daa76ac95","name":"","methods":[{"name":"between","params":[{"type":"str","value":"temp A"},{"type":"str","value":"temp B"}]}],"prop":"payload","propout":"t1","object":"msg","objectout":"msg","x":223,"y":356,"wires":[["d624d62b.1202b","d1a93d98.89c5d8"]]},{"id":"d624d62b.1202b","type":"string","z":"86adfe0daa76ac95","name":"","methods":[{"name":"between","params":[{"type":"str","value":"temp B"},{"type":"str","value":"temp C"}]}],"prop":"payload","propout":"t2","object":"msg","objectout":"msg","x":223,"y":456,"wires":[["6387613b.712f28","1f80d224.2d80ce"]]},{"id":"6387613b.712f28","type":"string","z":"86adfe0daa76ac95","name":"","methods":[{"name":"between","params":[{"type":"str","value":"temp C"},{"type":"str","value":"<"}]}],"prop":"payload","propout":"t3","object":"msg","objectout":"msg","x":223,"y":556,"wires":[["42b9bb53.0bc93c","38dad0be.e6431"]]},{"id":"42b9bb53.0bc93c","type":"template","z":"86adfe0daa76ac95","name":"set post","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":" ","output":"str","x":413,"y":642,"wires":[["67b4586c.0d92b"]]},{"id":"67b4586c.0d92b","type":"http request","z":"86adfe0daa76ac95","name":"","method":"GET","ret":"txt","url":"","x":591,"y":641.25,"wires":[[]]},{"id":"ffba6426.7c2a8","type":"e-mail","z":"86adfe0daa76ac95","server":".com","port":"465","secure":true,"name":" ","dname":"Home system","x":873,"y":296,"wires":[]},{"id":"d1a93d98.89c5d8","type":"function","z":"86adfe0daa76ac95","name":"custom function","func":"// declare place holder variables\nvar originalval = msg.t1;\nvar temp = \"\";\n\n\n// convert string of originalval to float with 1 decimal place\n// run originalval thru a simple minus operation to form the 'temp' number\ntemp = parseFloat(originalval).toFixed(1);\n\n// output the originalval after deduction \nmsg.payload = temp;\nmsg.topic = 'mandata';\n\nreturn msg;","outputs":1,"noerr":0,"x":413,"y":356,"wires":[["3fe5f1b9.2ab59e","57a1f2c9.315504","a10195db.346ca8","597cf3e37675401e","8f4632ac3e090244"]]},{"id":"1f80d224.2d80ce","type":"function","z":"86adfe0daa76ac95","name":"custom function","func":"// declare place holder variables\nvar originalval = msg.t2;\nvar temp = \"\";\n\n\n// convert string of originalval to float with 1 decimal place\n// run originalval thru a simple minus operation to form the 'temp' number\ntemp = parseFloat(originalval).toFixed(1);\n\n// output the originalval after deduction \nmsg.payload = temp;\nmsg.topic = 'ritorno';\n\nreturn msg;","outputs":1,"noerr":0,"x":413,"y":456,"wires":[["8f4632ac3e090244","8f94e6c3a3cc483a"]]},{"id":"9b0bc3d0.922fc","type":"function","z":"86adfe0daa76ac95","name":"set string","func":"msg.payload = msg.payload + \",\" + \nnew Date().toString();\nreturn msg;","outputs":1,"noerr":0,"x":553,"y":156,"wires":[["a0018dc2.a890e"]]},{"id":"3fe5f1b9.2ab59e","type":"switch","z":"86adfe0daa76ac95","name":"Allarm. oltre 80","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"80","vt":"num"}],"checkall":"true","outputs":1,"x":640,"y":260,"wires":[["ffba6426.7c2a8","7f76eeee.c23e"]]},{"id":"38dad0be.e6431","type":"function","z":"86adfe0daa76ac95","name":"to float","func":"var temp = \"\";\ntemp = parseFloat(msg.t3).toFixed(1);\nmsg.payload = temp;\nreturn msg;","outputs":1,"noerr":0,"x":416,"y":547,"wires":[["9366fe5b.3f8a1","1e11aa61.ac1a4e","ebe70fc0.a5df58","20ccd4e4dd1f53d7","2d711f7d287fd057"]]},{"id":"57a1f2c9.315504","type":"function","z":"86adfe0daa76ac95","name":"delta2","func":"var oldval = context.get('oldval')||0;\nvar dire = context.get('dire')||0;\nvar difval = msg.payload - oldval;\ncontext.set('oldval',msg.payload);\nmsg.t1 = difval;\nif (msg.payload > 60)\n{\n    if (difval>0 && dire<0)\n        {msg.payload = \"sale\";}\n    else \n        {\n            if (difval<0 && dire>0)\n                {msg.payload =\"scende\";}\n            else {msg.payload = \"notdef\";}\n        }\n}\nif (difval>0) { context.set('dire',1); }\nif (difval<0) { context.set('dire',-1); }\nreturn msg;\n","outputs":1,"noerr":0,"x":623,"y":356,"wires":[["15b9187d.aeef78"]]},{"id":"15b9187d.aeef78","type":"function","z":"86adfe0daa76ac95","name":"set message","func":"if (msg.payload == \"sale\" || msg.payload == \"scende\")\n    {\n        msg.payload = {\n            content : msg.payload,\n            chatId : 507724391,\n            type : \"message\"\n        }\n    }\nelse { msg.payload = \"\"; }\nreturn msg;","outputs":1,"noerr":0,"x":799.25,"y":356.7499694824219,"wires":[["1d5fda7b.8d7dae"]]},{"id":"51639e6d.7443f","type":"telegram sender","z":"86adfe0daa76ac95","name":"allarmi","bot":"c382e8cb.3ba0b","outputs":1,"x":1235,"y":285,"wires":[[]]},{"id":"7f76eeee.c23e","type":"function","z":"86adfe0daa76ac95","name":"set message","func":"msg.payload = {\n    content : msg.payload,\n    chatId : 507724391,\n    type : \"message\"\n    }\nreturn msg;","outputs":1,"noerr":0,"x":930,"y":220,"wires":[["51639e6d.7443f"]]},{"id":"67c0da6b.390f94","type":"inject","z":"86adfe0daa76ac95","name":"","repeat":"","crontab":"","once":false,"topic":"oltre","payload":"81","payloadType":"num","x":413,"y":274,"wires":[["3fe5f1b9.2ab59e"]]},{"id":"1d5fda7b.8d7dae","type":"switch","z":"86adfe0daa76ac95","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"str"}],"checkall":"true","outputs":1,"x":949.375,"y":357,"wires":[["51639e6d.7443f"]]},{"id":"d401aa45.d57ef","type":"status","z":"86adfe0daa76ac95","name":"","scope":["67b4586c.0d92b"],"x":563.125,"y":695.75,"wires":[["96089d75.b80908"]]},{"id":"96089d75.b80908","type":"debug","z":"86adfe0daa76ac95","name":"","active":false,"console":"false","complete":"true","x":744.375,"y":695.75,"wires":[]},{"id":"9675fbed.4231f","type":"switch","z":"86adfe0daa76ac95","name":"Allarm. gela","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"0.5","vt":"num"}],"checkall":"true","outputs":1,"x":947,"y":572,"wires":[["bc39f221.d705d8","f2485022.6009b8","fe47e4f1.e71138"]]},{"id":"bc39f221.d705d8","type":"function","z":"86adfe0daa76ac95","name":"set message","func":"msg.payload = {\n    content : \"gela!\",\n    chatId : 507724391,\n    type : \"message\"\n    }\nreturn msg;","outputs":1,"noerr":0,"x":1119,"y":417,"wires":[["51639e6d.7443f"]]},{"id":"9366fe5b.3f8a1","type":"gate","z":"86adfe0daa76ac95","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":790.5,"y":573,"wires":[["9675fbed.4231f"]]},{"id":"f2485022.6009b8","type":"change","z":"86adfe0daa76ac95","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":795.5,"y":648,"wires":[["9366fe5b.3f8a1","fe47e4f1.e71138"]]},{"id":"1e11aa61.ac1a4e","type":"switch","z":"86adfe0daa76ac95","name":"reset","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"3","vt":"num"}],"checkall":"true","outputs":1,"x":772,"y":512,"wires":[["d296532f.bbe89"]]},{"id":"d296532f.bbe89","type":"change","z":"86adfe0daa76ac95","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":905,"y":511,"wires":[["9366fe5b.3f8a1"]]},{"id":"fe47e4f1.e71138","type":"debug","z":"86adfe0daa76ac95","name":"","active":false,"console":"false","complete":"false","x":1119.5,"y":647,"wires":[]},{"id":"a10195db.346ca8","type":"link out","z":"86adfe0daa76ac95","name":"mand","links":[],"x":798.5,"y":418,"wires":[]},{"id":"ebe70fc0.a5df58","type":"link out","z":"86adfe0daa76ac95","name":"est","links":[],"x":864.5,"y":747,"wires":[]},{"id":"4d40890b.9cda08","type":"debug","z":"86adfe0daa76ac95","name":"","active":false,"console":"false","complete":"false","x":438.5,"y":215,"wires":[]},{"id":"496975f3.8ae23c","type":"stoptimer","z":"86adfe0daa76ac95","duration":"30","units":"Minute","payloadtype":"num","payloadval":"0","name":"manca il segnale","x":445,"y":92,"wires":[["bd57e155.8cfab"],[]]},{"id":"b75ae037.309528","type":"function","z":"86adfe0daa76ac95","name":"set message","func":"msg.payload = {\n    content : msg.payload,\n    chatId : 507724391,\n    type : \"message\"\n    }\nreturn msg;","outputs":1,"noerr":0,"x":905,"y":92,"wires":[["51639e6d.7443f"]]},{"id":"bd57e155.8cfab","type":"change","z":"86adfe0daa76ac95","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"manca il segnale","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":675,"y":92,"wires":[["b75ae037.309528"]]},{"id":"597cf3e37675401e","type":"ui-gauge","z":"86adfe0daa76ac95","name":"","group":"db12b1d9a3c57ce9","order":0,"value":"payload","valueType":"msg","width":3,"height":3,"gtype":"gauge-half","gstyle":"needle","title":"Mandata","alwaysShowTitle":false,"floatingTitlePosition":"top-left","units":"C°","icon":"","prefix":"","suffix":"","segments":[{"from":"0","color":"#5cd65c","text":"","textType":"label"},{"from":"45","color":"#ffc800","text":"","textType":"label"},{"from":"60","color":"#ea5353","text":"","textType":"label"}],"min":0,"max":"100","sizeThickness":16,"sizeGap":4,"sizeKeyThickness":8,"styleRounded":true,"styleGlow":false,"className":"","x":633,"y":316,"wires":[[]]},{"id":"8f4632ac3e090244","type":"ui-chart","z":"86adfe0daa76ac95","group":"db12b1d9a3c57ce9","name":"","label":"caldaia","order":9007199254740991,"chartType":"line","category":"topic","categoryType":"msg","xAxisLabel":"","xAxisProperty":"","xAxisPropertyType":"timestamp","xAxisType":"time","xAxisFormat":"","xAxisFormatType":"auto","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"15","ymax":"90","bins":10,"action":"append","stackSeries":false,"pointShape":"circle","pointRadius":"2","showLegend":true,"removeOlder":"24","removeOlderUnit":"3600","removeOlderPoints":"","colors":["#ed333b","#3584e4","#ff7f0e","#2ca02c","#a347e1","#d62728","#ff9896","#9467bd","#c5b0d5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":"9","height":"6","className":"","interpolation":"linear","x":633,"y":416,"wires":[[]]},{"id":"20ccd4e4dd1f53d7","type":"ui-chart","z":"86adfe0daa76ac95","group":"db12b1d9a3c57ce9","name":"","label":"Esterna","order":9007199254740991,"chartType":"line","category":"topic","categoryType":"msg","xAxisLabel":"","xAxisProperty":"","xAxisPropertyType":"timestamp","xAxisType":"time","xAxisFormat":"","xAxisFormatType":"auto","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"","ymax":"","bins":10,"action":"append","stackSeries":false,"pointShape":"false","pointRadius":4,"showLegend":true,"removeOlder":"24","removeOlderUnit":"3600","removeOlderPoints":"","colors":["#0095ff","#ff0000","#ff7f0e","#2ca02c","#a347e1","#d62728","#ff9896","#9467bd","#c5b0d5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":6,"height":8,"className":"","interpolation":"linear","x":613,"y":496,"wires":[[]]},{"id":"2d711f7d287fd057","type":"ui-gauge","z":"86adfe0daa76ac95","name":"","group":"db12b1d9a3c57ce9","order":0,"value":"payload","valueType":"msg","width":3,"height":3,"gtype":"gauge-half","gstyle":"needle","title":"Esterna Nord","alwaysShowTitle":false,"floatingTitlePosition":"top-left","units":"C°","icon":"","prefix":"","suffix":"","segments":[{"from":"-10","color":"#5cd65c","text":"","textType":"label"},{"from":"10","color":"#ffc800","text":"","textType":"label"},{"from":"20","color":"#ea5353","text":"","textType":"label"}],"min":"-10","max":"30","sizeThickness":16,"sizeGap":4,"sizeKeyThickness":8,"styleRounded":true,"styleGlow":false,"className":"","x":603,"y":596,"wires":[[]]},{"id":"8f94e6c3a3cc483a","type":"ui-gauge","z":"86adfe0daa76ac95","name":"","group":"db12b1d9a3c57ce9","order":0,"value":"payload","valueType":"msg","width":3,"height":3,"gtype":"gauge-half","gstyle":"needle","title":"Ritorno","alwaysShowTitle":false,"floatingTitlePosition":"top-left","units":"C°","icon":"","prefix":"","suffix":"","segments":[{"from":"0","color":"#5cd65c","text":"","textType":"label"},{"from":"45","color":"#ffc800","text":"","textType":"label"},{"from":"60","color":"#ea5353","text":"","textType":"label"}],"min":0,"max":"100","sizeThickness":16,"sizeGap":4,"sizeKeyThickness":8,"styleRounded":true,"styleGlow":false,"className":"","x":633,"y":456,"wires":[[]]},{"id":"c382e8cb.3ba0b","type":"telegram bot","botname":" ","usernames":" ","chatids":"","baseapiurl":"","testenvironment":false,"pollinterval":"","usesocks":false,"sockshost":"","socksport":"","socksusername":"","sockspassword":"","bothost":"","botpath":"","localbothost":"","localbotport":"","publicbotport":"","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false},{"id":"db12b1d9a3c57ce9","type":"ui-group","name":"caldaia","page":"4d5116c6b639e03e","width":"9","height":1,"order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"4d5116c6b639e03e","type":"ui-page","name":"Home","ui":"af30e1f160d6cbe8","path":"/page1","icon":"home","layout":"grid","theme":"f4a146d1b21f88e8","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":true,"disabled":false},{"id":"af30e1f160d6cbe8","type":"ui-base","name":"My Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":true},{"id":"f4a146d1b21f88e8","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}},{"id":"79a990c09c134096","type":"global-config","env":[],"modules":{"node-red-contrib-string":"1.0.0","node-red-node-email":"3.1.0","node-red-contrib-telegrambot":"16.3.2","node-red-contrib-simple-gate":"0.5.2","node-red-contrib-stoptimer":"0.0.7","@flowfuse/node-red-dashboard":"1.26.0"}}]

Sorry, bad formatted :slightly_frowning_face:

Edit it, cut, click </> button & paste.