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

[Axis] warning on minor and major tick count is shown, when ticks are not shown

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: 7u6
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      2.2.0b15

      Description

      Look at the attached movie.

      I switched to false: tickMarkVisible and minorTickVisible. After that started to increase the upper bound. (expontent set to 3 or 5 - means maximum of slider equal to 10^3 or 10^5). When upper bound value started to be more than 20864, I started to receive warnings:

      Warning we tried to create more than 2000 major tick marks on a NumberAxis. Lower Bound=0.0, Upper Bound=20864.667283676852, Tick Unit=10.0
      Warning we tried to create more than 2000 major tick marks on a NumberAxis. Lower Bound=0.0, Upper Bound=20864.667283676852, Tick Unit=10.0
      Warning we tried to create more than 2000 major tick marks on a NumberAxis. Lower Bound=0.0, Upper Bound=20864.667283676852, Tick Unit=10.0
      .....
      Warning we tried to create more than 10000 minor tick marks on a NumberAxis. Lower Bound=0.0, Upper Bound=60330.607115307495, Tick Unit=10.0

      This happens, even if minor ticks are not shown. BTW, chart is shown broken on the last moments of the movie.

      Code:


      import java.util.Arrays;
      import java.util.Comparator;
      import java.util.Random;
      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.chart.LineChart;
      import javafx.scene.chart.NumberAxis;
      import javafx.scene.chart.XYChart;
      import javafx.scene.control.Slider;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class JavaCharts extends Application {
          
          public static void main(String[] args) {
              launch(args);
          }
          NumberAxis axis1 = new NumberAxis(0, 100, 10);
          NumberAxis axis2 = new NumberAxis(0, 100, 10);
          LineChart testedLineChart = new LineChart(axis1, axis2);
          VBox vb = new VBox();
          
          @Override
          public void start(Stage stage) throws Exception {
              testedLineChart.setTitle("LineChart");
              testedLineChart.setStyle("-fx-border-color: darkgray;");
              
              ObservableList list = FXCollections.observableArrayList();
              int max = 100;
              int min = 30;
              
              for (int i = 0; i < 30; i++) {
                  XYChart.Data newData = new XYChart.Data();
                  newData.setXValue(new Random().nextDouble() * (max - min) + min);
                  newData.setYValue(new Random().nextDouble() * (max - min) + min);
                  list.add(newData);
              }
              Object[] array = list.toArray();
              Arrays.sort(array, new Comparator() {
                  
                  @Override
                  public int compare(Object t, Object t1) {
                      return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue()));
                  }
              });
              
              XYChart.Series serie = new XYChart.Series("serie", FXCollections.observableArrayList(array));
              
              testedLineChart.getData().add(serie);
              
              axis2.setTickMarkVisible(false);
              axis2.setMinorTickVisible(false);
              
              Pane pane = new Pane();
              pane.setPrefSize(600, 600);
              
              Slider slider = new Slider(0, 30000, 10);
              slider.setPrefWidth(500);
              slider.valueProperty().bindBidirectional(axis2.upperBoundProperty());
              slider.setShowTickLabels(true);
              slider.setShowTickMarks(true);
              
              pane.setPrefSize(600, 600);
              pane.getChildren().add(testedLineChart);
              
              vb.getChildren().addAll(pane, slider);
              
              Scene scene = new Scene(vb, 700, 700);
              stage.setScene(scene);
              stage.show();
          }
      }

      Just move slider to the end to reproduce.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported: