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 - Examples of keys</title> |
---|
22 | |
---|
23 | <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" /> |
---|
24 | <link rel="icon" type="image/png" href="../favicon.png"> |
---|
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.jpg"/> |
---|
29 | |
---|
30 | <script src="../libraries/RGraph.common.core.js" ></script> |
---|
31 | <script src="../libraries/RGraph.line.js" ></script> |
---|
32 | <script src="../libraries/RGraph.pie.js" ></script> |
---|
33 | <!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]--> |
---|
34 | |
---|
35 | <script> |
---|
36 | window.onload = function () |
---|
37 | { |
---|
38 | var pie = new RGraph.Pie('myPie', [45,43,23,68,84,41]); |
---|
39 | pie.Set('chart.title', 'A pie chart showing gutter mode'); |
---|
40 | |
---|
41 | pie.Set('chart.key', ['John','Fred','Lou','Pete','Kevin','Gary']); |
---|
42 | pie.Set('chart.key.position', 'gutter'); |
---|
43 | pie.Set('chart.key.position.y', pie.canvas.height - 35); |
---|
44 | pie.Set('chart.key.rounded', false); |
---|
45 | pie.Set('chart.key.shadow', true); |
---|
46 | pie.Set('chart.key.shadow.offsetx', 3); |
---|
47 | pie.Set('chart.key.shadow.offsety', 3); |
---|
48 | pie.Set('chart.key.shadow.blur', 0); |
---|
49 | pie.Set('chart.key.shadow.color', '#aaa'); |
---|
50 | |
---|
51 | pie.Draw(); |
---|
52 | |
---|
53 | var line = new RGraph.Line('myLine', [8,4,2,5,6,4,3,7,8,9,7,6], [4,3,1,6,5,8,4,9,8,7,4,6]); |
---|
54 | line.Set('chart.key', ['Richard', 'Fred']); |
---|
55 | line.Set('chart.title', 'A line chart showing the key in graph mode (interactive)'); |
---|
56 | line.Set('chart.key.position', 'graph'); |
---|
57 | line.Set('chart.key.shadow', true); |
---|
58 | line.Set('chart.key.shadow.offsetx', 0); |
---|
59 | line.Set('chart.key.shadow.offsety', 0); |
---|
60 | line.Set('chart.key.shadow.blur', 15); |
---|
61 | line.Set('chart.key.shadow.color', '#ccc'); |
---|
62 | line.Set('chart.key.interactive', true); |
---|
63 | line.Set('chart.hmargin', 5); |
---|
64 | line.Set('chart.linewidth', 3); |
---|
65 | line.Set('chart.labels', ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']); |
---|
66 | line.Draw(); |
---|
67 | } |
---|
68 | </script> |
---|
69 | |
---|
70 | <script> |
---|
71 | var _gaq = _gaq || []; |
---|
72 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
73 | _gaq.push(['_trackPageview']); |
---|
74 | |
---|
75 | (function() { |
---|
76 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
77 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
78 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
79 | })(); |
---|
80 | </script> |
---|
81 | |
---|
82 | </head> |
---|
83 | <body> |
---|
84 | |
---|
85 | |
---|
86 | <!-- Social networking buttons --> |
---|
87 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
88 | <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> |
---|
89 | <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> |
---|
90 | </div> |
---|
91 | |
---|
92 | <script> |
---|
93 | // Opera fix |
---|
94 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
95 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
96 | } |
---|
97 | </script> |
---|
98 | <!-- Social networking buttons --> |
---|
99 | |
---|
100 | <div id="breadcrumb"> |
---|
101 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
102 | > |
---|
103 | <a href="index.html">Documentation</a> |
---|
104 | > |
---|
105 | Examples of keys in charts |
---|
106 | </div> |
---|
107 | |
---|
108 | <h1>RGraph: <span>Javascript charts and graph library</span> - Examples of keys in charts</h1> |
---|
109 | |
---|
110 | <div style="float: right; display: inline-block; width: 650px"> |
---|
111 | <canvas id="myLine" width="600" height="250" style="float: right">[No canvas support]</canvas> |
---|
112 | <canvas id="myPie" width="450" height="250" style="float: right">[No canvas support]</canvas> |
---|
113 | </div> |
---|
114 | |
---|
115 | <p> |
---|
116 | As of 4th December 2010 the code that produces the keys has been rewritten. There are two variants of keys available, |
---|
117 | a horizontal one designed to sit in the gutter, and a vertical one that is designed to sit on top of (ie over) the chart. |
---|
118 | </p> |
---|
119 | |
---|
120 | <p> |
---|
121 | The actual positioning is now configurable though, so you could have a horizontal key and position it to sit on top |
---|
122 | of the chart. |
---|
123 | </p> |
---|
124 | |
---|
125 | <h4>Key properties</h4> |
---|
126 | |
---|
127 | <p> |
---|
128 | The available key properties and their defaults are listed below (some chart types have slightly different defaults to |
---|
129 | suit): |
---|
130 | </p> |
---|
131 | |
---|
132 | |
---|
133 | <ul> |
---|
134 | <li>chart.key (<i>[] (An empty array)</i>)</li> |
---|
135 | <li>chart.key.position (<i>graph</i>)</li> |
---|
136 | <li>chart.key.position.gutter.boxed (<i>true</i>)</li> |
---|
137 | <li>chart.key.position.x (<i>null</i>)</li> |
---|
138 | <li>chart.key.position.y (<i>null</i>)</li> |
---|
139 | <li>chart.key.shadow (<i>false</i>)</li> |
---|
140 | <li>chart.key.shadow.offsetx (<i>2</i>)</li> |
---|
141 | <li>chart.key.shadow.offsety (<i>2</i>)</li> |
---|
142 | <li>chart.key.shadow.color (<i>#666</i>)</li> |
---|
143 | <li>chart.key.shadow.blur (<i>3</i>)</li> |
---|
144 | <li>chart.key.color.shape (<i>square</i>)</li> |
---|
145 | <li>chart.key.background (<i>white</i>)</li> |
---|
146 | <li>chart.key.rounded (<i>true</i>)</li> |
---|
147 | <li>chart.key.text.size (<i>10</i>)</li> |
---|
148 | </ul> |
---|
149 | |
---|
150 | <h4>Interactive keys</h4> |
---|
151 | <p> |
---|
152 | The Line chart supports interactive keys - as shown in the example. This is only available when the key |
---|
153 | is in <i>graph</i> mode. This allows you to click a key item and it will be highlighted on the chart. |
---|
154 | </p> |
---|
155 | |
---|
156 | </body> |
---|
157 | </html> |
---|