设为首页收藏本站

birt家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7087|回复: 0

RGraph 官方图表示例(十二)线图

[复制链接]
发表于 2012-8-9 09:50:06 | 显示全部楼层 |阅读模式
这是RGraph 官方线图的示例
效果如下:


代码如下:
  1. <%@ include file="/common/tags.jsp"%>
  2. <%@ page contentType="text/html; charset=utf-8"%>
  3. <!DOCTYPE html>
  4. <html>
  5.     <head>
  6.         <title>RGraph: An example of the Line chart</title>
  7.         <meta name="keywords" content="rgraph html5 canvas example line charts" />
  8.         <meta name="description" content="An example of the Line chart that RGraph can produce" />
  9.         <meta name="googlebot" content="NOODP">
  10.         <meta property="og:title" content="RGraph: HTML5 Javascript charts library" />
  11.         <meta property="og:description" content="A charts library based on the HTML5 canvas tag" />
  12.         <meta property="og:image" content="http://www.rgraph.net/images/logo.png"/>
  13.         <link rel="stylesheet" href="${ctx}/script/html5/rgraph/css/website.css" type="text/css" media="screen" />
  14.         <link rel="icon" type="image/png" href="${ctx}/script/html5/rgraph/images/favicon.png">
  15.         <!-- Place this tag in your head or just before your close body tag -->
  16.         <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
  17.         <script src="${ctx}/script/html5/rgraph/libraries/RGraph.common.core.js" ></script>
  18.         <script src="${ctx}/script/html5/rgraph/libraries/RGraph.line.js" ></script>
  19.         <!--[if lt IE 9]><script src="${ctx}/script/html5/rgraph/excanvas/excanvas.original.js"></script><![endif]-->
  20.         <script>
  21.             $(function(){
  22.                 _createChart();
  23.             });
  24.             /**
  25.              * 线图
  26.              */
  27.             function _createChart(){
  28.                 var line1 = new RGraph.Line('line1', [56,45,43,52,56,65,21,23,34,15,21,12], [35,43,41,41,42,46,42,39,46,41,45,65,54]);
  29.                 line1.Set('chart.background.grid', true);
  30.                 line1.Set('chart.linewidth', 5);
  31.                 line1.Set('chart.gutter.left', 35);
  32.                 line1.Set('chart.hmargin', 5);
  33.                 if (!document.all || RGraph.isIE9up()) {
  34.                     line1.Set('chart.shadow', true);
  35.                 }
  36.                 line1.Set('chart.tickmarks', null);
  37.                 line1.Set('chart.units.post', 'k');
  38.                 line1.Set('chart.colors', ['red', 'green']);
  39.                 line1.Set('chart.background.grid.autofit', true);
  40.                 line1.Set('chart.background.grid.autofit.numhlines', 10);
  41.                 line1.Set('chart.curvy', 1);
  42.                 line1.Set('chart.curvy.factor', 0.25);
  43.                 line1.Set('chart.labels',['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']);
  44.                 line1.Set('chart.title','A curvy Line chart');
  45.                 line1.Draw();
  46.             }
  47.         </script>
  48.     </head>
  49.     <body>
  50.         <script>
  51.             if (RGraph.isOld()) {
  52.                 document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br /> Internet Explorer does not natively support the HTML5 canvas tag, so if you want to see the charts, you can either:<ul><li>Install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a></li><li>Use ExCanvas. This is provided in the RGraph Archive.</li><li>Use another browser entirely. Your choices are Firefox 3.5+, Chrome 2+, Safari 4+ or Opera 10.5+. </li></ul> <b>Note:</b> Internet Explorer 9 fully supports the canvas tag.</div>');
  53.             }
  54.         </script>
  55.         <div style="text-align: center">
  56.             <canvas id="line1" width="600" height="250">[Please wait...]</canvas>
  57.         </div>
  58.     </div>
  59. </body>
  60. </html>
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|birt家园    

GMT+8, 2020-8-7 11:58 , Processed in 0.280633 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表