public class JFreeChart1 extends HttpServlet {
private static final long serialVersionUID = 1L;
public JFreeChart1() {
super();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
TimeSeries xyseries = new TimeSeries("finince income", Month.class);
TimeSeriesCollection xyseriescollection = new TimeSeriesCollection();
xyseriescollection.addSeries(xyseries);
JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Example",
"y", "x", xyseriescollection, true, true, true);
jfreechart.setBackgroundPaint(Color.white);
XYPlot xyplot = jfreechart.getXYPlot();
xyplot.setNoDataMessage("no data to display");// 此名可用来做当没有数据的时候jfreechart面板上的显示
StandardEntityCollection sec = new StandardEntityCollection();
ChartRenderingInfo info = new ChartRenderingInfo(sec);
ChartUtilities.writeChartAsPNG(response.getOutputStream(), jfreechart,
600, 400, info);
}
}
已有 0 人发表留言,猛击->>这里<<-参与讨论
JavaEye推荐
文章来源:
http://java-jun.javaeye.com/blog/602654
posted on 2010-02-25 10:59
uqnetlove 阅读(297)
评论(1) 编辑 收藏