Chart with multiple lines

Hello everyone,
I’m trying to show two graphs on one chart with data extracted from sqlite, it’s working with only one graph, but when I try to show both, nothing is showing! Any help

Untitled Untitled1

Welcome to the forum

Try using different topics for each graph.

i tried, it shows only the first line

Are you trying to draw lines in real time or are you trying to fill a chart with historical data?
If real time then all you need to is send messages with the value in the payload and the line label in the topic. So you might send these messages in sequence, with time gaps in between each pair

{topic: "line1", payload: 2}
{topic: "line2", payload: 7}

{topic: "line1", payload: 3}
{topic: "line2", payload: 7}

and it will draw the lines. In fact you don't even need to send them in pairs.

If you are trying to send historical data then you must send all the data for both lines in one message with the complete set of data series as described in the docs.

Note also that the line at the end of your function
return [msg1,msg2]
will send msg1 to output 1 and msg2 to output 2. If you want to send them both to output 1 then you need
return [[msg1,msg2]]
as described in the docs Writing Functions.

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