Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094003

[Charts] StackedBarChart rendered incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8u20
    • javafx
    • Windows 7 64bit

      I have updated from Java 8u05 to Java 8u20. Now StackedBarCharts are rendered incorrect: all values (except the topmost category) seem to be truncated to the next integer value. Values smaller then 1 disappear.


      import javafx.application.*;
      import javafx.collections.*;
      import javafx.scene.*;
      import javafx.scene.chart.*;
      import javafx.stage.*;

      public class StackedBarChartTest extends Application {

        public static void main(String[] args) {
          launch(args);
        }

        @Override
        public void start(Stage primaryStage) throws Exception {

          XYChart.Series<String, Number> seriesA = new XYChart.Series<String, Number>();
          seriesA.setName("A");
          seriesA.getData().add(new XYChart.Data<String, Number>("1", 0.1));
          seriesA.getData().add(new XYChart.Data<String, Number>("2", 0.2));
          seriesA.getData().add(new XYChart.Data<String, Number>("3", 0.3));
          seriesA.getData().add(new XYChart.Data<String, Number>("4", 0.4));
          seriesA.getData().add(new XYChart.Data<String, Number>("5", 1.7));

          XYChart.Series<String, Number> seriesB = new XYChart.Series<String, Number>();
          seriesB.setName("B");
          seriesB.getData().add(new XYChart.Data<String, Number>("1", 0.5));
          seriesB.getData().add(new XYChart.Data<String, Number>("2", 0.6));
          seriesB.getData().add(new XYChart.Data<String, Number>("3", 0.7));
          seriesB.getData().add(new XYChart.Data<String, Number>("4", 0.8));
          seriesB.getData().add(new XYChart.Data<String, Number>("5", 1.9));

          XYChart.Series<String, Number> seriesC = new XYChart.Series<String, Number>();
          seriesC.setName("C");
          seriesC.getData().add(new XYChart.Data<String, Number>("1", 0.9));
          seriesC.getData().add(new XYChart.Data<String, Number>("2", 1.0));
          seriesC.getData().add(new XYChart.Data<String, Number>("3", 1.1));
          seriesC.getData().add(new XYChart.Data<String, Number>("4", 1.2));
          seriesC.getData().add(new XYChart.Data<String, Number>("5", 2.1));

          ObservableList<String> categories = FXCollections.observableArrayList("1", "2", "3", "4", "5");
          StackedBarChart<String, Number> chart = new StackedBarChart<String, Number>(new CategoryAxis(categories),
                                                                                      new NumberAxis());
          chart.getData().addAll(seriesA, seriesB, seriesC);

          primaryStage.setScene(new Scene(chart));
          primaryStage.show();
        }

      }

      screenshot of correct rendering in 8u05: http://i58.tinypic.com/15389if.jpg
      screenshot of incorrect rendering in 8u20: http://i62.tinypic.com/2lux452.jpg

            morris Morris Meyer (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: