我在这些值ArrayList<DailyPoint> points
:
- 账单:2013-04-12,1150.0
- ImportBill: 2013-04-21,300.0
- 账单:2013-04-28,1200.0
- ImportBill: 2013-04-29,100.0
类 DailyPoint
:
public static class DailyPoint {
public final String name;
public final Date date;
public final double total;
public DailyPoint(String name,Date date,double total) {
this.name=name;
this.date=date;
this.total=total;
}
}
图表代码:
ArrayList<DailyPoint> points;
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
if (points!=null) {
for(int i=0;i<points.size();i++) {
DailyPoint p=points.get(i);
System.out.println(p.name+": "+p.date+","+p.total);
dataset.addValue(p.total, p.name, p.date);
}
JFreeChart chart = ChartFactory.createLineChart(
"Import Bills and Bills", "Date", "Total", dataset,
PlotOrientation.HORIZONTAL, true, true, false);
问题是我得到空白图表......我不知道为什么......我也有过 ImportBill 有 7 个点和 Bill 有 3 个点的情况,只显示 ImportBill 的点......