Reputation: 322
I have a PieChart in my Java application which looks just like this:
A picture of a label (very hard to see):
Since the pie chart is rendered on a solid gray background, (which is basically the same color as the labels' text) the labels are virtually invisible. So, my question is, is there any CSS code that would change the color of a PieChart label's text, and if so, what is it?
Upvotes: 2
Views: 3641
Reputation: 322
So, the labels of a pie chart are Text
objects, meaning that the CSS property -fx-text-fill
does not work for them. Instead, the -fx-fill
property changes their color.
Here is a screenshot of my Pie Chart with colored labels:
A simple line of CSS does the trick...
.chart-pie-label {-fx-fill: #ff4f0a;}
Upvotes: 3
Reputation: 7255
For any future users below is answer with css code:
You can find more here : http://docs.oracle.com/javafx/2/charts/css-styles.htm
.chart-pie-label-line {
-fx-stroke: #8b4513;
-fx-fill: #8b4513;
}
.chart-pie-label { /*this is what you need for labels*/
-fx-fill: #8b4513;
-fx-font-size: 1em;
}
.chart-legend {
-fx-background-color: #fafad2;
-fx-stroke: #daa520;
}
Upvotes: 5