Loading...
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.

Product icon
TUTORIAL

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

Adrian Zara
5 years ago Aug 02, 2016 3:00am
Guillermo Alvarez
5 years ago Aug 02, 2016 6:19am
Adrian Zara
5 years ago Aug 02, 2016 7:12am
Guillermo Alvarez
5 years ago Aug 02, 2016 8:04am

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

Adrian Zara
5 years ago Aug 02, 2016 8:11am
Guillermo Alvarez
5 years ago Aug 02, 2016 8:20am