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

LineChart - Setting forceZeroInRangeProperty of NumberAxis to false doesn't work for negative values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Windows 7, jdk 8 (build 117), Ef(x)clipse 4.2.2

      Description

      For a NumberAxis in a LineChart, calling: forceZeroInRangeProperty().set(false) doesn' t work when all the values on the Axis are negative. The zero line is still displayed, forcing the chart to be pushed down, so the chart details are not shown.

      A test application to demonstrate the problem:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.chart.LineChart;
      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("Line Chart - negative Y Axis");
              final NumberAxis xAxis = new NumberAxis(1, 31, 1);
              final NumberAxis yAxis = new NumberAxis();
              final LineChart<Number,Number> ac =
                  new LineChart<Number,Number>(xAxis,yAxis);
              ac.setTitle("Test : Line chart - Zero line is shown ");
              
              yAxis.forceZeroInRangeProperty().set(false);
       
              XYChart.Series<Number, Number> seriesTest= new XYChart.Series<Number,Number>();
              seriesTest.getData().add(new XYChart.Data<Number,Number>(1, -1400));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(3, -1410));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(6, -1415));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(9, -1478));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(12, -1405));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(15, -1438));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(18, -1415));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(21, -1413));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(24, -1449));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(27, -1421));
              seriesTest.getData().add(new XYChart.Data<Number,Number>(30, -1422));
              
              
              Scene scene = new Scene(ac,800,600);
              ac.getData().add(seriesTest);
              stage.setScene(scene);
              stage.show();
          }
       
          public static void main(String[] args) {
              launch(args);
          }

      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              msladecek Martin Sládeček
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: