I want to create a chart that displays the date on the x-axis and max_power on the y-axis.
What function or node do i need, to transform the data in a format that can be used by a chart node?
I read a lot about about that issue i this forum and others, but i did not get the conclusion.
I use MS SQL but the output of the connection node is the same.
I Work with the function node and use the following code (translate with your variables)
How to copy data from node-red debug for posting on forum
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
How to post data/flows to the forum so that is is both readable and useable
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
If you are using @flowforge-dashboad (Dashboard 2) then you do not need to format the sql return. Except I believe the timestamp has to be unix millisecond timestamp, which of course you can have the sql request return. Chart ui-chart | Node-RED Dashboard 2.0
If you are still using the Angular node-red-dashboad then you have to use the format for data here. You can also have the sql query return the data in the [{"x":1234567891234", "y": 24.6}] format using AS key wordsyntax.