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

ScatterChart adding series bug

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • javafx
    • None
    • Mac OS X 10.7
      JavaFX 2.1.1
      java version "1.7.0_05"
      Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

      The following code produces the exception given below it

      public class Main1 extends Application {
       
          @Override public void start(Stage stage) {
              stage.setTitle("Scatter Chart Sample");
              final NumberAxis xAxis = new NumberAxis();
              final NumberAxis yAxis = new NumberAxis();
              final ScatterChart sc = new ScatterChart(xAxis,yAxis);

              XYChart.Series series1 = new XYChart.Series();
              series1.setName("Equities");
      sc.getData().add(series1);
              series1.getData().add(new XYChart.Data(4.2, 193.2));
              series1.getData().add(new XYChart.Data(2.8, 33.6));
              series1.getData().add(new XYChart.Data(6.2, 24.8));
              series1.getData().add(new XYChart.Data(1, 14));
              series1.getData().add(new XYChart.Data(1.2, 26.4));
              series1.getData().add(new XYChart.Data(4.4, 114.4));
              series1.getData().add(new XYChart.Data(8.5, 323));
              series1.getData().add(new XYChart.Data(6.9, 289.8));
              series1.getData().add(new XYChart.Data(9.9, 287.1));
              series1.getData().add(new XYChart.Data(0.9, -9));
              series1.getData().add(new XYChart.Data(3.2, 150.8));
              series1.getData().add(new XYChart.Data(4.8, 20.8));
              series1.getData().add(new XYChart.Data(7.3, -42.3));
              series1.getData().add(new XYChart.Data(1.8, 81.4));
              series1.getData().add(new XYChart.Data(7.3, 110.3));
              series1.getData().add(new XYChart.Data(2.7, 41.2));
       
              Scene scene = new Scene(sc, 500, 400);
              stage.setScene(scene);
              stage.show();
          }
       
          public static void main(String[] args) {
              launch(args);
          }
      }

      Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
      at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:399)
      at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
      at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
      at java.lang.Thread.run(Thread.java:680)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.get(ArrayList.java:322)
      at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:208)
      at javafx.scene.chart.ScatterChart.updateLegend(ScatterChart.java:188)
      at javafx.scene.chart.XYChart$2.onChanged(XYChart.java:132)
      at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:134)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
      at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
      at com.sun.javafx.collections.ObservableListWrapper.add(ObservableListWrapper.java:154)
      at com.sun.javafx.collections.ObservableListWrapper.add(ObservableListWrapper.java:144)
      at com.ods.infoview.Main1.start(Main1.java:24)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)

      Tthe same code for other chart types like LineChart do not produce this error.

            psomashe Parvathi Somashekar (Inactive)
            gmatthewsjfx Graham Matthews (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: