Consistency on Chart Colors With Live Data

I've got quite a few charts & bar graphs in my dashboard that populate with live data.

Being a newbie to charts and populating them with live data, no matter at the time interval the data gets pushed to a chart node, how can I ensure the same msg.topics get set to the same color in every chart or bar graph?

I have the following function right before my chart to populate the chart.

let total = msg.payload.total;
let band = msg.payload.band;

if (band == '1.8')
{
    band = '160M'
}
if (band == '3.5')
{
    band = '80M'
}
if (band == '7')
{
    band = '40M'
}
if (band == '14')
{
    band = '20M'
}
if (band == '21')
{
    band = '15M'
}
if (band == '28')
{
    band = '10M'
}

msg.topic = band;
msg.payload = total;

return msg;

Thanks
Kyle

Here is one way

Ugh...that is nasty. Ok, thanks for the reply.

Not really.

All you do is have an inject node and create a message which has an empty message with the same structure as your incoming messages with their data and have the fields set to blanks.

One node, one message injected at the start.

If you want to get more complicated there are other ways of doing with with the join node.
But that has it's own set of problems.

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