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

NumberAxis generates incorrect Tick values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u60
    • 8u25, 8u31
    • javafx
    • None
    • Arch Linux x64, Windows 8.1 x64

      Creating a NumberAxis between 2 values with a tick count greater than 0 creates a duplicate of the first tick value
      i.e. NumberAxis of 1 to 11 and a tick value of 2 yields (duplicate value of 1)
      [1, 1, 3, 5, 7, 9, 11]

      Example

      import javafx.application.Application;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.chart.Axis;
      import javafx.scene.chart.NumberAxis;
      import javafx.stage.Stage;

      public class NumberAxisExample extends Application
      {
          public void start(Stage primaryStage) throws Exception
          {
              NumberAxis axis = new NumberAxis(1, 11, 2);

              Scene scene = new Scene(axis);
              primaryStage.setScene(scene);
              primaryStage.show();

              ObservableList<Axis.TickMark<Number>> marks = axis.getTickMarks();
              for (Axis.TickMark<Number> mark : marks)
              {
                  Number value = mark.getValue();
                  System.out.println(value);
              }
          }
      }

      Output of running the above code

      1.0
      1.0
      3.0
      5.0
      7.0
      9.0
      11.0

      Expected

      1.0
      3.0
      5.0
      7.0
      9.0
      11.0

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

              Created:
              Updated:
              Resolved:
              Imported: