General.ServerExceptions 来自 TimeSeries.add
General.ServerExceptions from TimeSeries.add
我在一个封闭的系统上工作,不能在我的代码中 copy/paste,所以请原谅任何拼写错误,并假设代码在调用 tSeries.add(tsdi) 之前有效;我在哪里得到一般例外 "You are trying to add data where the time period class is org.jfree.data.time.Day but the time series is expecting an instance of java.sql.date"。
最终目标是创建跨越 1 月至 12 月的数据驱动时间序列图表,每个系列都是来自不同年份的数据。未显示的代码全部取自其他地方的演示和示例,并使用演示数据。此时我正在尝试插入自己的数据并遇到问题。我正在使用 1.0.19 并且知道这些方法已经过时,但我正在使用我目前可以找到的方法。
我试过了
tSeries.add(new Day(rsGetData.getDate("date")),rsGetData.getFloat("elevation")));
但得到相同的结果。所有这些让我相信
tSeries.add(rsGetData.getDate("date"),rsGetData.getFloat("elevation"));
会工作,但我收到以下投诉,"The Method add(TimeSeriesDataItem, Boolean) in type TimeSeries is not applicable for the arguments (Date, float)"
我有以下代码(rsGetData 是日期、浮点数对的有效 RecordSet):
TimeSeries tSeries = new TimeSeries(theYear, Date.class);
while(rsGetData.next()){
System.out.println("1"+rsGetData.getDate("date"));
TimeSeriesDataItem tsdi = new TimeSeriesDataItem (new Day(rsGetData.getDate("date")),rsGetData.getFloat("elevation"))
System.out.println("2"+tsdi.getValue()+"::"+tsdi.getPeriod());
tSeries.add(tsdi);
System.out.println("3");
}
如果您需要更多信息,请告诉我。非常感谢任何帮助!
以全新的视角回答了我自己的问题。 Date.class,
TimeSeries tSeries = new TimeSeries(theYear, Date.class);
必须更改为 Day.class、
TimeSeries tSeries = new TimeSeries(theYear, Day.class);
给定的错误并没有真正指出问题所在,但它是有道理的,因为提供给 TimeSeries tSeries 的数据是一天而不是日期。
进入下一个障碍,即设置 Jan-Dec 的域范围,而不用担心年份。
感谢所有看过这个问题并花时间试图弄明白的人。 @trashgod,以后我会尽量完善我的问题。
我在一个封闭的系统上工作,不能在我的代码中 copy/paste,所以请原谅任何拼写错误,并假设代码在调用 tSeries.add(tsdi) 之前有效;我在哪里得到一般例外 "You are trying to add data where the time period class is org.jfree.data.time.Day but the time series is expecting an instance of java.sql.date"。
最终目标是创建跨越 1 月至 12 月的数据驱动时间序列图表,每个系列都是来自不同年份的数据。未显示的代码全部取自其他地方的演示和示例,并使用演示数据。此时我正在尝试插入自己的数据并遇到问题。我正在使用 1.0.19 并且知道这些方法已经过时,但我正在使用我目前可以找到的方法。
我试过了
tSeries.add(new Day(rsGetData.getDate("date")),rsGetData.getFloat("elevation")));
但得到相同的结果。所有这些让我相信
tSeries.add(rsGetData.getDate("date"),rsGetData.getFloat("elevation"));
会工作,但我收到以下投诉,"The Method add(TimeSeriesDataItem, Boolean) in type TimeSeries is not applicable for the arguments (Date, float)"
我有以下代码(rsGetData 是日期、浮点数对的有效 RecordSet):
TimeSeries tSeries = new TimeSeries(theYear, Date.class);
while(rsGetData.next()){
System.out.println("1"+rsGetData.getDate("date"));
TimeSeriesDataItem tsdi = new TimeSeriesDataItem (new Day(rsGetData.getDate("date")),rsGetData.getFloat("elevation"))
System.out.println("2"+tsdi.getValue()+"::"+tsdi.getPeriod());
tSeries.add(tsdi);
System.out.println("3");
}
如果您需要更多信息,请告诉我。非常感谢任何帮助!
以全新的视角回答了我自己的问题。 Date.class,
TimeSeries tSeries = new TimeSeries(theYear, Date.class);
必须更改为 Day.class、
TimeSeries tSeries = new TimeSeries(theYear, Day.class);
给定的错误并没有真正指出问题所在,但它是有道理的,因为提供给 TimeSeries tSeries 的数据是一天而不是日期。
进入下一个障碍,即设置 Jan-Dec 的域范围,而不用担心年份。
感谢所有看过这个问题并花时间试图弄明白的人。 @trashgod,以后我会尽量完善我的问题。