Chart trace changing colour - again


(Yeah, ok, I have asked before..... B-u-t.....)

I have a screen with multiple charts. Alas at this point all but one are inactive. It is the one which is the problem.
(Oh, when the others are getting data, they are 99.9% black, as per settings.)

So, this chart - like the others - has the setting for the trace set to BLACK.

Usually it is blue - which I now can say is actually the second colour of the settings - and I had the first colour as BLACK.

I don't get why it is/was blue. But of late it has behaved itself and become black.
Alas it has decided to go back to blue.
I haven't edited anything in the flow anywhere near the chart to cause the data flow to change to the second colour.

Today I worked out it was the second colour because after seeing it was back to BLUE, I went in and looked at the settings. BLUE was the second colour, and if I change it to another colour, the trace colour changes.

But it is colour #2. Not #1.

This is annoying to me - though I could "cheat" and just make all the colours BLACK and not care. But I don't think that is the right thing to do.

Can anyone offer suggestions to why it is changing between colour #1 and colour #2 of the settings?


Are you sure you are not sending it data with two different topics?


I really hope not.

I have a DEBUG node out of the chart showing all the data.

This is the message packet:


Yesterday (or maybe the day before) it was the lovely BLACK.
Today when I went there, it was back to the "default" BLUE. :frowning:

But that made me check the colour and I noticed the colour was the second colour. I edited it from BLUE to GREEN and the chart colour changed. So that is the colour being used.

But WHY it is using the first or second colour and what causes it?


It may happen that if you are developing your solution, you send some test data to chart (maybe without topic property set), and then connect it with real data source and if you are not clearing the data between those inputs, the first color is still connected with you testing data structure (let say there was no topic). The time may go by and your chart may display no data at all and therefore you see wrong color with your real data.
I did slight experiments to achieve your problem and it may happen this way. Let's say "just by accident".


Sorry, I don't quite understand what is meant.

What I will do (shortly) is connect a node generating random data going into the chart's input and not set a topic.
I'll see if that changes anything.

That is about the best I can do in understanding what you wrote. No offence to you. I parsing system is not up to speed.


The suggestion is that maybe there was just one message at some point since the chart started with a different topic. That would reserve the first colour for that topic and then your actual data would use the second colour.
First try re-starting node-red and do a full refresh of the browser (often ctrl+F5). If that doesn't fix it then insert a switch node in front of the chart that tests for topic equal to TimePi and sends that to output 1, then select Otherwise for output 2. Put a debug node on output 2. Then restart node red again, refresh the browser and see what the chart shows. Also see if anything appears on o/p 2.


Here are two screen shots that show what is happening:

Look in the GREY box for the area of interest.

The GREEN lines are for the REAL data and the RED lines are my injected.
Sorry the chart colour is BLACK, and that is the FIRST colour. GREEN is the second colour on the chart's settings.


Shall do.

Best of my knowledge there is only 1 data stream coming in. But I will do that to see if I can see/find anything that could cause the problem.

Moving a bit ahead of myself: If that is the problem, how do I reset the graph's colour trace to colour 1?

Back with more shortly.


Refresh it by sending empty array. No topic needed.


Does not a node red restart reset it?


Isn't it "overkill" even if it does? :slight_smile:


I put this into the CHART:

[{"id":"c8a7cf73.3ba33","type":"inject","z":"c636aa5a.cc34","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1460,"y":3210,"wires":[["28c0c69d.a24122"]]},{"id":"28c0c69d.a24122","type":"function","z":"c636aa5a.cc34","name":"","func":"msg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":1580,"y":3210,"wires":[["f4616313.901d2"]]}]

Chart isn't cleared.

Did it multiple times.


msg.payload = null; is not same as msg.payload = [];

Chart needs empty array for clearing old data.

1 Like


This is after injecting the mistake.

The charts have this habit of being blank now and then, so I can't be sure.

This is now what I am seeing.

Woo Hoo!


I'm not sure and it's hard to see but

If this is your chart node, is there more than one inputs connected?


Yes, correct.

NOW I have two inputs.

The TRAFFIC LIGHT node below was injecting the second flow (generating the BLACK trace).

Since injecting the msg.payload = []; the chart was wiped and the trace has changed to BLACK.

Seems (maybe) somewhere along the line the data stream got a second one and the REAL data flow got bumped to second.

I'll leave the SWITCH node and the catching for possible future investigation.


This is an updated view of the flow:

RED = the wipe the chart part.
YELLOW = fake/second data flow injection part.
BLUE = debug part to track if some other messages are getting through.
They are put into a simple queue node so they are stored.
I can then look at the inputs and try to see from where they came.
Well, IF... But I guess I have to search if I want to find.


I haven't restarted NR just yet.

But interestingly enough: Yesterday the colour was BLACK.
Today - at an unknown time - the RPI rebooted..... Dunno why. The trace I saw when I looked at it WAY AFTER it is BLUE.

Dunno if that is important, but worth mentioning as restart was mentioned and I have noticed that the machine had rebooted since yesterday.
And weirdly a node that I just installed yesterday when working on another "problem" wasn't installed today.
I noticed this because the machine wasn't doing its normal things.
I went to the web page and it said SUNPOS was no installed.
It was last night. I reinstalled it and the machine was rebooted a couple of times for other reasons this afternoon.
I'll stop now.


I meant that a previous post had asked for a restart to be tried, so if this had been done the chart would already have been cleared. Thereby removing the possibility that he was just seeing a hangover from something that happened once and was not going to be repeated.


Absolutely :slight_smile:
I found that "hidden treasures" of nodes may bite you as hard as they can help you.
And there is a lot of them :slight_smile: Luckily