Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to Show Legend for PlotOptionsErrorbar in Charts 3.0.0
Hi,
Good morning!
After migrating to Charts 3.0.0, we noticed that there is no option to show the legend of the PlotOptionsErrorbar. Can someone advise me how to make a workaround to show the legend for the PlotOptionsErrorbar?
Thank you in advance!
Best regards,
Adrian
Hi Adrian,
What do you mean by showing the legend of the error bar?
Can you post an example of how you were seting it before migrating to Charts 3?
Thanks!
Hi Guillermo,
Thanks for the prompt response. Here's the code snippet:
PlotOptionsErrorBar plotOptionsErrorBar = new PlotOptionsErrorBar();
tooltip = new Tooltip();
tooltip.setPointFormat("Avg: {point.high:,.2f}");
plotOptionsErrorBar.setTooltip(tooltip);
plotOptionsErrorBar.setColor(SolidColor.RED);
plotOptionsErrorBar.setLineWidth(1);
plotOptionsErrorBar.setWhiskerLengthAsPercentage(105);
[b]plotOptionsErrorBar.setShowInLegend(true);[/b]
Previously, setShowInLegend() was still available before the PlotOptionsErrorBar was changed to PlotOptionsErrorbar. But not it has been removed and was not even tackled in the Charts Migration (https://vaadin.com/docs/-/part/charts/java-api/charts-migration.html).
Best regards,
Adrian
Thanks, now I get the issue.
You're right, PlotOptionsErrorbar is missing the showInLegend property. Could you create an issue for the missing API in https://dev.vaadin.com/ ?
In the meantime if you want to show legend for all series you can set the showInLegend porperty using PlotOptionSeries that will affect all series in the plot like this:
Configuration conf = chart.getConfiguration();
PlotOptionsSeries seriesOptions = new PlotOptionsSeries();
seriesOptions.setShowInLegend(true);
conf.setPlotOptions(seriesOptions);
If you only want to enable it for some series you can enable it for all on the same way and disable for each series you don't want to show in the legend.
If your case is more complex and you want to show some error bars in the legend and some others not there are other workarounds but it gets a bit more messy.
Hope this helps!
Guille
Hi Guillermo,
It worked! Thanks for the prompt action! Will raise a ticket for the missing API. Thank you again, buddy!
Best regards,
Adrian