如何在javaFX中为xylinechart
的时间戳设置x轴范围?
以下是例外:
Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.Number
at javafx.scene.chart.ValueAxis.invalidateRange(ValueAxis.java:446)
at javafx.scene.chart.LineChart.updateAxisRange(LineChart.java:174)
at javafx.scene.chart.XYChart.layoutChartChildren(XYChart.java:668)
答案 0 :(得分:0)
您的问题是ValueAxis扩展了Axis< Number>。我猜你正在尝试将Timestamp值添加到该范围的数据集中。试试这个(Timestamp是Date的子类):
http://myjavafx.blogspot.com/2013/09/javafx-charts-display-date-values-on.html