Chart Dashboard 2.0

I am trying to plot a chart using MySQL data in dashboard 2.0 but it is not working. while it is working on the chart of old node-red-dashboard.
Please see the flow.
flows (2).json (49.7 KB)

Dashboard 2.0 is not backward compatible.

One of the joys, and big changes we made for of Dashboard 2.0, is that you don't need to separate and pre-format your data.

Instead of having multiple arrays, all duplicating data as you have it currently, you can just use the output from SQL directly, and have a single array containing the relevant data in each object, e.g:

[{
    "DateTime": "2024-06-17 14:23:24"
    "Carbon Monoxide": 1
    "Oxygen": 20,
    "Light Intensity": 134,
    "Temperature": 29.3,
    "Humidity": 45
}, 
...]

Then, on the options of your chart, choose series type to be "JSON", and define each of your series there:

You can read more about this property here: Chart ui-chart | Node-RED Dashboard 2.0

flows (1).json (3.9 KB)
I tried as you said but it's not working, please see my flow and correct me.

Feed the data into a debug node and show us what you are sending the node. Also show us how you have configured it.

NODE-RED

This is not valid date

image

I corrected the time, but it is still not working.

True. Chart node doesn't take this time format. 2024-06-17T13:21:33 does work. Also if to parse it for example with Date.parse("2024-06-17 13:21:33") it works. But not directly with the format you have. May be a bug. Maybe not.

1 Like

n3
I corrected the time, but it is still not working.

Send an empty array to clear the chart before send new data.

flows (2).json (4.5 KB)
Please see the flow, I also send empty array, but it doesn't work.

Make this change also

1 Like

Your kind support is greatly appreciated. Finally, it is working.

1 Like

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