Reputation: 1
How do I change bar chart color of a specific bar, and how to change every bare to same color?
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);
Upvotes: 0
Views: 51
Reputation: 497
I suggest using CSS.
Check the oracle documentation here and also some of the answers on stck here
EDIT: If you can't use CSS then use the class to style, you'll have to search for each of them how they are defined and use that naming, e.g.:
xAxis.setTickLabelFill(Color.CHOCOLATE);
yAxis.setTickLabelFill(Color.CHOCOLATE);
Upvotes: 1