• 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic