• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error when creating a chart

 
Derek Smiths
Ranch Hand
Posts: 119
Eclipse IDE Mac VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why am I getting a ClassCastException here?
javafx.scene.chart.NumberAxis cannot be cast to javafx.scene.chart.XYChart$Series

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solarChart.getData().addAll(xHoursAxis, yPowerAxis);

Because getData returns an ObservableList<Series<X,Y>>. You can't add Axis instances to that; you have to add Series instances.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!