Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8181573 | 8u152 | Dipak Kumar | P3 | Resolved | Fixed | b05 |
FULL PRODUCT VERSION :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
XYCharts with a CategoryAxis set as the yAxis rotate improperly when vertical space decreases.
Here is a gif showing the issue:
https://drive.google.com/file/d/0B71GjZGQBItSVmxkTHhiSXVaMXM/view?usp=sharing
Here's a stack overflow question about it:
http://stackoverflow.com/questions/32979001/javafx-charting-categoryaixis-resize-issue
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an XYChart (Area, Bar, Line, etc...) and set its yAxis to be a CategoryAxis with several categories.
Resize the chart reducing its height until there is insufficient space to properly show all of the category labels. You will see that the labels rotate to 90 degrees, and only one or two display. As the chart re-grows the labels never rotate back to 90 degrees.
You can see this by running the provided source code and vertically resizing the window until it is small enough.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The labels shouldn't rotate since they already have the optimal layout rotation. I would PREFER to have the labels stack on top of each other, but I would EXPECT to have every other label disappear or something like that.
ACTUAL -
Labels turn vertical and nearly all labels hide.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
public class HorizontalBarExample extends Application {
@Override
public void start(Stage stage) {
NumberAxis xAxis = new NumberAxis();
CategoryAxis yAxis = new CategoryAxis();
BarChart<Number, String> bc = new BarChart<Number, String>(xAxis, yAxis);
bc.setBarGap(0d);
bc.setCategoryGap(0);
xAxis.setTickLabelRotation(90);
yAxis.tickLabelRotationProperty().set(0d);
XYChart.Series<Number, String> series1 = new XYChart.Series<>();
series1.setName("example");
for (int i = 0; i < 10; i++)
series1.getData().add(new XYChart.Data<Number, String>(Math.random() * 5000, "long data label number" + i));
bc.getData().add(series1);
Scene scene = new Scene(bc, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
XYCharts with a CategoryAxis set as the yAxis rotate improperly when vertical space decreases.
Here is a gif showing the issue:
https://drive.google.com/file/d/0B71GjZGQBItSVmxkTHhiSXVaMXM/view?usp=sharing
Here's a stack overflow question about it:
http://stackoverflow.com/questions/32979001/javafx-charting-categoryaixis-resize-issue
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an XYChart (Area, Bar, Line, etc...) and set its yAxis to be a CategoryAxis with several categories.
Resize the chart reducing its height until there is insufficient space to properly show all of the category labels. You will see that the labels rotate to 90 degrees, and only one or two display. As the chart re-grows the labels never rotate back to 90 degrees.
You can see this by running the provided source code and vertically resizing the window until it is small enough.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The labels shouldn't rotate since they already have the optimal layout rotation. I would PREFER to have the labels stack on top of each other, but I would EXPECT to have every other label disappear or something like that.
ACTUAL -
Labels turn vertical and nearly all labels hide.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
public class HorizontalBarExample extends Application {
@Override
public void start(Stage stage) {
NumberAxis xAxis = new NumberAxis();
CategoryAxis yAxis = new CategoryAxis();
BarChart<Number, String> bc = new BarChart<Number, String>(xAxis, yAxis);
bc.setBarGap(0d);
bc.setCategoryGap(0);
xAxis.setTickLabelRotation(90);
yAxis.tickLabelRotationProperty().set(0d);
XYChart.Series<Number, String> series1 = new XYChart.Series<>();
series1.setName("example");
for (int i = 0; i < 10; i++)
series1.getData().add(new XYChart.Data<Number, String>(Math.random() * 5000, "long data label number" + i));
bc.getData().add(series1);
Scene scene = new Scene(bc, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8181573 CategoryAxis rotates improperly as yAxis
-
- Resolved
-