Chart line colours

(Sorry, I've read a couple of suggestions, but I am still not getting it.)

I have a chart and I am feeding 2 data sets into it.

I get that they have to have different topics so the chart shows them correctly.

But where I am sticking is where/how to set the colours?

If it is one series, sure there is the colour selection thing in the chart box.

But 2 series? There isn't a second/third/etc colour selector.

I've tried setting msg.color to a value, but that doesn't seem to be working.

Thanks in advance.


For the sake of anyone who is also stuck and want to know how to set colours on a chart with multiple lines.

When you open the CHART icon and scroll down to the colour selection section.

The colour/s for the sets of data are:
From top left to the right, then down to the next row, left to right.

So, if you have ONE set of data, it will use the top right colour.
If you have TWO sets of data, set #1 will use the top right colour, the set #2 will use the next colour which is to the right of that first colour.

I have only two sets. If you have three sets of data, the third set will use the top right colour.

I have seen a lot of people stuck on this problem.

I hope this helps others.

See attached picture to show the colour selection order.

The red numbers are the number for which set of data.

1 Like

You also also set the colors using a
msg.ui_control = {"colors":['#FF0000', '#00FF00', '#0000FF', '#000000', '#000000', '#000000', '#000000', '#000000', '#000000']};
right before the final
return msg;
in any object in front of the chart node.
Example would turn first 3 attached sources into red, green, blue .....
And as long as you ensure the order of the msgs being served all remains pretty static.
Though it doesn't work straight out of the box since it does require an update on the displayed webpage after such a change. Means if the flow gets started by an injection most times nothing happens until the next inject does take place of if you simply press the update button on the displaying browserpage.


Isn't that 'top left colour' etc?


I stand corrected.

Sorry: left/right. I easily get them confused.

Luckily now while driving though.

Node-RED version: v1.0.1
Node.js version: v10.16.3
Dashboard version 2.17.0 started at /ui

I'm sending msg={topic:'RH',payload:45}; to a single line chart. The color of the line (payload) is now determined by the top middle box color.

Here's a dump of the saved output:


...looks like the color array is determined by the series, which would explain why, in this case, "series[0]" is "". and series[1] maps to colors[1] which is the payload.


Left, right.... Yeah. Sorry. My bad.

Thanks Paul. I am lisdexic.

...and late replying too :laughing::laughing::laughing:


What can I say?