Multiple lines on a graph from one message?

My flow displays temperature, pressure and humidity from my BME280 sensor, compared with local data from OpenWeatherMap.
I have a function node to send 11 seperate messages to 4 graphs on the dashboard. Is this the right way to do it? It seems very unwieldy. It would be nice to send one message per graph.


ps There are 3 lines on each of the top graphs, one of them (a rolling mean) is pretty much hidden under another line.

Probably 4 outputs would be enough. One for each chart. Charts do have logic that every line color is connected to the one topic so thing you'll need to do in your function is keep track of source data, ensure that topic is correct and direct it to the desired output.

In your multiple data series function node, you could build the messages and use node.send

var msg1 = {
  payload : 1,
  topic : "Series 1"
}

var msg2 = {
  payload : 2,
  topic : "Series 2"
}

node.send([[msg1,msg2]]);

Thanks for your replies.

Possibly I'm failing to grasp hotNipi's point; I conclude that I do need a discrete message for each line on the chart.

1 Like

I suppose we are talking about live charting.

The data is just a number. The origin of the data is different. You have 3 data sources. Local data, OpenWeatherMap data and computed data (mean). They all are meant to end in one chart.

Chart differs data origin by msg.topic So if you can figure out the origin of the data in you function node before chart node, you can modify the topic of the message before sending it to the chart.

Even if you have to deal with your data all together for one chart, you can send it out from one output.

var msg1 = { payload:"first out of output 1", topic:"msg_1_topic" };
var msg2 = { payload:"second out of output 1" , topic:"msg_2_topic"};
var msg3 = { payload:"third out of output 1" , topic:"msg_3_topic"};
return [[ msg1, msg2, msg3 ]];

Messages will be sent out one by one, not all together. So there is no need to send them together, same way you can send them out one by one. Just the topic must be ensured to be correct.

2 Likes

@deekshaha have same question with you,
did you figure out how to solve the problem?
thanks

@deekshaha and @apex rather than adding to an ancient thread then please start a new thread. Add a debug node showing what is going into the chart and post what that shows.