This is a recent regression, maybe related to CategoryAxis changes. See broken and working screenshots. The Broken is drawn using only about half the X axis width.
Code to make chart
final Random RANDOM = new Random(29782198273l);
String[] years = {"2001","2002","2003"};
String[] series;
if (simple) {
series = new String[]{"A","B","C"};
} else {
series = new String[]{"A","B","C","D","E","F","G","H"};
}
CategoryAxis xAxis = new CategoryAxis(FXCollections.<String>observableArrayList(years));
NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Units Sold");
ObservableList<BarChart.Series> barChartData = FXCollections.observableArrayList();
final double negative = -500;
for (int s=0; s<series.length; s++) {
ObservableList<BarChart.Data> sd = FXCollections.observableArrayList();
for(int y=0; y<years.length; y++) {
sd.add(new BarChart.Data(years[y], negative+(2000*RANDOM.nextDouble())));
}
barChartData.add(new BarChart.Series(series[s],sd));
}
Node barChart = new BarChart(xAxis, yAxis, barChartData);
Code to make chart
final Random RANDOM = new Random(29782198273l);
String[] years = {"2001","2002","2003"};
String[] series;
if (simple) {
series = new String[]{"A","B","C"};
} else {
series = new String[]{"A","B","C","D","E","F","G","H"};
}
CategoryAxis xAxis = new CategoryAxis(FXCollections.<String>observableArrayList(years));
NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Units Sold");
ObservableList<BarChart.Series> barChartData = FXCollections.observableArrayList();
final double negative = -500;
for (int s=0; s<series.length; s++) {
ObservableList<BarChart.Data> sd = FXCollections.observableArrayList();
for(int y=0; y<years.length; y++) {
sd.add(new BarChart.Data(years[y], negative+(2000*RANDOM.nextDouble())));
}
barChartData.add(new BarChart.Series(series[s],sd));
}
Node barChart = new BarChart(xAxis, yAxis, barChartData);
- blocks
-
JDK-8102642 New modern theme for JavaFX (Modena)
- Closed