[77] | 1 | <?php ob_start('ob_gzhandler') ?> |
---|
| 2 | <!DOCTYPE html > |
---|
| 3 | <html> |
---|
| 4 | <head> |
---|
| 5 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> |
---|
| 6 | |
---|
| 7 | <!-- |
---|
| 8 | /** |
---|
| 9 | * o------------------------------------------------------------------------------o |
---|
| 10 | * | This file is part of the RGraph package - you can learn more at: | |
---|
| 11 | * | | |
---|
| 12 | * | http://www.rgraph.net | |
---|
| 13 | * | | |
---|
| 14 | * | This package is licensed under the RGraph license. For all kinds of business | |
---|
| 15 | * | purposes there is a small one-time licensing fee to pay and for non | |
---|
| 16 | * | commercial purposes it is free to use. You can read the full license here: | |
---|
| 17 | * | | |
---|
| 18 | * | http://www.rgraph.net/LICENSE.txt | |
---|
| 19 | * o------------------------------------------------------------------------------o |
---|
| 20 | */ |
---|
| 21 | --> |
---|
| 22 | <title>RGraph: Javascript charts and graph library - line charts</title> |
---|
| 23 | |
---|
| 24 | <meta name="keywords" content="rgraph html5 canvas example line chart" /> |
---|
| 25 | <meta name="description" content="RGraph: Javascript charts and graph library - Line chart example" /> |
---|
| 26 | |
---|
| 27 | <meta property="og:title" content="RGraph: Javascript charts and graph library" /> |
---|
| 28 | <meta property="og:description" content="A charts library based on the HTML5 canvas tag" /> |
---|
| 29 | <meta property="og:image" content="http://www.rgraph.net/images/logo.png"/> |
---|
| 30 | |
---|
| 31 | <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" /> |
---|
| 32 | <link rel="icon" type="image/png" href="../images/favicon.png"> |
---|
| 33 | |
---|
| 34 | <script src="../libraries/RGraph.common.core.js" ></script> |
---|
| 35 | <script src="../libraries/RGraph.common.context.js" ></script> |
---|
| 36 | <script src="../libraries/RGraph.common.annotate.js" ></script> |
---|
| 37 | <script src="../libraries/RGraph.common.tooltips.js" ></script> |
---|
| 38 | <script src="../libraries/RGraph.common.zoom.js" ></script> |
---|
| 39 | <script src="../libraries/RGraph.common.resizing.js" ></script> |
---|
| 40 | <script src="../libraries/RGraph.line.js" ></script> |
---|
| 41 | <!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]--> |
---|
| 42 | |
---|
| 43 | <script> |
---|
| 44 | window.onload = function () |
---|
| 45 | { |
---|
| 46 | var line1 = new RGraph.Line('line1', [56,45,43,52,56,65,21,23,34,15,21,-12,-13,-31,-25], [35,43,41,41,42,46,42,39,46,41,45,65,54,54,41,41]); |
---|
| 47 | line1.Set('chart.background.barcolor1', 'white'); |
---|
| 48 | line1.Set('chart.background.barcolor2', 'white'); |
---|
| 49 | line1.Set('chart.background.grid', true); |
---|
| 50 | line1.Set('chart.linewidth', 5); |
---|
| 51 | line1.Set('chart.gutter.left', 35); |
---|
| 52 | line1.Set('chart.hmargin', 5); |
---|
| 53 | line1.Set('chart.shadow', true); |
---|
| 54 | line1.Set('chart.tickmarks', null); |
---|
| 55 | line1.Set('chart.units.post', 'k'); |
---|
| 56 | line1.Set('chart.xticks', 8); |
---|
| 57 | line1.Set('chart.colors', ['red', 'green']); |
---|
| 58 | line1.Set('chart.key', ['Sales (not good)','Costs (reasonably consistent)']); |
---|
| 59 | line1.Set('chart.key.shadow', true); |
---|
| 60 | line1.Set('chart.key.shadow.offsetx', 0); |
---|
| 61 | line1.Set('chart.key.shadow.offsety', 0); |
---|
| 62 | line1.Set('chart.key.shadow.blur', 15); |
---|
| 63 | line1.Set('chart.key.shadow.color', '#ddd'); |
---|
| 64 | line1.Set('chart.key.rounded', true); |
---|
| 65 | line1.Set('chart.key.position', 'graph'); |
---|
| 66 | line1.Set('chart.key.position.x', line1.Get('chart.gutter.left') + 4); |
---|
| 67 | line1.Set('chart.key.position.y', (line1.canvas.height / 2) + 5); |
---|
| 68 | line1.Set('chart.xaxispos', 'center'); |
---|
| 69 | line1.Set('chart.background.grid.autofit', true); |
---|
| 70 | line1.Set('chart.background.grid.autofit.numhlines', 16); |
---|
| 71 | line1.Set('chart.title', 'Sales last year'); |
---|
| 72 | line1.Draw(); |
---|
| 73 | |
---|
| 74 | var line2 = new RGraph.Line('line2', [6,5,4,5,6,4,1,2,3], [7,8,9,9,8,7,8,7,6]); |
---|
| 75 | line2.Set('chart.labels', ['13th','14th','15th','16th','15th','16th','17th','18th','19th']); |
---|
| 76 | line2.Set('chart.title', 'Range of fuel consumption'); |
---|
| 77 | line2.Set('chart.title.vpos', 0.5); |
---|
| 78 | line2.Set('chart.background.barcolor1', 'white'); |
---|
| 79 | line2.Set('chart.background.barcolor2', 'white'); |
---|
| 80 | line2.Set('chart.filled', true); |
---|
| 81 | line2.Set('chart.filled.range', true); |
---|
| 82 | line2.Set('chart.fillstyle', 'rgba(128,255,128,0.5)'); |
---|
| 83 | line2.Set('chart.linewidth', 2); |
---|
| 84 | line2.Set('chart.colors', ['green']); |
---|
| 85 | line2.Set('chart.hmargin', 5); |
---|
| 86 | line2.Draw(); |
---|
| 87 | } |
---|
| 88 | </script> |
---|
| 89 | |
---|
| 90 | <script> |
---|
| 91 | var _gaq = _gaq || []; |
---|
| 92 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
| 93 | _gaq.push(['_trackPageview']); |
---|
| 94 | |
---|
| 95 | (function() { |
---|
| 96 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
| 97 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
| 98 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
| 99 | })(); |
---|
| 100 | </script> |
---|
| 101 | |
---|
| 102 | </head> |
---|
| 103 | <body> |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | <!-- Social networking buttons --> |
---|
| 107 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
| 108 | <a title="Bookmark with delicious" href="http://delicious.com/save?jump=close&v=4&noui&jump=close&url=http://www.rgraph.net¬es=RGraph%20is%20a%20HTML5%20based%20javascript%20charts%20library%20supporting%20a%20wide%20range%20of%20different%20charts%20types&title=RGraph:Javascript%20charts%20and%20graphs%20library" target="_blank"><img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" /></a> |
---|
| 109 | <a href="http://twitter.com/home/?status=RGraph%3A%20Javascript+charts+and+graph+library+http%3A%2F%2Fwww.rgraph.net+%23rgraph+%23html5+%23canvas+%23javascript+%23charts+@_rgraph" target="_blank"><img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" /></a> |
---|
| 110 | </div> |
---|
| 111 | |
---|
| 112 | <script> |
---|
| 113 | // Opera fix |
---|
| 114 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
| 115 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
| 116 | } |
---|
| 117 | </script> |
---|
| 118 | <!-- Social networking buttons --> |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | <div id="breadcrumb"> |
---|
| 122 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
| 123 | > |
---|
| 124 | <a href="./index.html">Examples</a> |
---|
| 125 | > |
---|
| 126 | Line chart |
---|
| 127 | </div> |
---|
| 128 | |
---|
| 129 | <h1>RGraph: <span>Javascript charts and graph library</span> - Line charts</h1> |
---|
| 130 | |
---|
| 131 | <script> |
---|
| 132 | if (RGraph.isIE8()) { |
---|
| 133 | document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br /> Internet Explorer 8 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. Click <a href="http://support.rgraph.net/message/rgraph-in-internet-explorer-9.html" target="_blank">here</a> to see some screenshots.</div>'); |
---|
| 134 | } |
---|
| 135 | </script> |
---|
| 136 | |
---|
| 137 | <div> |
---|
| 138 | <p> |
---|
| 139 | Like Bar charts, Line charts are some of the most versatile chart types. It is similar, but can indicate chronological |
---|
| 140 | data better. Line charts are good if, for example, you want to illustrate sales figures over a year (or any period of |
---|
| 141 | time). You'll then be able to easily see whether sales are going up, down or are stagnant. It will also become apparent |
---|
| 142 | which months are busier than others. By using a multiple line chart you can add multiple sets of data (eg two or more years |
---|
| 143 | of figures) to your chart. You can customise the line chart by stipulating it as being filled, having drop shadows, keys, |
---|
| 144 | having the X axis in the centre, different colors, different tickmark styles and tooltips etc. |
---|
| 145 | </p> |
---|
| 146 | |
---|
| 147 | <p> |
---|
| 148 | The first chart uses external DIVs for the tooltip contents. The DIVs are at the bottom of this page (they're set not to |
---|
| 149 | be visible). Using external DIVs for tooltips can make maintenance easier. |
---|
| 150 | </p> |
---|
| 151 | |
---|
| 152 | <div> |
---|
| 153 | <ul> |
---|
| 154 | <li><a href="../docs/line.html">Line charts API documentation</a></li> |
---|
| 155 | </ul> |
---|
| 156 | </div> |
---|
| 157 | |
---|
| 158 | <div> |
---|
| 159 | <canvas id="line1" width="475" height="250">[Please wait...]</canvas> |
---|
| 160 | <canvas id="line2" width="475" height="250">[Please wait...]</canvas> |
---|
| 161 | </div> |
---|
| 162 | </div> |
---|
| 163 | |
---|
| 164 | </body> |
---|
| 165 | </html> |
---|