I try to get a chart with the parameters I receive via UDP. The parameters are like '16,1.23'. The first is a time, and the second, a voltage. The first should be the X axis, and the second, the Y axis
i have created this function:
dato = msg.payload.split(",");
var time = dato[0];
var voltage = dato[1];
if(time == "+++"){
time = 0;
voltage = 1;
}
var xydata=;
var dat = {x:time,y:voltage}
xydata.push(dat);
msg.payload=[{
"series": ["voltage"],
"data": [xydata],
"labels": [""]
}];
return msg;
And the debug message of each of the couples of data received is like this:
So everything seems OK in the debug, but the chart is completelly EMPTY (the '+++' is the end of the received packets). The variable 'time' comes from 0 to XXXXX, and it is and integer.
I think, my problem is that the objects are passed to the chart node as characters instead of numbers:
x: "2108"
y: "0.9959"
I store all the received datas in a csv file and when I send it to the chart node, the parameters are without "", and they are represented correctly.
How can I send the datas without the ""?
As shown you are only sending a single point to the chart, which may not be easy to see. You must either build up the complete set of points before sending it to the chart or you can, I think, send them one at a time in the format {topic:"temperature", payload:22, timestamp:1520527095000}
as described in node-red-dashboard/Charts.md at master · node-red/node-red-dashboard · GitHub. I think that works for non-time series data, but I have not tried it.
No, I am receiving a data (time,voltage) every 4 ms and I send then to the chart in the moment they are received, like this:
0,1.234
4,1.444
8,2.345
.....
2108,0.9959
.....
and so on.
Sorry, I am very new in node red and I don't know how to write in the function node what you see about
{topic:"temperature", payload:22, timestamp:1520527095000}
Is it anything like this?
msg.topic = {payload:22,timestamp:1520527095000}