[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 | * o------------------------------------------------------------------------------o |
---|
| 9 | * | This file is part of the RGraph package - you can learn more at: | |
---|
| 10 | * | | |
---|
| 11 | * | http://www.rgraph.net | |
---|
| 12 | * | | |
---|
| 13 | * | This package is licensed under the RGraph license. For all kinds of business | |
---|
| 14 | * | purposes there is a small one-time licensing fee to pay and for non | |
---|
| 15 | * | commercial purposes it is free to use. You can read the full license here: | |
---|
| 16 | * | | |
---|
| 17 | * | http://www.rgraph.net/LICENSE.txt | |
---|
| 18 | * o------------------------------------------------------------------------------o |
---|
| 19 | */ |
---|
| 20 | --> |
---|
| 21 | <title>RGraph: Javascript charts and graph library - donut charts</title> |
---|
| 22 | |
---|
| 23 | <meta name="keywords" content="rgraph html5 canvas example donut charts" /> |
---|
| 24 | <meta name="description" content="RGraph: Javascript charts and graph library - Donut charts examples" /> |
---|
| 25 | |
---|
| 26 | <meta property="og:title" content="RGraph: Javascript charts and graph library" /> |
---|
| 27 | <meta property="og:description" content="A charts library based on the HTML5 canvas tag" /> |
---|
| 28 | <meta property="og:image" content="http://www.rgraph.net/images/logo.png"/> |
---|
| 29 | |
---|
| 30 | <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" /> |
---|
| 31 | <link rel="icon" type="image/png" href="../images/favicon.png"> |
---|
| 32 | |
---|
| 33 | <script src="../libraries/RGraph.common.core.js" ></script> |
---|
| 34 | <script src="../libraries/RGraph.common.context.js" ></script> |
---|
| 35 | <script src="../libraries/RGraph.common.annotate.js" ></script> |
---|
| 36 | <script src="../libraries/RGraph.common.tooltips.js" ></script> |
---|
| 37 | <script src="../libraries/RGraph.common.zoom.js" ></script> |
---|
| 38 | <script src="../libraries/RGraph.pie.js" ></script> |
---|
| 39 | <!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]--> |
---|
| 40 | |
---|
| 41 | <script> |
---|
| 42 | window.onload = function () |
---|
| 43 | { |
---|
| 44 | var donut = new RGraph.Pie('donut1', [41,37,16,3,3]); |
---|
| 45 | donut.Set('chart.variant', 'donut'); |
---|
| 46 | donut.Set('chart.linewidth', 5); |
---|
| 47 | donut.Set('chart.strokestyle', 'white'); |
---|
| 48 | donut.Set('chart.title', "Browser share"); |
---|
| 49 | donut.Set('chart.key', ['MSIE 7 (41%)', 'MSIE 6 (37%)', 'Firefox (16%)', 'Safari (3%)', 'Other (3%)']); |
---|
| 50 | donut.Set('chart.key.shadow', true); |
---|
| 51 | donut.Set('chart.key.shadow.offsetx', 0); |
---|
| 52 | donut.Set('chart.key.shadow.offsety', 0); |
---|
| 53 | donut.Set('chart.key.shadow.blur', 15); |
---|
| 54 | donut.Set('chart.key.shadow.color', '#ccc'); |
---|
| 55 | donut.Set('chart.key.position', 'graph'); |
---|
| 56 | donut.Set('chart.align', 'left'); |
---|
| 57 | donut.Draw(); |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | function getGradient(obj, color) |
---|
| 61 | { |
---|
| 62 | var gradient = obj.context.createRadialGradient(obj.canvas.width / 2, obj.canvas.height / 2, 0, obj.canvas.width / 2, obj.canvas.height / 2, 200); |
---|
| 63 | gradient.addColorStop(0, 'black'); |
---|
| 64 | gradient.addColorStop(0.5, color); |
---|
| 65 | gradient.addColorStop(1, 'black'); |
---|
| 66 | |
---|
| 67 | return RGraph.isIE8() ? color : gradient; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | var donut2 = new RGraph.Pie('donut2', [8,6,5,3,8,9,9,4]); |
---|
| 71 | |
---|
| 72 | // Create the gradients |
---|
| 73 | var gradient = getGradient(donut2, 'red'); |
---|
| 74 | var gradient2 = getGradient(donut2, 'green'); |
---|
| 75 | var gradient3 = getGradient(donut2, 'pink'); |
---|
| 76 | var gradient4 = getGradient(donut2, 'yellow'); |
---|
| 77 | var gradient5 = getGradient(donut2, 'grey'); |
---|
| 78 | var gradient6 = getGradient(donut2, 'cyan'); |
---|
| 79 | var gradient7 = getGradient(donut2, 'red'); |
---|
| 80 | var gradient8 = getGradient(donut2, '#ddd'); |
---|
| 81 | var gradient9 = getGradient(donut2, 'blue'); |
---|
| 82 | |
---|
| 83 | donut2.Set('chart.variant', 'donut'); |
---|
| 84 | donut2.Set('chart.labels', ['Flipper', 'Harry', 'Ben', 'Richard', 'Keith', 'Ben', 'George', 'Barry']); |
---|
| 85 | donut2.Set('chart.title', "Sales figures for week 43"); |
---|
| 86 | donut2.Set('chart.gutter.left', 35); |
---|
| 87 | donut2.Set('chart.gutter.right', 35); |
---|
| 88 | donut2.Set('chart.strokestyle', 'rgba(0,0,0,0)'); |
---|
| 89 | donut2.Set('chart.colors', [gradient, gradient2, gradient3, gradient4, gradient5, gradient6, gradient7, gradient8, gradient9]); |
---|
| 90 | donut2.Draw(); |
---|
| 91 | } |
---|
| 92 | </script> |
---|
| 93 | |
---|
| 94 | <script> |
---|
| 95 | var _gaq = _gaq || []; |
---|
| 96 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
| 97 | _gaq.push(['_trackPageview']); |
---|
| 98 | |
---|
| 99 | (function() { |
---|
| 100 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
| 101 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
| 102 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
| 103 | })(); |
---|
| 104 | </script> |
---|
| 105 | </head> |
---|
| 106 | <body> |
---|
| 107 | |
---|
| 108 | <!-- Social networking buttons --> |
---|
| 109 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
| 110 | <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> |
---|
| 111 | <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> |
---|
| 112 | </div> |
---|
| 113 | |
---|
| 114 | <script> |
---|
| 115 | // Opera fix |
---|
| 116 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
| 117 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
| 118 | } |
---|
| 119 | </script> |
---|
| 120 | <!-- Social networking buttons --> |
---|
| 121 | |
---|
| 122 | <div id="breadcrumb"> |
---|
| 123 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
| 124 | > |
---|
| 125 | <a href="./index.html">Examples</a> |
---|
| 126 | > |
---|
| 127 | Donut charts |
---|
| 128 | </div> |
---|
| 129 | |
---|
| 130 | <h1>RGraph: <span>Javascript charts and graph library</span> - Donut charts</h1> |
---|
| 131 | |
---|
| 132 | <script> |
---|
| 133 | if (RGraph.isIE8()) { |
---|
| 134 | 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>'); |
---|
| 135 | } |
---|
| 136 | </script> |
---|
| 137 | |
---|
| 138 | <div> |
---|
| 139 | |
---|
| 140 | <p> |
---|
| 141 | Formerly the Donut chart was a separate class, though now it's a variant of the Pie chart. This means smaller downloads and |
---|
| 142 | a much simpler implementation. Essentially it's a Pie chart with a big hole in the middle. |
---|
| 143 | comparisons easier. |
---|
| 144 | </p> |
---|
| 145 | |
---|
| 146 | <div> |
---|
| 147 | <ul> |
---|
| 148 | <li><a href="../docs/pie.html">Pie charts API documentation</a></li> |
---|
| 149 | </ul> |
---|
| 150 | </div> |
---|
| 151 | |
---|
| 152 | <div> |
---|
| 153 | <canvas id="donut1" width="430" height="350">[No canvas support]</canvas> |
---|
| 154 | <canvas id="donut2" width="450" height="350">[No canvas support]</canvas> |
---|
| 155 | </div> |
---|
| 156 | </div> |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | </body> |
---|
| 160 | </html> |
---|