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

BarChart doesn't work for Series where each has one data item from its own category

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • Windows 7
      Product: javafx-2.0beta
      Platform: windows-i586
      Build-Number: 171
      Build-ID: 2011-05-31_19-32-58

      I need bar charts where each column has different color and different category name, so I use the following code:

              barChart.setData(FXCollections.observableArrayList(
                      new BarChart.Series(FXCollections.observableArrayList(new BarChart.Data("A", 10))),
                      new BarChart.Series(FXCollections.observableArrayList(new BarChart.Data("B", 20))),
                      new BarChart.Series(FXCollections.observableArrayList(new BarChart.Data("C", 1))),
                      new BarChart.Series(FXCollections.observableArrayList(new BarChart.Data("D", 50)))));

      which results in:

      Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
              at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:168)
              at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:17)
              at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:55)
              at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
              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:125)
              at javafx.scene.chart.BarChart.getDataItem(BarChart.java:390)
              at javafx.scene.chart.BarChart.layoutPlotChildren(BarChart.java:331)
              at javafx.scene.chart.XYChart.layoutChartChildren(XYChart.java:524)
              at javafx.scene.chart.Chart$1.layoutChildren(Chart.java:53)
              at javafx.scene.Parent.layout(Parent.java:855)
              at javafx.scene.Scene.doLayoutPass(Scene.java:401)
              at javafx.scene.Scene.preferredSize(Scene.java:969)
              at javafx.scene.Scene.impl_initPeer(Scene.java:505)
              at javafx.stage.Window$12.invalidated(Window.java:467)
              at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:57)
              at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
              at javafx.stage.Window.setVisible(Window.java:514)
              at javafx.stage.Stage.setVisible(Stage.java:105)
              at bugsfiling.BarChartSeries.start(BarChartSeries.java:52)
              at com.sun.javafx.application.LauncherImpl$3.run(LauncherImpl.java:127)
              at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:87)
              at com.sun.javafx.application.PlatformImpl$2.run(PlatformImpl.java:65)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
              at com.sun.glass.ui.win.WinApplication$1$1.run(WinApplication.java:49)
              ... 1 more

            psomashe Parvathi Somashekar (Inactive)
            mrkam Alexander Kuznetcov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: