我找到了解決上述問題的方法。現在我可以在涉及ListSeries的條形圖欄中設置我選擇的顏色。
PlotOptionsColumn就是答案。
//Hard Coded Values
String months[] = { "DataSet 1", "DataSet 2", "DataSet 3", "DataSet 4", "DataSet 5"};
int dataArray[][] = {
{ 8, 13, 7, 4 },
{ 23, 1, 30, 7 },
{ 37, 3, 22, 2 },
{ 13, 23, 4, 3 },
{ 3, 10, 9, 5 },
};
int counter = 0;
// Data series for each numeric column in the table
for (int month = 0; month < 4; month++) {
ListSeries series = new ListSeries();
PlotOptionsColumn options = new PlotOptionsColumn();
options.setColor(colors[counter++]);
series.setPlotOptions(options);
series.setName(months[month]);
// The rows of the table
for (int data = 0; data < dataArray.length; data++) {
series.addData(dataArray[data][month]);
}
conf.addSeries(series);
}
我沒有執照,所以我無法驗證如何將這些應用,但也許你可以找到有用的東西:你的造型圖表博客文章(https://vaadin.com/blog/-/blogs/styling-your-vaadin-charts)和[vaadin docs - charts config](https://vaadin.com/docs/-/part/charts/java-api/charts-configuration.html) – Morfic