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 - meter charts</title> |
---|
22 | |
---|
23 | <meta name="keywords" content="rgraph html5 canvas example meter charts" /> |
---|
24 | <meta name="description" content="RGraph: Javascript charts and graph library - Meter 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.common.resizing.js" ></script> |
---|
39 | <script src="../libraries/RGraph.meter.js" ></script> |
---|
40 | <!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]--> |
---|
41 | |
---|
42 | <script> |
---|
43 | window.onload = function () |
---|
44 | { |
---|
45 | var meter1 = new RGraph.Meter('meter1', 50, 100, 58); |
---|
46 | |
---|
47 | var grad1 = meter1.context.createRadialGradient(meter1.canvas.width / 2,meter1.canvas.height - 25,0,meter1.canvas.width / 2,meter1.canvas.height - 25,200); |
---|
48 | grad1.addColorStop(0, 'green'); |
---|
49 | grad1.addColorStop(1, 'white'); |
---|
50 | |
---|
51 | var grad2 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,200); |
---|
52 | grad2.addColorStop(0, 'yellow'); |
---|
53 | grad2.addColorStop(1, 'white'); |
---|
54 | |
---|
55 | var grad3 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,200); |
---|
56 | grad3.addColorStop(0, 'red'); |
---|
57 | grad3.addColorStop(1, 'white'); |
---|
58 | |
---|
59 | //meter1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show palette', RGraph.Showpalette], ['Clear annotations', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}], null, ['Cancel', function () {}]]); |
---|
60 | meter1.Set('chart.annotatable', true); |
---|
61 | meter1.Set('chart.labels.position', 'inside'); |
---|
62 | meter1.Set('chart.title', 'A sample measurement'); |
---|
63 | meter1.Set('chart.title.vpos', 0.5); |
---|
64 | meter1.Set('chart.title.color', 'black'); |
---|
65 | meter1.Set('chart.green.color', grad1); |
---|
66 | meter1.Set('chart.yellow.color', grad2); |
---|
67 | meter1.Set('chart.red.color', grad3); |
---|
68 | meter1.Set('chart.shadow', true); |
---|
69 | meter1.Set('chart.shadow.color', 'gray'); |
---|
70 | meter1.Set('chart.shadow.offsetx', 0); |
---|
71 | meter1.Set('chart.shadow.offsety', 0); |
---|
72 | meter1.Set('chart.shadow.blur', 15); |
---|
73 | meter1.Set('chart.zoom.hdir', 'center'); |
---|
74 | meter1.Set('chart.zoom.vdir', 'center'); |
---|
75 | meter1.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}]]); |
---|
76 | |
---|
77 | meter1.Set('chart.tickmarks.small.num', 100); |
---|
78 | meter1.Set('chart.tickmarks.big.num', 10); |
---|
79 | meter1.Set('chart.tickmarks.small.color', '#bbb'); |
---|
80 | meter1.Set('chart.tickmarks.big.color', 'black'); |
---|
81 | meter1.Set('chart.scale.decimals', 1); |
---|
82 | meter1.Draw(); |
---|
83 | |
---|
84 | var meter2 = new RGraph.Meter('meter2', 0, 10, 5); |
---|
85 | meter2.Set('chart.units.post', 'kg'); |
---|
86 | meter2.Set('chart.red.start', 0); |
---|
87 | meter2.Set('chart.red.end', 3); |
---|
88 | meter2.Set('chart.yellow.start', 3); |
---|
89 | meter2.Set('chart.yellow.end', 6); |
---|
90 | meter2.Set('chart.green.start', 6); |
---|
91 | meter2.Set('chart.green.end', 10); |
---|
92 | meter2.Draw(); |
---|
93 | } |
---|
94 | </script> |
---|
95 | |
---|
96 | <script> |
---|
97 | var _gaq = _gaq || []; |
---|
98 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
99 | _gaq.push(['_trackPageview']); |
---|
100 | |
---|
101 | (function() { |
---|
102 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
103 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
104 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
105 | })(); |
---|
106 | </script> |
---|
107 | </head> |
---|
108 | <body> |
---|
109 | |
---|
110 | |
---|
111 | <!-- Social networking buttons --> |
---|
112 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
113 | <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> |
---|
114 | <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> |
---|
115 | </div> |
---|
116 | |
---|
117 | <script> |
---|
118 | // Opera fix |
---|
119 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
120 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
121 | } |
---|
122 | </script> |
---|
123 | <!-- Social networking buttons --> |
---|
124 | |
---|
125 | |
---|
126 | <h1>RGraph: <span>Javascript charts and graph library</span> - Meter charts</h1> |
---|
127 | |
---|
128 | <script> |
---|
129 | if (RGraph.isIE8()) { |
---|
130 | 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>'); |
---|
131 | } |
---|
132 | </script> |
---|
133 | |
---|
134 | |
---|
135 | <div id="breadcrumb"> |
---|
136 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
137 | > |
---|
138 | <a href="./index.html">Examples</a> |
---|
139 | > |
---|
140 | Meter |
---|
141 | </div> |
---|
142 | |
---|
143 | <div> |
---|
144 | <p> |
---|
145 | Meter charts are similar to Odometer charts albeit only a semi-circle and not a full circle. It can be better when trying illustrate |
---|
146 | a particular level, but only have a limited amount of space. It could also be quite effective as part of a control panel. |
---|
147 | </p> |
---|
148 | |
---|
149 | <p></p> |
---|
150 | </div> |
---|
151 | |
---|
152 | <div> |
---|
153 | <ul> |
---|
154 | <li><a href="../docs/meter.html">Meter charts API documentation</a></li> |
---|
155 | </ul> |
---|
156 | </div> |
---|
157 | |
---|
158 | <div style="text-align: center"> |
---|
159 | <canvas id="meter1" width="400" height="250"><div class="canvasfallback">[No canvas support]</div></canvas> |
---|
160 | |
---|
161 | <canvas id="meter2" width="400" height="250"><div class="canvasfallback">[No canvas support]</div></canvas> |
---|
162 | </div> |
---|
163 | |
---|
164 | </body> |
---|
165 | </html> |
---|