Vaadin Charts 1.0.0 ContainerDataSeries PlotOptions Problem

Hi Folks,
i’m playing arround a bit with the new vaadin charts add-on.
I’ve got problems to colorize my series when using ContainerDataSeries.
The following code displays a chart with one series colored in the standard-first-blue-theme-color.
In my opinion it should instead be filled with light-blue color and have orange markers.

public class ChartsUI extends UI {

    protected class Test {
        private int number;
        private String name;

        public Test(final int number, final String name) {
            this.number = number;
            this.name = name;
        }

        public int getNumber() {
            return number;
        }

        public String getName() {
            return name;
        }
    }

    protected Component getChart() {
        Chart chart = new Chart(ChartType.AREA);

        Configuration conf = chart.getConfiguration();

        conf.setTitle(new Title("Colored ContainerDataSeries"));

        conf.addxAxis(new XAxis());
        YAxis yAxis = new YAxis();
        yAxis.setTitle("Numbers");
        conf.addyAxis(yAxis);

        BeanItemContainer<Test> beanItemContainer = new BeanItemContainer<Test>(Test.class);
        beanItemContainer.addBean(new Test(10, "TEN"));
        beanItemContainer.addBean(new Test(11, "ELEVEN"));
        beanItemContainer.addBean(new Test(12, "TWELVE"));

        ContainerDataSeries containerDataSeries = new ContainerDataSeries(beanItemContainer);
        containerDataSeries.setName("Test Series");
        containerDataSeries.setYPropertyId("number");
        containerDataSeries.setNamePropertyId("name");

        PlotOptionsArea plotOptions = new PlotOptionsArea();
        plotOptions.setFillColor(SolidColor.CORNFLOWERBLUE);
        plotOptions.setColor(SolidColor.GOLDENROD);
        containerDataSeries.setPlotOptions(plotOptions);

        conf.setSeries(containerDataSeries);

        chart.drawChart(conf);

        return chart;
    }

    @Override
    protected void init(final VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        layout.addComponent(getChart());
    }
}

Am I missing something or is it a bug in the add-on?

Changing the theme isn’t realy an option, but would probably work.

Hi,

You found a bug. Could you please create a ticket for it at
dev.vaadin.com
?

Everything works as you’d expect if you set the plot options on the configuration object instead of the container series object, but if you have multiple series and want different colors for these it currently won’t work using container series. Setting the plot options for the configuration object is recommended if you do not need different options for different series of the same type in the same chart.

HTH,
/Jonatan

Ok, I created a ticket.

Ticket #11147