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

StackedAreaChart throws ClassCastException if x-axis uses string categories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7u6
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      JRE6 Win7 64

      Description

      Apparently, a StackedAreaChart expects Number as x-axis type. A ClassCastException occurs when using a CategoryAxis. After this the scene is frozen (inside a JFXPanel).

      I don't see a reason why the stacked area chart would require numbers on the x-axis while the regular area chart does not. So, preferable it should work with a CategoryAxis as well. Otherwise, it makes sense to document the limitation and probably throw an IllegalArgumentException when trying to use an unsupported axis.

      java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
      at javafx.scene.chart.CategoryAxis.getDisplayPosition(CategoryAxis.java:60)
      at javafx.scene.chart.StackedAreaChart.layoutPlotChildren(StackedAreaChart.java:431)
      at javafx.scene.chart.XYChart.layoutChartChildren(XYChart.java:688)
      at javafx.scene.chart.Chart$1.layoutChildren(Chart.java:84)
      at javafx.scene.Parent.layout(Parent.java:1018)
      at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
      at javafx.scene.Scene.doLayoutPass(Scene.java:484)
      at javafx.scene.Scene.access$3900(Scene.java:169)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2199)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:363)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
      at com.sun.javafx.tk.quantum.QuantumToolkit$9.run(QuantumToolkit.java:329)
      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$2$1.run(WinApplication.java:67)
      at java.lang.Thread.run(Unknown Source)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psomashe Parvathi Somashekar (Inactive)
              Reporter:
              wlehmann Werner Lehmann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: