Look at the attached movie.
I set
x_axis.setTickLabelRotation(45);
y_axis.setTickLabelRotation(45);
But you can see, that I changed height of scene, and y_axis labels rotation changed from 45 degrees to 90 degrees.
Code is here :
@Override
public void start(Stage stage) {
VBox content = new VBox();
Series s1 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Green"),
new XYChart.Data("Second", "Blue"),
new XYChart.Data("Fourth", "Red")
));
s1.setName("Set 1");
Series s2 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Red"),
new XYChart.Data("Second", "Green"),
new XYChart.Data("Fourth", "Blue")
));
s2.setName("Set 2");
Series s3 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Blue"),
new XYChart.Data("Second", "Red"),
new XYChart.Data("Third", "Green")
));
s3.setName("Set 3");
ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
Axis y_axis = new CategoryAxis();
Axis x_axis = new CategoryAxis(FXCollections.<String>observableArrayList("First", "Second", "Third", "Fourth"));
Chart chart = new ScatterChart(x_axis, y_axis, data);
content.getChildren().add(chart);
stage.setScene(new Scene(content, 400, 400));
stage.show();
x_axis.setTickLabelRotation(45);
y_axis.setTickLabelRotation(45);
}
I set
x_axis.setTickLabelRotation(45);
y_axis.setTickLabelRotation(45);
But you can see, that I changed height of scene, and y_axis labels rotation changed from 45 degrees to 90 degrees.
Code is here :
@Override
public void start(Stage stage) {
VBox content = new VBox();
Series s1 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Green"),
new XYChart.Data("Second", "Blue"),
new XYChart.Data("Fourth", "Red")
));
s1.setName("Set 1");
Series s2 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Red"),
new XYChart.Data("Second", "Green"),
new XYChart.Data("Fourth", "Blue")
));
s2.setName("Set 2");
Series s3 = new Series( FXCollections.observableArrayList(
new XYChart.Data("First", "Blue"),
new XYChart.Data("Second", "Red"),
new XYChart.Data("Third", "Green")
));
s3.setName("Set 3");
ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
Axis y_axis = new CategoryAxis();
Axis x_axis = new CategoryAxis(FXCollections.<String>observableArrayList("First", "Second", "Third", "Fourth"));
Chart chart = new ScatterChart(x_axis, y_axis, data);
content.getChildren().add(chart);
stage.setScene(new Scene(content, 400, 400));
stage.show();
x_axis.setTickLabelRotation(45);
y_axis.setTickLabelRotation(45);
}
- duplicates
-
JDK-8093707 [Charts, CategoryAxis] x labels remain vertical after resize
- Closed