Dashboard 2.0 ui-chart - Don't show the Legend

I need to place some lines and other information on a chart that doesn't require a legend to be displayed. For example, these upper and lower limits are two lines. But the legend must be for other lines.


Here I would like to remove the "min" and "max" labels Legend, but leave their lines, and leave the label Voltage.
I tried passing different parameters to msg.ui_update.chartOptions but it doesn't work. Is it possible to do this or not?

I haven't tried it but I think something like this may work

msg.ui_update = {chartOptions: {legend: {data: ['Voltage']}}}

Only the series listed in the array should show a legend.

1 Like

Thank you!
It worked! But how could I have guessed this before? I couldn't find any information. Google's AI said something like:

"title": {"display": false}
legend: { display: false }

None of this worked.

The Brave browser AI gave me the answer. The docs for options.legend.data do give some clues to how to do it.

What file are you talking about? Can you provide a link?

I'm afraid it's complicated.

For anyone not getting answers from the all mighty AI (suprise suprise), the docs do mention the how to perform runtime configuration updates:

msg.ui_update.chartOptions. Any of the options defined in the eCharts Documentation may be set...

I.e. the information is there!

However I totally appreciate this requires a leap of faith. It is such a difficult balance of keeping things (like the chart node settings) lean & mean for low-code purposes vs presenting hundreds of options vs what to leave to documentation.

Hope that helps.

The eCharts docs are extensive but not complete, unfortunately. For legend.data it does not explicitly say that if you have an array of series names it will show legends for those present and not for the rest. You have to read between the lines to work that out.

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