隨筆-57  評論-202  文章-17  trackbacks-0
                以前一直是用JFreeChart畫統(tǒng)計圖的,不過JFreeChart畫出來的圖形不夠精細(xì),看起來有些模糊,今天在網(wǎng)上看到另外一個工具ChartDirector,這是一個商業(yè)版本的工具,不過也可以免費使用,只是在畫出來的圖形下面都有一條它的廣告條。
                下面是它的一個柱狀圖的例子:

          threedbar.JPG
                范例程序:

          <%@page import="ChartDirector.*" %>
          <%
          //The data for the bar chart
          double[] data = {85156179.5211123};

          //The labels for the bar chart
          String[] labels = {"Mon""Tue""Wed""Thu""Fri"};

          //Create a XYChart object of size 300 x 280 pixels
          XYChart c = new XYChart(300280);

          //Set the plotarea at (45, 30) and of size 200 x 200 pixels
          c.setPlotArea(4530200200);

          //Add a title to the chart
          c.addTitle("Weekly Server Load");

          //Add a title to the y axis
          c.yAxis().setTitle("MBytes");

          //Add a title to the x axis
          c.xAxis().setTitle("Work Week 25");

          //Add a bar chart layer with green (0x00ff00) bars using the given data
          c.addBarLayer(data, 0xff00).set3D();

          //Set the labels on the x axis.
          c.xAxis().setLabels(labels);

          //output the chart
          String chart1URL = c.makeSession(request, "chart1");

          //include tool tip for the chart
          String imageMap1 = c.getHTMLImageMap("""""title='{xLabel}: {value} MBytes'")
              ;
          %>
          <html>
          <body topmargin="5" leftmargin="5" rightmargin="0">
          <div style="font-size:18pt; font-family:verdana; font-weight:bold">
              3D Bar Chart
          </div>
          <hr color="#000080">
          <a href="viewsource.jsp?file=<%=request.getServletPath()%>">
              
          <font size="2" face="Verdana">View Chart Source Code</font>
          </a>
          </div>
          <br>
          <img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'
              usemap
          ="#map1" border="0">
          <map name="map1"><%=imageMap1%></map>
          </body>
          </html>


                如果要在柱的頂部顯示數(shù)值,可以調(diào)用Layer的setDataLabelFormat方法設(shè)置,范例:layer.setDataLabelFormat("{value}");

                其它的例子可以參考它的文檔的說明。ChartDirector的網(wǎng)址:http://www.advsofteng.com

          posted on 2005-06-14 17:46 小米 閱讀(5248) 評論(5)  編輯  收藏 所屬分類: Java

          評論:
          # re: 用ChartDirector在JSP中畫統(tǒng)計圖 2005-06-14 19:41 | Mstar軟件研發(fā)小組
          這東西的確非常不錯,又好用,功能也很強(qiáng)。可惜就是不是免費的  回復(fù)  更多評論
            
          # re: 用ChartDirector在JSP中畫統(tǒng)計圖 2005-06-15 09:41 | 小米
          看他們公司的地址,應(yīng)該是香港的公司。ChartDirector支持大部分的編程語言,所以是不錯的一個工具。不過,確實是不便宜,按照國內(nèi)的價格來說。  回復(fù)  更多評論
            
          # re: 用ChartDirector在JSP中畫統(tǒng)計圖 2005-06-15 11:43 | Mstar軟件研發(fā)小組
          我在網(wǎng)上搞到過破解的,在一些自己弄得小玩意中用過它。  回復(fù)  更多評論
            
          # re: 用ChartDirector在JSP中畫統(tǒng)計圖 2005-06-15 12:34 | 小米
          呵呵,看看這里,也許有幫助:http://www.javayou.com/showlog.jspe?log_id=414,自己用倒是沒有問題,但是要用在商業(yè)項目上估計就不行了。不知道還有沒有其它開源的工具呢。  回復(fù)  更多評論
            
          # re: 用ChartDirector在JSP中畫統(tǒng)計圖[未登錄] 2008-12-27 14:20 | 冷面閻羅
          生成的jsp圖片,我想點某一個柱,跳轉(zhuǎn)到另一個頁面怎么實現(xiàn)?  回復(fù)  更多評論
            
          主站蜘蛛池模板: 孟州市| 嘉荫县| 汉寿县| 台东县| 巴塘县| 乌海市| 卢氏县| 阿拉善右旗| 彭阳县| 合山市| 尼木县| 新源县| 芷江| 金溪县| 邵阳县| 神木县| 盈江县| 息烽县| 壤塘县| 灵山县| 莒南县| 萍乡市| 驻马店市| 泰和县| 巴林右旗| 宕昌县| 老河口市| 清远市| 司法| 巴东县| 广平县| 通江县| 南汇区| 南澳县| 塔城市| 霍邱县| 郧西县| 龙陵县| 兴海县| 吴桥县| 河西区|