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

AreaChart fills the area above the chart when y axis starts with value bigger than 0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • emb-8u6, 8u20
    • 8
    • javafx
    • Windows 7, Ef(x)clipse 4.2.2, JDK 1.8 (build 117).

      When creating an areaChart with y axis which start with value bigger than zero, it fills the area above the chart line instead of the area below the chart line.(E.g. the vertical area between the values and y max value instead of the vertical area between the values and y min value).

      A test app which reproduces the problem:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.chart.AreaChart;
      import javafx.scene.chart.NumberAxis;
      import javafx.scene.chart.XYChart;
      import javafx.stage.Stage;


      public class AreaChartSample extends Application {

      @Override public void start(Stage stage) {
              stage.setTitle("Area Chart Y Axis above Zero");
              final NumberAxis xAxis = new NumberAxis(1, 31, 1);
              final NumberAxis yAxis = new NumberAxis();
              final AreaChart<Number,Number> ac =
                  new AreaChart<Number,Number>(xAxis,yAxis);
              ac.setTitle("Test : Area chart - fill above chart line ");
              
              yAxis.forceZeroInRangeProperty().set(false);
       
              XYChart.Series<Number, Number> seriesTest= new XYChart.Series<Number,Number>();
              seriesTest.getData().add(new XYChart.Data<Number,Number>(1, 4)); // change the 4 to 0 to 'fix' the problem
              seriesTest.getData().add(new XYChart.Data<Number,Number>(3, 10));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(6, 15));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(9, 8));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(12, 5));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(15, 18));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(18, 15));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(21, 13));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(24, 19));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(27, 21));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(30, 21));
              
              
              Scene scene = new Scene(ac,800,600);
              ac.getData().add(seriesTest);
              stage.setScene(scene);
              stage.show();
          }
       
          public static void main(String[] args) {
              launch(args);
          }

      }


        1. areachart.PNG
          areachart.PNG
          37 kB
        2. areachart-before.PNG
          areachart-before.PNG
          36 kB
        3. rt34626.patch
          1 kB

            jgiles Jonathan Giles
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: