Hello everyone,
I'm currently facing an issue when I'm trying to style my LineChart with some CSS. Indeed I would like to change the color of the labels of my xAxis (CategoryAxis) and yAxis (NumberAxis) but it's not working.
In my FXML file I tried to use the style attribute on my LineChart tag using: <LineChart style="-fx-text-fill: white"> with no result, the text remains black (even for the title of my chart). In order to know if the style attribute is well parsed I changed it to: style="-fx-background-color: red; -fx-text-fill: white;". The background is becoming red but the text still remains black.
Finally I tried to define a stylesheet in my controller class with the same properties (red background and white text). My stylesheet is this one:
.chart {
-fx-text-fill: white;
-fx-background-color: red;
}
In my controller I do the following line in order to load my CSS file:
this.chart.getStylesheets().add(getClass().getResource("statistics-style.css").toExternalForm());
Even with this option the text remains white, while the background becomes red.
What I also tried is to put the -fx-text-file CSS property directly on my axises, but again it seems it is ignored.
I followed the steps described in Figure 8-2 of this site: http://docs.oracle.com/javafx/2/charts/css-styles.htm
Does anybody have an idea or encountered this issue?
Thank you very much,
Thierry.
PS: I'm using JFX 2.1 on MacOS X
Edited by: twasyl on May 8, 2012 7:57 AM
Edited by: twasyl on May 8, 2012 7:59 AM