我有一个表示颜色序列的颜色列表。我想将新的颜色序列应用到饼图数据。Javafx更改PieChart颜色
private final int CASPIAN_COLOR_COUNTS = 8;
public void setPieChartColor(PieChart chart, List<String> colors) {
chart.getData().get(i); // for debug to get the node name (.data)
/**
* Set Pie color
*/
int i = 0;
for (String color : colors) {
final Node node = chart.lookup(".data" + i);
node.getStyleClass().remove("default-color" + (i % CASPIAN_COLOR_COUNTS));
node.getStyleClass().add(color);
i++;
}
但所有图表数据采取从里海颜色只有一种颜色。
我有包含颜色序列的颜色列表。我想将我的新颜色序列应用于饼图数据。 – 2013-03-05 09:05:33