Two real time series chart

i find this example.
https://flows.nodered.org/flow/36f2de38ed4bb62cf3a5e8fdc76d779e

but can some explain why?
many thanks

Explain what about it?
Unless you need to do what that flow does then it is not relevant to your problem.
What exactly are you trying to do?

@Colin , hi i want to display both real time series curve in one chart.
that is two real time curve?
i have try

var total = msg.payload.data.count;
for(var i = 0;i<=20 ; i++){
   temp.push({"x":msg.payload.data.datastreams[0].datapoints[i].at, "y":parseInt(msg.payload.data.datastreams[0].datapoints[i].value.substr(-6))/10
});
   wind.push({"x":msg.payload.data.datastreams[0].datapoints[i].at, "y":parseInt(msg.payload.data.datastreams[0].datapoints[i].value.substr(9,11))/100
});
}
msg1.topic = "A"
msg1.payload = [{
"series": ["WindSpeed"],
"data": [ temp],
"labels": [""]
}]

msg2.topic = "B"
msg2.payload = [{
"series": ["Temperature"],
"data": [ wind],
"labels": [""]
}]

return msg1,msg2;

but without success.

and this is my single real time curve with result from API

let data =[];
//for (let prop in msg.payload) {
//    data.push({"x":msg.payload.data.datastreams[1].datapoints[prop].value, "y":msg.payload[prop].at});
//}

for (var i = 0; i<total; i++){
    data.push({"x":msg.payload.data.datastreams[0].datapoints[i].at, "y":parseInt(msg.payload.data.datastreams[0].datapoints[i].value.substr(-6))/10
});
}
//payload.data.datastreams[1].datapoints[0].value


msg.data = data;
return msg;


series = [];
data = [];
data_1 = [];

labels = [];
var msg1 = {};
var msg2 = {};
series.push("Count","test","abc");
labels.push("Labels");
data.push(msg.data);
msg.payload = [{"series":series, "data":data,"labels": labels}];

//series.push("Count","test","abc");
//labels.push("Labels");
//data.push(msg2.data);
//msg2.payload = [{"series":series, "data":data,"labels": labels}];


return msg;

Read the node red docs page on Writing Functions to see how to correctly return two messages.

i have successful in sending two messgae,
by modifyingreturn [[msg1,msg2]];
however, the chart is now displaying only the chart on ONLY last msg,

but not both
any more hints , thanks

You don't need to send two separated messages. You have data for two series.
Do following

msg.payload = [{
"series": ["WindSpeed","Temperature"],
"data": [ wind,temp],
"labels": [""]
}]

thanks~
it works well

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