To access default styles, you can refer to the Caspian CSS file for JavaFX 2.2 and Java 8. You can find them in this JavaFX 2.2 link and this Java 8 link.
If you want to view style classes interactively, use the ScenicView tool.
You have the option to print nodes in the chart recursively at runtime to determine their types and applied CSS classes. It's recommended to print the nodes after they've been attached to a visible stage so that the correct style classes are applied. Additionally, you can dynamically style or manipulate nodes in code by looking them up via CSS class.
Below is a customizable sample code snippet for your chart:
// Sample code for creating a simple AreaChart in JavaFX
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.stage.Stage;
public class SimpleChart extends Application {
public static void main(String[] args) { launch(args); }
@Override public void start(Stage stage) {
final AreaChart chart = new AreaChart(
new NumberAxis(), new NumberAxis(),
FXCollections.observableArrayList(
new XYChart.Series("April", FXCollections.observableArrayList(
new XYChart.Data(0, 4), new XYChart.Data(1, 10), new XYChart.Data(2, 18)
)),
new XYChart.Series("May", FXCollections.observableArrayList(
new XYChart.Data(0, 20), new XYChart.Data(1, 15), new XYChart.Data(2, 12)
))
)
);
chart.setTitle("Temperature Monitoring (in Degrees C)");
stage.setScene(new Scene(chart, 800, 600));
stage.show();
printNodes(chart, 0);
}
public void printNodes(Node node, int depth) {
for (int i = 0; i < depth; i++) System.out.print(" ");
System.out.println(node);
if (node instanceof Parent)
for (Node child : ((Parent) node).getChildrenUnmodifiable())
printNodes(child, depth + 1);
}
}
The output of printing nodes would be like below:
AreaChart@fb17e5[styleClass=root chart]
Label[id=null, styleClass=label chart-title]
...
Legend@2a46d1[styleClass=chart-legend]
Label[id=null, styleClass=label chart-legend-item]
...
Label[id=null, styleClass=label chart-legend-item]
...