initial commit
[home-automation.git] / RGraph / examples / bipolar.html
1 <?php ob_start('ob_gzhandler') ?>
2 <!DOCTYPE html>
3 <html>
4 <head>
5
6     <meta http-equiv="X-UA-Compatible" content="chrome=1">
7
8     <!--
9         /**
10         * o------------------------------------------------------------------------------o
11         * | This file is part of the RGraph package - you can learn more at:             |
12         * |                                                                              |
13         * |                          http://www.rgraph.net                               |
14         * |                                                                              |
15         * | This package is licensed under the RGraph license. For all kinds of business |
16         * | purposes there is a small one-time licensing fee to pay and for non          |
17         * | commercial  purposes it is free to use. You can read the full license here:  |
18         * |                                                                              |
19         * |                      http://www.rgraph.net/LICENSE.txt                       |
20         * o------------------------------------------------------------------------------o
21         */
22     -->
23     <title>RGraph: HTML5 canvas graph library - bi-polar chart</title>
24     
25     <meta name="keywords" content="rgraph html5 canvas example bipolar chart" />
26     <meta name="description" content="RGraph: Bipolar chart example" />
27
28     <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
29     <link rel="icon" type="image/png" href="../images/favicon.png">
30
31     <script src="../libraries/RGraph.common.core.js"></script>
32     <script src="../libraries/RGraph.common.annotate.js"></script>
33     <script src="../libraries/RGraph.common.context.js"></script>
34     <script src="../libraries/RGraph.common.tooltips.js"></script>
35     <script src="../libraries/RGraph.common.zoom.js"></script>
36     <script src="../libraries/RGraph.common.resizing.js" ></script>
37     <script src="../libraries/RGraph.bipolar.js"></script>
38     <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
39
40     <script>
41         window.onload = function ()
42         {
43             var left  = [5,6,8,9,12,13,4,9];
44             var right = [5,8,4,11,15,26,13,16];
45            
46             var bipolar1 = new RGraph.Bipolar('bipolar1', left, right);        
47             bipolar1.Set('chart.colors', ['red']);
48             bipolar1.Set('chart.labels', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']);
49             bipolar1.Set('chart.title.left', '2007');
50             bipolar1.Set('chart.title.right', '2008');
51             bipolar1.Set('chart.title', 'Sales (tooltips, context, zoom)');
52             
53             if (!RGraph.isIE8()) {
54                 bipolar1.Set('chart.tooltips', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike', 'Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']);
55                 bipolar1.Set('chart.tooltips.effect', 'fade');
56             }
57
58             bipolar1.Set('chart.units.post', 'k');
59             bipolar1.Set('chart.contextmenu', [['Zoom', RGraph.Zoom], ['Get PNG', RGraph.showPNG], null, ['Cancel', function () {}]]);
60             bipolar1.Set('chart.xmax', 35);
61             bipolar1.Set('chart.shadow', true);
62             bipolar1.Set('chart.shadow.color', '#aaa');
63             bipolar1.Set('chart.shadow.blur', 3);
64             
65             RGraph.Clear(bipolar1.canvas, 'white');
66
67             bipolar1.Draw();
68
69
70
71             var bipolar2 = new RGraph.Bipolar('bipolar2', left, right);
72             bipolar2.Set('chart.labels', ['Fezza', 'Porka', 'CRX', 'RX8', 'DB9', 'Aston', 'F430', 'BMX']);
73             bipolar2.Set('chart.title.left', 'July')
74             bipolar2.Set('chart.title.right', 'August');
75             bipolar2.Set('chart.title', 'Vehicles (context, annotatable)');
76             bipolar2.Set('chart.contextmenu', [['Show palette', function (e) {RGraph.Showpalette(e)}], ['Clear', function () {RGraph.Clear(bipolar2.canvas); bipolar2.Draw()}]]);
77             bipolar2.Set('chart.units.post', 'k');
78             bipolar2.Set('chart.annotatable', true);
79             bipolar2.Draw();
80
81             var bipolar3 = new RGraph.Bipolar('bipolar3', [1,2,3,4,5,6,7], [1,2,3,4,5,6,7]);
82
83             var gradient = bipolar3.context.createLinearGradient(0,0,475,0);
84             gradient.addColorStop(0,'red');
85             gradient.addColorStop(0.5,'white');
86             gradient.addColorStop(1,'red');
87
88             bipolar3.Set('chart.labels', ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh']);
89             bipolar3.Set('chart.title.left', '2007');
90             bipolar3.Set('chart.title.right', '2008');
91             bipolar3.Set('chart.title', 'A red chart (resizable)');
92             bipolar3.Set('chart.colors', [gradient]);
93             bipolar3.Set('chart.gutter', 30);
94             bipolar3.Set('chart.resizable', true);
95             
96             if (!document.all) {
97                 bipolar3.Set('chart.zoom.mode', 'thumbnail');
98             }
99
100             bipolar3.Draw();
101
102             var bipolar4 = new RGraph.Bipolar('bipolar4', [45,43,46,78,41,42,35], [31,21,25,26,26,26,12]);
103             bipolar4.Set('chart.labels', ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']);
104             bipolar4.Set('chart.title.left', 'January');
105             bipolar4.Set('chart.title.right', 'February');
106             bipolar4.Set('chart.title', 'A bi-polar chart');
107             bipolar4.Set('chart.colors', ['#ff0']);
108             bipolar4.Set('chart.gutter', 20);
109             bipolar4.Draw();
110         }
111     </script>
112 </head>
113 <body>
114
115     <!-- Social networking buttons -->
116     
117     <script>
118         function HideTwitterDIV ()
119         {
120             document.getElementById("twitter_div").style.opacity = 0;
121             document.getElementById("twitter_div").style.display = 'none';
122         }
123
124
125         function ShowTwitterDIV (e)
126         {
127             var e   = RGraph.FixEventObject(document.all ? event : e);
128             var div = document.getElementById("twitter_div");
129             var img = document.getElementById("twitter_icon");
130
131             div.style.display = 'block';
132             div.style.left    = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
133             div.style.top     = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
134
135             /**
136             * Fade it in
137             */
138             setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
139             setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
140             setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
141             setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
142             setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
143
144             e.stopPropagation();
145
146             return false;
147         }
148
149         /**
150         * This code installs the event handler that hides the Twitter DIV
151         */
152         if (RGraph.isIE8()) {
153              window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
154         } else {
155             window.addEventListener('click', HideTwitterDIV, false);
156         }
157     </script>
158
159     <!-- The twitter DIV --> 
160     <div id="twitter_div" style="position: absolute;top: 0;left: 0;background-color: #eee;border: 2px dashed black;box-shadow: 0 0 15px #aaa;-moz-box-shadow: 0 0 15px #aaa;-webkit-box-shadow: 0 0 15px #aaa;padding: 3px;display: none;opacity: 0;z-index: 99;"> 
161         <a href="http://twitter.com/home/?status=RGraph%3A+HTML5+canvas+graph+library+based+on+the+HTML5+canvas+tag+http%3A%2F%2Fwww.rgraph.net+%23rgraph+%23html5+%23canvas" target="_blank" title="Share on Twitter" rel="nofollow" style="text-decoration: none">Tweet&nbsp;about&nbsp;RGraph</a><br>
162         <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a> 
163     </div>
164
165     <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
166         <script>
167             // Opera fix
168             if (navigator.userAgent.indexOf('Opera') == -1) {
169               document.getElementById("social_icons").style.position = 'fixed';
170               document.getElementById("twitter_div").style.position = 'fixed';
171     
172             }
173         </script>
174     
175         <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
176     
177     
178             <div id="social">
179                 <a title="Bookmark with delicious" href="http://delicious.com/save?jump=close&v=4&noui&jump=close&url=http://www.rgraph.net&notes=RGraph%20is%20a%20HTML5%20based%20graph%20library%20supporting%20a%20wide%20range%20of%20different%20graph%20types:Bar,%20Bipolar,%20Donut,%20Funnel,%20Gantt,%20Horizontal%20Bar,%20LED,%20Line,%20Meter,%20Odometer,%20Pie,%20Progress%20Bar,%20Rose,%20RScatter,%20Scatter%20and%20Traditional%20Radar&title=RGraph:%20HTML5%20canvas%20graph%20library%20based%20on%20the%20HTML5%20canvas%20tag" target="_blank">
180                     <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" /> 
181                 </a> 
182      
183                 <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
184                     <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
185                 </a>
186     
187     
188 <!--
189                 <a title="Post to Google Buzz!" href="" onclick="window.open('http://www.google.com/buzz/post?url=http://www.rgraph.net&imageurl=http://www.rgraph.net/images/logo.png', 'google_buzz_window', 'width=800,height=400,top=100,left=100'); return false">
190                     <img src="../images/buzz.png" width="22" height="22" alt="Post to Google Buzz!" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
191                 </a>
192     
193     
194                 <a title="Share RGraph on Facebook" href="" onclick="window.open('http://www.facebook.com/sharer.php?u=http://www.rgraph.net&t=RGraph:%20HTML5%20canvas%20graph%20library', 'facebook_window', 'width=500,height=300,top=100,left=100'); return false">
195                     <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
196                 </a>
197     
198                 <a href="mailto:share@friendfeed.com" title="Share on FriendFeed"> 
199                     <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" /> 
200                 </a>
201     
202                 <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
203                     <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" /> 
204                 </a>
205 -->
206             </div>
207     </div>
208     <!-- /Social networking buttons -->
209
210 <div id="breadcrumb">
211     <a href="../index.html">RGraph: HTML5 canvas graph library</a>
212     >
213     <a href="./index.html">Examples</a>
214     >
215     Bi-polar chart
216 </div>
217
218
219 <h1>RGraph: HTML5 canvas graph library - Bi-polar chart</h1>
220
221     <script>
222         if (RGraph.isIE8()) {
223             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 graphs, 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://groups.google.com/group/rgraph/browse_thread/thread/c5651ff8c56b8f3c#" target="_blank">here</a> to see some screenshots.</div>');
224         }
225     </script>
226     
227     <div>
228         <p>
229             The Bi-polar chart is also (possibly more commonly) known as an age-frequency chart or a population pyramid. It allows you to very straight forwardly
230             compare two sets of data. For example two years worth of sales figues. Using this type of chart abnormalities will become
231             apparent. Other charts that would also be comparable, include a grouped bar chart, a stacked bar chart, and a multiple
232             line graph.
233         </p>
234
235         <div>
236             <ul>
237                 <li><a href="../docs/bipolar.html">Bi-polar chart API documentation</a></li>
238             </ul>
239         </div>
240         
241         <div style="width: 950px">
242             <div style="width: 450px; float: left">
243                 <canvas id="bipolar1" width="475" height="250">[No canvas support]</canvas>
244                 <canvas id="bipolar2" width="475" height="250">[No canvas support]</canvas>
245             </div>
246             
247             <div style="width: 450px; float: right">
248                 <canvas id="bipolar3" width="475" height="250">[No canvas support]</canvas>
249                 <canvas id="bipolar4" width="475" height="250">[No canvas support]</canvas>
250             </div>
251         </div>
252     </div>
253
254 </body>
255 </html>