ChartDirector开发实例

  1. http://www.iteye.com/topic/410124 
  2. <%@page import="ChartDirector.*" %>   
  3. <%   
  4. // The data for the line chart   
  5. double[] data0 = {4249333851462941445759523734515656,   
  6.     6070766367756451};   
  7. double[] data1 = {5055473442496362735956506460676758,   
  8.     5973778482808498};   
  9. double[] data2 = {3628253338202230253330242815212646,   
  10.     4248454352646070};   
  11.   
  12. // The labels for the line chart   
  13. String[] labels = {"0""1""2""3""4""5""6""7""8""9""10""11",   
  14.     "12""13""14""15""16""17""18""19""20""21""22""23""24"};   
  15.   
  16. //设置图表的高和宽600*300,背景色为白色   
  17. XYChart c = new XYChart(6003000xeeeeff0x0000001);   
  18. c.setRoundedFrame();   
  19.   
  20. //设置绘图领域为(55,58) 大小为520*195    
  21. //背景色为白色 横坐标和纵坐标的网格线颜色   
  22. c.setPlotArea(55585201950xffffff, -1, -10xcccccc0xcccccc);   
  23.   
  24. //设置网格上边和标题下边的区域大小为(50, 30),字横向排列,字体为宋体,大小为9   
  25. c.addLegend(5030false"Arial Bold"9).setBackground(Chart.Transparent);   
  26.   
  27. //设置标题的内容,字体,颜色   
  28. c.addTitle("Application Server Throughput""Times New Roman Bold Italic"15  
  29.     ).setBackground(0xccccff0x000000, Chart.glassEffect());   
  30.   
  31. //设置y轴的标题,字体,大小,颜色   
  32. c.yAxis().setTitle("MBytes per hour");   
  33.   
  34. //设置x轴的标签   
  35. c.xAxis().setLabels(labels);   
  36.   
  37. //设置x轴显示数据的跨度   
  38. c.xAxis().setLabelStep(3);   
  39.   
  40. //设置x轴标题,字体,大小,颜色   
  41. c.xAxis().setTitle("Jun 12, 2006");   
  42.   
  43. // Add a line layer to the chart   
  44. LineLayer layer = c.addLineLayer2();   
  45.   
  46. //设置线的宽度2   
  47. layer.setLineWidth(2);   
  48.   
  49. //填写数据,设置线的颜色   
  50. layer.addDataSet(data0, 0xff0000"Server #1");   
  51. layer.addDataSet(data1, 0x008800"Server #2");   
  52. layer.addDataSet(data2, c.dashLineColor(0x3333ff, Chart.DashLine), "Server #3");   
  53.   
  54. //输出图表   
  55. String chart1URL = c.makeSession(request, "chart1");   
  56.   
  57. // Include tool tip for the chart   
  58. String imageMap1 = c.getHTMLImageMap("""",   
  59.     "title='[{dataSetName}] Hour {xLabel}: {value} MBytes'");   
  60. %>   
  61. <html>   
  62. <body topmargin="5" leftmargin="5" rightmargin="0">   
  63. <div style="font-size:18pt; font-family:verdana; font-weight:bold">   
  64.     Multi-Line Chart   
  65. </div>   
  66. <hr color="#000080">   
  67. <a href="viewsource.jsp?file=<%=request.getServletPath()%>">   
  68.     <font size="2" face="Verdana">View Chart Source Code</font>   
  69. </a>   
  70. </div>   
  71. <br>   
  72. <img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'  
  73.     usemap="#map1" border="0">   
  74. <map name="map1"><%=imageMap1%></map>   
  75. </body>   
  76. </html>  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值