Hello all,
I am using ui-chart to show data from a sql database and have some trouble getting this done. I have removed all the database details in the attached flow, only showing examples of the database output in the funcition or inject nodes.
#1
I am pushing 7 datapoints (see attached flow, one per day) to the chart node. Only the first series is completely shown all others are missing the last day.
#2
In another example I am trying to show only one series. The x-axis is taken from the incoming data but nothing (no line) is shown.
#3
The starting datapoint is the 20th of August (UTC+2) but shown as 21st of August. Is it possible to configure/optimize the grid layout? Do I need to add the timezone?
I have added a debug node to the output of ui-chart. The _datapoint array seems to be correct.
Any suggestions?
Testsystem: (new installation)
Node-RED v4.0.2
Node.js v20.17.0
Linux 6.6.31+rpt-rpi-v8 arm64 LE
[ui-base:My Dashboard] Node-RED Dashboard 2.0 (v1.15.0)
[{"id":"5204436492f582f2","type":"tab","label":"Chart","disabled":false,"info":"","env":[]},{"id":"6c6753a1a966dd85","type":"junction","z":"5204436492f582f2","x":740,"y":180,"wires":[["cc9e641808892939"]]},{"id":"cc9e641808892939","type":"ui-chart","z":"5204436492f582f2","group":"3fd5e9376eed9c3c","name":"test-cart","label":"chart","order":5,"chartType":"line","category":"anzeige","categoryType":"msg","xAxisLabel":"","xAxisProperty":"TIMESTAMP","xAxisPropertyType":"property","xAxisType":"time","xAxisFormat":"","xAxisFormatType":"d/L","yAxisLabel":"","yAxisProperty":"","ymin":"","ymax":"","action":"replace","stackSeries":false,"pointShape":"false","pointRadius":4,"showLegend":true,"removeOlder":1,"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":"","x":920,"y":180,"wires":[["a3b05a97e5a712e5"]]},{"id":"b6803adcdc0cfee3","type":"inject","z":"5204436492f582f2","name":"4 series","props":[{"p":"payload"},{"p":"anzeige","v":"[\"H_Energie_heute\",\"M_Energie_exported_heute\",\"klima_heute\",\"solar_heute\"]","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"TIMESTAMP\":1724709300008,\"H_Energie_heute\":14.7,\"M_Energie_exported_heute\":38.3,\"klima_heute\":0.8,\"solar_heute\":45.981},{\"TIMESTAMP\":1724622900004,\"H_Energie_heute\":6.4,\"M_Energie_exported_heute\":38,\"klima_heute\":0,\"solar_heute\":37.685},{\"TIMESTAMP\":1724536513650,\"H_Energie_heute\":24.3,\"M_Energie_exported_heute\":33.1,\"klima_heute\":7.3,\"solar_heute\":51.355},{\"TIMESTAMP\":1724450100022,\"H_Energie_heute\":10.5,\"M_Energie_exported_heute\":31.6,\"klima_heute\":0.1,\"solar_heute\":34.468},{\"TIMESTAMP\":1724363700004,\"H_Energie_heute\":30.2,\"M_Energie_exported_heute\":24.9,\"klima_heute\":0.1,\"solar_heute\":48.472},{\"TIMESTAMP\":1724277300004,\"H_Energie_heute\":8.9,\"M_Energie_exported_heute\":28.7,\"klima_heute\":0.5,\"solar_heute\":22.477},{\"TIMESTAMP\":1724190900004,\"H_Energie_heute\":7.2,\"M_Energie_exported_heute\":40,\"klima_heute\":0.9,\"solar_heute\":40.723}]","payloadType":"json","x":410,"y":220,"wires":[["6c6753a1a966dd85"]]},{"id":"e7b864207df09ff3","type":"inject","z":"5204436492f582f2","name":"1 series","props":[{"p":"payload"},{"p":"anzeige","v":"[\"H_Energie_heute\"]","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"TIMESTAMP\":1724709300008,\"H_Energie_heute\":14.7,\"M_Energie_exported_heute\":38.3,\"klima_heute\":0.8,\"solar_heute\":45.981},{\"TIMESTAMP\":1724622900004,\"H_Energie_heute\":6.4,\"M_Energie_exported_heute\":38,\"klima_heute\":0,\"solar_heute\":37.685},{\"TIMESTAMP\":1724536513650,\"H_Energie_heute\":24.3,\"M_Energie_exported_heute\":33.1,\"klima_heute\":7.3,\"solar_heute\":51.355},{\"TIMESTAMP\":1724450100022,\"H_Energie_heute\":10.5,\"M_Energie_exported_heute\":31.6,\"klima_heute\":0.1,\"solar_heute\":34.468},{\"TIMESTAMP\":1724363700004,\"H_Energie_heute\":30.2,\"M_Energie_exported_heute\":24.9,\"klima_heute\":0.1,\"solar_heute\":48.472},{\"TIMESTAMP\":1724277300004,\"H_Energie_heute\":8.9,\"M_Energie_exported_heute\":28.7,\"klima_heute\":0.5,\"solar_heute\":22.477},{\"TIMESTAMP\":1724190900004,\"H_Energie_heute\":7.2,\"M_Energie_exported_heute\":40,\"klima_heute\":0.9,\"solar_heute\":40.723}]","payloadType":"json","x":410,"y":140,"wires":[["6c6753a1a966dd85"]]},{"id":"95cdfa884c46f6e8","type":"inject","z":"5204436492f582f2","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":410,"y":80,"wires":[["6c6753a1a966dd85"]]},{"id":"a3b05a97e5a712e5","type":"debug","z":"5204436492f582f2","name":"debug test-chart","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1180,"y":180,"wires":[]},{"id":"9bdd4c8120ebaea1","type":"function","z":"5204436492f582f2","name":"4-series","func":"msg.payload = [\n {\n \"TIMESTAMP\": 1724709300008,\n \"H_Energie_heute\": 14.7,\n \"M_Energie_exported_heute\": 38.3,\n \"klima_heute\": 0.8,\n \"solar_heute\": 45.981\n },\n {\n \"TIMESTAMP\": 1724622900004,\n \"H_Energie_heute\": 6.4,\n \"M_Energie_exported_heute\": 38,\n \"klima_heute\": 0,\n \"solar_heute\": 37.685\n },\n {\n \"TIMESTAMP\": 1724536513650,\n \"H_Energie_heute\": 24.3,\n \"M_Energie_exported_heute\": 33.1,\n \"klima_heute\": 7.3,\n \"solar_heute\": 51.355\n },\n {\n \"TIMESTAMP\": 1724450100022,\n \"H_Energie_heute\": 10.5,\n \"M_Energie_exported_heute\": 31.6,\n \"klima_heute\": 0.1,\n \"solar_heute\": 34.468\n },\n {\n \"TIMESTAMP\": 1724363700004,\n \"H_Energie_heute\": 30.2,\n \"M_Energie_exported_heute\": 24.9,\n \"klima_heute\": 0.1,\n \"solar_heute\": 48.472\n },\n {\n \"TIMESTAMP\": 1724277300004,\n \"H_Energie_heute\": 8.9,\n \"M_Energie_exported_heute\": 28.7,\n \"klima_heute\": 0.5,\n \"solar_heute\": 22.477\n },\n {\n \"TIMESTAMP\": 1724190900004,\n \"H_Energie_heute\": 7.2,\n \"M_Energie_exported_heute\": 40,\n \"klima_heute\": 0.9,\n \"solar_heute\": 40.723\n }\n];\nmsg.anzeige = [\n \"H_Energie_heute\",\n \"M_Energie_exported_heute\",\n \"klima_heute\",\n \"solar_heute\"\n];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":540,"wires":[["6c6753a1a966dd85"]]},{"id":"f6a58dcacc3ecb7a","type":"ui-button","z":"5204436492f582f2","group":"3fd5e9376eed9c3c","name":"clear","label":"clear","order":1,"width":"2","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","x":350,"y":360,"wires":[["c5f8cceae3d50893"]]},{"id":"c00b36747aeda0bc","type":"ui-button","z":"5204436492f582f2","group":"3fd5e9376eed9c3c","name":"4-series","label":"4-series","order":4,"width":"2","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","x":340,"y":540,"wires":[["9bdd4c8120ebaea1"]]},{"id":"5fccc8dc522a30d0","type":"ui-button","z":"5204436492f582f2","group":"3fd5e9376eed9c3c","name":"1-serie","label":"1-serie","order":2,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","x":350,"y":420,"wires":[["e3de3ca9be564a8e"]]},{"id":"e3de3ca9be564a8e","type":"function","z":"5204436492f582f2","name":"1-serie","func":"msg.payload = [\n {\n \"TIMESTAMP\": 1724709300008,\n \"H_Energie_heute\": 14.7,\n \"M_Energie_exported_heute\": 38.3,\n \"klima_heute\": 0.8,\n \"solar_heute\": 45.981\n },\n {\n \"TIMESTAMP\": 1724622900004,\n \"H_Energie_heute\": 6.4,\n \"M_Energie_exported_heute\": 38,\n \"klima_heute\": 0,\n \"solar_heute\": 37.685\n },\n {\n \"TIMESTAMP\": 1724536513650,\n \"H_Energie_heute\": 24.3,\n \"M_Energie_exported_heute\": 33.1,\n \"klima_heute\": 7.3,\n \"solar_heute\": 51.355\n },\n {\n \"TIMESTAMP\": 1724450100022,\n \"H_Energie_heute\": 10.5,\n \"M_Energie_exported_heute\": 31.6,\n \"klima_heute\": 0.1,\n \"solar_heute\": 34.468\n },\n {\n \"TIMESTAMP\": 1724363700004,\n \"H_Energie_heute\": 30.2,\n \"M_Energie_exported_heute\": 24.9,\n \"klima_heute\": 0.1,\n \"solar_heute\": 48.472\n },\n {\n \"TIMESTAMP\": 1724277300004,\n \"H_Energie_heute\": 8.9,\n \"M_Energie_exported_heute\": 28.7,\n \"klima_heute\": 0.5,\n \"solar_heute\": 22.477\n },\n {\n \"TIMESTAMP\": 1724190900004,\n \"H_Energie_heute\": 7.2,\n \"M_Energie_exported_heute\": 40,\n \"klima_heute\": 0.9,\n \"solar_heute\": 40.723\n }\n];\nmsg.anzeige = [\n \"H_Energie_heute\"\n];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":420,"wires":[["6c6753a1a966dd85"]]},{"id":"c5f8cceae3d50893","type":"function","z":"5204436492f582f2","name":"1-serie","func":"msg.payload = [];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":360,"wires":[["6c6753a1a966dd85"]]},{"id":"b52205323f50ca38","type":"function","z":"5204436492f582f2","name":"1-serie reduced","func":"msg.payload = [\n {\n \"TIMESTAMP\": 1724709300008,\n \"H_Energie_heute\": 14.7,\n },\n {\n \"TIMESTAMP\": 1724622900004,\n \"H_Energie_heute\": 6.4,\n },\n {\n \"TIMESTAMP\": 1724536513650,\n \"H_Energie_heute\": 24.3,\n },\n {\n \"TIMESTAMP\": 1724450100022,\n \"H_Energie_heute\": 10.5,\n },\n {\n \"TIMESTAMP\": 1724363700004,\n \"H_Energie_heute\": 30.2,\n },\n {\n \"TIMESTAMP\": 1724277300004,\n \"H_Energie_heute\": 8.9,\n },\n {\n \"TIMESTAMP\": 1724190900004,\n \"H_Energie_heute\": 7.2,\n }\n];\nmsg.anzeige = [\n \"H_Energie_heute\"\n];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":480,"wires":[["6c6753a1a966dd85"]]},{"id":"225643c3fc9363d3","type":"ui-button","z":"5204436492f582f2","group":"3fd5e9376eed9c3c","name":"1-serie red","label":"1-serie red","order":3,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","x":350,"y":480,"wires":[["b52205323f50ca38"]]},{"id":"3fd5e9376eed9c3c","type":"ui-group","name":"My Group Chart","page":"5535507f2a417138","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"5535507f2a417138","type":"ui-page","name":"Chart","ui":"05ce572236e22194","path":"/chart","icon":"home","layout":"notebook","theme":"d105f4c6080b1e98","order":1,"className":"","visible":"true","disabled":"false"},{"id":"05ce572236e22194","type":"ui-base","name":"My Dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"showPageTitle":true,"navigationStyle":"default","titleBarStyle":"default"},{"id":"d105f4c6080b1e98","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"}}]
Best regards Michael
PS. please be patient, it's my first post....