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.