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 - Animated Pie chart</title> |
---|
22 | |
---|
23 | <meta name="keywords" content="rgraph html5 canvas chart docs animated pie chart" /> |
---|
24 | <meta name="description" content="RGraph: Javascript charts and graph library - An example of an animated Pie chart" /> |
---|
25 | |
---|
26 | <meta property="og:title" content="RGraph: Javascript charts and graph library" /> |
---|
27 | <meta property="og:description" content="A chart 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 | |
---|
34 | <!-- These are the Javascript includes that pull in the RGraph libraries (and ExCanvas) --> |
---|
35 | <script src="../libraries/RGraph.common.core.js" ></script> |
---|
36 | <script src="../libraries/RGraph.common.tooltips.js" ></script> |
---|
37 | <script src="../libraries/RGraph.pie.js" ></script> |
---|
38 | <!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]--> |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | <script> |
---|
43 | var _gaq = _gaq || []; |
---|
44 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
45 | _gaq.push(['_trackPageview']); |
---|
46 | |
---|
47 | (function() { |
---|
48 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
49 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
50 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
51 | })(); |
---|
52 | </script> |
---|
53 | </head> |
---|
54 | <body> |
---|
55 | |
---|
56 | |
---|
57 | <!-- Social networking buttons --> |
---|
58 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
59 | <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> |
---|
60 | <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> |
---|
61 | </div> |
---|
62 | |
---|
63 | <script> |
---|
64 | // Opera fix |
---|
65 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
66 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
67 | } |
---|
68 | </script> |
---|
69 | <!-- Social networking buttons --> |
---|
70 | |
---|
71 | <div id="breadcrumb"> |
---|
72 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
73 | > |
---|
74 | <a href="index.html">Documentation</a> |
---|
75 | > |
---|
76 | An example of an animated & interactive Pie chart |
---|
77 | </div> |
---|
78 | |
---|
79 | <h1>RGraph: <span>Javascript charts and graph library</span> - An example of an animated & interactive Pie chart</h1> |
---|
80 | |
---|
81 | <script> |
---|
82 | if (RGraph.isIE8()) { |
---|
83 | document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br />Because of the need for a global variable, this example does not work in Internet Explorer 8</div>'); |
---|
84 | } |
---|
85 | </script> |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | <!-- This is the canvas that the Pie chart is drawn on --> |
---|
90 | <canvas id="cvs" width="500" height="300" style="float: right">[No canvas support]</canvas> |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | <script> |
---|
95 | pie = new RGraph.Pie('cvs', [24,43,51,16,26,23,35]); |
---|
96 | pie.Set('chart.strokestyle', 'rgba(0,0,0,0)'); |
---|
97 | pie.Set('chart.labels', ['Richard','John','Kev','Lou','Pete','Fred','Bob']); |
---|
98 | pie.Set('chart.tooltips', ['Richard','John','Kev','Lou','Pete','Fred','Bob']); |
---|
99 | //pie.Set('chart.tooltips.event', 'onmousemove'); |
---|
100 | pie.Set('chart.highlight.style', 'explode'); |
---|
101 | pie.Set('chart.labels.sticks', true); |
---|
102 | pie.Set('chart.radius', 100); |
---|
103 | pie.Draw(); |
---|
104 | </script> |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | <p> |
---|
109 | This example shows animated segment separation. This used to be something that had to be done seperately, however now it's |
---|
110 | built into the Pie chart as a tooltip effect. You can utilise the effect by using the <i>chart.highlight.style</i> setting |
---|
111 | like this: |
---|
112 | </p> |
---|
113 | |
---|
114 | <br clear="all" /> |
---|
115 | |
---|
116 | |
---|
117 | <pre class="code"> |
---|
118 | <script> |
---|
119 | window.onload = function () |
---|
120 | { |
---|
121 | var pie = new RGraph.Pie('cvs', [24,43,51,16,26,23,35]); |
---|
122 | pie.Set('chart.strokestyle', 'rgba(0,0,0,0)'); |
---|
123 | pie.Set('chart.labels', ['Richard','John','Kev','Lou','Pete','Fred','Bob']); |
---|
124 | pie.Set('chart.tooltips', ['Richard','John','Kev','Lou','Pete','Fred','Bob']); |
---|
125 | <span style="color: green">pie.Set('chart.highlight.style', 'explode');</span> |
---|
126 | pie.Set('chart.labels.sticks', true); |
---|
127 | pie.Set('chart.radius', 100); |
---|
128 | pie.Draw(); |
---|
129 | } |
---|
130 | </script> |
---|
131 | </pre> |
---|
132 | |
---|
133 | <p> |
---|
134 | <a href="animation.html">« Back to animation page</a> |
---|
135 | </p> |
---|
136 | |
---|
137 | </body> |
---|
138 | </html> |
---|