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");//?此名可用來做當(dāng)沒有數(shù)據(jù)的時候jfreechart面板上的顯示
??
????StandardEntityCollection sec = new StandardEntityCollection();
??ChartRenderingInfo info = new ChartRenderingInfo(sec);
??ChartUtilities.writeChartAsPNG(response.getOutputStream(), jfreechart,
????600, 400, info);
?}
}
已有 0 人發(fā)表留言,猛擊->>這里<<-參與討論
JavaEye推薦
- 上海:天會皓聞?wù)\聘CTO技術(shù)總監(jiān)
- 上海:高薪誠聘Python開發(fā)人員
- 北京:手機之家網(wǎng)站誠聘PHP程序員
- 上海:天會皓聞?wù)\聘資深Java架構(gòu)師
- 成都:月薪5千到1萬招聘Java開發(fā)工程師
文章來源:http://java-jun.javaeye.com/blog/602654