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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 3 weeks ago
Different color for different axis categories
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
Last updated on
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
Last updated on
You cannot reply to this thread.