initial commit
[home-automation.git] / RGraph / docs / scatter.html
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 personal,    |
15         * | charity and educational purposes it is free to use. You can read the full    |
16         * | license here:                                                                |
17         * |                      http://www.rgraph.net/LICENSE.txt                       |
18         * o------------------------------------------------------------------------------o
19         */
20     -->
21     <title>RGraph: HTML5 canvas graph library - scatter graph documentation</title>
22     <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
23     <link rel="icon" type="image/png" href="/favicon.png">
24 </head>
25 <body>
26     <a name="top"></a>
27
28     <!-- Social networking buttons -->
29     <script src="../libraries/RGraph.common.core.js" ></script>
30     
31     <script>
32         function HideTwitterDIV ()
33         {
34             document.getElementById("twitter_div").style.opacity = 0;
35             document.getElementById("twitter_div").style.display = 'none';
36         }
37
38
39         function ShowTwitterDIV (e)
40         {
41             var e   = RGraph.FixEventObject(document.all ? event : e);
42             var div = document.getElementById("twitter_div");
43             var img = document.getElementById("twitter_icon");
44
45             div.style.display = 'block';
46             div.style.left    = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
47             div.style.top     = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
48
49             /**
50             * Fade it in
51             */
52             setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
53             setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
54             setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
55             setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
56             setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
57
58             e.stopPropagation();
59
60             return false;
61         }
62
63         /**
64         * This code installs the event handler that hides the Twitter DIV
65         */
66         if (RGraph.isIE8()) {
67              window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
68         } else {
69             window.addEventListener('click', HideTwitterDIV, false);
70         }
71     </script>
72
73     <!-- The twitter DIV --> 
74     <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;"> 
75         <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>
76         <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a> 
77     </div>
78
79     <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
80         <script>
81             // Opera fix
82             if (navigator.userAgent.indexOf('Opera') == -1) {
83               document.getElementById("social_icons").style.position = 'fixed';
84               document.getElementById("twitter_div").style.position = 'fixed';
85     
86             }
87         </script>
88     
89         <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
90     
91     
92             <div id="social">
93                 <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">
94                     <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" /> 
95                 </a> 
96      
97                 <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
98                     <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
99                 </a>
100     
101     
102 <!--
103                 <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">
104                     <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"/>
105                 </a>
106     
107     
108                 <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">
109                     <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
110                 </a>
111     
112                 <a href="mailto:share@friendfeed.com" title="Share on FriendFeed"> 
113                     <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" /> 
114                 </a>
115     
116                 <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
117                     <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" /> 
118                 </a>
119 -->
120             </div>
121     </div>
122     <!-- /Social networking buttons -->
123
124     <div id="breadcrumb">
125         <a href="../index.html">RGraph: HTML5 canvas graph library</a>
126         >
127         <a href="index.html">Documentation</a>
128         >
129         Scatter graph
130     </div>
131
132     <h1>RGraph: HTML5 canvas graph library - Scatter graph documentation</h1>
133
134     <script>
135         if (RGraph.isIE8()) {
136             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>');
137         }
138     </script>
139
140     <p>
141         A scatter graph. Used to represent many data points over a period of time. For example, events occurring in a given year.
142     </p>
143     
144     <p>
145         The example file is <a href="../examples/scatter.html">here</a>.
146     </p>
147     
148     <ul>
149         <li><a href="#properties">Properties</a></li>
150         <li><a href="#boxplots">Box plots</a></li>
151         <li><a href="#labelpoints">Specific points for labels on the X axis</a></li>
152         <li><a href="#custom.tickmarks">Custom tickmarks</a></li>
153         <li><a href="#colors">Note about colors and the key</a></li>
154     </ul>
155     
156     <pre class="code">
157 &lt;script&gt;
158     window.onload = function ()
159     {
160         var data = [
161                     [67,78,null, 'The winner!'], [67,40,'red'], [58,12], [78,56], [365,90], [360,300], [320,150], [15,45],
162                     [16,43], [84,12], [67,89,'green'], [90,23,'green'], [23,80], [80,66], [55,66], [88,12], [43,45], [61,12],
163                     [15,89], [13,16]
164                    ];
165         var sg = new RGraph.Scatter('myScatter', data);
166         sg.Set('chart.background.barcolor1','rgba(255,255,255,1)');
167         sg.Set('chart.background.barcolor2', 'rgba(255,255,255,1)');
168         sg.Set('chart.grid.color', 'rgba(238,238,238,1)');
169         sg.Set('chart.gutter', 30);
170         sg.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
171         sg.Set('chart.xmax', 365); // Important!
172         sg.Draw();
173     }
174 &lt;/script&gt;
175 </pre>
176
177     <p>
178         As you can see each mark on the Scatter chart is made by supplying an array of up to 4 elements:
179     </p>
180     
181     <ul>
182         <li>The X value (required)</li>
183         <li>The Y value (required)</li>
184         <li>The color (optional)</li>
185         <li>The tooltip for this mark (optional)</li>
186     </ul>
187     
188     <p>
189         If you wish to specify a tooltip, but not a color (ie use the default color instead), you can pass null instead of a color.
190     </p>
191
192
193     <a name="properties"></a>
194     <h2>Properties</h2>
195     
196     <p>
197         You can use these properties to control how the Scatter apears. You can set them by using the Set() method. Eg:
198     </p>
199     
200     <p>
201         <b>myScatter.Set('chart.xmax', 365);</b>
202     </p>
203     
204     <ul>
205         <li><a href="#background">Background</a></li>
206         <li><a href="#labels and text">Labels and text</a></li>
207         <li><a href="#margins">Margins</a></li>
208         <li><a href="#axis properties">Axis properties</a></li>
209         <li><a href="#titles">Titles</a></li>
210         <li><a href="#scale">Scale</a></li>
211         <li><a href="#interactive features">Interactive features</a></li>
212         <li><a href="#line properties">Line properties</a></li>
213         <li><a href="#key">Key</a></li>
214         <li><a href="#zoom">Zoom</a></li>
215         <li><a href="#miscellaneous">Miscellaneous</a></li>
216     </ul>
217
218
219 <a name="background"></a>
220 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Background</h3>            <a name="chart.background.barcolor1"></a>
221 <b>chart.background.barcolor1</b><br />
222             The color of the background bars. <br /><i>Default: rgba(0,0,0,0)</i><br /><br />
223             <a name="chart.background.barcolor2"></a>
224 <b>chart.background.barcolor2</b><br />
225             The color of the background bars. <br /><i>Default: rgba(0,0,0,0)</i><br /><br />
226             <a name="chart.background.grid"></a>
227 <b>chart.background.grid</b><br />
228             Whether to show the background grid or not. <br /><i>Default: true</i><br /><br />
229             <a name="chart.background.grid.color"></a>
230 <b>chart.background.grid.color</b><br />
231             The color of the background grid. <br /><i>Default: #eee</i><br /><br />
232             
233             <a name="chart.background.hbars"></a>
234             <b>chart.background.hbars</b><br />
235             An array of information stipulating horizontal coloured bars. You can use these to indicate limits. Eg: 
236             
237             <pre class="code">myScatter.Set('chart.background.hbars', [[75, 10, 'yellow'], [85, 15, 'red']]);</pre>
238             
239             This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the
240             starting point and the height.<br />
241             <i>Default: null</i><br /><br />
242             
243             <b>chart.background.vbars</b><br />
244             An array of vertical bar information. They're specified like his:
245             <pre class="code">myScatter.Set('chart.background.vbars', [[0, 181, 'rgba(0,255,0,0.5)']]);</pre>           
246             <i>Default: null</i><br /><br />
247
248             <a name="chart.background.grid.border"></a>
249 <b>chart.background.grid.border</b><br />
250             Determines whether a border line is drawn around the grid.<br /><i>Default: true</i><br /><br />
251             <a name="chart.background.grid.hlines"></a>
252 <b>chart.background.grid.hlines</b><br />
253             Determines whether to draw the horizontal grid lines.<br /><i>Default: true</i><br /><br />
254             <a name="chart.background.grid.vlines"></a>
255 <b>chart.background.grid.vlines</b><br />
256             Determines whether to draw the vertical grid lines.<br /><i>Default: true</i><br /><br />
257             <a name="chart.background.grid.autofit"></a>
258 <b>chart.background.grid.autofit</b><br />
259             Instead of specifying a pixel width/height for the background grid, you can use autofit and specify how many horizontal and vertical lines you want.<br /><i>Default: false</i><br /><br />
260             <a name="chart.background.grid.autofit.numhlines"></a>
261 <b>chart.background.grid.autofit.numhlines</b><br />
262             When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 7</i><br /><br />
263             <a name="chart.background.grid.autofit.numvlines"></a>
264 <b>chart.background.grid.autofit.numvlines</b><br />
265             When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
266 <a name="labels and text"></a>
267 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Labels and text</h3>            <a name="chart.labels"></a>
268 <b>chart.labels</b><br />
269             An array of the X labels for the graph. <br /><i>Default: [] (An empty array)</i><br /><br />
270             <a name="chart.ylabels"></a>
271 <b>chart.ylabels</b><br />
272             A boolean (<i>true</i> or <i>false</i>) that controls whether the graph has Y labels. <br /><i>Default: true</i><br /><br />
273             <a name="chart.ylabels.count"></a>
274 <b>chart.ylabels.count</b><br />
275             A value (<i>1, 3 or 5</i>) that controls how many Y labels there are. <br /><i>Default: 5</i><br /><br />
276             <a name="chart.text.font"></a>
277 <b>chart.text.font</b><br />
278             The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
279             <a name="chart.text.color"></a>
280 <b>chart.text.color</b><br />
281             The color of the labels. <br /><i>Default: black</i><br /><br />
282             <a name="chart.text.size"></a>
283 <b>chart.text.size</b><br />
284             The size of the text (in points).<br /><i>Default: 10</i><br /><br />
285             <a name="chart.text.angle"></a>
286 <b>chart.text.angle</b><br />
287             The angle of the horizontal text labels (at the bottom of the graph). This can be one of three values - 0, 45 or 90.<br /><i>Default: 0 (Horizontal)</i><br /><br />
288 <a name="margins"></a>
289 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Margins</h3>            <a name="chart.gutter"></a>
290 <b>chart.gutter</b><br />
291             The gutter on the graph (the area outside of the axes). <br /><i>Default: 25</i><br /><br />
292 <a name="axis properties"></a>
293 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Axis properties</h3>            <a name="chart.xmax"></a>
294 <b>chart.xmax</b><br />
295             The maximum X axis value you wish to set. For example if you're displaying products sold in a year, you might use 365. <br /><i>Default: none - must be supplied</i><br /><br />
296             <a name="chart.ymax"></a>
297 <b>chart.ymax</b><br />
298             The optional maximum Y scale value. If not specified then it will be calculated.<br /><i>Default: null (It's calculated)</i><br /><br />
299             <a name="chart.ymin"></a>
300 <b>chart.ymin</b><br />
301             The optional minimum Y scale value. If not specified it will be zero.<br /><i>Default: null</i><br /><br />
302             <a name="chart.ticksize"></a>
303 <b>chart.ticksize</b><br />
304             The size of the tickmarks. <br /><i>Default: 3</i><br /><br />
305             <a name="chart.tickmarks"></a>
306 <b>chart.tickmarks</b><br />
307             The style of the tickmarks. Can be: <i>cross</i>, <i>plus</i>, <i>circle</i>, <i>diamond</i>, <i>square</i> or <i>null</i> (no tickmarks). <br /><i>Default: cross</i><br /><br />
308             <a name="chart.xticks"></a>
309 <b>chart.xticks</b><br />
310             This controls whether the X axis tickmarks are drawn.<br /><i>Default: true</i><br /><br />
311             <a name="chart.xaxispos"></a>
312 <b>chart.noendxtick</b><br />
313             Whether to draw an end X tick. Usually used when combining Scatter charts<br /><i>Default: false</i><br /><br />
314             <a name="chart.xaxispos"></a>
315 <b>chart.xaxis</b><br />
316             This controls whether the X axis is drawn.<br /><i>Default: true</i><br /><br />
317             <a name="chart.xaxispos"></a>
318 <b>chart.xaxispos</b><br />
319             Where the X axis should be drawn. Can be either <i>center</i> or <i>bottom</i>.<br /><i>Default: bottom</i><br /><br />
320             <a name="chart.yaxispos"></a>
321 <b>chart.yaxispos</b><br />
322             Where the Y axis should be drawn. Can be either <i>left</i> or <i>right</i>.<br /><i>Default: left</i><br /><br />
323             <a name="chart.yaxispos"></a>
324 <b>chart.yaxispos</b><br />
325             Where the Y axis should be drawn. Can be either <i>left</i> or <i>right</i>.<br /><i>Default: left</i><br /><br />
326             <a name="chart.axis.color"></a>
327 <b>chart.axis.color</b><br />
328             The color of the axes.<br /><i>Default: black</i><br /><br />
329             <a name="chart.noaxes"></a>
330 <b>chart.noaxes</b><br />
331             If this is set to true, no axes will be drawn. <br /><i>Default: false</i><br /><br />
332 <a name="titles"></a>
333 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Titles</h3>            <a name="chart.title"></a>
334 <b>chart.title</b><br />
335             The title of the scatter graph. <br /><i>Default: none</i><br /><br />
336
337 <a name="chart.title.background"></a>
338 <b>chart.title.background</b><br />
339 The background color (if any) for the title.<br />
340 <i>Default: null</i><br /><br />
341
342             <a name="chart.title.hpos"></a>
343 <b>chart.title.hpos</b><br />
344             This allows you to completely override the horizontal positioning of the title. It should be a number between 0 and 1, and is multiplied with the whole width of the canvas and then used as the horizontal position. <br /><i>Default: null</i><br /><br />
345             <a name="chart.title.vpos"></a>
346 <b>chart.title.vpos</b><br />
347             This allows you to completely override the vertical positioning of the title. It should be a number between 0 and 1, and is multiplied with the gutter and then used as the vertical position. It can be useful if you need to have a large gutter.<br /><i>Default: null</i><br /><br />
348             <a name="chart.title.color"></a>
349 <b>chart.title.color</b><br />
350             The color of the title.<br /> <i>Default: black</i><br /><br />
351             <a name="chart.title.xaxis"></a>
352 <b>chart.title.xaxis</b><br />
353             This allows to specify a title for the X axis.<br /><i>Default: none</i><br /><br />
354             <a name="chart.title.yaxis"></a>
355 <b>chart.title.yaxis</b><br />
356             This allows to specify a title for the Y axis.<br /><i>Default: none</i><br /><br />
357             <a name="chart.title.xaxis.pos"></a>
358 <b>chart.title.xaxis.pos</b><br />
359             This is multiplied with the gutter to give the position of the X axis title.<br /><i>Default: 0.25</i><br /><br />
360             <a name="chart.title.yaxis.pos"></a>
361 <b>chart.title.yaxis.pos</b><br />
362             This is multiplied with the gutter to give the position of the Y axis title.<br /><i>Default: 0.25</i><br /><br />
363
364 <a name="scale"></a>
365 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Scale</h3>            <a name="chart.scale.decimals"></a>
366 <b>chart.scale.decimals</b><br />
367             The number of decimal places to display for the Y scale.<br /><i>Default: 0</i><br /><br />
368             <a name="chart.scale.point"></a>
369 <b>chart.scale.point</b><br />
370             The character used as the decimal point.<br /><i>Default: .</i><br /><br />
371             <a name="chart.scale.thousand"></a>
372 <b>chart.scale.thousand</b><br />
373             The character used as the thousand separator<br /><i>Default: ,</i><br /><br />
374
375             <a name="chart.scale.round"></a>
376             <b>chart.scale.round</b><br />
377             Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
378             <i>Default: null</i><br /><br />
379
380             <a name="chart.units.pre"></a>
381 <b>chart.units.pre</b><br />
382             The units (if any) that the Y axis is measured in (these are preppended to the number).<br /><i>Default: none</i><br /><br />
383             <a name="chart.units.post"></a>
384 <b>chart.units.post</b><br />
385             The units (if any) that the Y axis is measured in (these are appended to the number).<br /><i>Default: none</i><br /><br />
386
387 <a name="interactive features"></a>
388 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Interactive features</h3>
389
390     <p style="background-color: #ffe; padding: 3px; border: 1px black solid; border-radius: 5px">
391         <b>Note:</b> Unlike other charts, the Scatter chart tooltips are specified as part of the data array. See <a href="#top">above</a>.
392     </p>
393
394     <a name="chart.tooltips.effect"></a>
395     <b>chart.tooltips.effect</b><br />
396     The animated effect used for showing tooltips.<br />
397     <i>Default: fade</i><br /><br />
398     
399     <a name="chart.tooltips.hotspot"></a>
400 <b>chart.tooltips.hotspot</b><br />
401             This controls the size of the hotspot on the chart for tooltips.<br /><i>Default: 3</i><br /><br />
402             <a name="chart.tooltips.css.class"></a>
403 <b>chart.tooltips.css.class</b><br />
404             This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
405             <a name="chart.tooltips.override"></a>
406 <b>chart.tooltips.override</b><br />
407             If you wish to handle showing tooltips yourself, this should be a function object which does just that. There's more information on the <a href="tooltips.html">tooltips documentation page</a><br /><i>Default: null</i><br /><br />
408             <a name="chart.tooltips.coords.adjust"></a>
409 <b>chart.tooltips.coords.adjust</b><br />
410             If you translate() before drawing your graph to reduce wasted space, the coords used for tooltips may need adjusting by how much you translate() by. This setting is how to do it. It should be an array of the X/Y adjustments. There's an example of this on the <a href="misc.html#reducing.white.space">misc documentation</a> page.<br /><i>Default: [0,0]</i><br /><br />
411             <a name="chart.crosshairs"></a>
412 <b>chart.crosshairs</b><br />
413             If true, you will get a crosshair centering on the current mouse position.<br /><i>Default: false</i><br /><br />
414             <a name="chart.crosshairs.linewidth"></a>
415 <b>chart.crosshairs.linewidth</b><br />
416             This controls the linewidth of the crosshairs.<br /><i>Default: 1</i><br /><br />
417             <a name="chart.crosshairs.color"></a>
418 <b>chart.crosshairs.color</b><br />
419             The color of the crosshairs.<br /><i>Default: #333</i><br /><br />
420             <a name="chart.crosshairs.coords"></a>
421 <b>chart.crosshairs.coords</b><br />
422             If true, this will show the coordinates that the crosshairs are currently over.<br /><i>Default: false</i><br /><br />
423             <a name="chart.crosshairs.fixed"></a>
424 <b>chart.crosshairs.fixed</b><br />
425             If true, this makes the coordinates static (attached), instead of following the pointer around.<br /><i>Default: false</i><br /><br />
426             <a name="chart.crosshairs.fadeout"></a>
427 <b>chart.crosshairs.fadeout</b><br />
428             If true, when you move your mouse off of the canvas the coordinates will fade out.<br /><i>Default: false</i><br /><br />
429             <a name="chart.crosshairs.labels.x"></a>
430 <b>chart.crosshairs.labels.x</b><br />
431             Instead ox X and Y, you can specify more meaningful labels.<br /><i>Default: X</i><br /><br />
432             <a name="chart.crosshairs.labels.y"></a>
433 <b>chart.crosshairs.labels.y</b><br />
434             Instead ox X and Y, you can specify more meaningful labels.<br /><i>Default: Y</i><br /><br />
435             <a name="chart.contextmenu"></a>
436 <b>chart.contextmenu</b><br />
437             An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: null</i><br /><br />
438             <a name="chart.annotatable"></a>
439 <b>chart.annotatable</b><br />
440             Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
441             <a name="chart.annotate.color"></a>
442 <b>chart.annotate.color</b><br />
443             If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: #000</i><br /><br />
444             <a name="chart.resizable"></a>
445 <b>chart.resizable</b><br />
446             Defaulting to false, this determines whether your graph will be resizable. Because of the numerous event handlers this has to install code on, This feature is unlikely to work with other dynamic features (the context menu is fine however).<br /><i>Default: false</i><br /><br />
447 <a name="line properties"></a>
448 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Line properties</h3>            <a name="chart.line"></a>
449 <b>chart.line</b><br />
450             Whether to show a connecting line (like in the sixth example). <br /><i>Default: false</i><br /><br />
451             <a name="chart.line.colors"></a>
452 <b>chart.line.colors</b><br />
453             The colors of the lines connecting the tick marks. <br /><i>Default: ['green', 'red']</i><br /><br />
454             <a name="chart.line.shadow.color"></a>
455 <b>chart.line.shadow.color</b><br />
456             The color of the lines shadow (if any). <br /><i>Default: rgba(0,0,0,0) (invisible)</i><br /><br />
457             <a name="chart.line.shadow.offsetx"></a>
458 <b>chart.line.shadow.offsetx</b><br />
459             The X offset of the lines shadow. <br /><i>Default: 3</i><br /><br />
460             <a name="chart.line.shadow.offsety"></a>
461 <b>chart.line.shadow.offsety</b><br />
462             The Y offset of the lines shadow. <br /><i>Default: 3</i><br /><br />
463             <a name="chart.line.shadow.blur"></a>
464 <b>chart.line.shadow.blur</b><br />
465             The severity of the line shadows blurring effect. <br /><i>Default: 2</i><br /><br />
466             <a name="chart.line.stepped"></a>
467 <b>chart.line.stepped</b><br />
468             Like the line chart, Scatter chart lines can be stepped by setting this to true <br /><i>Default: false</i><br /><br />
469
470
471
472
473             <a name="key"></a>
474             <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Key</h3>
475             
476             <a name="chart.key"></a>
477             <b>chart.key</b><br />
478             An array of key information. <br />
479             <i>Default: [] (An empty array)</i><br /><br />
480
481             <a name="chart.key.background"></a>
482             <b>chart.key.background</b><br />
483             The color of the key background. Typically white, you could set this to something like rgba(255,255,255,0.7) to allow people to see things behind it.<br>
484             <i>Default: white</i><br /><br />
485             
486             <a name="chart.key.position"></a>
487             <b>chart.key.position</b><br />
488             Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
489             <i>Default: graph</i><br /><br />
490             
491             <b>chart.key.position.x</b><br />
492             This allows you to specify a specific X coordinate for the key.<br />
493             <i>Default: null</i><br /><br />
494             
495             <b>chart.key.position.y</b><br />
496             This allows you to specify a specific Y coordinate for the key.<br />
497             <i>Default: null</i><br /><br />
498             
499             <b>chart.key.position.gutter.boxed</b><br />
500             If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
501             <i>Default: true</i><br /><br />
502             
503             <a name="chart.key.shadow"></a>
504             <b>chart.key.shadow</b><br />
505             Whether a small drop shadow is applied to the key.<br />
506             <i>Default: false</i><br /><br />
507
508             <a name="chart.key.shadow.color"></a>
509             <b>chart.key.shadow.color</b><br />
510             The color of the shadow.<br />
511             <i>Default: #666</i><br /><br />
512
513             <a name="chart.key.shadow.blur"></a>
514             <b>chart.key.shadow.blur</b><br />
515             The extent of the blurring effect used on the shadow.<br />
516             <i>Default: 3</i><br /><br />
517
518             <a name="chart.key.shadow.offsetx"></a>
519             <b>chart.key.shadow.offsetx</b><br />
520             The X offset of the shadow.<br />
521             <i>Default: 2</i><br /><br />
522
523             <a name="chart.key.shadow.offsety"></a>
524             <b>chart.key.shadow.offsety</b><br />
525             The Y offset of the shadow.<br />
526             <i>Default: 2</i><br /><br />
527
528             <b>chart.key.rounded</b><br />
529             This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
530             <i>Default: false</i><br /><br />
531             
532             <b>chart.key.color.shape</b><br />
533             This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
534             <i>Default: square</i><br /><br />
535
536
537
538
539
540 <a name="zoom"></a>
541 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Zoom</h3>            <a name="chart.zoom.mode"></a>
542 <b>chart.zoom.mode</b><br />
543             Can be used to control whether the zoom is in thumbnail or canvas mode. Possible values are: <i>thumbnail</i> and <i>canvas</i>.<br /><i>Default: canvas</i><br /><br />
544             <a name="chart.zoom.factor"></a>
545 <b>chart.zoom.factor</b><br />
546             This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
547             <a name="chart.zoom.fade.in"></a>
548 <b>chart.zoom.fade.in</b><br />
549             Whether the zoomed canvas fades in or not. This also can be used to control the fade in for the zoom in thumbnail mode.<br /><i>Default: true</i><br /><br />
550             <a name="chart.zoom.fade.out"></a>
551 <b>chart.zoom.fade.out</b><br />
552             Whether the zoomed canvas fades out or not. This also can be used to control the fade in for the zoom in thumbnail mode.<br /><i>Default: true</i><br /><br />
553             <a name="chart.zoom.hdir"></a>
554 <b>chart.zoom.hdir</b><br />
555             The horizontal direction of the zoom. Possible values are: <i>left</i>, <i>center</i>, <i>right</i><br /><i>Default: right</i><br /><br />
556             <a name="chart.zoom.vdir"></a>
557 <b>chart.zoom.vdir</b><br />
558             The vertical direction of the zoom. Possible values are: <i>up</i>, <i>center</i>, <i>down</i><br /><i>Default: down</i><br /><br />
559             <a name="chart.zoom.delay"></a>
560 <b>chart.zoom.delay</b><br />
561             The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
562             <a name="chart.zoom.frames"></a>
563 <b>chart.zoom.frames</b><br />
564             The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
565             <a name="chart.zoom.shadow"></a>
566 <b>chart.zoom.shadow</b><br />
567             Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
568             <a name="chart.zoom.thumbnail.width"></a>
569 <b>chart.zoom.thumbnail.width</b><br />
570             When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
571             <a name="chart.zoom.thumbnail.height"></a>
572 <b>chart.zoom.thumbnail.height</b><br />
573             When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
574             <a name="chart.zoom.background"></a>
575 <b>chart.zoom.background</b><br />
576             Defaulting to true, this determines whether the zoom has a dark, semi-opaque background that covers the entire web page.<br /><i>Default: true</i><br /><br />
577 <a name="miscellaneous"></a>
578 <h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Miscellaneous</h3>            <a name="chart.defaultcolor"></a>
579 <b>chart.defaultcolor</b><br />
580             This is the default color of tick marks, which is used if a color isn't given.<br /><i>Default: #000</i><br /><br />
581             <a name="chart.boxplot.width"></a>
582 <b>chart.boxplot.width</b><br />
583             This stipulates the default width of boxes. For more on boxplots, see <a href="#boxplots">here</a>.<br /><i>Default: 8</i><br /><br />
584 </div><!-- /DOCS --><br /><br />
585
586     <a name="boxplots"></a>
587     <h2>Box plots</h2>
588     
589     <p>
590         Instead of a single Y value, you have the ability to specify an array of 5, 6, 7 or 8 values, which will be used to make a box plot.
591         The <a href="../examples/scatter.html#boxplots">example page shows a box plot</a>. These values are (in order):
592
593         <ul>
594             <li>Lower whisker</li>
595             <li>Bottom of box</li>
596             <li>Middle value (which isn't necessarily in the center of the box - this depends on your data)</li>
597             <li>Top of box</li>
598             <li>Upper whisker</li>
599             <li>Upper color (optional)</li>
600             <li>Lower color (optional)</li>
601             <li>Width (optional)</li>
602         </ul>
603
604         <pre class="code">
605 &lt;script&gt;
606     scatter8 = new RGraph.Scatter('scatter8', [
607                                                [10,<span style="color: green">[1,1,16,24,24, 'red', 'green']</span>],
608                                                [105,<span style="color: green">[5,10,15,25,25, 'red', 'green']</span>],
609                                                [125,<span style="color: green">[10,15,25,35,45, 'red', 'green']</span>],
610                                                [325,<span style="color: green">[10,15,25,35,45, 'red', 'green', 30]</span>]
611                                               ]);
612     scatter8.Set('chart.title', 'An example of a boxplot');
613     scatter8.Set('chart.labels', ['Q1', 'Q2', 'Q3', 'Q4']);
614     scatter8.Set('chart.xmax', 365);
615     scatter8.Set('chart.ymax', 50);
616     scatter8.Set('chart.boxplot.width', 12); // The default width
617     scatter8.Draw();
618 &lt;/script&gt;
619 </pre>
620     </p>
621
622
623     <a name="labelpoints"></a>
624     <h2>Specific points for labels on the X axis</h2>
625     
626     <p>
627         Instead of a simple string which is used as the label, each entry of the chart.labels array can be a two element array
628         consisting of the label, and the X value that the label should be placed at. For example:
629     </p>
630
631     <pre class="code">
632 scatter.Set('chart.labels', [
633                              ['Quarter 1', 0],
634                              ['Quarter 2', 90],
635                              ['Quarter 3', 181],
636                              ['Quarter 4', 273]
637                             ]);
638 </pre>
639
640
641
642     <a name="custom.tickmarks"></a>
643     <h2>Custom tickmarks</h2>
644
645     <p>
646         If none of the available tickmark styles are suitable, you can instead specify a function object that draws the tickmark,
647         enabling you to draw the tickmark yourself. For example:
648     </p>
649
650     <pre class="code">
651 &lt;script&gt;
652     line.Set('chart.tickmarks', myTick);
653
654     /**
655     * The function that is called once per tickmark, to draw it
656     * 
657     * @param object obj   The graph object
658     * @param object data  The graph data
659     * @param number x     The X coordinate
660     * @param number y     The Y coordinate
661     * @param number xVal  The X value
662     * @param number yVal  The Y value
663     * @param number xMax  The maximum X scale value
664     * @param number xMax  The maximum Y scale value
665     * @param string color The color of the tickmark
666     */
667     function myTick (obj, data, x, y, xVal, yVal, xMax, yMax, color)
668     {
669         // Draw your custom tick here
670     }
671 &lt;/script&gt;
672 </pre>
673
674     <a name="colors"></a>
675     <h2>Note about colors and the key</h2>
676     
677     <p>
678         If you're using a key you may need to set <i>chart.line.colors</i> to allow it to use the correct colors. For example:
679     </p>
680     
681     <pre class="code">myObj.Set('chart.line.colors', ['red','green','blue']);</pre>
682 </body>
683 </html>