-
Bug
-
Resolution: Fixed
-
P4
-
7u9
-
Windows 7
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
In the BarChart.createBar(Series, int, Data, int) method, the bar.getStyleClass.setAll(...) method is used to set the bar node's style classes, which removes any existing style classes before adding the additional style classes. The following test demonstrates the problem:
{code:java}
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis();
BarChart<String, Number> myChart = new BarChart<>(xAxis, yAxis);
XYChart.Series<String, Number> series = new XYChart.Series<>();
ObservableList<Data<String, Number>> seriesData = series.getData();
String xValue = "A";
Number yValue = Integer.valueOf(20);
Data<String, Number> item = new XYChart.Data<>(xValue, yValue);
Node bar = item.getNode();
if (bar == null) {
bar = new StackPane();
}
String myStyleClass = "my-style";
bar.getStyleClass().add(myStyleClass);
item.setNode(bar);
seriesData.add(item);
myChart.getData().add(series);
assert bar.getStyleClass().contains(myStyleClass);
{code}
Using bar.getStyleClass.addAll(...) would allow style classes to be set at the time of item creation.
{code:java}
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis();
BarChart<String, Number> myChart = new BarChart<>(xAxis, yAxis);
XYChart.Series<String, Number> series = new XYChart.Series<>();
ObservableList<Data<String, Number>> seriesData = series.getData();
String xValue = "A";
Number yValue = Integer.valueOf(20);
Data<String, Number> item = new XYChart.Data<>(xValue, yValue);
Node bar = item.getNode();
if (bar == null) {
bar = new StackPane();
}
String myStyleClass = "my-style";
bar.getStyleClass().add(myStyleClass);
item.setNode(bar);
seriesData.add(item);
myChart.getData().add(series);
assert bar.getStyleClass().contains(myStyleClass);
{code}
Using bar.getStyleClass.addAll(...) would allow style classes to be set at the time of item creation.
- relates to
-
JDK-8162547 Unify CSS handling of charts nodes
-
- Open
-