Legend labels in chart

Hi I am relatively new to node red and am trying to create a dashboard recording my sensor output.
I have this flow:

and it produces this dashboard:

What i would like to do is have the legend identify which data series it is, and have the same order for each chart (i.e. highpoint, x1, x2, x3... etc)
Thanks in advance!

Are you sending a msg.topic in each of those Change nodes before each Chart ?
the Topic will be used as a Label for the chart Legend.

ps. are you sure the label text is not black on that black background you have ? :wink:

this is the change node:

your point about the font colour of the label is a good one, and having checked it in a browser that is not running dark mode, you are correct!
how would i change the font colour? (or changing the background colour of the chart would work)

You can't say to the chart node anything about what color should it use for topic. Colors, like they are configured are taken in fifo order. So what ever topic is first to reach emty chart gets first color and so on.

So you have 2 options. Make sure that data is always sent to the chart in validated order. Or take control over chart by using underlying chartjs library wiyh ui_template node. Then you have control over all chart options and you can define colors as you like.

@UnborN I sorted it thanks, newbie error, the browser is in dark mode, but switching the dashboard theme to dark mode too resolved the issue :slight_smile:

1 Like

@hotNipi i have no control over the order of the data input, as it's live data from sensors in the field. do you have a link to the guide to the ui_template node?

To make sure you get consistent colours for the lines configure an Inject node to fire on startup and use it to send messages to the chart, one for each topic, with msg.payload null. That will force them always to use the same colours.


Thats a useful tip, thankyou @Colin