public class JfreeChartDemo {
private static DefaultCategoryDataset dataset = new DefaultCategoryDataset();
private DefaultCategoryDataset getDataset() {// 取数据
List processOrdertList=new DBOperate().getMatchProcessOrders();
for(int i=0;i<processOrdertList.size();i++){
Order order = (Order)processOrdertList.get(i);
double dt = Double.parseDouble(String.valueOf(order.getTime()));
dataset.addValue(dt, order.getAddress(), order.getPayment());
}
return dataset;
}
public String drawPic(HttpSession session, JspWriter out) {
String fileName = null;
JFreeChart chart = ChartFactory.createBarChart3D("2007-08成本统计", "费用类型",
"金额(单位:元)", getDataset(), PlotOrientation.VERTICAL, true, true,
true);
chart.setBackgroundPaint(Color.WHITE);
CategoryPlot plot = chart.getCategoryPlot();// 获取绘图区
plot.setBackgroundPaint(new Color(255, 255, 255)); // 设置绘图区背景色
plot.setRangeGridlinePaint(Color.gray); // 设置水平方向背景线颜色
plot.setRangeGridlinesVisible(true); // 设置是否显示水平方向背景线,默认值为True
plot.setDomainGridlinePaint(Color.black); // 设置垂直方向背景线颜色
// plot.setDomainGridlinesVisible(true); // 设置是否显示垂直方向背景线,默认值为False
CategoryAxis domainAxis = plot.getDomainAxis();// 获取统计种类轴标题(X轴)
plot.setDomainAxis(domainAxis);// 添加X轴
BarRenderer3D renderer = new BarRenderer3D();// 获得BarRenderer3D类的实例,目的是设置柱形的绘制属性
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());// 这条有错
renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator("index2.jsp"));// 生成热点,用于链接
renderer.setItemMargin(0.1);// 设置每个组所包含的平行柱的之间距离
renderer.setSeriesPaint(0, Color.GREEN);// 设置柱子的颜色
renderer.setSeriesPaint(1, Color.blue);// 设置柱子的颜色
renderer.setBaseOutlinePaint(Color.BLACK);
renderer.setWallPaint(Color.gray);// 设置 Wall 的颜色
renderer.setItemLabelAnchorOffset(10D);// 设置柱形图上的文字偏离值
renderer.setBaseItemLabelFont(new Font("arial", Font.PLAIN, 10), true);// 设置柱形图上的文字
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());// //显示每个柱的数值,并修改该数值的字体属性
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
renderer.setBaseItemLabelsVisible(true);
renderer.setMaximumBarWidth(0.050000000000000003D);
plot.setRenderer(renderer);
plot.setForegroundAlpha(0.80f);// 设置柱的透明度
// plot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);//设置显示位置
plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);// 设置显示位置
try {
PrintWriter pw = new PrintWriter(out);
StandardEntityCollection sec = new StandardEntityCollection();
ChartRenderingInfo info = new ChartRenderingInfo(sec);
fileName = ServletUtilities.saveChartAsPNG(chart, 640, 400, info,
session);
// ChartUtilities.writeChartAsPNG(op,chart, 640, 400, info,true,0);
ChartUtilities.writeImageMap(pw, fileName, info, true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return fileName;
}
}
在eclipse有错那快点击后提示configure build path。请问大家这个错误怎么调试啊
private static DefaultCategoryDataset dataset = new DefaultCategoryDataset();
private DefaultCategoryDataset getDataset() {// 取数据
List processOrdertList=new DBOperate().getMatchProcessOrders();
for(int i=0;i<processOrdertList.size();i++){
Order order = (Order)processOrdertList.get(i);
double dt = Double.parseDouble(String.valueOf(order.getTime()));
dataset.addValue(dt, order.getAddress(), order.getPayment());
}
return dataset;
}
public String drawPic(HttpSession session, JspWriter out) {
String fileName = null;
JFreeChart chart = ChartFactory.createBarChart3D("2007-08成本统计", "费用类型",
"金额(单位:元)", getDataset(), PlotOrientation.VERTICAL, true, true,
true);
chart.setBackgroundPaint(Color.WHITE);
CategoryPlot plot = chart.getCategoryPlot();// 获取绘图区
plot.setBackgroundPaint(new Color(255, 255, 255)); // 设置绘图区背景色
plot.setRangeGridlinePaint(Color.gray); // 设置水平方向背景线颜色
plot.setRangeGridlinesVisible(true); // 设置是否显示水平方向背景线,默认值为True
plot.setDomainGridlinePaint(Color.black); // 设置垂直方向背景线颜色
// plot.setDomainGridlinesVisible(true); // 设置是否显示垂直方向背景线,默认值为False
CategoryAxis domainAxis = plot.getDomainAxis();// 获取统计种类轴标题(X轴)
plot.setDomainAxis(domainAxis);// 添加X轴
BarRenderer3D renderer = new BarRenderer3D();// 获得BarRenderer3D类的实例,目的是设置柱形的绘制属性
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());// 这条有错
renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator("index2.jsp"));// 生成热点,用于链接
renderer.setItemMargin(0.1);// 设置每个组所包含的平行柱的之间距离
renderer.setSeriesPaint(0, Color.GREEN);// 设置柱子的颜色
renderer.setSeriesPaint(1, Color.blue);// 设置柱子的颜色
renderer.setBaseOutlinePaint(Color.BLACK);
renderer.setWallPaint(Color.gray);// 设置 Wall 的颜色
renderer.setItemLabelAnchorOffset(10D);// 设置柱形图上的文字偏离值
renderer.setBaseItemLabelFont(new Font("arial", Font.PLAIN, 10), true);// 设置柱形图上的文字
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());// //显示每个柱的数值,并修改该数值的字体属性
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
renderer.setBaseItemLabelsVisible(true);
renderer.setMaximumBarWidth(0.050000000000000003D);
plot.setRenderer(renderer);
plot.setForegroundAlpha(0.80f);// 设置柱的透明度
// plot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);//设置显示位置
plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);// 设置显示位置
try {
PrintWriter pw = new PrintWriter(out);
StandardEntityCollection sec = new StandardEntityCollection();
ChartRenderingInfo info = new ChartRenderingInfo(sec);
fileName = ServletUtilities.saveChartAsPNG(chart, 640, 400, info,
session);
// ChartUtilities.writeChartAsPNG(op,chart, 640, 400, info,true,0);
ChartUtilities.writeImageMap(pw, fileName, info, true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return fileName;
}
}
在eclipse有错那快点击后提示configure build path。请问大家这个错误怎么调试啊
这条语句包错,提示信息是configure build path
输入引用也没提示