posts - 10,comments - 1,trackbacks - 0

          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推薦




          文章來源:http://java-jun.javaeye.com/blog/602654
          posted on 2010-02-25 10:59 uqnetlove 閱讀(304) 評論(1)  編輯  收藏

          FeedBack:
          # re: [導(dǎo)入]jfreechart里當(dāng)沒有數(shù)據(jù)顯示時的處理[未登錄]
          2014-08-11 16:11 | Aa
          代碼看的不是很懂
          直接貼代碼的做法真的不怎么樣  回復(fù)  更多評論
            

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 金溪县| 镇赉县| 佛山市| 湘乡市| 温州市| 和硕县| 赤城县| 河东区| 宿迁市| 禄丰县| 松潘县| 贵德县| 曲周县| 长子县| 航空| 略阳县| 西林县| 民丰县| 万山特区| 嘉定区| 定西市| 犍为县| 兰西县| 高雄市| 百色市| 同江市| 达日县| 黄山市| 宜君县| 含山县| 重庆市| 建湖县| 灵川县| 涞水县| 黑河市| 昌邑市| 淮阳县| 郴州市| 澄江县| 乐至县| 九寨沟县|