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

LineChart displaying path issue/glitch

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Occurs on MacOS, Linux and Windows

      A DESCRIPTION OF THE PROBLEM :
      When point is going out of bounds path is skipping it and goes straight to point that precedes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to press button until points go out of left bound in provided test sample.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Not glitch
      ACTUAL -
      Glitch

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.beans.property.*;
      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.Button;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TestApplication extends Application {
          @Override
          public void start(Stage primaryStage) throws Exception {
              NumberAxis yAxis = new NumberAxis();
              NumberAxis xAxis = new NumberAxis();
              LineChart<Number, Number> lineChart = new LineChart<>(xAxis, yAxis);

              DoubleProperty xAxisLower = new SimpleDoubleProperty(0);
              DoubleProperty xAxisUpper = new SimpleDoubleProperty(3);

              lineChart.getXAxis().setAutoRanging(false);
              lineChart.getYAxis().setAutoRanging(true);
              ((NumberAxis) lineChart.getXAxis()).lowerBoundProperty().bind(xAxisLower);
              ((NumberAxis) lineChart.getXAxis()).upperBoundProperty().bind(xAxisUpper);

              Button button = new Button("Move right");
              button.setOnAction(e -> {
                  final double CHANGE_VALUE = 0.1;
                  xAxisLower.set(xAxisLower.get() + CHANGE_VALUE);
                  xAxisUpper.set(xAxisUpper.get() + CHANGE_VALUE);
              });
              VBox vBox = new VBox(lineChart, button);

              XYChart.Series<Number, Number> series = new XYChart.Series<>();
              series.getData().addAll(
                      new XYChart.Data<>(0.4, 0.5),
                      new XYChart.Data<>(0.8, 0.5),
                      new XYChart.Data<>(0.8, 1d),
                      new XYChart.Data<>(1d, 1d),
                      new XYChart.Data<>(1d, 0.8),
                      new XYChart.Data<>(1.5, 0.8)
              );
              ObservableList<XYChart.Series<Number, Number>> data = FXCollections.observableArrayList(series);
              lineChart.setData(data);

              Scene scene = new Scene(vBox);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: