簡體   English   中英

如何改變圖表的顏色?

[英]How to change color of chart?

如何更改特定條形的條形圖顏色,以及如何將每個裸色更改為相同顏色?

XYChart.Series<String, Integer> exPhil = new XYChart.Series<>();
exPhil.setName("Examen philosophicum for naturvitenskap og teknologi");
exPhil.getData().add(new XYChart.Data<>("A", 70));
exPhil.getData().add(new XYChart.Data<>("B", 20));
exPhil.getData().add(new XYChart.Data<>("C", 40));
exPhil.getData().add(new XYChart.Data<>("D", 10));
exPhil.getData().add(new XYChart.Data<>("E", 5));
exPhil.getData().add(new XYChart.Data<>("F", 5));
barChart.getData().add(exPhil);
barChart.setLegendVisible(true);

我建議使用 CSS。

此處查看 oracle 文檔以及此處有關 stck 的一些答案


編輯:如果您不能使用 CSS 然后使用 class 來設置樣式,則必須搜索它們中的每一個它們是如何定義的並使用該命名,例如:

xAxis.setTickLabelFill(Color.CHOCOLATE);

yAxis.setTickLabelFill(Color.CHOCOLATE);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM