Hey Community, this is my first post and I hope, that you can help me
For a task I want to take (battery-) data from a matlab/simulink simulation and sort and output it in the node-red dashboard via the chart node. From Matlab I get a app. 20000 x 1 Vector, the original plan was to safe the data in a database and process it from there, but one thing after another. So I safed the data in an excel .xlsx and used the alafile-in node with a timestamp (temporarily), to trigger the event. The Output is an array of objects. When I split the output 2 times, I get 20k simgle values.
Now I searched the dashboard docu for the chart node, which needs a special format for stored data:
[{
"series": ["A", "B", "C"],
"data": [
[{ "x": 1504029632890, "y": 5 },
{ "x": 1504029636001, "y": 4 },
{ "x": 1504029638656, "y": 2 }
],
[{ "x": 1504029633514, "y": 6 },
{ "x": 1504029636622, "y": 7 },
{ "x": 1504029639539, "y": 6 }
],
[{ "x": 1504029634400, "y": 7 },
{ "x": 1504029637959, "y": 7 },
{ "x": 1504029640317, "y": 7 }
]
],
"labels": [""]
}]
Can someone help me with manipulating the output with a function node, so that I get the data in this format? I'm actually not that good in javascript, but I'm currently taking a course to close that gap. I've read the javascript array docu and the working with messages docu, but I couldn't figure out how to solve it.
I've tried a node in that way:
var array =
array = array.push(msg.payload)
return msg
Thank you.