Is it possible in a basic column chart (ChartType.COLUMN) to have different color for different axis categories.
To explain better: I would like every column in my chart to have a different color… is that configuration possible?
Thanks
Is it possible in a basic column chart (ChartType.COLUMN) to have different color for different axis categories.
To explain better: I would like every column in my chart to have a different color… is that configuration possible?
Thanks
Hi Tiziano,
if I understand your problem correctly you have a simple column chart and you would like each column to have a seperate color. In that case, the following example should contain what you need.
final VerticalLayout layout = new VerticalLayout();
setContent(layout);
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
conf.getChart().setType(ChartType.COLUMN);
conf.getLegend().setEnabled(false);
DataSeries data = new DataSeries();
DataSeriesItem item1 = new DataSeriesItem();
item1.setY(2);
item1.setColor(SolidColor.RED);
data.add(item1);
DataSeriesItem item2 = new DataSeriesItem();
item2.setY(1);
item2.setColor(SolidColor.YELLOW);
data.add(item2);
DataSeriesItem item3 = new DataSeriesItem();
item3.setY(3);
item1.setColor(SolidColor.GREEN);
data.add(item3);
conf.addSeries(data);
layout.addComponent(chart);
I hope this helps,
Henrik