Chart -UI How to plot multiple lines?

821 views
Skip to first unread message

Tony Contrada

unread,
Jun 28, 2016, 2:19:24 PM6/28/16
to Node-RED UI
I have a single Chart-UI control and I want to plot two lines of data. The info says to use a different msg.topic for each input.
I have a Function Node before the chart node which has multiple outputs from the Function Node.
How do I set up the msg.topic in the Function Node in order to plot both data values on the same chart?

Thanks,
Tony

Juha Autioniemi

unread,
Jun 29, 2016, 1:31:34 PM6/29/16
to Node-RED UI
Hi,

You can do for example like this:

ValueToLine1 = Math.round(Math.random()*10*100)/100;
ValueToLine2 = Math.round(Math.random()*10*100)/100;

line1 = { topic: 'line1', payload: ValueToLine1 };
line2 = { topic: 'line2', payload: ValueToLine2 };
  
return [line1, line2]

Juha

Tony Contrada

unread,
Jun 29, 2016, 4:31:23 PM6/29/16
to Node-RED UI
Thanks, exactly what I needed!

I noticed that the Chart-UI control picks it's own colors for the lines. In my case a Dark Blue for Line#1 and a Light Blue for Line#2.
It would be nice to be able to specify the line colors to differentiate them better.

-Tony
Reply all
Reply to author
Forward
0 new messages