--- /dev/null
+###############################################################################
+# The MIT License (MIT)
+# Copyright (c) Russell Handorf
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+###############################################################################
+
+I've been building a home automation solution over the years. The code within is built to help manage these systems.
+
+The graphics were generated by Mike Anthony at http://www.mejadesign.com/. They are to be included for this project.
+
+Hardware:
+-Insteon
+-Elk M1 Gold
+-TED - The Energy Detector
+
+Software:
+-Zoneminder
+-Asterisk
+-Wview
+
+I'm leaving out some code for now for you to edit for your own source. Once I lock up mine, I'll upload it; some stuff is just very specific. I've set some account defaults for you, specifically admin/admin in the ISY and zoneminder. There isnt a central config yet... yet.
+
+Edit your /etc/hosts to be
+[IP] isy99
+[IP] zoneminder
+[IP] TED
+[IP] weather
--- /dev/null
+THE RGRAPH LICENSE VERSION 1.5.4
+
+Everyone is permitted to copy and distribute this license document.
+
+This license applies to any software originating from the www.rgraph.net website.
+Such software is herein referred to as the Software. This license covers
+modification and distribution of the Software, use of third-party application
+programs based on the Software, and development of software which uses the
+Software. Note that ExCanvas is covered by the Apache license.
+
+
+SUMMARY
+
+
+A summary of the license is that non-commercial use of the Software is free,
+whilst for commercial use there is a one-time fee of £49 (GBP).
+
+
+
+GRANTED RIGHTS
+
+
+1. You are granted the non-exclusive rights set forth in this license
+ provided you agree to and comply with any and all conditions in
+ this license. Whole or partial distribution of the Software,
+ signifies acceptance of this license.
+
+
+2. You may copy and distribute the Software in unmodified form
+ provided that the entire package, including - but not restricted to
+ - copyright, trademark notices and disclaimers, as released by the
+ initial developer of the Software, is distributed. See clause (3)
+ regarding the inclusion of this license document with your software.
+
+
+3. You may develop application programs, reusable components and other
+ software items that use the original or modified versions of the
+ Software. You may distribute these programs or components as long
+ as this license is distributed along with the Software. If you have
+ purchased an RGraph license you do not need to include this license
+ document with your software.
+
+
+4. For commercial use you are required to buy a license from the copyright
+ holder. A commercial license permits you to use any code you wish that
+ originated from the RGraph website (www.rgraph.net) and also the
+ PHPGuru website (www.phpguru.org). This license is £49 (UK pounds).
+ Commercial use incorporates applications, websites (regardless of
+ whether they sell products or services or simply promote them),
+ intranets and use in offline materials.
+
+
+5. Non-commercial use (eg personal, charity and educational) is permitted.
+ Please link back to the RGraph website. Example code as follows:
+
+ <a href="http://www.rgraph.net" target="_blank">
+ RGraph: HTML5 canvas graph library
+ </a>
+
+ Alternatively, if you don't wish to link to the RGraph website, you can
+ buy an RGraph license and you won't need to.
+
+
+LIMITATIONS OF LIABILITY
+
+In no event shall the initial developers or copyright holders be
+liable for any damages whatsoever, including - but not restricted to
+- lost revenue or profits or other direct, indirect, special,
+incidental or consequential damages, even if they have been advised
+of the possibility of such damages, except to the extent invariable
+law, if any, provides otherwise.
+
+
+NO WARRANTY
+
+The Software and this license document are provided AS IS with NO
+WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN,
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+CHOICE OF LAW
+
+This license is governed by the Laws of England. Disputes shall be
+settled by Chelmsford town court.
+
+
+QUESTIONS
+
+Any questions or queries about this license or its extent should
+be directed to licensing@rgraph.net
+
+
+
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+
+ /**
+ * Modal Dialog
+ */
+ .modalBg {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ filter: Alpha(Opacity=50);
+ -moz-opacity: 0.5;
+ background-color: #ddd;
+ visibility: hidden;
+ width: expression(document.body.clientWidth);
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight);
+ z-index: 100;
+ }
+
+ .modalDialog {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ visibility: hidden;
+ z-index: 101;
+ background-color: white;
+ top: expression(document.body.clientHeight / 2 - this.offsetHeight / 2);
+ left: expression(document.body.clientWidth / 2 - this.offsetWidth / 2);
+ border: 1px solid #777;
+ border-top: 0;
+ padding: 20px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ }
+
+ .modalDialog .modalDialogHeader {
+ margin:0;
+ padding: 0px;
+ color: #333;
+ font-weight: bold;
+ background-color: #ccc;
+ border: 1px solid #989898;
+ position: absolute;
+ top: 0px;
+ left: -1px;
+ height: 7px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-bottomright: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-bottom-right-radius: 0;
+ }
+
+ .modalShadow {
+ position: absolute;
+ background-color: black;
+ top: 0px;
+ left: 0px;
+ z-index: 99;
+ top: expression(document.body.clientHeight / 2 - this.offsetHeight / 2);
+ left: expression(document.body.clientWidth / 2 - this.offsetWidth / 2);
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ opacity: 0.5;
+ }
+
+ /**
+ * This is not part of the core Modal Dialog styles, instead it's just so that the dialog looks
+ * respectable.
+ */
+ h4 {
+ font-family: Verdana, Arial;
+ padding-top: 10px;
+ }
\ No newline at end of file
--- /dev/null
+@font-face {
+ font-family: Delicious;
+ src: url('/Delicious-Roman.otf')
+}
+
+/**
+* Various
+*/
+body {
+ margin: 0px;
+}
+
+a {
+ text-decoration: none;
+}
+
+code {
+ background-color: #dedede;
+ border: 1px dashed #aaaaaa;
+ padding: 3px;
+ display: block;
+ font-family: Monospace;
+}
+
+
+/**
+* Datagrid stuff
+*/
+table.datagrid {
+ border-collapse: collapse;
+ margin-left: 30px;
+}
+
+table.datagrid th {
+ background-color: #ccc;
+ border: 1px solid #aaa;
+ padding: 2px;
+}
+
+table.datagrid tr {
+ background-color: #ddd;
+}
+
+table.datagrid tr.oddrow {
+ background-color: #eee;
+}
+
+table.datagrid td {
+ border: 1px solid #aaa;
+ padding: 3px;
+}
+
+
+/**
+* Master div
+*/
+.master {
+ font-family: Georgia;
+}
+
+
+/**
+* Header section
+*/
+.header {
+ margin-right: 10px;
+ letter-spacing: 2px;
+ background-image: url(/images/hdrbg.jpg);
+ margin-left: 10px;
+}
+
+.header h1 {
+ margin-top: 0px;
+}
+
+.tagline {
+ font-size: 8pt;
+ position: relative;
+ top: -15px;
+ left: 15px;
+ letter-spacing: 0px;
+}
+
+
+/**
+* Top nav
+*/
+.topnav {
+ color: white;
+ background-color: #314657; /* Old */
+ background-color: #2D4B33;
+ padding: 1px;
+ padding-left: 10px;
+}
+
+.topnav a {
+ color: white;
+}
+
+
+/**
+* Left nav
+*/
+.leftnav,
+.searchbox {
+ width: 180px;
+ color: black;
+ background-color: #FF5A18;
+ margin-left: 5px;
+ margin-top: 10px;
+ padding: 10px;
+ padding-top: 0;
+ padding-bottom: 0;
+ padding: expression('10px');
+ border: 1px solid #B33E11;
+}
+
+.leftnav {
+ box-shadow: 3px 3px 3px #aaa;
+ border-radius: 5px;
+ -moz-box-shadow: 3px 3px 3px #aaa;
+ -webkit-box-shadow: 3px 3px 3px #aaa;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ width: 180px;
+ float: left;
+ hmargin: 5px;
+}
+
+.leftnav h4 {
+ border-bottom: 1px solid black;
+}
+.leftnav a {
+ color: black;
+}
+
+.leftnav ul {
+ margin-left: -20px;
+ margin-left: expression('20px');
+ list-style-type: square;
+}
+
+
+/**
+* Main body section
+*/
+.mainbody {
+ margin-left: 220px;
+}
+
+.borderedTable table {
+ border-collapse: collapse;
+}
+
+.borderedTable th {
+ background-color: #dddddd;
+ border: 1px solid #aaaaaa;
+ font-size: 70%;
+ padding-left: 3px;
+ padding-right: 3px;
+}
+
+.borderedTable td {
+ vertical-align: top;
+ font-size: 70%;
+ border: 1px solid #dddddd;
+}
+
+.newsitem {
+ margin-bottom: 25px;
+}
+
+.newsitem h2,
+.newsitem h1 {
+ display: inline;
+}
+
+.newsitem .date {
+ font-size: 70%;
+}
+
+p.firstLetter:first-letter {
+ font-size: 200%;
+ font-style: italic;
+ font-weight: bold;
+ float: left;
+ padding-right: 3px;
+}
+
+.newsitem p.update {
+ background-color: #efefef;
+ border: 1px dashed black;
+ padding: 5px;
+}
+
+
+/**
+* Comments
+*/
+.comment {
+ padding: 5px;
+ margin-bottom: 20px;
+ font-size: 80%;
+ background-color: #efefef;
+ border: 1px dashed #cccccc;
+}
+
+.comment .body {
+ margin-top: 5px;
+ padding-left: 7px;
+}
+
+.comment .quoteLink {
+ text-align: right;
+ font-size: 90%;
+}
+
+
+/**
+* Errors
+*/
+.error {
+ color: red;
+ font-style: italic;
+}
+
+
+/**
+* Copyright text
+*/
+.copyright {
+ text-align: right;
+ font-size: 75%;
+}
+
+
+/**
+* Admin page
+*/
+.adminPage table {
+ font-family: Verdana;
+ font-size: 10pt;
+}
+
+.adminPage th {
+ background-color: #dddddd;
+}
+
+
+/**
+* Tools page
+*/
+#toolsPage th,
+#toolsPage td {
+}
+
+#toolsPage th {
+ font-weight: bold;
+ text-align: right;
+ white-space: nowrap;
+ vertical-align: top;
+ background-color: #ffffcc;
+}
+
+#toolsPage textarea {
+ height: 200px;
+ width: 800px;
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#ffffff, endColorstr=#ffffcc);
+}
+
+#shortcuts th {
+
+}
+
+#shortcuts th {
+ text-align: left;
+ background-color: #ededed;
+ padding: 2px;
+}
+
+/**
+* Download header/footer
+*/
+div#download pre,
+div#download pre a {
+
+}
+
+/**
+* Code
+*/
+div.boxout,
+pre.code {
+ border: 2px dashed gray;
+ padding: 3px;
+ background-color: #eee;
+}
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+
+body {
+ padding-top: 10px;
+ font-family: Georgia, Arial, Sans-Serif;
+}
+
+pre#code,
+code {
+ display: block;
+ border: 1px solid #aaa;
+ padding: 5px;
+ background-color: #ddd;
+}
+
+#breadcrumb,
+#logo {
+ border: 2px black solid;
+ background-color: #eee;
+ padding: 3px;
+ top: 0;
+ right: 0;
+ position: absolute;
+ margin: 2px;
+ opacity: 0.8;
+}
+#breadcrumb a,
+#logo a {
+ text-decoration: none;
+}
+
+th {
+ text-align: left;
+ border: 1px solid gray;
+ background-color: #ddd;
+ padding: 3px;
+ vertical-align: top;
+}
+
+td {
+ vertical-align: top;
+}
+
+ol li {
+ margin-top: 20px;
+}
+
+ol#implementation li code {
+ margin-top: 5px;
+}
+
+td.description {
+ background-color: #eee;
+ padding: 3px;
+ border: 1px solid #ddd;
+}
+
+td.chart {
+ text-align: center;
+}
+
+.example_boxout {
+ background-color: #eee;
+ padding: 3px;
+ border: 1px solid #aaa;
+}
+
+.code {
+ padding: 5px;
+ background-color: #eee;
+ border: 2px dashed gray
+}
+
+/**
+* This is semi-transparent box in the top left corner
+*/
+div#devtag {
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ -webkit-box-shadow: #999 3px 3px 3px;
+ -moz-box-shadow: #999 3px 3px 3px;
+ box-shadow: #999 3px 3px 3px;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135);
+ position: fixed;
+ top: 2px;
+ right: 2px;
+ width: 145px;
+ border: 2px solid black;
+ text-align: center;
+ font-weight: bold;
+ font-family: Arial;
+ background-color: #fdd;
+}
+
+div#devtag a {
+ font-size: 10px;
+ text-decoration: none;
+ color: blue;
+ opacity: 1;
+}
+
+/**
+* This overrides something defined earlier
+*/
+ol#colors li {
+ margin: 0;
+}
+
+/**
+* styles lists
+*/
+div.list-item {
+ width: 220px;
+ display: inline-block;
+}
+
+div.list-item.label {
+ width: 170px;
+}
+
+legend {
+ background-color: #efefef;
+ border: 1px solid #75736e;
+}
+
+body#licensing span {
+ font-size: 120%;
+}
+
+/**
+* The yellow warning box on the front page
+*/
+div.warning {
+ border: 1px solid black;
+ text-align: center;
+ background-color: #ffa;
+ padding: 5px;
+ margin-top: 5px;
+ border-radius: 15px;
+ -moz-border-radius: 15px;
+ -webkit-border-radius: 15px;
+ -webkit-box-shadow: #aaa 1px 1px 15px;
+ -moz-box-shadow: #aaa 1px 1px 15px;
+ box-shadow: #aaa 1px 1px 15px;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135);
+ z-index: 98;
+}
+
+div.canvasfallback {
+ border: 2px dashed red;
+ background-color: #fee;
+ width: 475px;
+ height: 150px;
+ text-align: center;
+ padding-top: 50px;
+}
+
+/**
+* The title "bar"
+*/
+div#title {
+}
+
+div#title div#image {
+ float: left;
+ margin-right: 15px;
+}
+
+div#title div#text {
+ padding-top: 5px;
+ margin-left: 70px;
+}
+
+
+div.warning p {
+ text-align: center;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ font-weight: bold;
+}
+
+
+div.description {
+ border: 1px dashed gray;
+ background-color: #eee;
+ font-size: 75%;
+ padding: 3px;
+}
+
+div#social {
+ display: inline;
+ display: inline-block;
+}
+
+
+/***************************************************************************************
+* *
+* RGraph CSS classes. *
+* *
+* These allow you to customise how tooltips and context menus will appear. To override *
+* the CSS defined in the graph scripts, you may need to use " ! important" like so: *
+* *
+* font-weight: bold ! important *
+* *
+* You don't always need to use this, only if you're trying to override something which *
+* the script sets. *
+* *
+***************************************************************************************/
+
+.RGraph_png {
+}
+
+.RGraph_tooltip {
+}
+
+.RGraph_contextmenu {
+}
+
+.RGraph_contextmenu_background {
+}
+
+.RGraph_contextmenu_item {
+}
+
+.RGraph_zoom_window {
+}
+
+.RGraph_zoomed_canvas {
+}
+
+.ModalDialog_background {
+}
+
+.ModalDialog_dialog {
+}
+
+.ModalDialog_topbar {
+}
\ No newline at end of file
--- /dev/null
+
+ Backwards compatibility breaks and advisories
+ ===============================================
+
+ +---------------------------------------------------------------------------------------+
+ o [24-12-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [04-12-2010] chart.key.vpos is now silently converted to chart.key.position.y (note that these two properies behave slightly
+ differently - chart.key.position.y is an absolute coordinate). ALSO; the key has been rewritten, so check that
+ your graphs are working as you expect
+ o [04-12-2010] The HBar labels (from chart.labels.above) now have an extra property (chart.labels.above.decimals) which controls
+ how many decimals are shown. This defaults to 0, and as a result you may need to set this if you're expecting decimals.
+
+ +---------------------------------------------------------------------------------------+
+ o [27-11-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [20-11-2010] For the line/bar/scatter, when the X axis is at the bottom and there is a background bar with a
+ negative start (or it results in a negative end value), you now get a warning.
+ o [13-11-2010] All line chart labels are now shown, regardless of how many points on the line there are.
+ o [06-11-2010] The HBar and Scatter have had their scaled handling changed slightly - now if you specify a maximum Y value,
+ that is what is used.
+ o [06-11-2010] The API function RGraph.getSCale(max, obj) now takes two arguments - the maximum value and the graph object.
+
+ +---------------------------------------------------------------------------------------+
+ o [30-10-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [30-10-2010] The Scatter chart can now only have 1/3/5 labels
+ o [30-10-2010] The Line chart can now only have 1/3/5 labels
+ o [23-10-2010] The Bar chart can now only have 1/3/5/10 labels
+ o [23-10-2010] The default for chart.scale.decimals has changed, as such you may need to specify this:
+ myScatter.Set('chart.scale.decimals', 0);
+ o [09-10-2010] Scatter chart ticksize has changed behaviour slightly, you therefore may need to alter it slightly.
+
+ +---------------------------------------------------------------------------------------+
+ o [25-09-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [18-09-2010] For IE9 compatibility purposes, the IE8 DirectX shadow has been removed from the ModalDialog. This only affects
+ MSIE8. The background is still semi-opaque.
+ o [18-09-2010] The common function RGraph.isIE9() has changed to RGraph.isIE9up(). The old one will continue to work, but
+ not indefinitely.
+ o [11-09-2010] The Odometer properties chart.units.pre and chart.units.post have now changed to chart.value.units.pre
+ and chart.value.units.post. The properties chart.units.post and chart.units.pre are now used for the main
+ labels.
+ o [04-09-2010] HBar and Pie charts have been moved to DOM2 event registration for tooltips
+ o [04-09-2010] The RGraph.number_format() function has had its argument list changed
+ o [04-09-2010] Now that RGraph is moving to DOM2 event handlers, tooltips will be incompatible with IE8
+
+ +---------------------------------------------------------------------------------------+
+ o [28-08-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [28-08-2010] Removed option to have the labels on the outside of a Meter. Now they're always on the inside of the Meter
+ and there's always 11 of them (including zero)
+ o [14-08-2010] Changed the HBar property chart.strokecolor to chart.strokestyle
+ o [07-08-2010] The Odometer property chart.needle.thickness has been changed to chart.needle.width. Work has been done on the
+ needle head.
+ o [07-08-2010] Progress bar has now been split into two different graph types:
+ o HProgress
+ o VProgress
+ o [07-08-2010] Progress bar property chart.color is now chart.colors, and should be an array
+ o [07-08-2010] Changed default Bipolar colors to just one - green
+
+ +---------------------------------------------------------------------------------------+
+ o [31-07-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [17-07-2010] Stepped line charts and their tickmarks have been marginally altered. No final tickmark is now shown (it looks
+ odd being isolated)
+ o [17-07-2010] Changed the Odo chart.needle.style to chart.needle.color
+ o [17-07-2010] The Odo properties chart.start, chart.end and chart.value have all been changed to internal properties:
+ obj.start, obj.end and obj.value
+ o [09-07-2010] With the Odometer the old property chart.needle.style has been renamed to be chart.needle.color
+ o [09-07-2010] The Progress bar has had it's properties chart.max and chart.value changed to class properties, this means
+ that if you want to make use of these, you will now need to use myProgress.value and myProgress.max.
+ myProgress being the name of your graph object.
+
+ +---------------------------------------------------------------------------------------+
+ o [26-06-2010] | Stable release |
+ +---------------------------------------------------------------------------------------+
+
+ o [08-05-2010] The Rose charts "chart.labels" property is now different to the "chart.key" property
+ o [01-05-2010] The Donut chart is now a variant of the Pie chart (chart.variant = donut)
+ o [24-04-2010] The radar chart has been renamed to Rose. The library is now called RGraph.rose.js and the constructor has
+ been renamed. It has also been prettied up marginally and labels have been added.
+ o [17-04-2010] All charts have had their property "chart.tooltip.effect" renamed to "chart.tooltips.effect".
+ The Scatter chart has also had its property "chart.tooltip.hotspot" renamed to "chart.tooltips.hotspot"
+ o [17-04-2010] Default chart.tooltips bar chart property has changed from an empty array to null.
+ o [17-04-2010] The RGraph.common.js library has now been split into 5 separate files because it had
+ become far too large. You can read the new implementation details here:
+ http://www.rgraph.net/docs/index.html#implementation
+ o [10-04-2010] The "coords" arrays (for each object) have been unified. Now you no longer need to take
+ into account the margins. What you get in the coords arrays are as they are used on the
+ graph.
+
+ +---------------------------------------------------------------------------------------+
+ o [27-03-2010] | Initial stable release |
+ +---------------------------------------------------------------------------------------+
\ No newline at end of file
--- /dev/null
+ 24th December 2010 (STABLE)
+ ==================
+ o [ANNOTATING] Annotating has been changed to allow annotating to occur in the gutter
+
+ 18th December 2010
+ ==================
+ o [MSIE] MSIE 9 now uses the double click event to trigger the context menu
+ o [ZOOM] Added a note about making the zoom in thumdnail mode circular:
+ http://www.rgraph.net/docs/zoom.html#thumbnail
+
+ 11th December 2010
+ ==================
+ o [API] Added pointer, in the docs, for how to add text to your charts
+ o [BAR] The Bar chart now converts null values to zero
+ o [BAR] You can now specify a textual scale with chart.ylabels.specific
+ o [GANTT] Fixed background bars when specifying an xmin
+ o [HPROGRESS] Labels can now be on top of the bar as well as the bottom
+ o [LINE] You can now specify a textual scale with chart.ylabels.specific
+ o [MISC] Added the RGraph.SetConfig() function - http://www.rgraph.net/docs/setconfig.html
+ o [MISC] Added chart.title.background to graph types that use a title
+ o [PIE] Added chart.highlight.style.2d.color - default is a semi-transparent white color
+ o [PIE] Added chart.tooltips.event
+ o [SCATTER] Crosshairs readout now works when the X axis is in the center
+
+ 4th December 2010
+ =================
+ o [GANTT] Added chart.xmin (default is 0)
+ o [HBAR] Added chart.labels.above.decimals, defaulting to 0. You may need to set this to the number of desired decimals
+ if you're expecting decimals
+ o [LICENSING] If you prefer you can now use PayPal instead of Google Checkout to buy an RGraph license:
+ http://www.rgraph.net/docs/licensing.html#paypal
+ o [LINE] Fixed a bug with null points still showing tooltips
+ o [MISC] The key handling has been rewritten. There is now a documentation page about keys:
+ http://www.rgraph.net/docs/keys.html
+ o [MISC] Added default key properties to all relevant graph types - the key has been completely rewritten and as such,
+ you should check your graphs are as you expect. You may neeed to slightly adjust your key coordinates for example.
+ o [SCATTER] Added option to have vertical bars (much like the horizontal bars option)
+ o [SKELETON] Added more default properties
+ o [VPROGRESS] You can now position the labels on the left of the chart instead of the (default) right.
+
+ 27th November 2010 (STABLE)
+ ==================
+ o [BAR] When showing 10 Y labels, chart.scale.decimals is respected
+ o [DOCS] Add an example showing dynamic updating
+ o [DOCS] Added animation example using jQuery
+ o [LINE] When showing 10 Y labels, chart.scale.decimals is respected
+ o [MISC] Improved the jQuery animation example
+ o [MISC] Removed the "functions as colors" option - this may re-added at a later date
+ o [SCATTER] When showing 10 Y labels, chart.scale.decimals is respected
+ o [SKEL] Added lots more default default properties and functionality that common RGraph functionality
+ uses, for example: chart.resizable.
+
+ 20th November 2010
+ ==================
+ o [API] Documented RGraph.background.Draw().
+ o [DOCS] Added note to AJAX section about types
+ o [DOCS] Added skeleton object which can be used to ease creating new graph types
+ o [DOCS] Added note to misc docs about debugging your graphs
+ o [LINE] Fixed line chart tooltips as separate arguments
+ o [MISC] Minor adjustments to placement and borders
+ o [MISC] For the line/bar/scatter, when the X axis is at the bottom and there is a background bar with a
+ negative start (or it results in a negative end value), you now get a warning.
+ o [MISC] Added animation example using jQuery
+ o [MSIE] Changed instances of document.all to RGraph.isIE8()
+ o [RESIZING] Tweaked the positioning a little, so now nothing should move when you resize a canvas
+ o [SKEL] Added a skeleton file, which can be used as a base when creating new RGraph libraries.
+
+ 13th November 2010
+ ==================
+ o [API] Added RGraph.array_shift() function (removes an element from the beginning of an array)
+ o [LINE] Added chart.labels.above and chart.labels.above.size (default is 8)
+ o [LINE] All chart labels are now shown, regardless of how many points on the line there are.
+ o [LINE] Sets of line points can now be given as one big multi-dimensional array. This may make it easier to use in AJAX, eg:
+ http://dev.rgraph.net/tests/line.arguments.html
+ o [LINE] In Google Chrome, the shadow fix is applied by default. An option exists to enable you to turn this off: chart.chromefix
+ In a few rare cases you will need to turn off shadow blurring (chart.shadow.blur=0)
+ o [MISC] Added more options for in-graph labels. See http://www.rgraph.net/docs/ingraph.html
+ o [MISC] Added note about AJAX and types
+ o [VPROGRESS] Added chart.tooltips.coords.adjust
+ o [VPROGRESS] Added chart.min
+ o [VPROGRESS] Added chart.labels.count, chart.min, chart.scale.decimals
+
+ 6th November 2010
+ =================
+ o [API] RGraph.getScale() now takes the graph object as the second argument
+ o [BAR] Added chart.labels.above.decimals, defaulting to 0
+ o [BAR] Added chart.labels.above.size, which if specified is used as the font size. An example of this and the above change is
+ here: http://dev.rgraph.net/tests/above.bar.html
+ o [BIPOLAR] Added chart.gutter.center, which controls the space where the labels are
+ O [BIPOLAR] Added chart.scale.round
+ o [DOCS] Added note to API docs about references available
+ o [HBAR] Added chart.scale.decimals
+ o [HBAR] Added chart.scale.round
+ o [HPROGRESS] Added chart.min, for specifying a minimum value and chart.scale.decimals
+ o [LINE] Y labels can once again be 1/3/5/10
+ o [LINE] Added chart.scale.round
+ o [LINE] chart.outofbounds is now usable in conjunction with chart.ymax
+ o [LINE] Added chart.chromefix
+ o [RESIZE] Resize now sets the placeholder DIVs 'position' CSS value as inline-block, thus reducing page re-organisation
+ o [ROSE] Added chart.scale.decimals
+ o [ROSE] Added chart.ymax
+ o [ROSE] Added chart.ymin (There's an example here: http://dev.rgraph.net/tests/rose.ymin.html
+ o [RSCATTER] Added chart.scale.decimals // If you use the Rscatter, please test this with your graph(s)
+ o [RSCATTER] Added chart.scale.round // If you use the Rscatter, please test this with your graph(s)
+ o [RSCATTER] Added chart.ymin // If you use the Rscatter, please test this with your graph(s)
+ o [SCATTER] Y labels can once again be 1/3/5/10
+ o [SCATTER] Added chart.scale.decimals
+ o [SCATTER] Added chart.scale.round
+ o [SCATTER] Scatter chart, translating and crosshairs now work when you tell RGraph how you've translated using
+ chart.tooltips.coords.adjust
+ o [SCALE] Added chart.scale.round to: bar, bi-polar, line, rscatter, rose, scatter, tradar This means that scales produced are
+ rounded up, producing rounder values
+ o [SCALE] Re-added 10 Y labels to Line/Scatter. This may be best used In conjunction with chart.scale.round
+ o [TRADAR] Added chart.scale.round
+
+ 30th October 2010 (STABLE)
+ =================
+ o [DOCS] The combination example has been changed and extended. It now shows Pie charts in the tooltips,
+ which can be clicked on.
+ o [DOCS] Added note about using RGraph.showPNG() without a context menu.
+ o [DOCS] RGraph.showPNG() has had it's parameter list changed: http://www.rgraph.net/docs/api.html
+ o [API] Added fix to crosshairs when coordinates are used in conjunction with an X minimum value
+
+
+ 23rd October 2010
+ =================
+
+ Important:
+ The Line (and Scatter chart) chart have been PARTIALLY REVERTED, meaning that the number of labels is again a
+ choice between 1/3/5. The option to have 10 labels will be re-added, but for positive charts only, and
+ probably for scales with maximum values over 10.
+
+ o [API] The RGraph.showPNG() function can now accept the canvas to use as an (optional) argument,
+ allowing you to use the RGraph.showPNG() function with an image, eg:
+ http://www.rgraph.net/examples/tradar.html (1st graph)
+ o [BAR] Bar chart can now only have 1/3/5/10 labels
+ o [GANTT] Borders are now a little thinner (and less blurry)
+ o [KEY] Rounded key corners now lives behind an option: chart.key.rounded (default is false), also documented this
+ o [KEY] Filled keys now only cover the key with one layer of color - so transparency works better
+ o [PNG] URL is now selected by default
+ o [SCATTER] Box plot coords bug has been corrected
+ o [SCATTER] The default for chart.scale.decimals has been changed fr0m 0 (zero) to null. You may need to set this now
+ with: myScatter.Set('chart.scale.decimals', 0);
+
+ 16th October 2010
+ =================
+ o [LINE] Y axis can now have an arbitrary number of labels: http://dev.rgraph.net/tests/ymin.html
+ o [LINE] Made addition so that in Chrome a 1px linewidth is changed to 1.01
+ o [MISC] Corners on the key (in graph mode) are now curvy
+ o [MISC] RGraph.showPNG() now shows the data: URL to the image and makes it easy to copy it to the clipboard
+
+ 9th October 2010
+ ================
+ o [LINE] Changed decimal handling - you may need to specify this: myLine.Set('chart.scale.decimals', 0);
+ o [LINE] Added chart.outofbounds (default is false)
+ o [LINE] Added obj.getPoint(e) method which simplifies getting the pertinent point on the line
+ chart in events (eg the onmousemove event, and now the Line chart uses it)
+ o [LINE] Line charts can now have custom tickmarks
+ o [SCATTER] Added facility for custom tickmarks
+ o [WEBSITE] Fixed favicon path
+
+ 1st October 2010
+ ================
+
+ In October, 25% of all license fees will be donated to Unicef - the International charity for children
+
+ o [BAR] Added .getBar() method. This allows you to easily get the focused/selected bar. There is an example usage here:
+ o [DOCS] Documentation is no longer dynamic
+ o [FUNNEL] Shadows can now go upwards (ie any x/y offset is feasible)
+ o [FUNNEL] Converted this chart type to DOM2 for tooltips
+ o [GANTT] This chart has been moved to DOM2 for tooltips
+ o [HPROGRESS] This chart has been moved to DOM2 for tooltips
+ o [MISC] Colors can now be functions as well as well as strings/gradients. These colors are resolved once, at the start
+ of the .Draw() method
+ o [PIE] Documented method .getSegment(). Used for getting the pertinent
+ segment when the canvas is clicked on (for example), http://www.rgraph.net/docs/pie.html#available.methods
+ o [ROSE] This chart has been moved to DOM2 for tooltips
+ o [ROSE] Documented method .getSegment(). Used for getting the pertinent
+ segment when the canvas is clicked on (for example), http://www.rgraph.net/docs/rose.html#available.methods
+ o [RSCATTER] This chart has been moved to DOM2 for tooltips
+ o [SCATTER] This chart has been moved to DOM2 for tooltips
+ o [SCATTER] Added new properties: chart.yaxispos
+ chart.xaxis
+ chart.noendxtick
+ o [TOOLTIPS] Fixed a tooltip bug that probably only presented itself on the bar chart example page
+ o [TRADAR] Added chart.tooltips.highlight (default is true)
+ o [TRADAR] This chart has been moved to DOM2 for tooltips
+ o [VPROGRESS] This chart has been moved to DOM2 for tooltips
+ o [XML] Removed XML documentation
+
+ 25th September 2010 (STABLE)
+ ===================
+ o [DOCS] Fleshed out the integration example - http://www.rgraph.net/docs/index.html#mysql
+ o [DOCS] Added note to docs about line chart obj.original_data
+
+ 18th September 2010
+ ===================
+ o [ANNOTATE] Added onannotatestart and onannotateend events
+ o [CONTEXT] Fixed submenu offset in MSIE 9
+ o [DOCS] Added MySQL integration example to integration docs
+ o [DOCS] Documented how to use a dynamically created canvas with ExCanvas
+ o [MODALDIALOG] Removed MSIE 8 DirectX shadow from ModalDialog
+ o [MODALDIALOG] Better MSIE 9 compatibility
+ o [PIE] Fixed Pie chart sticks for Chrome 6
+ o [TOOLTIPS] If Y position is less than 0, tooltips are now shown below the cursor to mitigate this
+ o [WEBSITE] Added social networking icons to all pages
+ o [WEBSITE] "Preload" social networking icons
+
+ 11th September 2010
+ ===================
+ o [API] Updated docs for RGraph.Redraw() slightly
+ o [LINE] Added chart.toltips.highlight
+ o [MISC] Updated the combined bar/line example
+ o [ODO] The chart.units.pre and chart.units.post properties have changed to chart.value.units.pre and chart.value.units.post.
+ The chart.units.pre and chart.units.post properties have changed functionally.
+ o [ODO] Added chart.needle.extra to allow you to specify extra needles.
+ o [RSCATTER] Added chart.toltips.highlight
+ o [SCATTER] Added chart.toltips.highlight
+ o [SCATTER] Added coordinates readout: chart.crosshairs.coords
+ chart.crosshairs.coords.fixed
+ chart.crosshairs.coords.fadeout
+ chart.crosshairs.coords.labels.x
+ chart.crosshairs.coords.labels.y
+ Example: http://dev.rgraph.net/tests/crosshairs.html
+ o [ZOOM] Much improved the smoothness of the indicator box when in area mode - see http://www.rgraph.net/docs/zoom.html
+ for an example of area mode
+
+ 4th September 2010
+ ==================
+ o [API] Changed RGraph.number_format() functions arguments
+ o [API] Added RGraph.getGutterSuggest() function, which is a suggestion based on the left labels (only)
+ for the chart.gutter setting.
+ o [API] Added RGraph.showPNG() function, which makes it easy to get images of graphs. This is designed to be
+ used in conjunction with the context menu, and is therfore defined in the RGraph.common.context.js file.
+ There's documentation about it here: http://www.rgraph.net/docs/png.html
+ o [BAR] Added key shadow control
+ o [BAR] Added chart.scale.point and chart.scale.decimal
+ o [BIPOLAR] Added chart.scale.point and chart.scale.decimal
+ o [FUNNEL] Added key shadow control
+ o [HBAR] Moved to DOM 2 event handler functions
+ o [HBAR] Added chart.scale.point and chart.scale.decimal
+ o [LINE] Added key shadow control
+ o [LINE] Added warning about Chrome 6 shadow bug
+ o [LINE] Added chart.noyaxis
+ o [LINE] Added chart.scale.point and chart.scale.decimal
+ o [MISC] Added RGraph.getGutterSuggest(). See the misc documentation for more detail
+ o [MSIE] Now that RGraph is moving to DOM2, tooltips on graph libraries that have been changed will not function in MSIE8.
+ The graphs will still be shown, however tooltips will not function. MSIE9 will still work.
+ o [ODO] Pointer is now more pointy
+ o [PIE] Moved to DOM 2 event handler functions
+ o [ROSE] Added key shadow control
+ o [RSCATTER] Added key shadow control
+ o [SCATTER] Added chart.tooltips.coords.adjust
+ o [SCATTER] Added key shadow control
+ o [SCATTER] Added chart.scale.point and chart.scale.decimal
+ o [TRADAR] Added key shadow control
+ o [WEBSITE] Added code to async page that demonstrates the difference more
+
+ 28th August 2010
+ ================
+ o [API] Updated the API docs a little with the correct data properties for some graph types
+ o [DOCS] Added information about AJAX requests to performance section
+ o [DOCS] Added information about the DOMContentLoaded event to the docs.
+ o [LINE] Fixed problem with chart.ylabels = false
+ o [METER] Added arrow head to the Meter
+ o [METER] Removed outer labels
+ o [METER] Increased number of labels to 11
+ o [MSIE] A few small tweaks to the palette, the scatter chart, the context menu, and tooltips
+ o [ODO] A few fixes for the Odometer in Chrome 6, and a few minor enhancements to the appearance.
+ o [WEBSITE] Live site now uses images.rgraph.net for the index page ** REVERTED **
+ o [WEBSITE] Social networking icons are now combined into one image.
+
+ 21st August 2010
+ ================
+ o [HBAR] Added chart.units.ingraph (for when your units are quite long)
+ o [MISC] Fixed various bugs in circular charts with Chrome 6
+ o [MISC] Added note to front page about suitability for Chrome extensions
+ o [MSIE] Lots more fixes for MSIE 9
+
+ 14th August 2010
+ ================
+ o [BAR] Added chart.tooltips.coords.adjust which allows you to adjust tooltip coordinates when you translate
+ o [HBAR] HBar shadow is now "unified", so you can have an upwards shadow with a large offset and it still looks OK
+ o [HBAR] "chart.labels.abovebar" are now left aligned if they would go off the end of the canvas
+ o [HBAR] Fixed a bug with chart.strokecolor - renamed to chart.strokestyle
+ o [LINE] Added chart.tooltips.coords.adjust (for when you translate() first)
+ o [LINE] Tweaked filled/stepped line charts - stepped line charts show trailing line again
+ o [LINE] Tickmarks, as well as a string, can now also be an array of tickmark styles, eg:
+ http://dev.rgraph.net/tests/test3.html
+ o [LINE] Added chart.ylabels.invert
+ o [MISC] You can now specify in-graph labels like this:
+ line4.Set('chart.labels.ingraph', [6,'July', 3, 'November']);
+ If you have a lot ofempty spaces, this will help.
+ o [MISC] Added type property(=common) to common objects
+ o [ODO] Improved the appearance of the Odometer border
+ o [SCATTER] Tickmarks are no longer drawn when the ticks are boxplots
+ o [SCATTER] Added chart.xmin (upgrade cautiously)
+ o [SCATTER] Boxplots are now usable when the X axis is in the center
+
+ o [NOTE] Chrome 6 appears to have an issue with canvas shadows. Other browsers are fine. A workaround has been added to the
+ Line chart library, however it won't be a solution for all cases. In these cases, turn off shadow blurring.
+
+ 7th August 2010
+ ===============
+ o [BAR] Changed this graph type over to the DOM2 .addEventListener() for tooltips
+ o [BAR] Bar chart can now have an arbitrary number of labels
+ o [BAR] Added chart.ylabels.inside
+ o [BAR] Labels can now be at any angle
+ o [BIPOLAR] Changed the default colors to just one - green
+ o [EVENTS] Added more events:
+ o onmodaldialog
+ o onresize
+ o onadjust
+ o onannotate
+ o [HPROGRESS] Multiple segments are now supported
+ O [HPROGRESS] Added the ability to configure the number of inner tickmarks
+ o [LINE] Labels can now be at any angle
+ o [LINE] Changed this graph type to use the DOM2 .addEventListener() for tooltips
+ o [MISC] Added isRGraph property to common objects
+ o [MISC] Added chart.title.hpos to all graph libraries
+ o [MODALDIALOG] Added onmodaldialog event
+ o [ODO] Outer shadow is now configurable
+ o [ODO] Inner shadow is now configurable
+ o [PROGRESS] This has now been split into the HProgress and VProgress
+ o [SCATTER] Labels can now be at any angle
+ o [TOOLTIPS] Added contract effect, similar to expand but in reverse
+ o [TRADAR] Background grid now matches RScatter in terms of width etc
+ o [VPROGRESS] Multiple segments are now supported
+ o [VPROGRESS] Added the ability to configure the number of inner tickmarks
+
+ o [NOTE] Upgrading to the new H/VProgress should be done cautiously as they have undergone significant alterations
+
+ 31st July 2010
+ ==============
+ o [MISC] Stable release
+ o [DOCS] Added CSS class: RGraph_palette
+ o [DOCS] Added simple example AJAX function to integration documentation:
+ http://www.rgraph.net/docs/index.html#integration
+ o [ZOOM] Fixed a fade-in bug with full canvas zoom
+
+ 24th July 2010
+ ==============
+ o [LINE] This chart can now have text at any angle. Other graph types to follow
+ o [MISC] The minify script now accepts multiple arguments (filenames),
+ eg. ./minify file1 file2 file3 ...
+
+ 17th July 2010
+ ==============
+ o [BAR] Abovebar labels in GROUPED charts are now formatted
+ o [BIPOLAR] Moved this to use addeventListener() for events - this is a test case
+ o [EVENTS] Renamed the RGraph functions RGraph.AddEventListener() and RGraph.FireEvent()
+ to RGraph..AddCustomEventListener() and RGraph.FireCustomEvent()
+ o [EVENTS] Added onbeforedraw event which fires at the start of the .Draw() function
+ o [EVENTS] Added onzoom event to all types of zoom. See docs for details
+ o [HBAR] Added formatting to above bar labels
+ o [HBAR] Fixed grouped HBars with shadows going upwards (partially)
+ o [ODO] Changed a few internal properties. Read more in the docs/.BC.txt file
+ o [ODO] Changed chart.needle.style to chart.needle.color
+ o [RSCATTER] Updated test script
+ o [TRADAR] Added chart.labels.axes - defaults to "nsew"
+ o [TRADAR] Added chart.ymax
+ o [BIPOLAR] Implemented chart.xtickinterval. If you specify this, X tickmark spacing is totally down to this setting
+ o [MISC] Added chart.tooltips.override (see tooltips docs for details)
+
+ 9th July 2010
+ =============
+ o [API] Added __index__ to tooltip DIVs, which corresponds to the original tooltips array. If you're not using an array of strings
+ for your tooltips, this is not pertinent
+ o [API] The RGraph.Tooltip() function now accepts an extra parameter - the index of the tooltip
+ o [MISC] Introduced event support. There are currently just three events - ontooltip - which naturally fires when
+ a tooltip is shown, oncontextmenu - which fires when the RGraph context menu is shown and ondraw - which
+ fires when the .Draw() method is called.. More information is available here:
+ http://www.rgraph.net/docs/events.html
+ o [MISC] Added snap tooltip effect for graph types where the tooltips are triggered using the onmousemove event,
+ ie Line, Rscatter, Scatter and the Tradar
+ o [MISC] MooTools compatibility fix
+ o [MISC] Added obj.isRGraph boolean to all graph objects. This is documented on the misc docs page (docs/misc.html)
+ o [MSIE] MSIE9 compatibility work
+ o [ODO] You can now use textual labels instead of numbers, eg. N/S/E/W (using chart.labels)
+ o [ODO] Added chart.zerostart option determining whether the top label is zero or the end value
+ o [ODO] Fixed a pointer bug
+ o [ODO] Fixed a rounding issue and added chart.scale.decimals (default is 0)
+ o [ODO] Colors can now be configured with: chart.green.color, chart.yellow.color, chart.red.color
+ o [PROGRESS] Changed a few internal properties. Read more in the docs/.BC.txt file
+ o [TRADAR] Added background diagonal lines (going from the center outwards)
+
+
+ 26th June 2010
+ ==============
+ o Stable release
+
+ 18th June 2010
+ ==============
+ o [BAR] Documented grid properties: chart.background.grid.autofit, chart.background.grid.autofit.numhlines, chart.background.grid.autofit.numvlines
+ o [DOCS] Documentation pages have been reorganised and a contents list added to each page
+ o [GANTT] Documented grid properties: chart.background.grid.autofit, chart.background.grid.autofit.numhlines, chart.background.grid.autofit.numvlines
+ o [HBAR] Documented grid properties: chart.background.grid.autofit, chart.background.grid.autofit.numhlines, chart.background.grid.autofit.numvlines
+ o [LINE] Documented grid properties: chart.background.grid.autofit, chart.background.grid.autofit.numhlines, chart.background.grid.autofit.numvlines
+ o [SCATTER] Documented grid properties: chart.background.grid.autofit, chart.background.grid.autofit.numhlines, chart.background.grid.autofit.numvlines
+ o [WEBSITE] Added warning about MSIE versions less than 8
+
+ 5th June 2010
+ =============
+ o [HBAR] Added the following properties: chart.title.xaxis
+ chart.title.yaxis
+ chart.title.xaxis.pos
+ chart.title.yaxis.pos
+ o [ROSE] Slightly increased the area recognised to initiate resizing the Rose (ie the size of the hotspot)
+ o [TRADAR] Added adjusting to the TRadar
+
+ 29th May 2010
+ =============
+ o [BAR] Added adjusting
+ o [ODO] Added gray border effect
+ o [ODO] Added chart.tickmarks.highlight
+ o [PROGRESS] Added adjusting
+ o [ROSE] Added adjusting
+ o [SCATTER] Added chart.ymin
+
+ 22nd May 2010
+ =============
+ o [LINE] Added interactive adjustments
+
+ 15th May 2010
+ =============
+ o [API] Updated the .getSegment() for use with the Rose chart and Donut variant charts
+ o [API] Added RGraph.array_pad() function
+ o [BAR] You can now have grouped bar charts with shadows going to the left
+ o [LINE] Linewidth can now, as well as being a single number, be an array of numbers, one for each line
+ o [LINE] You can now have labels on the inside of the Y axis as opposed to having them in the gutter
+ o [MISC] ModalDialog and zoom background DIVs are now much better in regards to page coverage (the semi-opaque background)
+ o [MISC] Removed RGraph.getPageWidth() and RGraph.getPageHeight() functions
+ o [MISC] You can now pass a color as the second argument to RGraph.Redraw() which it will use
+ o [MISC] Resizing the window when zoomed no longer hides the zoom
+ o [ODO] Little bit of work on pointers and MSIE compatibility
+ o [ODO] Added "digital" readout option, as shown on the example page
+ o [PROGRESS] This chart type can now have an "in-bar" indicator
+ o [PIE] Converted this chart to use RGraph.getSegment() for tooltips
+ o [ROSE] You can now set the strokestyle
+ o [ROSE] Converted this chart to use RGraph.getSegment() for tooltips
+ o [SCATTER] Added chart.line.linewidth and, as with the line, it can be either a number or an array of numbers
+ o [SCATTER] chart.line.stepped can now, as well as simply true or false, be an array of booleans. This allows you to have
+ multiple lines, some stepped, some not.
+
+ 8th May 2010
+ ============
+ o [MISC] You can now have multi-line labels by using the text "\r\n" in your label (without the quotes)
+ o [MISC] Resizing a graph no longer affects the page layout
+ o [ROSE] Added labels to this chart
+ o [ROSE] The Rose chart origin is now the "north" axis
+ o [WEBSITE] Re-arranged the front page
+ o [WEBSITE] Removed a lot of examples from the website and made the whole thing a little more streamlined
+ o [ZOOM] Once visible, you can now double click a zoomed area to expand it to a full size zoom. You can see
+ this on the line graph on the front page.
+
+ 1st May 2010
+ ============
+ o [DONUT] This is no longer a seperate class, but now a variant of the Pie chart (chart.variant = donut)
+ o [MISC] Added note about copying the text in tooltips using Firefox
+ o [ROSE] Tooltip highlighted area is now "under" the labels (as opposed to "over")
+
+ 25th April 2010
+ ===============
+ o [MISC] Separated out resizing functionality into it's own file - RGraph.common.resizing.js This further reduces the size of
+ RGraph.common.core.js
+ o [MISC] In area zoom, you can now left-drag to move the zoom itself around, and right-drag to move the zoomed canvas around inside
+ the zoom
+ o [MISC] Added RGraph_zoomed_area CSS class
+ o [MISC] Added chart.crosshairs.linewidth to bar, line and scatter
+ o [MISC] You can now have a single level of submenu items with the context menu
+ o [RADAR] This chart has been renamed to Rose and the appearance enhanced
+
+ 17th April 2010
+ ===============
+ o [BAR] This chart type can now use the onmousemove event for tooltips instead of the onmousedown
+ o [DOCS] Added tooltips documentation page - this explains tooltips and how you can specify them. There are now 4 methods available.
+ o [MISC] The zoomed area is now draggable once visible
+ o [MISC] Split out RGraph.common.js into separate files, consisting of:
+ o RGraph.common.core.js
+ o RGraph.common.annotate.js
+ o RGraph.common.context.js
+ o RGraph.common.tooltips.js
+ o RGraph.common.zoom.js
+ If you don't use any of the interactive features, the core common library is now roughly half the size. See
+ http://www.rgraph.net/docs/index.html#implementation for details of the new way to implement RGraph
+ o [MISC] You can now specify the CSS class that tooltips use (using chart.tooltips.css.class). If you have multiple
+ graphs on one page and want the tooltips to appear differently, this is how to do it
+ o [MISC] New tooltip effect - "none". Which, as the name implies, doesn't fade or expand.
+
+ 10th April 2010
+ ===============
+ o [MISC] Cleaned up each graphs coords array. If you use the coords arrays, you may need to adjust your numbers slightly.
+ The new coords may be off for you by one or two chart.margin (it can be hmargin or vmargin depending on your graph type)
+ o [MISC] Added details of backwards compatibility breaks
+ o [MISC] New zoom mode - area. You can see this on the front page line graph and on the zoom documentation page
+ o [MISC] Added resizing capability. Will not work with other dynamic features (except the context menu)
+
+ 3rd April 2010
+ ==============
+ o [BAR] Added new grid properties: chart.background.grid.autofit
+ chart.background.grid.autofit.numhlines
+ chart.background.grid.autofit.numvlines
+ o [BAR] Added chart.title.xaxis
+ o [BAR] Added chart.title.yaxis
+ o [BAR] Added chart.title.xaxis.pos
+ o [BAR] Added chart.title.yaxis.pos
+ o [GANTT] Adjusted the background grid, adding the required default properties
+ o [GANTT] Added new grid properties: chart.background.grid.autofit
+ chart.background.grid.autofit.numhlines
+ chart.background.grid.autofit.numvlines
+ o [HBAR] Added new grid properties: chart.background.grid.autofit
+ chart.background.grid.autofit.numhlines
+ chart.background.grid.autofit.numvlines
+ o [LINE] Multiple shadow colors are now facilitated (see example on front page)
+ o [LINE] Added new grid properties: chart.background.grid.autofit
+ chart.background.grid.autofit.numhlines
+ chart.background.grid.autofit.numvlines
+ o [LINE] Added chart.title.xaxis
+ o [LINE] Added chart.title.yaxis
+ o [LINE] Added chart.title.xaxis.pos
+ o [LINE] Added chart.title.yaxis.pos
+ o [LINE] Added chart.backdrop, chart.backdrop.alpha and chart.backdrop.size
+ o [LINE] Shadow color can now be an array of shadow colors. ie. A different one for each line
+ o [MISC] Added note about installing your own event handlers to misc documentation page
+ o [MISC] Added RGraph.SetShadow() - a shortcut function for setting the shadow
+ o [ODO] Added option to not draw the pointer tail
+ o [ODO] Added chart.needle.type option. It can be "pointer" (default) or "triangle".
+ o [PROGRESS] Added chart.margin
+ o [PROGRESS] Added inner tickmarks (chart.tickmarks.inner)
+ o [PROGRESS] Made examples a bit better
+ o [SCATTER] Connecting lines can now be stepped (chart.line.stepped)
+ o [SCATTER] You can now specify the exact X point at which an X label is drawn
+ o [SCATTER] Added new grid properties: chart.background.grid.autofit
+ chart.background.grid.autofit.numhlines
+ chart.background.grid.autofit.numvlines
+ o [SCATTER] Added chart.title.xaxis
+ o [SCATTER] Added chart.title.yaxis
+ o [SCATTER] Added chart.title.xaxis.pos
+ o [SCATTER] Added chart.title.yaxis.pos
+
+
++------------------------------------------------------------------------------------------------------------+
+| STABLE RELEASE - 27th March 2010 |
++------------------------------------------------------------------------------------------------------------+
+
+
+ 27th March 2010
+ ===============
+ o [MISC] Just tweaks - nothing major
+
+ 20th March 2010
+ ===============
+ o [MISC] Reverted dark background color for zoom back to the lighter one
+ o [MODALDIALOG] Reverted the dark background color back to the lighter one
+ o [METER] Added more feint tickmarks
+ o [METER] Labels are now angled. This will be an option in the future
+ o [ODO] Added more feint tickmarks
+ o [ODO] Labels are now angled. This will be an option in the future
+ o [ODO] Significant changes to this see the docs page - http://www.rgraph.net/docs/odo.html
+
+ 13th March 2010
+ ===============
+ o [MISC] Removed curvy corner from context menu
+ o [WEBSITE] Added Google Buzz social networking icon
+ o [MODALDIALOG] Darkened the background a little. You can set this back if you wish by using the ModalDialog_dialog CSS class
+
+ 6th March 2010
+ ==============
+ o [METER] Documented shadow properties
+ o [MISC] Added RGraph.getPageWidth() which returns the page width, accommodating browser differences
+ o [MISC] Added RGraph.getPageHeight() which returns the page height, accommodating browser differences
+ o [MODALDIALOG] Increased the radius of the corners (ie they're more rounded now)
+ o [MODALDIALOG] Documented the ModalDialog CSS classes and also added miscellaneous documentation
+ o [MSIE] Added context menu to the MSIE example
+
+ 27th February 2010
+ ==================
+ o [API] Added information about the coords array.
+ o [API] Added a little information about dynamically updating your graphs
+ o [MISC] Zoom in canvas mode now has a dark background option - chart.zoom.background - can be true or false and defaults to true
+ Note: If you use the full canvas zoom, this will affect you - if you don't like it, you will need to turn it off
+ o [MISC] Added RGraph_zoomed_canvas CSS class. Also tweaked the default CSS for the two types of zoom
+ o [MISC] Tweaked the animation example
+
+ 20th February 2010
+ ==================
+ o [DOCS] Added reasonable caching strategy
+ o [DOCS] Expanded the API docs regarding the data properties
+ o [LINE] Removed chart.border property. You should use CSS on your canvas element instead.
+ o [LINE] Added chart.ymin property
+ o [LINE] Tickmarks are no longer drawn if the tick is outside the Y scale range
+ o [METER] Added shadow
+ o [WEBSITE] Removed most tables from the website
+ o [WEBSITE] Fixed the issue with the front page graphs, Google Chrome and missing text. This was done by NOT using
+ asynchronous processing.
+
+ 9th February 2010
+ =================
+ o [PIE] Fixed pie chart sticks with athick white border
+ o [PIE] Added chart.labels.sticks.color
+ o [DOCS] Added link anchors to documentation pages, eg: http://www.rgraph.net/docs/bar.html#chart.labels
+
+ 7th February 2010
+ =================
+ o [BAR] Added ability to specify number of Y labels - 1, 3 or 5 (the default).
+ o [LINE] Added ability to specify number of Y labels - 1, 3 or 5 (the default).
+ o [LINE] Added a little missing documentation
+ o [LINE] Small fix to MSIE arrow style tickmarks
+ o [MISC] Optimisations to all chart libraries
+ o [MISC] Added RGraph_zoom_window CSS class - the front page uses it if you want an example
+ o [SCATTER] Added ability to specify number of Y labels - 1, 3 or 5 (the default).
+ o [SCATTER] Added a little missing documentation
+
+ 30th January 2010
+ =================
+ o [BAR] Performance tweaks.
+ o [DOCS] Made note about using tables for layout and how it can impact negatively on graph speed.
+ o [DOCS] Documented Pie chart label sticks.
+ o [LINE] Performance tweaks.
+ o [MISC] Opera (10.5) now supports the canvas text and shadow APIs
+
+ 23rd January 2010
+ =================
+ o [LINE] Fix to arrow style tickmarks
+ o [MISC] Very minor change to tooltips and event handling
+ o [SCATTER] Added diamond shape tickmarks
+
+ 16th January 2010
+ =================
+ o [BAR] Documented chart.ylabels
+ o [CONTEXT] Context menus are now positioned correctly when you specify a DOCTYPE in MSIE
+ o [LINE] Added and documented chart.ylabels
+ o [MODAL DIALOG] This is now completely static (when scrolling) in all browsers (Chrome, FF, MSIE, Safari, Opera), (MSIE requires that
+ you use a doctype.
+ o [ODO] Improved MSIE support (spurious circles are no longer drawn)
+
+ 9th January 2010
+ ================
+ o [BAR] Added glass variant
+ o [BAR] Added sketch variant
+ o [DOCS] Documented getCanvasXY() function
+ o [MISC] Links now work in tooltips
+ o [MISC] Added standard box-shadow: CSS property where necessary
+ o [MISC] Slight border-radius change to context menu
+ o [PIE] Added small (optional) label sticks
+ o [PROGRESS] Added indicator arrows
+
+ 2nd January 2010
+ ================
+ o [METER] Added this as a new chart type
+ o [MISC] More optimisations for Meter, Line and Bar charts
+ o [TRADAR] Added tooltips
+ o [TRADAR] Added ability to specify offsetx and offsety for labels
+
+ 19th December 2009
+ ==================
+ o [BAR] Added support for MSIE shadows. Shadow blurring is not available though
+ o [BAR] Fixed dot chart colours not showing correctly in MSIE
+ o [BIPOLAR] Added support for MSIE shadows. Shadow blurring is not available though
+ o [FUNNEL] Optimised this chart type a little
+ o [FUNNEL] Added support for MSIE shadows. Shadow blurring is not available though
+ o [LINE] Added support for MSIE shadows. Shadow blurring is not available though
+ o [MISC] The context menu for Safari, Opera and Firefox Mac is now triggered by a double click (left mouse button).
+ o [MSIE] Tooltips now work (albeit a little unreliably), but this browser is very slow at showing them. Using a doctype will
+ cause them to be ou of position.
+ o [PIE] Added support for MSIE shadows. Shadow blurring is not available though
+ o [PROGRESS] Added support for MSIE shadows. Shadow blurring is not available though
+
+ 12th December 2009
+ ==================
+ o [MSIE] Microsoft Internet Explorer is now supported in a limited fashion. You can see it in action here:
+ http://www.rgraph.net/docs/msie.html This is not using Google Chrome Frame.
+ o [TRADAR] Rewrote so that it works with MSIE. This rewrite means that tooltips will be feasible (I'm yet to add them)
+ o [WEBSITE] Significant reorganisation of website
+
+ 5th December 2009
+ =================
+ o [API] Added and documented RGraph.Async() function, which can be used to help speed up your pages. There's a page which details it:
+ http://www.rgraph.net/docs/async.html
+ o [MISC] Removed text support for Opera. The graphs are still displayed, albeit without text
+ o [MISC] Changed to object detection in place of specific browser detection for older browsers. This means more
+ browsers are accounted for.
+ o [MISC] Added RGraph.getSegment() function, which returns the applicable segment information
+ (x, y, radius, startAngle, endAngle)
+ o [SCATTER] Added ability to do Barplots using the Scatter chart.
+ o [SCATTER] Can now specify the scatter to not display tick marks (be specifying the tickmark as null)
+
+ 28th November 2009
+ ==================
+ o [DOCS] Added RGraph.HideContext() to API documentation.
+ o [MISC] Simplified logic for showing the context menu. Please test your browser on the website before upgrading as this may
+ cause regressions.
+ o [MISC] Fixed slight oddity for zoom which resulted in a small zoom thumbnail
+ o [MISC] The RGraph website now works with Google Chrome Frame. NB: If you're having a similar problem, ensure the META
+ tag is in the first 1Kb of the page.
+ o [MISC] Achieved a degree of Opera compatibility. Please bear in mind that Opera does not yet support the canvas text
+ or shadow APIs so do not expect to see any shadows on your graphs. Text is simulated however, so the graphs
+ are still usable in some circumstances however. Also bear in mind that Opera support is buggy.
+
+ 20th November 2009
+ ==================
+ o [MISC] Added new mode for zoom - thumbnail This shows a zoom thumbnail (you must set chart.zoom.mode to thumbnail) instead of
+ zooming the entire canvas. The line graph on the front page shows an example of it.
+ o [MISC] Context menu in Mac Firefox is now attached to the left mouse button instead of the right
+ o [NOTE] Annotations are now persistent in Chrome (dev channel releases at the moment) and Chrome Frame
+
+ 14th November 2009
+ ==================
+ o [ALL] Finished zoom function
+ o [PIE] Work on linewidth and line color
+ o [MISC] Changed Safari to use left click for context menu - should elimate the temperamentality
+
+ 8th November 2009
+ =================
+ o [ALL] Added zoom functionality (This is not finished yet)
+ o [API] Corrected this regarding graph data
+ o [MISC] Added RGraph.ClearAnnotations() to API documentation. NB: This function is called when you call RGraph.Clear()
+
+ 31st October 2009
+ =================
+ o [DOCS] Correct the docs regarding text sizes
+ o [PIE] Miscellaneous fixes
+ o [RADAR] Changed to be left aligned
+
+ 25th October 2009
+ =================
+ o [ALL] Added property: chart.text.font
+ o [ALL] Added property: chart.text.color
+ o [ALL] Changed from pixels to points for font sizes (you may need to reduce your font sizes slightly). Default is now 10pt
+ o [DONUT] Added ability to set key as being in gutter
+ o [DONUT] Added chart.align for left/center/right aligning the chart
+ o [PIE] Added chart.align for left/center/right aligning the chart
+
+ 17th October 2009
+ =================
+ o [BAR] Added new option: chart.axis.color
+ o [Bipolar] Added new option: chart.axis.color
+ o [DOCS] Automated generation of API (properties) documentation
+ o [HBAR] Added new option: chart.axis.color
+ o [LINE] Added new option: chart.noxaxis
+ o [LINE] Added new option: chart.axis.color
+ o [LINE] Reduced default X/Y shadow offset
+ o [LINE] Added new option: chart.noendtick - useful for when you're generating line charts with Y axes on both sides
+ o [MISC] Changed "Combining..." page to illustrate combining two line charts
+ o [MISC] Added XML documentation
+ o [MISC] Added performance note about combining libraries
+ o [SCATTER] Added new option: chart.axis.color
+
+ 10th October 2009
+ =================
+ o [BAR] Added chart.background.grid.hlines, chart.background.grid.chart.background.grid.vlines and chart.background.grid.border
+ o [BAR] Changed chart.labels.abovebar to chart.labels.above
+ o [BAR] Added chart.labels.above to stacked bar charts
+ o [BIPOLAR] Fixed using chart.xmax
+ o [BIPOLAR] Added chart.scale.decimals
+ o [HBAR] Added chart.background.grid.hlines, chart.background.grid.chart.background.grid.vlines and chart.background.grid.border
+ o [HBAR] Added chart.labels.above. Not technically "above" the bar (not at all), but it's so named for API compatibility
+ o [HBAR] Added chart.labels.above to stacked chart
+ o [LINE] Added chart.background.grid.hlines, chart.background.grid.chart.background.grid.vlines and chart.background.grid.border
+ o [PIE] Miscellaeous work
+ o [SCATTER] Added chart.background.grid.hlines, chart.background.grid.chart.background.grid.vlines and chart.background.grid.border
+ o [WEBSITE] Added sharing buttons
+
+ 3rd October 2009
+ ================
+ o [ALL] Charts now clean up events if tooltips are not installed. This means that if tooltips are not being used
+ the onmousemove/onclick events (depending on the graph library) are reset to null.
+ o [BAR] 3D effect now works with background grid and bars
+ o [DOCS] Added API documentation (replaces working.html)
+ o [MISC] Changed various graphs default background bar colors to white
+ O [MISC] Removed array_range() function - unused
+ o [LINE] More (general) work
+ o [LINE] chart.fillstyle can now be an array as well as a string
+ o [LINE] Added 3D variant to line chart.
+ o [MISC] Added minified library archive
+
+ 19th September 2009
+ ===================
+ o [ALL] Added new option - chart.title.color - to all graph types (except the LED)
+ o [LINE] Slight modification to filled line charts and the (stroke) colour.
+ o [LINE] Changed stepped line chart so last vertical line is not drawn
+ o [LINE] Changed the look (for the better) of filled line charts and thick lines
+ o [LINE] Added option - chart.axesontop - useful in a minority of cases; causes the axes to be
+ redrawn after the graph
+ o [LINE] Added "chart.filled.range" option. Used to compare the range/difference between two sets of data.
+ o [MISC] Fixed negative horizontal bars
+ o [LINE] Fixed problem with null arguments
+ o [LINE] Filled line charts now work a little better with negative values
+ o [PROGRESS] Added chart.tickmarks.color
+ o [PROGRESS] Added chart.text.color
+
+ 6th September 2009
+ ==================
+ o [ALL] Fixed libraries to work with Prototype.js
+ o [ALL] Added chart.title.vpos allowing you override and specify the position of the title. This should be a
+ decimal from 0 to 1. By default it's not used
+ o [BAR] Can now have Y axis labels in right hand gutter
+ o [LINE] Can now have Y axis labels in right hand gutter
+ o [COMMON] Fixed scale generation bug when maximum value is zero (ie all of your values are zero)
+
+ 22nd August 2009
+ ================
+ o [MISC] Optimisations on various graph libraries
+ o [MISC] Very minor albeit better HTML5 compliance
+ o [LINE] You can now specify the Y axis position - left (default) or right
+
+ 8th August 2009
+ ===============
+ o [BAR] Added 3D effect to regular, grouped and stacked charts
+ o [GANTT] Can now specify background grid width
+ o [LED] The text is now stripped of right-most whitespace
+
+ 25th July 2009
+ ==============
+ o [MISC] Stop using $() function for better compatibility with outside libraries
+ o [SCATTER] Support supplying multiple datasets as one big array instead of multiple arrays
+ o [ALL] Changed all graph types to "new RGraph.xxx()" format
+
+ 3rd July 2009
+ =============
+ o [DOCS] Misc updates
+ o [DOCS] Fixed docs regarding default gutter size
+ o [LINE] Handle null values better
+ o [LINE] Documented optional different fill colour
+ o [MISC] Added caching enhancements
+ o [MISC] Slight change to FixEventObject() so offsetX and offsetY are available in Firefox
+ o [SCATTER] Allow multiple datasets. Effect is only visible when lines are shown
+ o [SCATTER] Key can now be shown for multiple lines
+
+ 20th June 2009
+ ==============
+ o [ALL] Code optimisations
+ o [ALL] Annotations are now persistent in browsers that support HTML5 DOM storage (currently Firefox 3.5 and Safari 4)
+ o [BAR] Added ability to specify labels above bars on single and grouped bar charts
+ o [SCATTER] Added ability to show connecting line
+
+ 6th June 2009
+ =============
+ o [ALL] On graphs that support tooltips, you can now have context menus at the same time as tooltips
+ o [MISC] Fixes to hiding palette in Chrome
+ o [MISC] Fixed a palette resizing bug
+ o [MISC] Changed the number of frames for expand and fade tooltip effects from 5 to 10 - looks a little smoother
+ o [MISC] Fixed a minor scale bug
+ o [MISC] Changed name of ShowPalette() function to RGraph.Showpalette()
+ o [PIE] Fixed minor pie chart bugs with mouse cursor
+
+ 23rd May 2009
+ =============
+ o [ALL] Documented context menu
+ o [ALL] Added annotations - useful to highlight interactively, and added example to front page line chart
+ o [BAR] Added pyramid chart variant
+ o [BAR] Added arrow chart variant
+ o [BAR] Added crosshairs
+ o [FUNNEL] Added tooltips
+ o [LINE] Added crosshairs
+ o [LINE] Can now have a context menu at the same time as tooltips
+ o [MISC] Added annotations mini colour palette
+ o [SCATTER] Added crosshairs
+ o [SCATTER] Fixed bug where pre/post units were not being shown
+ o [SCATTER] Can now have a context menu at the same time as tooltips
+
+ 9th May 2009
+ ============
+ o [BAR] Can now better control the shadow
+ o [BAR] Now ymax is exactly that which is used
+ o [BAR] You can now control the number of decimals that are used
+ o [BIPOLAR] Added shadow
+ o [HBAR] Can now better control the shadow
+ o [HBAR] Added tooltipcapability
+ o [PIE] Can now better control the shadow
+ o [LINE] Can now better control the shadow
+ o [LINE] Reversed order of arguments to the constructor - ie the data - so they are uniform with things like labels and tooltips
+ o [LINE] Can now have a fill colour that's different to the line colour (see the last example on the lines example page)
+ o [LINE] Added arrow style tickmarks (filled and not) - look best with a linewidth of 1 or 2
+ o [LINE] Number of labels is now independent of number of datapoints, as are number of X tickmarks
+ The second to last two line chart examples show this in action
+ o [LINE] Added an interesting example showing off the new independence of labels, datapoints and tickmarks. The ninth
+ line example (the sin/cos/tan curves) has 361 datapoints but only 5 labels - 361 labels would be a bit much.
+ o [LINE] Line chart no longer draws in the gutter (see this in action by looking at the above tangent curve example)
+ o [PROGRESS] Brought shadow into line with the rest of the graphs
+ o [PROGRESS] Tidied this up a little
+ o [PROGRESS] Added tooltip capability
+ o [RADAR] Added tooltip capability
+ o [DOCS] Added small note about canvas and accessibility
+ o [MISC] Fixed a few HTML warnings
+ o [MISC] Cleaned up CSS warnings
+ o [MISC] Updated license
+ o [MISC] Slight tweaks to context menu: Specifying a null callback now means that that menu item
+ will not trigger the rollover effect
+ o [MISC] Fixed a scale bug where the top value is 5.xxx
+ o [WEBSITE] Made the line graph and pie chart on the front page a little more interactive
+ o [WEBSITE] Added a funnel chart to the front page
+ o [FUNNEL] Added horizontal alignment for labels
+
+ 25th April 1009
+ ===============
+ o [MISC] Changed to .zip format for archive instead of .tar.gz - easier to work with
+ o [MISC] Fixed issue with "expand" type tooltips & timers
+ o [MISC] Unified default gutter setting (25px)
+ o [MISC] Made shadows all point the same way across all graphs
+ o [MISC] Fixed horizontal background bars so that specifying a value greater than the ymax (or less than the negative ymax)
+ uses the ymax value instead
+ o [MISC] ModalDialog fixes for width and height settings on various browsers and DOM modes
+ o [MISC] Scale is now generated more accurately for *really* tiny values
+ o [LINE] Performance enhancements regarding scale generation
+
+ 11th April 2009
+ ===============
+ o [MISC] Slight aleration to improve "grow" option of tooltips. Instead of starting at the top and growing downwards, it now
+ starts in the center and grows outward in all directions
+ o [MISC] Changed "grow" to "expand" for tooltips
+ o [ODO] Documented ability to turn off the pointer end
+ o [DONUT] Added ring-in-ring effect, enabling multiple datasets
+ o [DONUT] Added option to use in-graph key instead of labels
+ o [LINE] Changed "tick" style tickmarks to "halftick". "tick" now gives a fullheight tickmark, and also added "endtick"
+ which gives a full height tick mark at the ends of the lines
+ o [MISC] Added doctype to all pages and fixed modaldialog accordingly
+ o [MISC] CSS and DTD fixes across the site
+ o [MISC] ModalDialog fixes
+ o [MISC] Add type attribute back to SCRIPT tags - needed for DTD compliance
+ o [HBAR] Added new graph type - Horizontal Bar chart
+
+ 28th March 2009
+ ===============
+ o [BAR] Added dot chart capability
+ o [BAR] When mouse is over a hotspot, cursor now changes
+ o [PIE] When mouse is over a hotspot, cursor now changes
+ o [LINE] When mouse is over a hotspot, cursor now changes
+ o [GANTT] When mouse is over a hotspot, cursor now changes
+ o [DONUT] When mouse is over a hotspot, cursor now changes
+ o [SCATTER] When mouse is over a hotspot, cursor now changes
+ o [MISC] Added new effect for tooltips. So now you can have "fade" (default) or "grow"
+ o [MISC] Added drop shadow to context menu
+ o [MISC] Resolved Chrome color, shadow and gradient bugs
+ o [DOCS] Added short section about suggested library layout
+ o [WEBSITE] Always now show two download links
+
+ 14th March 2009
+ ===============
+ o o------------------------------------------------------------------------------------------------------------------o
+ | IMPORTANT ! |
+ | Every single one of the property names has been changed to be a little more unified. The new format is now |
+ | "chart.xxx" where xxx is the actual name. Some of the names have been changed completely, eg. "chart.text.size", |
+ | which was formerly "textheight", whilst others only marginally. This was necessary to bring some semblance of |
+ | uniformity to the RGraph properties across all of the libraries, make it look a bit more "proffessional" and |
+ | provide plenty of scope for future properties. |
+ | |
+ | You should also note that as of this release (14th March 2009) that RGraph has been changed to use the canvas |
+ | text and shadow APIs. This may mean you needing to upgrade your browser if you want to use the latest version. |
+ | At the time of writing, this meant Firefox 3.1b2, Safari 4 and Chrome 2. If you don't wish to upgrade your |
+ | browser, or need Opera support, then you will need to remain on the 28th February 2009 version. |
+ o------------------------------------------------------------------------------------------------------------------o
+ o [FUNNEL] Added key ability to Funnel chart
+ o [FUNNEL] Added shadow for key
+ o [BAR] Added shadow for key
+ o [LINE] Added shadow for key
+ o [RADAR] Added shadow for key
+ o [TRADAR] Added shadow for key
+ o [RADAR] Added tick marks to the axes
+ o [PIE] Added border option.
+ o [BAR] Added "in graph" static labels, useful for highlighting things
+ o [LINE] Added "in graph" static labels, useful for highlighting things
+ o [MISC] Provided easy access to minified copies of the libraries
+ o [ODO] Added inner and outer shadows
+ o [BAR] Changed to canvas text & shadow API
+ o [BIPOLAR] Changed to canvas text & shadow API
+ o [DONUT] Changed to canvas text & shadow API
+ o [FUNNEL] Changed to canvas text & shadow API
+ o [GANTT] Changed to canvas text & shadow API
+ o [LED] Changed to canvas text & shadow API
+ o [LINE] Changed to canvas text & shadow API
+ o [ODO] Changed to canvas text & shadow API
+ o [PIE] Changed to canvas text & shadow API
+ o [PROGRESS] Changed to canvas text & shadow API
+ o [radar] Changed to canvas text & shadow API
+ o [SCATTER] Changed to canvas text & shadow API
+ o [TRADAR] Changed to canvas text & shadow API
+
+ 28th February 2009
+ ==================
+ o [MISC] Added performance information about onload
+ o [BAR] Can now specify Y axis units (both before and after the number)
+ o [LINE] Can now specify Y axis units (both before and after the number)
+ o [SCATTER] Can now specify Y axis units (both before and after the number)
+ o [PROGRESS] Can now specify Y axis units (both before and after the number)
+ o [BIPOLAR] Can now specify X axis units (both before and after the number)
+ o [BAR] Fixed scale bug
+ o [MISC] Added UK pound sign to font set
+ o [FUNNEL] Added new chart - Funnel chart. Can be used to represent sales processes
+ o [FUNNEL] Made funnel use canvas shadow API
+ o [MISC] Changed minification script to work "in-place" NOTE
+ o [PROGRESS] Made progress use canvas shadow API
+ o [MISC] Tested RGraph on Safari 4.0 - appears to be fine
+ o [LINE] Added ability to specify horizontal coloured bars
+ o [BAR] Added ability to specify horizontal coloured bars
+ o [SCATTER] Added ability to specify horizontal coloured bars
+
+ 14th February 2009
+ ==================
+ o [PIE] Added tooltips + updated docs to correspond
+ o [WEBSITE] Added tooltips to Pie on front page
+ o [LED] Added "counter-like" basic LED grid
+ o [DONUT] Made donut a proxy to pie chart
+ o [DONUT] Added tooltips
+ o [MISC] Moved CSS styles to scripts. You no longer need to define CSS styles unless you wish to override something
+ o [PIE] Made tooltips for pie use 3D effect. This is optional - it can be the traditional 2D or the new 3D effect
+ o [SCATTER] Can now have the X axis in the center
+ o [SCATTER] Added tooltip facility
+ o [MISC] Consolidated invoice handling
+ o [MISC] Minor fix to DOM structure of context menu
+ o [LINE] Can now have combined Line and Bar chart so you can overlay Line graphs on top of Bar charts
+ o [BAR] Can now have combined Line and Bar chart so you can overlay Line graphs on top of Bar charts
+ o [MISC] Moved showcase examples to separate pages - showcase.html was doing too much and becoming far too slow
+
+ 31st January 2009
+ =================
+ o [ODO] Added .beginPath() when starting to draw the Odo - needed for animation
+ o [MISC] Rewrote ModalDialog
+ o [GANTT] Corrected gantt chart docs
+ o [MISC] Context menu is now always the correct width
+ o [BAR] Added ability to specify X axis labels to be drawn at eith 45 or 90 degrees
+ o [LINE] Added ability to specify X axis labels to be drawn at eith 45 or 90 degrees
+ o [SCATTER] Added ability to specify X axis labels to be drawn at eith 45 or 90 degrees
+ o [BIPOLAR] Added tooltips
+ o [DOCS] Re-jigged (ever so slightly) docs index layout
+ o [DOCS] Added info on working with RGraph objects in conjunction with accessing the underlying
+ canvas/context objects
+ o [DONUT] Made sure the above was valid
+ o [PROGRESS] Made sure the above was valid
+
+ 17th January 2009
+ =================
+ o [MISC] Added licensing FAQ page including invoice mailer
+ o [MISC] Moved CSS to css subfolder
+ o [MISC] Renamed modaldialog and removed external fade library
+ o [MISC] Added example of how to integrate RGraph with external libraries using the ModalDialog
+ o [MISC] ymax property is no longer deprecated - it can be used to stop the scale changing when animating your graphs.
+ o [MISC] Added documentation page about animation
+ o [SCATTER] Added square tick type
+ o [PIE] Fixed last segments line width
+ o [MISC] Updated copyright notice
+ o [DOCS] Added basic example for implementation guidance
+ o [MISC] Changed test page to use tables instead of divs. This will make it more apparent if something breaks
+ in the RGraph.getMouseXY() function.
+ o [ODO] Changed to use 10 labels instead of 8 - should make for nicer scale values.
+ o [ODO] Made tick marks tie into labels more
+
+ 4th January 2009
+ ================
+ o [DOCS] Added note about pre-caching
+ o [SCATTER] Added color example to scatter chart
+ o [MISC] Fixed tooltips appearing in the wrong place
+ o [MISC] Removed tooltip shadow layer. Shadows are accomodated for in CSS3
+ o [DOCS] CSS class documentation
+ o [MISC] More work on things working with html5 doctype
+ o [MISC] Removed shadow layer from tooltips. This will be accomodated in CSS3, and is already by some browsers (MSIE (!), Chrome,
+ Safari, and the forthcoming FF 3.1)
+ o [MISC] Ditto for context menus
+ o [MISC] Changed RGraph.getMouseXY() to be more accomodating
+ o [WEBSITE] Added favicon.png
+ o [WEBSITE] Added example of pie chart to front page
+ o [WEBSITE] Changed front page to use tables instead of divs to tell if tooltips keep working
+ o [MISC] Overhauled RGraph.getMouseXY() so that it works in spite of being nested in tables. It also works
+ if you position the canvas absolutely and only specify one of the top or left. Wonderbar!
+ o [SCATTER] Added ability to specify the color of the tick ie:[x, y, color] It's optional. ** Could do with a key **
+ o [DOCS] Added color information
+ o [DOCS] Added context menu information
+ o [MISC] Made context menus more XP style
+ o [GANTT] Customised the example more, showing the completage indicators.
+ o [GANTT] Events and vertical bars are now defined in the usual way, by using the Set() method
+ o ]MISC] Added __object__ property to all graph objects
+ o [MISC] Unified text size at 10 points (and 2 greater for titles).
+ o [MISC] Added context menus to all graph types
+ o [MISC] Fixed tooltip widths on front page. And siving in general in Opera
+
+ 20th December 2008
+ ==================
+ o [MISC] Converted all graphs to use dollar ($) function in place of document.getElementById("...")
+ o [TRADAR] Now defaults to drawing the key out of graph
+ o [LINE] Now labels are turned off if there's fewer labels than data points (every line)
+ o [MISC] Added better smaller scales - now goes down to 0.0005
+ o [DOCS] Added more details on tooltips and positioning
+ o [LINE] Added gridwidth property
+ o [BAR] Added gridwidth property
+ o [MISC] Removed rotating text example (it's still in the archive - it's just not linked)
+ o [MISC] More work on scales when decimal values are involved, plus graphs now use thousand seperators to aid readability
+ o [MISC] More work on tooltips and their positioning.
+ o [MISC] Added "keyposition" option, which can be either "gutter" or "graph" and determines where the key is drawn
+ o [MISC] Unified all graphs to use the same "textheight" property for text.
+ o [MISC] All titles are now drawn two pixels larger than the "textheight" property
+ o [LINE] Key can now be placed above the actual graph area if desired
+ o [BAR] Key can now be placed above the actual graph area if desired
+ o [MISC] Fixes to number formatting, including when there multiple graphs on a page
+ o [BAR] Changed summary line to default to off
+ o [BIPOLAR] Scale values now contain thousand separators
+ o [SCATTER] Scale values now contain thousand separators
+ o [LINE] Scale values now contain thousand separators
+ o [BAR] Scale values now contain thousand separators
+ o [MISC] Updated issues.html with details of the smallest scales
+ o [SCATTER] Deprecated the ymax property. RGraph.getScale() is now good enough (xMax is bipolar chart equivalent)
+ o [LINE] Deprecated the ymax property. RGraph.getScale() is now good enough
+ o [BIPOLAR] Deprecated the xmax property. RGraph.getScale() is now good enough
+ o [BAR] Deprecated the ymax property. RGraph.getScale() is now good enough
+ o [MISC] Made RGraph.getScale() return the whole scale (all five values), not just the top value
+ This means better quality scales can be produced.
+ o [MISC] Made note about positioning in docs on issues page
+ o [ODO] Work on Small scale values
+ o [BIPOLAR] Work on Small scale values
+ o [BAR] Work on Small scale values
+ o [LINE] Work on Small scale values
+ o [MISC] Added tooltip fade in effect using CSS3 opacity
+ o [BAR] Added tooltip functionality to stacked bar chart
+ o [BAR] Added tooltip functionality to grouped bar chart
+ o [MISC] Added gradient to front page graphs
+ o [TRADAR] Added gradient to bipolar on test page
+ o [TRADAR] Re-added traditional radar chart. It doesn't work in Opera 9.x, only Opera 10+. Documentation for this also fine tuned
+ o [MISC] Tidied up RGraph.common.js
+ o [MISC] Removed drawTextAngle() - RGraph.Text() does this
+ o [MISC] Added a bar chart with centre X axis to example page
+ o [GANTT] Fixed Gantt chart title text placement
+ o [GANTT] Added title text size property
+ o [WEBSITE] Changed colour of example on website
+ o [RADAR] Changed key to be the same as the bar/line/tradar
+ o [DOCS] Lots of link updates
+
+ 5th December 2008
+ =================
+ o [LINE] Made keys and lines (ie stacked/filled) totally correspond.
+ o [BAR] Stopped bar chart tooltips redrawing the axes. Not entirely sure why it's doing this, but it seems fine without it.
+ o [DOCS] Bundled license document with archive
+ o [DOCS] Documentation and example updates.
+ o [MISC] Changed index.php to index.html Not earth shattering, but should make it clearer for people where to start,
+ and also makes the downloaded index.html styled as it should be.
+ o [WEBSITE] Added Cache-Control: Header
+ o [WEBSITE] Added link to support group on Google more obvious
+ o [DOCS] Added list of common issues
+ o [MISC] Added header into files that didn't have it
+ o [MISC] Removed CanvasText.enable() - unneccessary
+ o [ODO] Shortened the Odos pointer
+
+ 28th November 2008
+ ==================
+ o [MISC] Got rid of HTML5 doctypes - they seem to be interfering with tooltip positioning.
+ If you don't use tooltips, you'll therefore be fine.
+ o [ODO] Better needle. I think.
+ o [BAR] Keys for charts are now specified in the same order as the pertaining datasets
+ o [LINE] Keys for charts are now specified in the same order as the pertaining datasets
+ o [MISC] Added CSS3 shadows to tooltips
+ o [GANTT] Fixed bug in Gantt chart textsize property
+ o [LINE] Finally made shadows 100% accurate (ie tickmarks now have shadows too), including stepped line
+ o [WEBSITE] Added tooltips to line chart on front page
+ o [MISC] Fixed release script (check)
+ o [LINE] Added keys to line & bar chart
+ o [BAR] Added keys to line & bar chart
+ o [MISC] o-----------------------------------------------------------------------------------------------------o
+ | Use unified better getters/setters for all charts. This is a MAJOR update, since it affects all the |
+ | charts in a fundamental way. For the better. Any update should be done cautiously. But since |
+ | RGraph is beta, all updates should be done that way. Judging by the RGraph test page though, |
+ | everything seems fine. |
+ o-----------------------------------------------------------------------------------------------------o
+
+ 15th November 2008
+ ------------------
+ o [BAR] Removed animation
+ o [LINE] Documented stepped line chart
+ o [LINE] Fixed tick marks
+ o [LINE] Added ability to specify line chart as being stepped
+ o [MISC] Documented default values.
+ o [GANTT] Added gantt chart
+ o [PROGRESS] Corrected name of Progressbar
+ o [LINE] Moved the background drawing to RGraph.common.js
+ o [SCATTER] Moved the background drawing to RGraph.common.js
+ o [MISC] Tooltips now move to the left of the cursor when it's too far right
+ o [MISC] Changed print_r() to pr() - less to type
+ o [MISC] Added GetDays() function for Gantt chart
+ o [GANT] Added it
+ o [MISC] Added an RGraph.print_r() method for easier debugging
+ o [MISC] Added a registry object to the common library to resolve scoping issues and so we don't need to use globals. Globals suck.
+ o [SCATTER] Added a plus tick style to the scatter chart - added a demo too
+ o [SCATTER] Fixed a bug in the Scatter graphs background drawing
+ o [BAR] Moved bar charts DrawBackground() into the RGraph.background class. Should make reuse far easier.
+ o [BAR] "backgroundGrid" property changed to "grid"
+ o [MISC] Added a minification script. This script doesn't reduce the scripts to the bare minimum. But it can take 50% off the size (!).
+ o [LINE] Can now specify colour of shadows for line and bar graphs
+ o [BAR] Can now specify colour of shadows for line and bar graphs
+ o [LINE] line chart now has real shadows and so they can be used for lines of any thickness
+ o [LINE] can now specify shadow offset
+ o [SCATTER] Fixed background bar boundaries
+ o [SCATTER] Added plus cross type
+ o [MISC] Moved background drawing to common library
+ o [WEBSITE] sitemap.xml Now has correct <lastmod> date which changes correctly when a release is performed CHECK
+ o [MISC] Tooltip nows store the text in __text__ variable on the tooltip object (.innerHTML changes the HTML when it's set)
+
+ 1st November 2008
+ ------------------
+ o [BAR] Last bar chart example now uses a gradient
+ o [MISC] Changed hyphens to be slightly shorter
+ o [WEBSITE] Changed sitemap to use an update frequency of weekly. Last modified is now updated when a release is performed
+ o [BAR] Can now specify the grid size on the bar chart
+ o [LINE] Setting propeties can now be any case, upper or lower
+ o [MISC] Added RGraph.print_r() function
+ o [LINE] TickSize now actually has an effect
+ o [LINE] Added tooltips to line chart
+ o [WEBSITE] Moved support forum to Google group
+ o [MISC] Added object registration (for redrawing)
+ o [BAR] Removed margin from being accounted for in height calculation
+ o [LINE] Made tickmarks more coherent
+ o [BAR] Bar chart now uses canvas ID in some, but not all, error messages
+ o [LINE] Added small drop shadow to line chart
+ o [WEBSITE] Added example graphs to front page
+ o [BAR] Added tooltips to line chart
+ o [WEBSITE] Added more performance related information
+ o [PIE] Added drop shadow
+
+ 25th October 2008
+ -----------------
+ o [DOCS[ Added integration section
+ o [RADAR] Added title to radar
+ o [RADAR] Added textStyle to radar
+ o [PIE] Made one of the pie charts use a gradient
+ o [PROGRESS] Added shadows
+ o [PROGRESS] Added title
+ o [ODO] Converted plain colour to radial gradient
+ o [PIE] Added gutter and title
+ o [DONUT] Added gutter and title
+ o [MISC] Fixed comma issue with rendering text
+ o [MISC] Added something to text bounding box illustrating exactly where the point specified is
+ o [BIPOLAR] Bipolar middle bit is now 60px wide instead of 50
+ o [BAR] Fixed shadow bugettee in Safari, Chrome, Opera
+ o [ODO] Documented and vastly improved. Made it use a gutter now allowind for a title (implemented)
+ o [MISC] Added common function, DrawTitle()
+ o [MISC] Added a Javascript version of the PHP function range()
+ o [MISC] Added ability to specify a title to the bar chart, line graph and scatter graph.
+ o [MISC] Changed directory layout slightly
+ o [MISC] Forum is now ecluded from the tar
+ o [MISC] Much improved scale auto-generation
+ o [DOCS] Added code samples to docs pages
+ o [DOCS] Added section on the front page about performance
+ o [SCATTER] Many improvements to the scatter graph
+ o [SCATTER] Much better auto scale generation
+ o [SCATTER] Made scatter use RGraph common library for text
+ o [RADAR] Converted to use common library for text
+ o [LINE] Much improved scale auto-generation
+ o [LINE] Changed to rounded line ends - not very noticable though
+ o [LINE] Converted labels to be drawn by the RGraph library
+ o [BAR] Added optional shadow effect
+ o [BAR] Removed ability to have X axis at the top. It served no real purpose and only served to complicate the code
+ o [BAR] Added animation
+ o [BAR] Much improved scale auto-generation
+ o [BAR] Converted text functions to use RGraph common library
+ o [BAR] Can now specify a title for the bar chart
+ o [BAR] Fixed a bug for Chrome
+ o [BAR] Fixed minor bugs in bar chart (background bars)
+ o [BAR] Added grouping property, which defaults to stacked, but can also be grouped, producing what you would
+ expect (unless you're expecting a chicken.
+ o [BAR] Added a few warnings concerning bad combinations of axis positions
+ o [ODO] Added more labels, now at 8 instead of 4
+
+ 24th September 2008
+ -------------------
+ o [WEBSITE] Added RSS feed to forum
+ o [DOCS] Added more documentation
+ o [ALL] Unified (sort of) the error messages
+ o [ODO] Added odometer
+ o [BIPOLAR] Added a bottom gutter for scale to go in
+ o [BIPOLAR] Added bottom text labels
+ o [PIE] Made pie chart work without translating
+ o [TRADAR] Added real radar chart.
+ o [BAR] Bar chart can now have the X axis in the center, so it now able to represent negative values
+ o [LINE] Allowed multiple lines
+ o [LINE] Line chart can now have the X axis in the center, so it now able to represent negative values
+ o [LINE] Fixed bug in line chart that meant if it was filled the filled line was stopping too short
+ o [LINE] Made it more obvious (I think) for specifying data when using multiple data sets (ie multiple lines)
+
+ 4th September 2008
+ ------------------
+ o Various additions including labels on all the graphs
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Adjusting your graphs interactively</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph adjusting docs " />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about adjusting your graphs" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.adjusting.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="../libraries/RGraph.hprogress.js" ></script>
+ <script src="../libraries/RGraph.rose.js" ></script>
+ <script src="../libraries/RGraph.tradar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+</head>
+
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Adjusting graphs interactively
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Adjusting your graphs interactively</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <canvas id="myc" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <canvas id="myc2" width="600" height="75" style="float: right">[No canvas support]</canvas>
+ <canvas id="myc3" width="600" height="450" style="float: right">[No canvas support]</canvas>
+ <canvas id="myc4" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <canvas id="myc5" width="400" height="400" style="float: right">[No canvas support]</canvas>
+
+ <script>
+ window.onload = function (e)
+ {
+ var line = new RGraph.Line('myc', [45,74,84,85,45,35,65,68,87,97,45,34,12], [15,14,12,16,18,19,14,12,74,84,95,65,35]);
+ line.Set('chart.labels', ['Kev','Matt','Rich','Dave','Iggy','Polly','Fiona','Fred','Pete','Lou','Fred','Bob']);
+ line.Set('chart.ylabels.inside', true);
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.shadow', true);
+ line.Set('chart.adjustable', true);
+ line.Set('chart.title', 'An adjustable line chart (adjustable, context)');
+ line.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], null, ['Cancel', function () {}]]);
+ line.Set('chart.zoom.hdir', 'left');
+ line.Set('chart.zoom.vdir', 'center');
+ line.Draw();
+
+ var grad = line.context.createLinearGradient(25, 0, 575, 0);
+ grad.addColorStop(0, 'green');
+ grad.addColorStop(1, 'white');
+
+ var hprogress = new RGraph.HProgress('myc2', 83, 100, 0);
+ hprogress.Set('chart.color', grad);
+ hprogress.Set('chart.adjustable', true);
+ hprogress.Set('chart.margin', 5);
+ hprogress.Set('chart.tickmarks.inner', true);
+ hprogress.Set('chart.label.inner', true);
+ hprogress.Set('chart.units.post', '%');
+ hprogress.Draw();
+
+ var rose = new RGraph.Rose('myc3',[4,3,5,6,2,1,4]);
+ rose.Set('chart.gutter', 25);
+ rose.Set('chart.colors.alpha', 0.5);
+ rose.Set('chart.adjustable', true);
+ rose.Set('chart.labels', ['Olga','Kev','Bob','Charlie','Pete','John','Fred']);
+ rose.Draw();
+
+ var bar = new RGraph.Bar('myc4', [[512,433],[653,477],[512,436],[533,564],[674,741],[266,453],[411,159],[458,741],[496,845]]);
+ bar.Set('chart.colors', ['blue', 'pink']);
+ bar.Set('chart.labels.above', true);
+ bar.Set('chart.shadow', true);
+ bar.Set('chart.shadow.color', '#aaa');
+ bar.Set('chart.strokecolor', 'rgba(0,0,0,0)');
+ bar.Set('chart.gutter', 30);
+ bar.Set('chart.adjustable', true);
+ bar.Set('chart.labels', ['2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008']);
+ bar.Draw();
+
+ var tradar = new RGraph.Tradar('myc5', [4,3,8,6,8,7,7,4,5]);
+ tradar.Set('chart.adjustable', true);
+ tradar.Set('chart.circle', 5);
+ tradar.Set('chart.circle.fill', 'rgba(255,0,0,0.5)');
+ tradar.Set('chart.color', 'rgba(0,255,0,0.5)');
+ tradar.Set('chart.labels', ['Hoolio', 'Godfrey', 'Albert', 'Jeff', 'Jack', 'Pete', 'Lou', 'Barney', 'Fred']);
+ tradar.Draw();
+ }
+ </script>
+
+ <p>
+ Since 24th May 2010 you have had the ability to adjust your graphs interactively. Currently the Bar chart, Line chart,
+ Progress Bar, Rose chart and the Tradar have this facility. Some graph types use multiple event handlers and as such
+ are unlikely to work well with other dynamic features. The Line chart is an example of this, and whilst it does work
+ with the context menu (and so the full canvas zoom), it is unlikely to work with other dynamic features.
+ </p>
+
+
+ <p>
+ At the current time this feature on the Bar and Line charts don't work with X axis in the center.
+ </p>
+
+
+ <p>
+ If your intention is to make some sort of interactive console, new HTML5 input types may also be of interest (for example the new <i>range</i> input type
+ which gives you a "slider bar"). Eg (Chrome/Safari/Opera):
+ </p>
+
+ <p style="text-align: center">
+ <input type="range" min="0" max="100" value="76" onchange="document.getElementById('range_result').value = this.value"/>
+ <input type="text" id="range_result" size="3" value="76" />
+ </p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Animating your graphs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs animation" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about animating your charts" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.rose.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ /**
+ * The total number of frames, delay and current frame number
+ */
+ delay = 35;
+ curframe = 1;
+ numframe = 20;
+
+ window.onload = function ()
+ {
+ /**
+ * Clear all of the canvases
+ */
+ RGraph.Clear(document.getElementById("myRose"));
+
+ /**
+ * Draw the bar chart
+ */
+ var multiplier = curframe / numframe;
+ var rose = new RGraph.Rose('myRose', [45 * multiplier, 12 * multiplier,
+ 16 * multiplier, 18 * multiplier,
+ 44 * multiplier, 54 * multiplier,
+ 23 * multiplier, 21 * multiplier,
+ 56 * multiplier, 58 * multiplier,
+ 33 * multiplier, 47 * multiplier] );
+ rose.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ rose.Set('chart.ymax', 60); // This stops the scale from changing frame to frame
+ rose.Set('chart.hmargin', 5);
+ rose.Set('chart.gutter', 30);
+
+ // Gradient
+ var grad = rose.context.createRadialGradient(rose.canvas.width / 2,
+ rose.canvas.height / 2,
+ 0,
+ rose.canvas.width / 2,
+ rose.canvas.height / 2,
+ 150);
+
+ grad.addColorStop(0, 'white');
+ grad.addColorStop(1, 'red');
+
+ rose.Set('chart.colors', [grad]);
+ rose.Set('chart.strokecolor', null);
+ rose.Draw();
+
+ /**
+ * If the animation frame is less than number of the total number of frames, redraw the canvas
+ */
+ if (curframe < numframe) {
+ curframe++;
+ setTimeout(window.onload, delay);
+ }
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Animating your graphs
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Animating your graphs</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div style="float: right">
+ <canvas id="myRose" width="300" height="300">[No canvas support]</canvas>
+ </div>
+
+ <p>
+ Animating your graphs is a relatively easy affair, whilst not being supported natively as it would only serve to
+ over-complicate the RGraph libraries. The way to do it is to use
+ the function <i>RGraph.Clear(canvas)</i>, passing it your canvas object that is returned by
+ <i>document.getElementById()</i>. By default this will cover the canvas in white. You can change this by
+ passing it the color you want it to use as the second (optional) argument. You could even use a gradient if
+ you wanted. Then you can simply redraw the entire graph.
+ </p>
+
+ <p>
+ One thing you should note, is that you may have to specify the scale manually, to prevent it from changing
+ from frame to frame. This can be done by using the <i>chart.ymax</i> property.
+ </p>
+
+ <p>
+ You can review the source of this page if you need further help. Two global variables are set - the number of frames
+ and the current frame number (which starts at one). The graphs are then drawn with appropriate data
+ (ie the data multiplied by the frame number over the total number of frames). If the frame number is less than
+ the total number of frames, the frame number is incremented and the function (window.onload) is called again
+ after a small delay.
+ </p>
+
+ <h4>Animation using jQuery</h4>
+
+
+ <div style="width: 600px; height: 250px; display: inline; display: inline-block; float: right">
+ <canvas id="myLine" width="600" height="250" style="position: relative">[No canvas support]</canvas>
+ </div>
+ <button style="width: 600px; float: right" id="butAnimate" onclick="Animate(); this.disabled = true; setTimeout(function () {document.getElementById('butAnimate').disabled = false;}, 2000);">Animate!</button>
+
+ <script>
+ animate = false;
+ ShowGraph();
+
+ /**
+ * This is the jQuery animation bit
+ */
+ function Animate()
+ {
+ $('#myLine').animate({
+ opacity: 0,
+ width: 0,
+ height: 0,
+ left: '+=300px',
+ top: '+=125px'
+ }, 1000, null, function () {animate = true; ShowGraph();});
+ }
+
+ function ShowGraph()
+ {
+ // This clears the canvas
+ document.getElementById("myLine").width = 600;
+
+ if (document.getElementById("myLine").__object__ && document.getElementById("myLine").__object__.type == 'line') {
+ var bar = new RGraph.Bar('myLine', [4,2,3]);
+ bar.Set('chart.labels', ['Fred','Charles','Carl']);
+ bar.Set('chart.title', 'jQuery animation example');
+ bar.Set('chart.labels.above', true);
+ bar.Set('chart.labels.above.size', 16);
+ bar.Set('chart.units.post', 'pt');
+ bar.Draw();
+
+ } else {
+ line = new RGraph.Line('myLine', [4,5,3,4,6,8,4,9,5,2]);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.labels', ['Gavin','Hoolio','June','Kev','Lou','Jane','Rich','Tom','John','Pat']);
+ line.Set('chart.tickmarks', 'endcircle');
+ line.Set('chart.title', 'jQuery animation example');
+ line.Draw();
+ }
+
+ if (animate) {
+ $('#myLine').animate({
+ opacity: 1,
+ width: '600px',
+ height: '250px',
+ left: '-=300px',
+ top: '-=125px'
+ }, 1000);
+
+ animate = true;
+ }
+ }
+ </script>
+
+ <p>
+ You can if you prefer use an external library for animation, like jQuery.
+ </p>
+
+ <p>
+ The graph to the right is animated using
+ jQuery. In the example the width is maintained by placing the canvas within a DIV which has the width/height CSS
+ attributes set.
+ </p>
+
+ <p>
+ In this instance, the <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" target="_blank">
+ Google hosted jQuery</a> is used.
+ </p>
+
+
+ <br clear="all" />
+ <br />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Annotating your graphs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs animating" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about annotating your charts" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ bar = new RGraph.Bar('myBar', [[45,64],[32,51],[41,52],[54,43],[43,50]]);
+ bar.Set('chart.title', 'An annotatable graph with context menu');
+ bar.Set('chart.labels', ['John','Fred', 'Barry', 'Charlie', 'Joan']);
+ bar.Set('chart.colors', ['red', 'blue']);
+ bar.Set('chart.background.barcolor1', '#fff');
+ bar.Set('chart.background.barcolor2', '#fff');
+ bar.Set('chart.annotatable', true);
+ bar.Set('chart.contextmenu', [['Show palette', RGraph.Showpalette], ['Clear', function () {RGraph.Clear(bar.canvas); bar.Draw();}]]);
+ bar.Draw();
+
+ RGraph.AddCustomEventListener(bar, 'onannotatestart', function (obj) {cl('Started annotating: ' + obj.id);});
+ RGraph.AddCustomEventListener(bar, 'onannotate', function (obj) {cl('Annotating: ' + obj.id);});
+ RGraph.AddCustomEventListener(bar, 'onannotateend', function (obj) {cl('Finished annotating: ' + obj.id);});
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Annotating your graphs
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Annotating your graphs</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div style="float: right">
+ <canvas id="myBar" width="400" height="200">[No canvas support]</canvas><br />
+ </div>
+
+ <p>
+ The annotations feature brings presentation style functionality to RGraph graphs. You can use this feature
+ for highlighting your graphs if you need to.
+ </p>
+
+ <ul>
+ <li><a href="#how">How do annotations work?</a></li>
+ <li><a href="#browser">Browser support</a></li>
+ <li><a href="#what">What can I use annotations for?</a></li>
+ <li><a href="#persistent">Are annotations persistent?</a></li>
+ <li><a href="#palette">How do I show the mini-palette?</a></li>
+ <li><a href="#clear">How can I clear the annotations?</a></li>
+ <li><a href="#replay">Replaying annotations when they're off</a></li>
+ </ul>
+
+ <a name="how"></a>
+ <h4>How do annotations work?</h4>
+
+ <p>
+ Enabling annotations is a very simple affair, and consists of doing the following:
+ </p>
+
+ <pre class="code" style="width: 55%">myGraph.Set('chart.annotatable', true);</pre>
+
+ <a name="browser"></a>
+ <h4>Browser support</h4>
+
+ <p>
+ Annotations are supported in all browsers that RGraph works with - Firefox 3.5+, Chrome 2+, Safari 4+, Opera 10.5+ and
+ MSIE/Google Chrome Frame. They DO NOT however work with MSIE 8/ExCanvas.
+ </p>
+
+ <a name="what"></a>
+ <h4>What can I use annotations for?</h4>
+
+ <p>
+ As mentioned you can use it for presentations, highlighting things to yourself or others or just to have fun drawing (!).
+ </p>
+
+ <a name="persistent"></a>
+ <h4>Are annotations persistent?</h4>
+
+ <p>
+ That depends on which browser you're using. The annotation data is stored in the users web browser (not on the web server),
+ meaning currently (21st March 2010) browser support is limited to Firefox 3.5+, Safari 4+,
+ Chrome 4+ and Opera 10.5+. MSIE 8 also has the required storage capabilities, but since it doesn't yet support canvas, the point is moot.
+ The user does not have to
+ confirm anything for storage to be allowed - try it out on this page by drawing on the graph and then refreshing the page.
+ </p>
+
+ <a name="palette"></a>
+ <h4>How do I show the mini-palette?</h4>
+
+
+ <p>
+ You can show the palette by using the <i>RGraph.Showpalette</i> function shown below as a context menu item:
+ </p>
+
+ <pre class="code">
+myObj.Set('chart.contextmenu', [
+ ['Show palette', RGraph.Showpalette],
+ ['Clear', function () {RGraph.Clear(myObj.canvas); myObj.Draw();}]
+ ]);
+</pre>
+
+ <p>
+ This code will result in the same context menu as the graph above.
+ </p>
+
+ <a name="clear"></a>
+ <h4>How can I clear the annotations?</h4>
+
+ You can simply clear the graph and redraw it:
+
+ <pre class="code">RGraph.Clear(myGraph.canvas); // Clear the graph
+myGraph.Draw(); // Redraw it</pre>
+
+ <p>
+ In the graph above, there is a context menu that allows you to both clear the graph and also demonstrates the mini-palette
+ feature available to you.
+ </p>
+
+ <a name="replay"></a>
+ <h4>Replaying annotations when they're off</h4>
+
+ <p>
+ When annotations are not enabled, any prior annotations that may have been made are not displayed. To show them you need
+ to use the API function <i>RGraph.ReplayAnnotations(object)</i> after the call to .Draw().
+ </p>
+
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - API documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs api" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the RGraph API" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ API Documentation
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - API documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <br />
+
+ <ul>
+ <li><a href="#overview">Overview</a></li>
+ <li><a href="#references">Canvas and context references</a></li>
+ <li><a href="#events">Working with events</a></li>
+ <li><a href="#coords">Working with graph coordinates</a></li>
+ <li><a href="#data">Working with graph data</a></li>
+ <li><a href="#updating">Updating your graphs dynamically</a></li>
+ <li><a href="#accessors">Setting properties</a></li>
+ <li><a href="#references.other">References available on RGraph objects</a></li>
+ <li><a href="#scale">Scale information</a></li>
+ <li><a href="#text">Adding text to your graphs</a></li>
+ <li>
+ <a href="#functions">RGraph functions</a>
+ <ul>
+ <li><a href="#functions.arrays">Arrays</a></li>
+ <li><a href="#functions.strings">Strings</a></li>
+ <li><a href="#functions.numbers">Numbers</a></li>
+ <li><a href="#functions.misc">Miscellaneous</a></li>
+ <li><a href="#functions.events">Custom RGraph event related functions</a></li>
+ <li><a href="#functions.other">Other</a></li>
+ </ul>
+ </li>
+ <li><a href="#skeleton">The skeleton file</a></li>
+ <li><a href="#questions">Questions</a></li>
+ </ul>
+
+ <a name="overview"></a>
+ <h4>Overview</h4>
+
+ <p>
+ Working with RGraph objects is purposefully easy, to make them straight forward to integrate into your own scripts if you want to. For any
+ particular graph type there are a few files required - the common libraries and the graph specific library. Eg:
+ </p>
+
+ <pre class="code">
+<script src="RGraph.common.core.js"></script>
+<script src="RGraph.bar.js"></script>
+</pre>
+
+ <p>
+ <i>RGraph.common.core.js</i> is a function library that contains a large set of functions that support the graph classes.
+ Some functions, and sets of functions, have their own files. For example, the zoom functions reside in <i>RGraph.common.zoom.js</i>,
+ so if you don't need zoom, you don't need this file.
+ Each of the graph libraries (<i>RGraph.*.js</i>) contains that particular graphs class. If you'd like to see a "bare bones"
+ implementation, you can look at the <a href="../examples/basic.html">basic example</a>. There's also a
+ <a href="#skeleton">skeleton example</a> to make it easier to create new graph types.
+ </p>
+
+ <a name="references"></a>
+ <h4>Canvas and context references</h4>
+
+ <p>
+ Each graph object maintains references to the <i>context</i> and <i>canvas</i> as properties. So to get hold of them all you
+ need to do is this:
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ // 1/2 First draw the chart
+ var myBar = new RGraph.Bar('myCanvas', [1,5,8,4,6,3,1,5,7,8,4,6]);
+ myBar.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ myBar.Draw();
+
+ // 2/2 Now get hold of the references
+ var context = myBar.context; // Get hold of a reference to the context
+ var canvas = myBar.canvas; // Get hold of a reference to the canvas
+ }
+</script>
+</pre>
+
+ <a name="events"></a>
+ <h4>Working with events</h4>
+
+ <p>
+ When working with events, you may come across the situation where you have a reference to the <i>canvas</i>, but
+ also need to access the graph object. For this reason the constructor of each object adds a reference to the object to the
+ canvas and you can access it like this:
+ </p>
+
+ <pre class="code">
+<script>
+ document.getElementById("myCanvas").onclick = function (e)
+ {
+ var src = (RGraph.isIE8() ? event.srcElement) : e.target;
+
+ // The RGraph object constructors add __object__ to the canvas.
+ var myBar = src.__object__;
+ }
+</script>
+</pre>
+
+ <a name="coords"></a>
+ <h4>Working with graph coordinates</h4>
+
+ <p>
+ For most graph types, the coordinates of elements (eg bars, lines etc) are to be found in the class variable <i>obj.coords</i>.
+ This is usually a multi-dimensional array consisting of the coordinates of those shapes, or of points. As an example the bar
+ chart maintains the X, Y, width and height of each bar (or sections of bars in a stacked bar chart). The coords array is
+ usually a flat array, even when you have multiple sets of data.
+ </p>
+
+ <p>
+ By using the RGraph.getMouseXY() function and this array you can determine if a bar was clicked on, or if the mouse is near a
+ line point etc.
+ </p>
+
+ <pre class="code">
+var myCoords = myBar.coords;
+</pre>
+
+ <p>
+ <b>Note:</b> Previously the coords array values sometimes included the margin values, and sometimes didn't. As of 17th
+ April 2010 the values have all been unified to not include the margin values, so the values are as reported.
+ </p>
+
+ <a name="data"></a>
+ <h4>Working with graph data</h4>
+
+ <p>
+ Another variable you may need is the <i>data</i> variable. For most graph types, this is where the data is stored. It is usually
+ untouched, so it is as you supplied to the graph objects constructor. A notable exception to this is filled line charts.
+ Here the original data is stored in the class variable <i>original_data</i>. The data supplied is modified to produce the stacking
+ effect. If you need to modify a filled line charts data you will need to change this variable instead.
+ </p>
+
+ <p>
+ Not all graph types use the <i>data</i> variable. For some the name is different so that it makes a little more sense. The
+ graph types and their associate data variables are listed below<sup>1</sup>.
+ </p>
+
+ <style>
+ table#data_properties td,
+ th {
+ text-align: center;
+ }
+ </style>
+
+ <table border="0" align="center" id="data_properties">
+ <tr>
+ <th>Graph type</th>
+ <th>Data variable(s)</th>
+ </tr>
+
+ <tr>
+ <td>Bar</td>
+ <td>obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Bi-polar</td>
+ <td>obj.left, obj.right</td>
+ </tr>
+
+ <tr>
+ <td>Donut</td>
+ <td>This is now a variant of the Pie chart</td>
+ </tr>
+
+ <tr>
+ <td>Funnel</td>
+ <td>obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Gantt</td>
+ <td>See the <a href="gantt.html#events">docs</a></td>
+ </tr>
+
+ <tr>
+ <td>Horizontal Bar</td>
+ <td>obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Horizontal Progress bar</td>
+ <td>obj.max, obj.value</td>
+ </tr>
+
+ <tr>
+ <td>LED</td>
+ <td>obj.text</td>
+ </tr>
+
+ <tr>
+ <td>Line</td>
+ <td>obj.original_data<sup>3</sup></td>
+ </tr>
+
+ <tr>
+ <td>Meter</td>
+ <td>obj.min, obj.max, obj.value</td>
+ </tr>
+
+ <tr>
+ <td>Odometer</td>
+ <td>obj.start, obj.end, obj.value</td>
+ </tr>
+
+ <tr>
+ <td>Pie</td>
+ <td>obj.angles, obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Radial Scatter chart</td>
+ <td>obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Rose</td>
+ <td>obj.max, obj.data</td>
+ </tr>
+
+ <tr>
+ <td>Scatter</td>
+ <td>obj.max, obj.data<sup>2</sup></td>
+ </tr>
+
+ <tr>
+ <td>Traditional Radar</td>
+ <td>obj.data, obj.max</td>
+ </tr>
+
+ <tr>
+ <td>Vertical Progress bar</td>
+ <td>obj.max, obj.value</td>
+ </tr>
+ </table>
+
+ <ol>
+ <li style="margin-top: 0">In the table, <i>obj</i> refers to your graph object.</li>
+ <li style="margin-top: 0">For the Scatter chart, each data point is an array of X/Y coordinates, the color and the tooltip for that point.</li>
+ <li style="margin-top: 0">
+ The Line chart <i>obj.original_data</i> is an aggregation of all the datasets given to the Line chart, so the first
+ dataset is held in <i>obj.original_data[0]</i>, the second in <i>obj.original_data[1]</i> etc.
+ </li>
+ </ol>
+
+ <a name="updating"></a>
+ <h4>Updating your graphs dynamically</h4>
+
+ <p style="background-color: #ffa; padding: 3px; border: 1px dashed black">
+ <b>Note:</b>
+ It is important that you're careful with types when making AJAX requests. Since the response is initially a string,
+ and your AJAX function/library may not do conversions for you, you may need to convert these strings to numbers. To
+ do this you can use the <i>Number()</i> or <i>parseInt()</i> functions. For example:
+ </p>
+
+ <pre class="code">
+<script>
+ num = Number('23');
+ num = parseInt('43');
+</script>
+</pre>
+
+ <p>
+ A common request is to be able to update graphs dynamically. This is quite simple and consists of three steps:
+ </p>
+
+ <ol>
+ <li style="margin-top: 0">Get the new data from the server (with an AJAX request for example).</li>
+ <li style="margin-top: 0">Set the data in your graph object. See the above table for the appropriate property to use.</li>
+ <li style="margin-top: 0">Call the .Draw() method again.</li>
+ </ol>
+
+ <p>
+ If you don't need to get data from your server (ie it's all client-side) then you can omit the first step. Also, it may be
+ sufficient to simply recreate the entire object from scratch. This means that you won't have to alter and
+ RGraph internal properties - just recreate the graph object and configuration. There's a simple function
+ you can use for AJAX purposes <a href="index.html#ajax">here</a>.
+ </p>
+
+
+ <a name="accessors"></a>
+ <h4>Setting properties</h4>
+
+ <p>
+ To set RGraph properties, ideally you should use each objects setter (there's also a corresponding getter). These functions
+ accomodate some backwards compatibility changes, so by not using them you run the risk of your graphs not working entirely as
+ expected.
+ </p>
+
+ <pre class="code">
+myObj.Set('chart.gutter', 25);
+myObj.Get('chart.gutter');
+</pre>
+
+ <a name="references.other"></a>
+ <p> </p>
+ <h4>References available on RGraph objects</h4>
+ <p>
+ RGraph stores various references to objects on the canvas (typically) to make getting hold of them easier. There's also a
+ Registry object in
+ which references are stored. Typically the objects are named with the format <i>__xxx__</i>, and you can inspect the
+ objects by using a console(eg the inspector that's part of Google Chrome - <i>CTRL+SHIFT+J</i>). Some examples are:
+ </p>
+
+ <ul>
+ <li>__object__ on the canvas - a reference to the graph object</li>
+ <li>
+ RGraph.Registry.Get('chart.tooltip') - a reference to the currently visible tooltip. This in turn has the following
+ available:
+ <ul>
+ <li>__text__ - Since setting .innerHTML can cause changes in HTML, this is the original tooltip text.</li>
+ <li>__index__ - This is the numerical index corresponding to the tooltips array that you set.</li>
+ <li>__dataset__ - Used in the Scatter chart and corresponding to the dataset.</li>
+ <li>__canvas__ - A reference to the original canvas that triggered the tooltip.</li>
+ </ul>
+ </li>
+ <li>
+ RGraph.Registry.Get('chart.mousedown') - Used in annotating, and stipulates whether the mouse button is currently
+ pressed.
+ </li>
+ <li>
+ RGraph.Registry.Get('chart.contextmenu') - The currently shown context menu, if any. This in turn has the following
+ properties:
+ <ul>
+ <li>__canvas__ - The original canvas object.</li>
+ </ul>
+ </li>
+ </ul>
+
+ These are just a sample of what's available, to find more you should use an introspection tool, look at the source, or ask
+ on the <a href="http://groups.google.com/group/rgraph/topics?gvc=2" target="_blank">support mailing list</a>.
+
+
+
+ <a name="scale"></a>
+ <h4>Scale information</h4>
+ <p>
+ For the Bar, Bipolar, HBar, Line and Scatter charts the scale that is used is stored in the <i>scale</i> class variable. Eg:
+ </p>
+
+ <pre class="code">
+<script>
+ var myBar = new RGraph.Bar('cvs', [56,43,52,54,51,38,46,42,52]);
+ myBar.Draw();
+
+ var myScale = myBar.scale
+</script>
+</pre>
+
+ <a name="text"></a>
+ <h4>Adding text to your graphs</h4>
+ <p>
+ If you want to add arbitrary text to your graph(s) you can use the API function <a href="#functions.other">RGraph.Text().</a>
+ </p>
+
+ <pre class="code">
+<script>
+ // Draw a basic graph
+ var myObj = new RGraph.Bar('myCanvas', [4,5,5,8,7,6,4,8,5,9]);
+ myObj.Draw();
+
+ // Draw some text
+ myObj.context.beginPath();
+ size = 12;
+ font = 'Verdana';
+ text = 'Some text!;
+ x = 10;
+ y = 10;
+
+ RGraph.Text(myObj.context, font, size, x, y, text);
+ myObj.context.fill();
+</script>
+</pre>
+
+ <a name="functions"></a>
+ <h4>RGraph functions</h4>
+
+ <p>
+ This is a list of some of the functions available to you in the RGraph common libraries.
+ It's not every single one that's available, but is a list of the common ones that you're likely to want to use. Arguments
+ in square brackets are optional.
+ </p>
+
+ <pre class="code">
+<script src="RGraph.common.core.js"></script>
+
+<script>
+ // Returns 9
+ myArray = [3,2,5,4,9,7,8];
+ max = RGraph.array_max(myArray);
+</script>
+</pre>
+
+ <a name="functions.arrays"></a>
+ <h4>Arrays</h4>
+
+ <ul>
+ <li><b>(number) RGraph.array_max(array)</b><br />Returns the maximum value in the array.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(number) RGraph.array_sum(array)</b><br />Returns the sum of all values in the array. You can also pass a single integer, in which case it is simply returned as-is.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.array_clone(array)</b><br />Creates a copy/clone of the given array. Only numerically indexed arrays are supported.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.array_reverse(array)</b><br />Returns a reversal of the given array.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(boolean) RGraph.is_array(obj)</b><br />Returns true or false as to whether the given object is an array or not.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.array_pad(array, length[, value])</b><br />Pads the given array to the specified length (if the length is less, if not the array is returned as is). The third, optional, argument is the value which is used as the pad value. If not specified, <i>null</i> is used.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.array_shift(array)</b><br />Shifts an element off of the start of the given array and returns the new array.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ </ul>
+
+ <a name="functions.strings"></a>
+ <h4>Strings</h4>
+
+ <ul>
+ <li><b>(string) RGraph.rtrim(string)</b><br />Strips the right hand white space from the string that you pass it.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li>
+ <b>(string) RGraph.number_format(obj, number[, prepend[, append]])</b><br />
+ This formats the given number (which can be either an integer or a float. The prepend and append variables are
+ strings which are added to the string (eg 5%).<br /><br />
+ <b>Note:</b>As of 5th September 2010 this functions argument list has been changed to include the graph object, as shown above.<br /><br />
+ <i>File: RGraph.common.core.js</i><p />
+ </li>
+ </ul>
+
+ <a name="functions.numbers"></a>
+ <h4>Numbers</h4>
+
+ <ul>
+ <li><b>(number) RGraph.random(min, max)</b><br />Returns a random number between the minimum and maximum that you give.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(string) RGraph.number_format(number[, prepend[, append]])</b><br />See <a href="#functions.strings">above</a>.<br /><i>File: RGraph.common.core.js</i></li>
+ </ul>
+
+ <a name="functions.misc"></a>
+ <h4>Miscellaneous</h4>
+
+ <ul>
+ <li>
+ <b>(object) RGraph.FixEventObject(event)</b><br />Pass this function an event object and it will attempt to "fill in" the missing properties (depending on the browser).
+ It tries to add:<br /><br />
+
+ <ul>
+ <li>pageX (MSIE)</li>
+ <li>pageY (MSIE)</li>
+ <li>target (MSIE)</li>
+ <li>stopPropagation() (MSIE)</li>
+ <li>offsetX (FF)</li>
+ <li>offsetY (FF)</li>
+ </ul>
+ <br /><i>File: RGraph.common.core.js</i>
+ <p />
+ </li>
+ <li><b>(null) RGraph.OldBrowserCompat(context)</b><br />This function "fills in" any required functions that some browsers don't have. At the moment this consists of adding the measureText() and fillText() functions to the context when they're missing (usually this means older versions of Opera).<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(number) RGraph.GetDays(date)</b><br />This returns the number of days in the given month. The argument should be a Date object.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(null) RGraph.pr(mixed)</b><br />Emulates the PHP function print_r() by recursively printing the structure of whatever you pass to it. It handles numbers, strings, arrays, booleans, functions and objects.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(null) p(mixed)</b><br />An alias of the above albeit far shorter to type.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(null) cl(mixed)</b><br />A shortcut for the Firebug and Google Chrome debug function console.log().<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(null) RGraph.Clear(canvas[, color])</b><br />Clears the canvas by drawing a white (or the optional color you give) rectangle over it.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li>
+ <b>(null) RGraph.ClearAnnotations(id)</b><br />This function clears the annotation data associated with the given canvas ID (but DOES NOT redraw the graph). If you want to clear the visible annotations too, you will need to redraw the canvas. You could do this using the following code:
+ <br />
+ <pre class="code">
+function ClearAndRedraw (obj)
+{
+ RGraph.Clear(obj.canvas); // This function also calls the RGraph.ClearAnnotations() function
+ obj.Draw();
+}</pre>
+ <br /><i>File: RGraph.common.annotatate.js</i><p />
+ </li>
+ <li><b>(null) RGraph.ReplayAnnotations(object)</b><br />This function redraws any annotations which have previously been drawn on the canvas. You would use this function when annotations are turned off and you want previous annotations to be displayed.<br /><i>File: RGraph.common.annotate.js</i><p /></li>
+ <li><b>(array) RGraph.getMouseXY(event)</b><br />When passed your event object, it returns the X and Y coordinates (in relation to the canvas) of the mouse pointer. (0,0) is in the top left corner, with the X value increasing going right and the Y value increasing going down.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.getCanvasXY(event)</b><br />Similar to the above function but returns the X/Y coordinates of the canvas in relation to the page.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(number) RGraph.degrees2Radians(number)</b><br />Converts and returns the given number of degrees to radians. 1 radian = 57.3 degrees.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(array) RGraph.getScale(max, obj)</b><br />Given the maximum value this will return an appropriate scale. The second argument is the graph object.<br /><i>File: RGraph.common.core.js</i><p /></li>
+ <li><b>(mixed) RGraph.Registry.Get(name)</b><br />In conjunction with the next function, this is an implementation of the Registry pattern which can be used for storing settings.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(mixed) RGraph.Registry.Set(name, value)</b><br />In conjunction with the previous function, this is an implementation of the Registry pattern which can be used for storing settings.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.Register(object)</b><br />This function is used in conjunction with the next to register a canvas for redrawing. Canvases are redrawn (for example) when tooltips or crosshairs are being used.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+
+ <li>
+ <b>(null) RGraph.Redraw([id, [color]])</b><br />This function is used in conjunction with the previous to redraw a canvas. Canvases are redrawn (for example) when tooltips or crosshairs are being used.<br /><br /> <b>Note:</b> All canvases that are registered are redrawn. However the optional first argument can be an ID (a string) of the canvas that is NOT to be redrawn. The optional second argument is the color to use when clearing canvases.<br /><i>File: RGraph.common.core.js</i><br /><br />
+ </li>
+
+ <li><b>(null) RGraph.SetShadow(object, color, offetX, offsetY, blur)</b><br />This function is a shortcut function used to set the four shadow properties. The arguments are: your graph object, the shadow color, the X offset, the Y offset, the shadow blur.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.NoShadow(object)</b><br />This function is a shortcut function used to "turn off" the shadow. The argument is your graph object.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(array) RGraph.getSegment(event)</b><br />This function can be used with the Pie (including the donut variant) and Rose charts to get segment information when the canvas is clicked on (or the mouse is moved). It returns an array consisting of: <p /><ul><li>The center X coordinate</li><li>The center Y coordinate</li> <li>The radius</li><li>The start angle (in degrees)</li><li>The end angle (in degrees)</li></ul><br />Angles are measured starting from the "east" axis.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li>
+ <b>(number) RGraph.Async(mixed[, delay])</b><br />This is a simple function but has significant implications on your pages performance. You
+ can pass this either a function pointer, or a string containing the code to run and it will run the code asynchronously (ie in
+ parallel to the page loading). In doing so it can mean that your page is displayed faster, as the graph is created
+ seperate to the page loading. As such, the placement of your canvas tag becomes more important. What you can do is
+ define the canvas tag and then the code to produce the graph immediately after it. This is how the front page is coded,
+ (but not using the RGraph.Async() function).
+ There's an example of it <a href="async.html">here</a>. The optional delay argument is measured in milliseconds
+ (1 second = 1000 milliseconds) and defaults to 1. What you can do is specify something like 1000 to make the effect
+ more pronounced to ensure it's working as expected.
+
+ <p>
+ <b>Note:</b> Since a dev release of version 4, Google Chrome versions 4 and 5 have an issue with rendering text when using
+ the RGraph.Async() function. The solution here is to simply not use the RGraph.Async() function.
+ </p>
+ <i>File: RGraph.common.core.js</i><br /><br />
+ </li>
+
+ <li>
+ <b>(null) RGraph.filledCurvyRect(context, x, y, width, height[, radius[, curvy top left[, curvy top right[, curvy bottom right[, curvy bottom left]]]]])</b><br />
+ This draws a rectangle with curvy corners. Similar to the built in rectangle functions, and you can control
+ individual corners. The radius controls the severity of the corner curvature and defaults to 3. By default all
+ the corners are curvy.<br /><i>File: RGraph.common.core.js</i><br /><br />
+ </li>
+
+ <li>
+ <b>(null) RGraph.strokedCurvyRect(context, x, y, width, height[, radius[, curvy top left[, curvy top right[, curvy bottom right[, curvy bottom left]]]]])</b><br />
+ This draws a rectangle with curvy corners. Similar to the built in rectangle functions, and you can control
+ individual corners. The radius controls the severity of the corner curvature and defaults to 3. By default all
+ the corners are curvy.<br /><i>File: RGraph.common.core.js</i><br /><br />
+ </li>
+ </ul>
+
+ <a name="functions.events"></a>
+ <h4>Custom RGraph event related functions</h4>
+
+ <ul>
+ <li><b>(null) RGraph.AddCustomEventHandler(object, event, callback)</b><br />This attaches a function to the spacified event. The object argument is your graph object, the event argument should be the name of the event, eg <i>ontooltip</i>, and the function argument is your function which handles the event.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.FireCustomEvent(object, event)</b><br />This fires a custom event. The object is your graph object, and the name is a string specifying the name of the event.<br /><i>File: RGraph.common.core.js</i></li>
+ </ul>
+
+ <a name="functions.other"></a>
+ <h4>Other</h4>
+
+ <p>
+ These are functions which are less generic, and used to build the graphs. You may still wish to use them however.
+ </p>
+
+ <ul>
+ <li><b>(null) RGraph.lineByAngle(context, x, y, angle, length)</b><br />This function draws a line from the given X and Y coordinates at the specified angle.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+
+ <li>
+ <b>(null) RGraph.Text(context, font, size, x, y, text[, valign[, halign[, border[, angle[, background[, bold[, indicator]]]]]]])</b><br />
+ This function acts as a wrapper around the canvas text functionality. The arguments are:
+
+ <ul>
+ <li>The context is the canvases 2D context.</li>
+ <li>The font is the name of the font you want to use (eg Arial).</li>
+ <li>The size is an integer specifying the size of the text, (measured in points).</li>
+ <li>The x and y arguments are the X/Y coordinates at which to draw the text.</li>
+ <li>The text argument is the text to draw.</li>
+ <li>The optional valign argument is the vertical alignment and can be either <i>top</i>, <i>center</i> or <i>bottom</i>.</li>
+ <li>The optional halign argument is the horizontal alignment and can be <i>left</i>, <i>center</i> or <i>right</i>.</li>
+ <li>The optional border argument is a boolean (<i>true</i> or <i>false</i>) controlling whether the text has a border.</li>
+ <li>The optional angle argument specifies the angle at which the text is drawn (rotated around the X/Y coordinates and measured in degrees).</li>
+ <li>The optional background argument is the color of the background, (eg #fff).</li>
+ <li>The optional bold argument is boolean which controls whether the text is bold or not.</li>
+ <li>And the optional indicator argument is a boolean which controls whether a placement indicator is shown.</li>
+ </ul>
+
+ <br /><i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li><b>(null) RGraph.DrawTitle(canvas, text, gutter[, centerx[, size]])</b><br />This function draws the title. The centerx argument is the center point to use. If not given the center of the canvas is used.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.Tooltip(canvas, text, x, y, idx)</b><br />This function shows a tooltip. The idx value corresponds to the tooltip array that you give.<br /><i>File: RGraph.common.tooltips.js</i><br /><br /></li>
+ <li><b>(null) RGraph.DrawKey(object, key, colors)</b><br />This function draws the key. The first argument is the graph object, the second is an array of key information and the last is an array of the colors to use.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.DrawBars(object)</b><br />This draws the horizontal background bars. The argument is the graph object.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.DrawInGraphLabels(object)</b><br />This draws the in-graph labels. The argument is the graph object.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.DrawCrosshairs(object)</b><br />This function draws the crosshairs. The argument is the graph object.<br /><i>File: RGraph.common.core.js</i><br /><br /></li>
+ <li><b>(null) RGraph.HideContext()</b><br />This function clears the context menu. RGraph uses it to hide the context menu, but only AFTER your function/callback is run. You may wish to hide the context menu before your own function, in which case you can call this function.<br /><i>File: RGraph.common.context.js</i><br /><br /></li>
+ <li>
+ <b>(null) RGraph.showPNG([canvas[, event]])</b><br />
+ This function allows you to easily facilitate getting a PNG image representation of your graph.
+ You can use it like this:<br />
+
+ <pre class="code">myBar.Set('chart.contextmenu', [
+ <span style="color: green">['Get PNG', RGraph.showPNG]</span>,
+ null,
+ ['Cancel', function () {}]
+ ]);</pre>
+ Optionally, you can pass in the canvas as an argument which will be used, meaning now you do not have to use a
+ context menu (there's an example <a href="png.html"><b>here</b></a>). It WAS originally designed to be used with a context menu, hence it's part of the <i>RGraph.core.context.js</i>
+ file.<br />
+ <i>File: RGraph.common.context.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(number) RGraph.getGutterSuggest(obj, data)</b><br />
+ This function returns a suggested gutter setting based on the vertical labels. If the bottom labels are larger, this
+ setting may be inappropriate. The <i>data</i> variable is a simple single dimension array, <i>eg [1,2,3,4,5]</i>.
+ <br />
+ <pre class="code">
+var size = RGraph.getGutterSuggest(obj, data);
+obj.Set('chart.gutter', size);
+</pre>
+ <i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(boolean) RGraph.isIE8()</b><br />
+ This function tests the useragent for MSIE8.<br />
+ <i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(boolean) RGraph.isIE8up()</b><br />
+ This function tests the useragent for MSIE8 or higher.<br />
+ <i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(boolean) RGraph.isIE9()</b><br />
+ This function tests the useragent for MSIE9.<br />
+ <i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(boolean) RGraph.isIE9up()</b><br />
+ This function tests the useragent for MSIE9 or higher.<br />
+ <i>File: RGraph.common.core.js</i>
+ <br /><br />
+ </li>
+
+ <li>
+ <b>(null) RGraph.background.Draw(obj)</b><br />
+ This function is used by the Bar, Gantt, Line and Scatter chart to draw the chart background (but not the axes).
+ It is passed the graph object which it uses to get the properties it uses:<br /><br />
+
+ <div>
+ <div style="float: left">
+ <ul>
+ <li>chart.gutter</li>
+ <li>chart.variant</li>
+ <li>chart.text.size</li>
+ <li>chart.text.font</li>
+ <li>chart.title</li>
+ <li>chart.title.yaxis</li>
+ <li>chart.background.barcolor1</li>
+ <li>chart.background.barcolor2</li>
+ <li>chart.background.grid</li>
+ <li>chart.background.grid.autofit</li>
+ </ul>
+ </div>
+ <div style="float: left">
+ <ul>
+ <li>chart.background.grid.autofit.numhlines</li>
+ <li>chart.background.grid.autofit.numvlines</li>
+ <li>chart.background.grid.hlines</li>
+ <li>chart.background.grid.vlines</li>
+ <li>chart.background.grid.hsize</li>
+ <li>chart.background.grid.vsize</li>
+ <li>chart.background.grid.width</li>
+ <li>chart.background.grid.color</li>
+ <li>chart.background.grid.color</li>
+ </ul>
+
+ </div>
+ </div>
+
+ <br clear="all" />
+
+
+
+ <p>
+ Note that this function also calls RGraph.DrawTitle() in order to draw the title.<br />
+ <i>File: RGraph.common.core.js</i>
+ </p>
+
+ <br /><br />
+ </li>
+ </ul>
+
+
+ <a name="skeleton"></a>
+ <h4>The skeleton file</h4>
+ <p>
+ The skeleton object
+ (<a href="../libraries/RGraph.skeleton.js" target="_blank"><i>RGraph.skeleton.js</i></a>) gives you a base for creating new graph types that
+ match the RGraph object system (eg getters, setters, RGraph names etc). Example usage of the skeleton object would be:
+ </p>
+
+ <pre class="code">
+<script>
+ var myObj = new RGraph.Skeleton('cvs', [3,3,4,5,3,8,3,2,1,9]);
+ myObj.Set('chart.colors', ['red']);
+ myObj.Draw();
+
+ var colors = myObj.Get('chart.colors');
+</script>
+</pre>
+
+ <a name="questions"></a>
+ <h4>Questions</h4>
+
+ <p>
+ If you have a question regarding the API, you can ask it on the
+ <a href="http://groups.google.com/group/rgraph/topics?gvc=2" target="_blank">mailing list</a>
+ </p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Asynchronous processing</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs async asynchronous" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about asynchronous processing" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js"></script>
+ <script src="../libraries/RGraph.line.js"></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var duration = (new Date().getTime() - timer.getTime()) / 1000;
+ document.getElementById("waiting").innerHTML = '<span style="color: green">Done! Extra time taken: ' + duration.toFixed(1) + ' seconds</span>';
+ alert('The window.onload event fired, extra time taken: ' + duration.toFixed(1) + ' seconds');
+ }
+
+ // Create a timer to show the difference
+ timer = new Date();
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Asynchronous processing
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Asynchronous processing</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p id="waiting" style="; font-weight: bold; font-size: 16pt"><span style="color: #aa0">Waiting for onload event...</span></p>
+
+ <p style="background-color: #eee; border: 1px dashed gray; padding: 5px; height: 50px;">
+ <span style="display: inline-block; margin-left: 10px; float: right">
+ <script>
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey.jpg?' + Math.random() + '" width="50" height="50" /> ');
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/window.jpg?' + Math.random() + '" width="50" height="50" /> ');
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey2.jpg?' + Math.random() + '" width="50" height="50" />');
+ </script>
+ </span>
+
+ These images are here to pad the page and slow down loading so that the window.onload event is slowed. This makes the
+ difference far more visible.
+ </p>
+
+ <canvas id="myCanvas" width="600" height="250" style="float: right">[No canvas support]</canvas>
+
+ <script>
+ /**
+ * Create the line graph
+ */
+ function CreateLineGraph ()
+ {
+ var line = new RGraph.Line('myCanvas', [1,2,4,2,1,3,5,6,6,5,3,5]);
+ line.Set('chart.title', 'Sales for Acme Inc.');
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 5);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Draw();
+ }
+
+ RGraph.Async(CreateLineGraph);
+ </script>
+
+ <p>
+ Asynchronous processing can speed up the display of your graphs, because the browser gets to your code, sets it
+ going and then continues on rendering the page. Particularly if you have a weighty page,
+ it can make quite a difference. The <i>RGraph.Async()</i> function itself is very simple, but because it can make
+ a significant difference to the speed of your page, it is documented here. There's an example of it to the right.
+ One thing to remember is to ensure your canvas tag is defined first before you set the function that creates
+ the graph going.
+ </p>
+
+ <p>
+ Although asynchronous processing can speed up your pages, it can also give the appearance of slower pages due to partial
+ rendering, (ie your pages render a bit at a time). You therefore will need to experiment to get the best result for you.
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script src="RGraph.common.js"></script>
+<script src="RGraph.line.js"></script>
+
+<canvas id="myCanvas" width="300" height="100">[No canvas support]</canvas>
+
+<script>
+ /**
+ * Create the line graph
+ */
+ function CreateLineGraph ()
+ {
+ var line = new RGraph.Line('myCanvas', [1,2,4,2,1,3,5,6,6,5,3,5]);
+ line.Set('chart.title', 'Sales for Acme Inc.');
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 5);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Draw();
+ }
+
+ RGraph.Async(CreateLineGraph);
+</script>
+</pre>
+
+ <p><b>Things to remember</b></p>
+
+ <ul>
+ <li>All your libraries must be loaded first. In the pages <head> for example. If not, you won't be able to create your graphs.</li>
+ <li>Your <canvas> tag must be defined before setting the asynchronous code going. If not, then the canvas may be referenced before it exists, and thus your graphs will not be created.</li>
+ <li>
+ The users connection speed may be a factor. Slower connections may mean, for example, that the onload event doesn't fire very
+ quickly. If you're using the onload event to create your graphs then asynchronous creation instead may give you more
+ apparent speed ups. Alternatively, careful placement of the <canvas> tag and the code that creates the graph may suffice
+ instead.
+ </li>
+ <li>Since the MSIE/ExCanvas combo requires you to use the window.onload event, aynchronous graph creation in this case will probably not be any help.</li>
+ <li>
+ Since a dev release of version 4, Google Chrome has had an issue when aynchronous processing is used, meaning that
+ text isn't always displayed. The solution here is simply to not use asynchronous processing. As of 27th March 2010,
+ Chrome 5 appears to be fine.
+ </li>
+ </ul>
+
+ <h4>See also</h4>
+
+ You might also be interested in the alternative, <a href="domcontentloaded.html">DOMContentLoaded</a> event.
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - bar chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs bar chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Bar chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Bar chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Bar chart documentation</h1>
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The bar graph, along with the line chart, is probably the most configurable of all the charts available,
+ simply because it's more common.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/bar.html">here</a>.
+ </p>
+
+ <ul>
+ <li><a href="#available.properties">Properties</a></li>
+ <li><a href="#available.methods">Methods</a></li>
+ </ul>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [280,45,133,166,84,259,266,960,219,311];
+
+ var bar = new RGraph.Bar('myCanvas', data);
+ bar.Set('chart.labels', ['Richard', 'Alex', 'Nick', 'Scott', 'Kjnell', 'Doug', 'Charles', 'Michelle', 'Mark', 'Alison']);
+ bar.Set('chart.gutter', 45);
+ bar.Set('chart.background.barcolor1', 'rgba(255,255,255,1)');
+ bar.Set('chart.background.barcolor2', 'rgba(255,255,255,1)');
+ bar.Set('chart.background.grid', true);
+ bar.Set('chart.colors', ['rgba(255,0,0,1)']);
+ bar.Draw();
+ }
+</script>
+</pre>
+
+ <a name="available.properties"></a>
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the bar graph apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myBar.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#background">Background</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ </ul>
+
+
+
+<a name="background"></a>
+<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>
+<b>chart.background.barcolor1</b><br />
+ The color of the background bars, (1 of 2). <br /><i>Default: white</i><br /><br />
+ <a name="chart.background.barcolor2"></a>
+<b>chart.background.barcolor2</b><br />
+ The color of the background bars, (2 of 2). <br /><i>Default: white</i><br /><br />
+ <a name="chart.background.grid"></a>
+<b>chart.background.grid</b><br />
+ Whether to show the background grid or not. <br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.color"></a>
+<b>chart.background.grid.color</b><br />
+ The color of the background grid. <br /><i>Default: #ddd</i><br /><br />
+ <a name="chart.background.grid.hsize"></a>
+<b>chart.background.grid.hsize</b><br />
+ The horizontal background grid size. <br /><i>Default: 40</i><br /><br />
+ <a name="chart.background.grid.vsize"></a>
+<b>chart.background.grid.vsize</b><br />
+ The vertical background grid size. <br /><i>Default: 18</i><br /><br />
+ <a name="chart.background.grid.width"></a>
+<b>chart.background.grid.width</b><br />
+ The width that the background grid lines are. Decimals (eg 0.5) are permitted.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.background.grid.border"></a>
+<b>chart.background.grid.border</b><br />
+ Determines whether a border line is drawn around the grid.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.hlines"></a>
+<b>chart.background.grid.hlines</b><br />
+ Determines whether to draw the horizontal grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.vlines"></a>
+<b>chart.background.grid.vlines</b><br />
+ Determines whether to draw the vertical grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.autofit"></a>
+<b>chart.background.grid.autofit</b><br />
+ 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 />
+ <a name="chart.background.grid.autofit.numhlines"></a>
+<b>chart.background.grid.autofit.numhlines</b><br />
+ When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 7</i><br /><br />
+ <a name="chart.background.grid.autofit.numvlines"></a>
+<b>chart.background.grid.autofit.numvlines</b><br />
+ When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
+ <a name="chart.background.hbars"></a>
+<b>chart.background.hbars</b><br />
+ An array of information stipulating horizontal coloured bars. You can use these to indicate limits. Eg: <i>myBar.Set('hbars', [[75, 10, 'yellow'], [85, 15, 'red']]);</i> This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the starting point and the height.<br /><i>Default: null</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.strokecolor"></a>
+<b>chart.strokecolor</b><br />
+ The color of the outline of the bars. <br /><i>Default: #666</i><br /><br />
+ <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ An array of the colors of the actual bars. <br /><i>Default: An array - ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0']</i><br /><br />
+<a name="margins"></a>
+<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.hmargin"></a>
+<b>chart.hmargin</b><br />
+ The horizontal margin (in pixels) of the graph. <br /><i>Default: 5</i><br /><br />
+ <a name="chart.gutter"></a>
+<b>chart.gutter</b><br />
+ The gutter of the graph. This is the area outside of the X and Y axis - where the labels go. If you're short on space for your labels, try increasing this. <br /><i>Default: 25</i><br /><br />
+<a name="labels and text"></a>
+<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.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size (in points) of the labels. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.angle"></a>
+<b>chart.text.angle</b><br />
+ 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 />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ An array of the labels to be used on the graph. <br /><i>Default: An empty array</i><br /><br />
+
+ <a name="chart.labels.above"></a>
+ <b>chart.labels.above</b><br />
+ If true, values will be shown above the bars. For regular and stacked bar charts units are included, whereas for
+ grouped bar charts they're not (usually there isn't enough space for them).
+ <br /><i>Default: false</i><br /><br />
+
+ <a name="chart.labels.above.decimals"></a>
+ <b>chart.labels.above.decimals</b><br />
+ This stipulates how many decimals are used in the above bar labels.
+ <br /><i>Default: 0</i><br /><br />
+
+ <a name="chart.labels.above.size"></a>
+ <b>chart.labels.above.size</b><br />
+ The font size of the above bar labels. Useful if you only have a few bars.
+ <br /><i>Default: false</i><br /><br />
+
+ <a name="chart.labels.ingraph"></a>
+<b>chart.labels.ingraph</b><br />
+ An array of labels for the graph which are drawn "inside" the graph. If you have 5 data points then this should have a corresponding number of elements, though there is a <a href="misc.html#shorthand.ingraph.labels">shorthand available</a>.<br /><i>Default: null</i><br /><br />
+ <a name="chart.ylabels"></a>
+<b>chart.ylabels</b><br />
+ Can be <i>true</i> or <i>false</i> and determines whether the chart has Y axis labels.<br /><i>Default: true</i><br /><br />
+ <a name="chart.ylabels.count"></a>
+<b>chart.ylabels.count</b><br />
+ A value that controls how many Y labels there are. Previously (prior to 8th August 2010) this could be 1,3,5. Now it can be any number, but keep in mind that if you use this it may result in decimals.<br /><i>Default: 5</i><br /><br />
+ <a name="chart.xlabels.offset"></a>
+<b>chart.xlabels.offset</b><br />
+ This allows you finer grained control over the X label positioning if you need it.<br /><i>Default: 0</i><br /><br />
+ <a name="chart.numyticks"></a>
+<b>chart.numyticks</b><br />
+ The number of Y tickmarks. If you have changed the number of Y labels, you may also want to change this to match. <br /><i>Default: 10</i><br /><br />
+<a name="titles"></a>
+
+<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>
+<b>chart.title</b><br />
+The title of the graph, if any. <br />
+<i>Default: null</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+<a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.xaxis"></a>
+<b>chart.title.xaxis</b><br />
+ This allows to specify a title for the X axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.yaxis"></a>
+<b>chart.title.yaxis</b><br />
+ This allows to specify a title for the Y axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.xaxis.pos"></a>
+<b>chart.title.xaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the X axis title.<br /><i>Default: 0.25</i><br /><br />
+ <a name="chart.title.yaxis.pos"></a>
+<b>chart.title.yaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the Y axis title.<br /><i>Default: 0.25</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether a drop shadow is applied. <br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow. <br /><i>Default: #666</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect. <br /><i>Default: 3</i><br /><br />
+<a name="scale"></a>
+<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>
+<b>chart.scale.decimals</b><br />
+ The number of decimal places to display for the Y scale.<br /><i>Default: 0</i><br /><br />
+ <a name="chart.scale.point"></a>
+<b>chart.scale.point</b><br />
+ The character used as the decimal point.<br /><i>Default: .</i><br /><br />
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+ <a name="chart.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the Y axis is measured in. This string is displayed BEFORE the actual number, allowing you to specify values such as "$50".<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the Y axis is measured in. This string is displayed AFTER the actual number, allowing you to specify values such as "50ms".<br /><i>Default: none</i><br /><br />
+ <a name="chart.ymax"></a>
+<b>chart.ymax</b><br />
+ The optional maximum Y scale value. If not specified then it will be calculated.<br /><i>Default: null (It's calculated)</i><br /><br />
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ A numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.<br /><i>Default: null</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.event"></a>
+<b>chart.tooltips.event</b><br />
+ This is the event that triggers the tooltips. It can be either <i>onclick</i> or <i>onmousemove</i>.<br /><i>Default: onclick</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.tooltips.coords.adjust"></a>
+<b>chart.tooltips.coords.adjust</b><br />
+ When you translate (to make the best use of space for example) this allows you to adjust the tooltip coordinates accordingly.<br /> <i>Default: [0,0]</i><br /><br />
+ <a name="chart.crosshairs"></a>
+<b>chart.crosshairs</b><br />
+ If true, you will get a crosshair centering on the current mouse position.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.linewidth"></a>
+<b>chart.crosshairs.linewidth</b><br />
+ This controls the linewidth of the crosshairs.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.crosshairs.color"></a>
+<b>chart.crosshairs.color</b><br />
+ The color of the crosshairs.<br /><i>Default: #333</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.adjustable"></a>
+<b>chart.adjustable</b><br />
+ Defaulting to false, this determines whether your bar chart will be adjustable. <br /><i>Default: false</i><br /><br />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="miscellaneous"></a>
+<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.line"></a>
+<b>chart.line</b><br />
+ Formerly a boolean, this now stipulates a line graph object which is to be drawn on top of the bar chart. You can see an example <a href="combine.html">here</a>.<br /><i>Default: null</i><br /><br />
+ <a name="chart.variant"></a>
+<b>chart.variant</b><br />
+ This simply stipulates whether you want a regular bar chart, a dot chart, a pyramid chart a 3D chart, a sketch or a glassy chart. Possible values are:<ul><li>bar</li><li>dot</li><li>pyramid</li><li>arrow</li><li>3d</li><li>sketch</li><li>glass</li></ul>The pyramid, dot, arrow, sketch and glass variants are only effective for regular bar charts - not grouped or stacked charts.<br /><i>Default: bar</i><br /><br />
+ <a name="chart.xaxispos"></a>
+<b>chart.xaxispos</b><br />
+ The position of the X axis. This can be <i>bottom</i> or <i>center</i>. <br /><i>Default: bottom</i><br /><br />
+ <a name="chart.axis.color"></a>
+<b>chart.axis.color</b><br />
+ The color of the axes.<br /><i>Default: black</i><br /><br />
+ <a name="chart.grouping"></a>
+<b>chart.grouping</b><br />
+ How the bars are grouped, and it should be one of: <b>grouped</b> or <b>stacked</b><br /><i>Default: grouped</i><br /><br />
+</div>
+
+ <a name="available.methods"></a>
+ <br /> <br />
+ <h2>Methods</h2>
+
+ <a name="getbar"></a>
+ <b>obj.getBar()</b><br /><br />
+ This method makes it easier to get hold of which bar has been clicked on, or hovered over. It returns an array of:
+ <ul>
+ <li>The graph object</li>
+ <li>The X coordinate</li>
+ <li>The Y coordinate</li>
+ <li>The width of the bar</li>
+ <li>The height of the bar</li>
+ <li>The numerical index of the bar. This corresponds (for example) to the tooltips array, and the coordinates array</li>
+ </ul>
+
+ An example usage is:
+
+ <pre class="code">
+<canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+
+<script src="RGraph.common.core.js"></script>
+<script src="RGraph.bar.js"></script>
+
+<script>
+ myGraph = new RGraph.Bar('myCanvas', [1.2, 1.3, 1.4, 1.5,6,1.9,2,2.1,2.5]);
+ myGraph.Set('chart.labels', ['John', 'Barry', 'Rich', 'Craig', 'Tom', 'Frank', 'Helen', 'Joyce', 'Fred'])
+ myGraph.Draw();
+
+ RGraph.Register(myGraph);
+
+ myGraph.canvas.onclick = function (e)
+ {
+ RGraph.Redraw();
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ <span style="color: green">var coords = obj.getBar(e);</span>
+
+ if (coords) {
+ var top = coords[1];
+ var left = coords[2];
+ var width = coords[3];
+ var height = coords[4];
+
+ context.beginPath();
+ context.strokeStyle = 'black';
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.strokeRect(top, left, width, height);
+ context.fillRect(top, left, width, height);
+ context.stroke();
+ context.fill();
+ }
+ }
+</script>
+</pre>
+
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Bi-polar chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs bipolar chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Bipolar chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Bi-polar chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Bi-polar chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Bi-polar chart is good for comparing two things side by side. For example sales trends for two separate years, that you
+ want to compare.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/bipolar.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var left = [5,6,8,9,12,13,4,9];
+ var right = [5,8,4,11,15,26,13,16];
+
+ var bipolar = new RGraph.Bipolar('myBipolar', left, right);
+ bipolar.Set('chart.colors', ['#fff', '#eef', '#ddf', '#ccf', '#bbf', '#bbf', '#aaf', '#99f']);
+ bipolar.Set('chart.margin', 3);
+ bipolar.Set('chart.labels', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']);
+ bipolar.Set('chart.title.left', '2007');
+ bipolar.Set('chart.title.right', '2008');
+ bipolar.Set('chart.gutter', 35);
+ bipolar.Draw();
+ }
+</script>
+</pre>
+
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the chart apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myBipolar.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels, text and axes">Labels, text and axes</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The space given over to the labels. <br /><i>Default: 25</i><br /><br />
+ <a name="chart.margin"></a>
+<b>chart.margin</b><br />
+ The space above and below each bar. <br /><i>Default: 2</i><br /><br />
+<a name="titles"></a>
+<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>
+
+<b>chart.title</b><br />
+The main title of the chart.<br />
+<i>Default: (An empty string)</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+<a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title"></a>
+ <a name="chart.title.left"></a>
+<b>chart.title.left</b><br />
+ The left title. <br /><i>Default: An empty string</i><br /><br />
+ <a name="chart.title.right"></a>
+<b>chart.title.right</b><br />
+ The right title. <br /><i>Default: An empty string</i><br /><br />
+<a name="colors"></a>
+
+<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">Colors</h3>
+
+ <a name="chart.colors"></a>
+ <b>chart.colors</b><br />
+ An array of colors. These too can be gradients that you make if you wish. <br />
+ <i>Default: ['#fcf', '#00f', '#f00', '#0f0', '#ff0', '#0ff', '#f0f', '#ff6101', '#b401ff', '#e4ff01', '#fb8195', '#ccc']</i><br /><br />
+
+ <a name="chart.strokestyle"></a>
+ <b>chart.strokestyle</b><br />
+ This is the color used as the stroke style. If you didn't want it, you could set this to <i>rgba(0,0,0,0)</i><br />
+ <i>Default: #333</i><br /><br />
+
+<a name="labels, text and axes"></a>
+<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, text and axes</h3> <a name="chart.xtickinterval"></a>
+<b>chart.xtickinterval</b><br />
+ The X tick mark interval. <br /><i>Default: null</i><br /><br />
+ <a name="chart.axis.color"></a>
+<b>chart.axis.color</b><br />
+ The color of the axes. <br /><i>Default: black</i><br /><br />
+ <a name="chart.xmax"></a>
+<b>chart.xmax</b><br />
+ This allows you to set the maximum X value that the chart uses, instead of it being auto-generated.<br><i>Default: null</i></br><br /><br />
+ <a name="chart.scale.decimals"></a>
+<b>chart.scale.decimals</b><br />
+ This allows you to set the precision of the X labels.<br /><i>Default: null</i><br /><br />
+ <a name="chart.scale.point"></a>
+<b>chart.scale.point</b><br />
+ The character used as the decimal point.<br /><i>Default: .</i><br /><br />
+ <a name="chart.scale.thousand"></a>
+<b>chart.scale.thousand</b><br />
+ The character used as the thousand separator<br /><i>Default: ,</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ An array of the graphs labels (they go in the middle). <br /><i>Default: null</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text used (in points). <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+<a name="scale"></a>
+<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.units.pre"></a>
+
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+<b>chart.units.pre</b><br />
+ The units that are applied to the X axis labels (these are pre-pended to the number).<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that are applied to the X axis labels (these are appended to the number).<br /><i>Default: none</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ A numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. Cannot be used in conjunction with tooltips.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Turns the shadow on or off.<br /> <i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow.<br /> <i>Default: #666</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The horizontal offset of the shadow.<br /> <i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The vertical offset of the shadow. <br /> <i>Default: 3</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ How severe the blurring effect is for the shadow.<br /> <i>Default: 3</i><br /><br />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - About canvas color definitions</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs color" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about canvas colors" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ About canvas color definitions
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - About canvas color definitions</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ You will probably want to know the different ways you can define a color. There are a few
+ ways which you can use, all of which are quite straight-forward.
+ </p>
+
+ <ul id="colors">
+ <li><a href="#named">Named colors</a></li>
+ <li><a href="#hex">Hex values</a></li>
+ <li><a href="#rgb">RGB values</a></li>
+ <li><a href="#rgba">RGBA values</a></li>
+ <li><a href="#hsl">HSL values</a></li>
+ <li><a href="#hsla">HSLA values</a></li>
+ <li><a href="#lgradients">Linear gradients</a></li>
+ <li><a href="#rgradients">Radial gradients</a></li>
+ <li><a href="#info">More information</a></li>
+ </ul>
+
+ <a name="named"></a>
+ <br /> <br />
+ <h2>Named colors</h2>
+
+ <p>
+ The first, and easiest, is to use named colors. This gives you a range of color values that have been predefined for you. Eg:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['red', 'blue']);</pre>
+
+ <a name="hex"></a>
+ <br /> <br />
+ <h2>Hex values</h2>
+
+ <p>
+ The next, is straight forward hex values like you can use in normal CSS. These consist of a hash sign,
+ followed by three or six hexadecimal characters. Eg:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['#f00', '#0000ff']);</pre>
+
+ <a name="rgb"></a>
+ <br /> <br />
+ <h2>RGB values</h2>
+
+ <p>
+ Also as used in CSS, RGB values are the same as what you can use in CSS. Eg:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['rgb(255,0,0)', 'rgb(0,0,255)']);</pre>
+
+ <a name="rgba"></a>
+ <br /> <br />
+ <h2>RGBA values</h2>
+
+ <p>
+ Probably new to most people, is rgba(). Similar to regular rgb() values, but with a fourth value that allows you to specify the
+ alpha value, which stipulates how transparent the color is. An alpha value of 0 is totally transparent, and a value of 1, is
+ totally opaque (ie. you can't see through it). With a value of 1, rgba() acts exactly like rgb(). This example gives you red
+ and blue colors that are semi-transparent:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['rgba(255,0,0,0.5)', 'rgba(0,0,255,0.5)']);</pre>
+
+ <a name="hsl"></a>
+ <br /> <br />
+ <h2>HSL() values</h2>
+
+ <p>
+ Also probably quite new to you, are hsl() values. Much like rgb(), but instead of red green and blue, it allows you to specify
+ the Hue, Saturation and Light values instead. For example:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['hsl(255, 100%, 50%)', 'hsl(169, 100%, 50%)']);</pre>
+
+ <a name="hsla"></a>
+ <br /> <br />
+ <h2>HSLA() values</h2>
+
+ <p>
+ Much like rgb() and rgba(), hsl() has a corresponding hsla() version, which allows you to specify an alpha (transparency) value.
+ Eg:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', ['hsla(255, 100%, 50%, 0.5)', 'hsla(169, 100%, 50%, 0.5)']);</pre>
+
+ <a name="lgradients"></a>
+ <br /> <br />
+ <h2>Linear gradients</h2>
+
+ <p>
+ Gradients can be used in place of color values. You can create a linear gradient like so:
+ </p>
+
+ <pre class="code">myGradient = myObject.context.createLinearGradient(0,0,0,250);
+myGradient.addColorStop(0, 'red');
+myGradient.addColorStop(1, 'blue');</pre>
+
+ <p>
+ This creates a gradient that goes from red to blue. The gradient starts at 0,0, and finishes at 0,250. ie A vertical
+ gradient. You may not see the whole gradient - that depends on the extent of the shape you're filling. You can use the gradient
+ in place of a regular color definition. Eg:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', [myGradient]);</pre>
+
+ <a name="rgradients"></a>
+ <br /> <br />
+ <h2>Radial gradients</h2>
+
+ <p>
+ Radial gradients are much like their linear counterparts, but circular, as the name suggests. Eg:
+ </p>
+
+ <pre class="code">myGradient = myObject.context.createRadialGradient(0,0,0,0,0,100);
+myGradient.addColorStop(0, 'red');
+myGradient.addColorStop(1, 'blue');
+</pre>
+
+ <p>
+ Instead of four arguments, it takes six - the coordinates of the start point along with the radius, and the coordinates
+ of the end point, along with the radius. After it has been created, you can treat as you would a linear gradient:
+ </p>
+
+ <pre class="code">myObject.Set('chart.colors', [myGradient]);</pre>
+
+ <a name="info"></a>
+ <br /> <br />
+ <h2>More information</h2>
+
+ <p>
+ You can read more about CSS3 color definitions <a href="http://www.w3.org/TR/css3-color/" target="_blank" rel="nofollow">here</a>.
+ </p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - combining bar and line graphs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs combining" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about combining charts" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="../libraries/RGraph.pie.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ div.RGraph_tooltip div {
+ display: inline-block;
+ width: 10px;
+ height: 10px;
+ margin-right: 5px;
+ }
+
+ div.RGraph_tooltip div#green {
+ background-color: green;
+ }
+
+ div.RGraph_tooltip div#red {
+ background-color: red;
+ }
+
+ div.RGraph_tooltip div#gray {
+ background-color: #ccc;
+ }
+ </style>
+
+
+ <script>
+ function enlarge_tooltip_graph (e, title)
+ {
+ var bg = document.createElement('DIV');
+ bg.style.opacity = 0;
+ bg.style.position = 'fixed';
+ bg.style.left = 0;
+ bg.style.top = 0;
+ bg.style.width = '2000px';
+ bg.style.height = '2000px';
+ bg.style.backgroundColor = 'rgba(0,0,0,0.2)';
+ bg.style.zIndex = 32568;
+ bg.style.textAlign = 'center';
+ document.body.appendChild(bg);
+
+ var div = document.createElement('DIV');
+ div.style.position = 'relative';
+ div.style.backgroundColor = 'white';
+ div.style.top = '200px';
+ div.style.width = '300px'
+ div.style.height = '240px';
+ div.style.padding = '15px';
+ div.style.WebkitBorderRadius = '5px';
+ div.style.MozBorderRadius = '5px';
+ div.style.borderRadius = '5px';
+ div.style.left = ((document.body.clientWidth / 2) - 175) + 'px';
+
+ // Add standard box-shadow and -moz-box-shadow
+ div.style.WebkitBoxShadow = 'gray 0 0 25px';
+ div.style.MozBoxShadow = '0 0 25px gray';
+ div.style.boxShadow = '0 0 25px gray';
+
+ div.style.border = '1px black solid';
+
+ bg.appendChild(div);
+
+ var canvas = document.createElement('CANVAS');
+ canvas.width = 300;
+ canvas.height = 240;
+ canvas.id = 'big_pie';
+ div.appendChild(canvas);
+
+ bg.onmousedown = function (e)
+ {
+ this.style.display = 'none';
+ document.body.removeChild(this);
+
+ e.stopPropagation();
+ }
+
+ div.onmousedown = function (e)
+ {
+ e.stopPropagation();
+ }
+
+ var data = e.target.__object__.data;
+
+ var pie = new RGraph.Pie('big_pie', data);
+ pie.Set('chart.strokestyle', 'white');
+ pie.Set('chart.linewidth', 5);
+ pie.Set('chart.title', title + ' statistics');
+ pie.Set('chart.align', 'left');
+ pie.Set('chart.colors', ['red','green','#ccc']);
+ pie.Set('chart.key', ['Jane', 'Fred', 'John']);
+ pie.Set('chart.key.shadow', true);
+ pie.Set('chart.key.shadow.blur', 15);
+ pie.Set('chart.key.shadow.offsetx', 0);
+ pie.Set('chart.key.shadow.offsety', 0);
+ pie.Set('chart.key.shadow.color', 'gray');
+ pie.Set('chart.key.rounded', true);
+ pie.Draw();
+
+
+ setTimeout(function () {bg.style.opacity = 0.2;}, 50);
+ setTimeout(function () {bg.style.opacity = 0.4;}, 100);
+ setTimeout(function () {bg.style.opacity = 0.6;}, 150);
+ setTimeout(function () {bg.style.opacity = 0.8;}, 200);
+ setTimeout(function () {bg.style.opacity = 1;}, 250);
+
+ }
+ </script>
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Documentation</a>
+ >
+ Combining charts
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Combining charts</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <ul>
+ <li><a href="#barandline">Combining bar and line charts</a></li>
+ <li><a href="#combiningline">Combining Line charts</a></li>
+ </ul>
+
+ <a name="barandline"></a>
+ <h4>Combining bar and line charts</h4>
+
+ <canvas id="myCanvas" width="600" height="250" style="float: right; border: 1px dashed gray">[No canvas support]</canvas>
+
+ <script>
+ var bar = new RGraph.Bar('myCanvas', [4,5,3,4,1,2,6,5,8,4,9,4]);
+ //bar.Set('chart.gutter', 35);
+ bar.Set('chart.title', 'A bar/line/pie combination (tooltips)');
+ bar.Set('chart.ymax', 15);
+ bar.Set('chart.text.angle', 45);
+ bar.Set('chart.colors', ['#ccc']);
+ bar.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ bar.Set('chart.background.grid.autofit', true);
+
+ // Define the line first so that it can be added to the bar chart
+ var line = new RGraph.Line('myCanvas', [1,3,4,3,2,1,4,5,2,3,8,8], [5,6,7,9,7,5,6,3,5,2,5,1]);
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.colors', ['red', 'green', '#ccc']);
+ line.Set('chart.key', ['Jane', 'Fred', 'John']);
+ line.Set('chart.key.shadow', true);
+ line.Set('chart.key.shadow.offsetx', 0);
+ line.Set('chart.key.shadow.offsety', 0);
+ line.Set('chart.key.shadow.blur', 10);
+ line.Set('chart.key.shadow.color', 'rgba(128,128,128,0.5)');
+ line.Set('chart.key.background', 'white');
+ line.Set('chart.key.rounded', true);
+ line.Set('chart.tickmarks', 'circle');
+
+ // This would all be done programmatically normally, and linked to the key, so that if you change a name in the key,
+ // it changes in all of the tooltips too
+ line.Set('chart.tooltips', [
+ '<b>January</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'January\')"></canvas> <div id="red"></div>Jane: 1<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 4',
+ '<b>February</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'February\')"></canvas> <div id="red"></div>Jane: 6<br /><div id="green"></div>Fred: 6<br /><div id="gray"></div>John: 5',
+ '<b>March</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'March\')"></canvas> <div id="red"></div>Jane: 4<br /><div id="green"></div>Fred: 7<br /><div id="gray"></div>John: 3',
+ '<b>April</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'April\')"></canvas> <div id="red"></div>Jane: 3<br /><div id="green"></div>Fred: 9<br /><div id="gray"></div>John: 4',
+ '<b>May</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'May\')"></canvas> <div id="red"></div>Jane: 2<br /><div id="green"></div>Fred: 7<br /><div id="gray"></div>John: 1',
+ '<b>June</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'June\')"></canvas> <div id="red"></div>Jane: 1<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 2',
+ '<b>July</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'July\')"></canvas> <div id="red"></div>Jane: 4<br /><div id="green"></div>Fred: 6<br /><div id="gray"></div>John: 6',
+ '<b>Aug</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'August\')"></canvas> <div id="red"></div>Jane: 5<br /><div id="green"></div>Fred: 3<br /><div id="gray"></div>John: 5',
+ '<b>September</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'September\')"></canvas> <div id="red"></div>Jane: 2<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 8',
+ '<b>October</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'October\')"></canvas> <div id="red"></div>Jane: 3<br /><div id="green"></div>Fred: 2<br /><div id="gray"></div>John: 4',
+ '<b>November</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'November\')"></canvas> <div id="red"></div>Jane: 8<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 9',
+ '<b>December</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'December\')"></canvas> <div id="red"></div>Jane: 8<br /><div id="green"></div>Fred: 1<br /><div id="gray"></div>John: 4',
+
+ '<b>January</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'January\')"></canvas> <div id="red"></div>Jane: 1<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 4',
+ '<b>February</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'February\')"></canvas> <div id="red"></div>Jane: 6<br /><div id="green"></div>Fred: 6<br /><div id="gray"></div>John: 5',
+ '<b>March</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'March\')"></canvas> <div id="red"></div>Jane: 4<br /><div id="green"></div>Fred: 7<br /><div id="gray"></div>John: 3',
+ '<b>April</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'April\')"></canvas> <div id="red"></div>Jane: 3<br /><div id="green"></div>Fred: 9<br /><div id="gray"></div>John: 4',
+ '<b>May</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'May\')"></canvas> <div id="red"></div>Jane: 2<br /><div id="green"></div>Fred: 7<br /><div id="gray"></div>John: 1',
+ '<b>June</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'June\')"></canvas> <div id="red"></div>Jane: 1<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 2',
+ '<b>July</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'July\')"></canvas> <div id="red"></div>Jane: 4<br /><div id="green"></div>Fred: 6<br /><div id="gray"></div>John: 6',
+ '<b>August</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'August\')"></canvas> <div id="red"></div>Jane: 5<br /><div id="green"></div>Fred: 3<br /><div id="gray"></div>John: 5',
+ '<b>September</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'September\')"></canvas> <div id="red"></div>Jane: 2<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 8',
+ '<b>October</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'October\')"></canvas> <div id="red"></div>Jane: 3<br /><div id="green"></div>Fred: 2<br /><div id="gray"></div>John: 4',
+ '<b>November</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'November\')"></canvas> <div id="red"></div>Jane: 8<br /><div id="green"></div>Fred: 5<br /><div id="gray"></div>John: 9',
+ '<b>December</b><br /> <canvas width="50" height="50" id="__tooltip_canvas__" style="float: right" onclick="enlarge_tooltip_graph(event, \'December\')"></canvas> <div id="red"></div>Jane: 8<br /><div id="green"></div>Fred: 1<br /><div id="gray"></div>John: 4'
+ ]);
+ line.Set('chart.tooltips.highlight', false);
+ // No need to call Draw() - the bar chart will do it
+
+ // Add a Line chart tooltip event that draws the tooltip Pie charts
+ RGraph.AddCustomEventListener(line, 'ontooltip', CreateTooltipGraph);
+
+
+
+ // Add the line graph to the bar chart
+ bar.Set('chart.line', line);
+
+ // Draw the bar chart, which in turn draws the line graph for us
+ bar.Draw();
+
+ /**
+ * This is the function that creates the tooltip graphs
+ */
+ function CreateTooltipGraph (obj)
+ {
+ var index = RGraph.Registry.Get('chart.tooltip').__index__;
+ var tooltip = obj.Get('chart.tooltips')[index];
+
+ // Extract the data for the obj.Get('chart.tooltips')[index]ie chart froim the tooltip
+ var jane_data = Number(tooltip.replace(/.*Jane: (\d+).*/, '$1'));
+ var fred_data = Number(tooltip.replace(/.*Fred: (\d+).*/, '$1'));
+ var john_data = Number(tooltip.replace(/.*John: (\d+).*/, '$1'));
+
+ var pie_data = [jane_data,fred_data,john_data];
+
+ // This data could be dynamic
+ var pie = new RGraph.Pie('__tooltip_canvas__', pie_data);
+ pie.Set('chart.gutter', 5);
+ pie.Set('chart.colors', ['red','green','#ccc']);
+ pie.Set('chart.strokestyle', '#ffd');
+ pie.Set('chart.linewidth', 2);
+ pie.Draw();
+
+ pie.canvas.style.cursor = 'pointer';
+ }
+ </script>
+
+ <p>
+ This is an example of combining Bar and Line charts. It's quite straight-forward, and the code here shows you how it can be achieved.
+ </p>
+
+ <p>
+ If the values for the line and bar result in different Y scales you may need to specify the <i>chart.ymax</i> property for each graph
+ so that the scales are the same. The line turns off Y labels so as not to overwrite the Bars labels.
+ </p>
+
+ <b>Tooltips</b>
+
+ <p>
+ You can have tooltips on the Line chart by setting <i>chart.tooltips.highlighting</i> to <i>false</i>, like below.
+ The order in which you create the graphs is also important, you must define the Bar chart first, and subsequently the Line
+ chart.
+ </p>
+
+ <pre class="code">line.Set('chart.tooltips.highlighting', false);</pre>
+
+ <p>
+ Because the tooltips are only triggered by the Line chart, you should put all of the information, for both the Line and the
+ Bar chart, in the tooltips.
+ </p>
+
+ <a name="combiningline"></a>
+ <h4>Combining Line charts</h4>
+
+ <!-- This is the canvas that both the line graphs use -->
+ <canvas id="myCanvas2" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <script>
+ line2 = new RGraph.Line('myCanvas2', [51,22,23,33,35,23,32,45]);
+ line2.Set('chart.hmargin', 10);
+ line2.Set('chart.labels', ['Kiff', 'Wayne', 'Pete', 'Lou', 'Jake', 'Jo', 'Fred', 'Bob']);
+ line2.Set('chart.linewidth', 3);
+ line2.Set('chart.shadow', true);
+ line2.Set('chart.shadow.offsetx', 2);
+ line2.Set('chart.shadow.offsety', 2);
+ line2.Set('chart.ymax', 65);
+ line2.Set('chart.units.post', 'l');
+ line2.Set('chart.gutter', 40);
+ line2.Set('chart.noxaxis', true);
+ line2.Set('chart.noendxtick', true);
+ line2.Set('chart.title', 'An example of axes both sides');
+ line2.Draw();
+
+ line3 = new RGraph.Line('myCanvas2', [42,50,51,23,46,48,65,11]);
+ line3.Set('chart.hmargin', 10);
+ line3.Set('chart.linewidth', 3);
+ line3.Set('chart.shadow', true);
+ line3.Set('chart.shadow.offsetx', 2);
+ line3.Set('chart.shadow.offsety', 2);
+ line3.Set('chart.yaxispos', 'right');
+ line3.Set('chart.noendxtick', true);
+ line3.Set('chart.background.grid', false);
+ line3.Set('chart.ymax', 100);
+ line3.Set('chart.colors', ['blue', 'red']);
+ line3.Set('chart.units.pre', '$');
+ line3.Set('chart.gutter', 40);
+ line3.Set('chart.key', ['Cost', 'Volume']);
+ line3.Set('chart.key.background', 'rgba(255,255,255,0.8)');
+ line3.Draw();
+ </script>
+
+ <p>
+ Another type of chart you may want is a line chart with Y axes on both sides, as illustrated on the right. You should
+ be careful with this chart type as it can easily lead to confusion.
+ </p>
+
+ <p>
+ This chart is made up from two line charts, one with the Y axis on the left and one on the right. The code that makes up
+ this chart is below.
+ </p>
+
+ <p>
+ The only reason to combine line charts is to get Y axes on the left and right. If you simply want mutiple lines,
+ you can do this without combining any charts. <a href="../examples/line.html">See the line chart example page</a>
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script>
+ window.onload = function
+ {
+ line2 = new RGraph.Line('myCanvas2', [51,22,23,33,35,23,32,45]);
+ line2.Set('chart.hmargin', 10);
+ line2.Set('chart.labels', ['Kiff', 'Wayne', 'Pete', 'Lou', 'Jake', 'Jo', 'Fred', 'Bob']);
+ line2.Set('chart.linewidth', 3);
+ line2.Set('chart.shadow', true);
+ line2.Set('chart.shadow.offsetx', 2);
+ line2.Set('chart.shadow.offsety', 2);
+ line2.Set('chart.ymax', 65);
+ line2.Set('chart.units.post', 'l');
+ line2.Set('chart.gutter', 35);
+ line2.Set('chart.noxaxis', true);
+ line2.Set('chart.noendxtick', true);
+ line2.Set('chart.title', 'An example of axes both sides');
+ line2.Draw();
+
+ line3 = new RGraph.Line('myCanvas2', [42,50,51,23,46,48,65,11]);
+ line3.Set('chart.hmargin', 10);
+ line3.Set('chart.linewidth', 3);
+ line3.Set('chart.shadow', true);
+ line3.Set('chart.shadow.offsetx', 2);
+ line3.Set('chart.shadow.offsety', 2);
+ line3.Set('chart.yaxispos', 'right');
+ line3.Set('chart.noendxtick', true);
+ line3.Set('chart.background.grid', false);
+ line3.Set('chart.ymax', 65);
+ line3.Set('chart.colors', ['blue', 'red']);
+ line3.Set('chart.units.pre', '$');
+ line3.Set('chart.gutter', 35);
+ line3.Set('chart.key', ['Cost', 'Volume']);
+ line3.Set('chart.key.background', 'rgba(255,255,255,0.5)');
+ line3.Draw();
+ }
+</script>
+</pre>
+
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Context menus</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs context menus" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about context menus" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <!-- Contextmenu CSS classes -->
+ <style>
+ .RGraph_contextmenu {
+ }
+
+ .RGraph_contextmenu_background {
+ }
+
+ .RGraph_contextmenu_item {
+ }
+ </style>
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Context menus
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Context menus</h1>
+
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <ul>
+ <li><a href="#what">What are context menus?</a></li>
+ <li><a href="#look">What do they look like?</a></li>
+ <li><a href="#multiple">Can I have multiple levels of menus?</a></li>
+ <li><a href="#define">How do I define context menus?</a></li>
+ <li><a href="#seperators">Can I have "separators"?</a></li>
+ <li><a href="#bypass">How do I bypass them?</a></li>
+ <li><a href="#use">What can I use them for?</a></li>
+ <li><a href="#example">Is there an example file that uses the CSS classes?</a></li>
+ <li><a href="#mac">Context menus, Macs, Safari and Opera</a></li>
+ </ul>
+
+ <a name="what"></a>
+ <br /> <br />
+ <h3>What are context menus?</h3>
+
+ <p>
+ Context menus are what you see when you click your right mouse button. With RGraph, you can specify custom menus
+ for your graphs if you wish. This way you can define custom actions to be associated with menu items. Context menus are a
+ very easy way to extend the functionality of your graphs, allowing you to associate presentation style functionality
+ with them.
+ </p>
+
+ <p>
+ <b>Important:</b> Opera does not allow you to customise the context menu, so with this browser you
+ should use the left mouse button on the graph, instead of the right.
+ </p>
+
+ <a name="look"></a>
+ <br /> <br />
+ <h3>What do they look like?</h3>
+
+ <img src="../images/context.png" width="148" height="90" alt="An RGraph context menu" style="float: right; margin-right: 200px; border: 2px dashed gray; margin-right: 280px" />
+
+ <p>
+ Context menus look like the image on the right. You can of course customise their look by using stylesheets. The CSS classes
+ you need to use are <b>RGraph_contextmenu_background</b>, <b>RGraph_contextmenu</b> and <b>RGraph_contextmenu_item</b>. Eg:
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<style type="text/css">
+ .RGraph_contextmenu {
+ }
+
+ .RGraph_contextmenu_item {
+ }
+
+ .RGraph_contextmenu_background {
+ }
+</style></pre>
+
+ <p>
+ The "! important" is not necessary if you're not overriding a style that is set by the graph script. If you're having trouble,
+ it's a good idea to use it though.
+ </p>
+
+ <a name="multiple"></a>
+ <br /> <br />
+ <h3>Can I have multiple levels of menus?</h3>
+
+ <p>
+ Yes, as of 24th April 2010 you can have a dual level context menu, which can reduce "option overload" in your user interface.
+ This example defines a simple context menu:
+ </p>
+
+ <pre class="code">
+bar.Set('chart.contextmenu', [
+ ['Zoom', RGraph.Zoom],
+ ['Application', <span style="color: green">[['Login...', function () {ModalDialog.Show('modaldialog_login', 300);}]]</span> ],
+ null,
+ ['Cancel', function () {}]
+ ]);
+</pre>
+
+ <p>
+ As you can see there could easily get to be a lot of arrays, so it may help you during development to structure your code by using
+ indentation.
+ </p>
+
+ <a name="define"></a>
+ <br /> <br />
+ <h3>How do I define context menus?</h3>
+
+ <p>
+ Defining a context menu is quite a simple affair. Eg:
+ </p>
+
+ <pre class="code">
+myBar.Set('chart.contextmenu', [
+ ['Menu item 1', Callback1],
+ ['Menu item 2', Callback2]
+ ]);</pre>
+
+ <p>
+ As you can see, the value is a two dimension array. The second being an array consisting of a string which is used as the name of the
+ menu item, and a function object (NOT the function name as a string). The function object is the function called when the menu item is selected.
+ </p>
+
+ <a name="seperators"></a>
+ <br /> <br />
+ <h3>Can I have "separators"?</h3>
+
+ <p>
+ Yes. Simply pass null instead of an array as your menu item. Eg:
+ </p>
+
+ <pre class="code">
+myBar.Set('chart.contextmenu', [
+ ['Menu item 1', Callback1],
+ null,
+ ['Menu item 2', Callback2]
+ ]);</pre>
+
+ <a name="bypass"></a>
+ <br /> <br />
+ <h3>How do I bypass them?</h3>
+
+ <p>
+ If for any reason you wish to access the browsers own context menu, you can hold down your CTRL key on your keyboard when you
+ click, and the canvas context menu will be bypassed. Try it on the graph below by holding your CTRL key whilst right clicking.
+ </p>
+
+ <a name="use"></a>
+ <br /> <br />
+ <h3>What can I use them for?</h3>
+
+ <p>
+ Since the context menu items run Javascript functions when selected, you can use them for pretty much
+ anything you want. For example you could make a presentation system, with the context menu controlling which
+ graph is shown on the canvas. For example:
+ </p>
+
+ <div style="text-align: center">
+ <canvas id="myCanvas" width="600" height="200">[No canvas support]</canvas>
+ </div>
+
+ <a name="example"></a>
+ <h3>Is there an example file that uses the CSS classes?</h3>
+
+ <p>
+ You can take a look at the bottom of the <a href="../css/website.css" >CSS file for this website</a>.
+ </p>
+
+ <a name="mac"></a>
+ <br /> <br />
+ <h3>Context menus, Macs, Safari, Opera and MSIE 9</h3>
+
+ <p>
+ Mac Safari, Mac Firefox, Windows Safari and MSIE 9 (beta 1) can have trouble displaying the context menu. So for this reason, for these browsers,
+ the context menu is attached to a double click of the left mouse button. Opera doesn't support customising the context menu so
+ this browser also uses a left mouse button double click to trigger the context menu.
+ </p>
+
+ <script>
+ /**
+ * Shows the bar chart
+ */
+ function ShowGraphOne ()
+ {
+ RGraph.Clear(document.getElementById('myCanvas'));
+
+ var bar = new RGraph.Bar('myCanvas', [[45,15],[16,23],[52,12],[33,64],[34,54],[62,33],[66,23],[12,23],[12,53],[16,45],[26,43],[46,42],[41,41],[32,46]]);
+ bar.Set('chart.colors', ['#66f', '#f66']);
+ bar.Set('chart.gutter', 25);
+ bar.Set('chart.title', 'Data represented on a bar chart (with context menu)');
+ bar.Set('chart.labels', ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th', '11th', '12th', '13th', '14th']);
+ bar.Set('chart.contextmenu', [['Graph', [['Bar chart', ShowGraphOne], ['Line graph', ShowGraphTwo]]], null, ['Cancel', function () {}]]);
+ bar.Set('chart.grouping', 'grouped');
+ bar.Draw();
+ }
+
+ /**
+ * Show the line chart
+ */
+ function ShowGraphTwo()
+ {
+ RGraph.Clear(document.getElementById('myCanvas'));
+
+ var line = new RGraph.Line('myCanvas', [15,23,12,64,54,33,23,23,53,45,43,42,41,46], [45,16,52,33,34,62,66,12,12,16,26,46,41,32]);
+ line.Set('chart.title', 'Same data, but represented on a line chart (with context menu)');
+ line.Set('chart.colors', ['#f66', '#66f']);
+ line.Set('chart.background.barcolor1', '#fff');
+ line.Set('chart.background.barcolor2', '#fff');
+ line.Set('chart.tickmarks', null);
+ line.Set('chart.linewidth', 3);
+ line.Set('chart.gutter', 25);
+ line.Set('chart.hmargin', 550 / 26);
+ line.Set('chart.labels', ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th', '11th', '12th', '13th', '14th']);
+ line.Set('chart.contextmenu', [['Graph', [['Bar chart', ShowGraphOne], ['Line graph', ShowGraphTwo]]], null, ['Cancel', function () {}]]);
+ line.Draw();
+ }
+
+ /**
+ * Show the first graph
+ */
+ window.onload = function ()
+ {
+ ShowGraphOne();
+ }
+
+ </script>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - available CSS classes</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs css classes" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about RGraph CSS classes" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <style type="text/css">
+ li {
+ margin: 0 ! important;
+ }
+
+ li a {
+ text-decoration: none;
+ }
+ </style>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Available CSS classes
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Available CSS classes</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ This is information about the CSS classes available to you to allow you to customise the appearance of tooltips and
+ context menus.
+ </p>
+
+ <ul>
+ <li><a href="#RGraph_png">RGraph_png</a></li>
+ <li><a href="#RGraph_palette">RGraph_palette</a></li>
+ <li><a href="#RGraph_tooltip">RGraph_tooltip</a></li>
+ <li><a href="#RGraph_contextmenu">RGraph_contextmenu</a></li>
+ <li><a href="#RGraph_contextmenu_item">RGraph_contextmenu_item</a></li>
+ <li><a href="#RGraph_contextmenu_background">RGraph_contextmenu_background</a></li>
+ <li><a href="#RGraph_zoom_window">RGraph_zoom_window</a></li>
+ <li><a href="#RGraph_zoomed_canvas">RGraph_zoomed_canvas</a></li>
+ <li><a href="#RGraph_zoomed_area">RGraph_zoomed_area</a></li>
+ <li><a href="#ModalDialog_background">ModalDialog_background</a></li>
+ <li><a href="#ModalDialog_dialog">ModalDialog_dialog</a></li>
+ <li><a href="#ModalDialog_topbar">ModalDialog_topbar</a></li>
+ <li><a href="#example">An example usage</a></li>
+ <li><a href="#important">! important</a></li>
+ </ul>
+
+ <a name="RGraph_png"></a>
+ <br /> <br />
+ <h2>RGraph_png</h2>
+ <p>
+ This controls the appearance of the PNG image which is shown when you use the context menu option <i>RGraph.showPNG()</i>.
+ </p>
+
+ <a name="RGraph_palette"></a>
+ <br /> <br />
+ <h2>RGraph_palette</h2>
+ <p>
+ This controls the appearance of the mini-palette that can be used with annotating.
+ </p>
+
+ <a name="RGraph_tooltip"></a>
+ <br /> <br />
+ <h2>RGraph_tooltip</h2>
+ <p>
+ This controls the appearance of tooltips. The default is to have them look like Windows tooltips.
+ </p>
+
+ <a name="RGraph_contextmenu"></a>
+ <br /> <br />
+ <h2>RGraph_contextmenu</h2>
+ <p>
+ This controls how context menus appear. The default is similar to the look that Windows XP has.
+ </p>
+
+ <a name="RGraph_contextmenu_item"></a>
+ <br /> <br />
+ <h2>RGraph_contextmenu_item</h2>
+ <p>
+ This controls how individual items on the context menu will appear, for example the default has roughly 25px padding-left
+ to accomodate the left bar.
+ </p>
+
+ <a name="RGraph_contextmenu_background"></a>
+ <br /> <br />
+ <h2>RGraph_contextmenu_background</h2>
+ <p>
+ This is the Windows XP style left vertical bar. By default this is light grey.
+ </p>
+
+ <a name="RGraph_zoom_window"></a>
+ <br /> <br />
+ <h2>RGraph_zoom_window</h2>
+ <p>
+ This is the class to use if you want to customise the mini-zoom window.
+ </p>
+
+ <a name="RGraph_zoomed_canvas"></a>
+ <br /> <br />
+ <h2>RGraph_zoomed_canvas</h2>
+ <p>
+ This is the class to use if you want to customise the full canvas zoom.
+ </p>
+
+ <a name="RGraph_zoomed_area"></a>
+ <br /> <br />
+ <h2>RGraph_zoomed_area</h2>
+ <p>
+ This is the class to use if you want to customise the zoomed area.
+ </p>
+
+ <a name="ModalDialog_background"></a>
+ <br /> <br />
+ <h2>ModalDialog_background</h2>
+ <p>
+ This class controls the dark semi-opaque background for the ModalDialog.
+ </p>
+
+ <a name="ModalDialog_dialog"></a>
+ <br /> <br />
+ <h2>ModalDialog_dialog</h2>
+ <p>
+ This class controls the ModalDialog itself.
+ </p>
+
+ <a name="ModalDialog_topbar"></a>
+ <br /> <br />
+ <h2>ModalDialog_topbar</h2>
+ <p>
+ This class controls the top bar for the ModalDialog. You could, for example, use the <i>display</i> CSS property to
+ hide this if you don't want it.
+ </p>
+
+ <a name="example"></a>
+ <br /> <br />
+ <h2>Example usage</h2>
+ <p>
+ Here is an example of using the CSS classes. At the time of writing, some of the items here were only implemented in newer
+ web browsers:
+ </p>
+
+ <pre class="code">
+<style>
+ .RGraph_png {
+ }
+
+ .RGraph_palette {
+ }
+
+ .RGraph_tooltip {
+ }
+
+ .RGraph_contextmenu {
+ }
+
+ .RGraph_contextmenu_background {
+ }
+
+ .RGraph_contextmenu_item {
+ }
+
+ .RGraph_zoom_window {
+ }
+
+ .RGraph_zoomed_canvas {
+ }
+
+ .RGraph_zoomed_area {
+ }
+
+ .ModalDialog_background {
+ }
+
+ .ModalDialog_dialog {
+ }
+
+ .ModalDialog_topbar {
+ }
+</style>
+</pre>
+
+<a name="important"></a>
+<br /> <br />
+<h2>! important</h2>
+
+ <p>
+ If you're attempting to override default styles, then because of the ordering (ie the script is setting the style AFTER
+ your own CSS) you may need to use the "! important" modifier, for example:
+ </p>
+
+ <pre class="code">
+<style>
+ .RGraph_tooltip {
+ background-color: white ! important;
+ }
+</style>
+</pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - DOMContentLoaded event</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs domcontentloaded" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library - DOMContentLoaded example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <meta name="keywords" content="rgraph graph html5 javascript canvas" />
+ <meta name="description" content="RGraph: The HTML5 graphing library for websites on all platforms" />
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+
+ <script>
+ window.onload = function ()
+ {
+ var duration = (new Date().getTime() - timer.getTime()) / 1000;
+ document.getElementById("waiting").innerHTML = '<span style="color: green">Done! Extra time taken: ' + duration.toFixed(1) + ' seconds</span>';
+ alert('The window.onload event fired, extra time taken: ' + duration.toFixed(1) + ' seconds');
+ }
+
+ function myFunc ()
+ {
+ var line = new RGraph.Line('cvs', [4,3,2,4,5,6,7,4,8,9]);
+ line.Set('chart.labels', ['Dez', 'Fliss','Geoff','Hoolio','John','Rich','Kev','Charles','Lou','Bob']);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.title', 'A demonstration of the DOMContentLoaded event');
+ line.Set('chart.tickmarks', 'circle');
+ line.Set('chart.linewidth', 1.01);
+
+ if (navigator.userAgent.indexOf('Chrome/6') == -1) {
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ }
+ line.Draw();
+ }
+
+ /**
+ * Install the function to the appropriate event
+ */
+ if(window.addEventListener) {
+ window.addEventListener('DOMContentLoaded', myFunc, false);
+ } else {
+ document.attachEvent("onDOMContentLoaded", myFunc);
+ }
+
+ // Create a timer to show the difference
+ timer = new Date();
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ DOMContentLoaded event
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - DOMContentLoaded example</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p id="waiting" style="; font-weight: bold; font-size: 16pt"><span style="color: #aa0">Waiting for onload event...</span></p>
+
+
+
+
+ <p style="background-color: #eee; border: 1px dashed gray; padding: 5px; height: 50px;">
+ <span style="display: inline-block; margin-left: 10px; float: right">
+ <script>
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey.jpg?' + Math.random() + '" width="50" height="50" /> ');
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/window.jpg?' + Math.random() + '" width="50" height="50" /> ');
+ document.write('<img src="http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey2.jpg?' + Math.random() + '" width="50" height="50" />');
+ </script>
+ </span>
+
+ These images are here to pad the page and slow down loading so that the window.onload event is slowed. This makes the
+ difference far more visible.
+ </p>
+
+ <canvas id="cvs" width="600" height="250" style="float: right">[No canvas support]</canvas>
+
+ <p>
+ The DOMContentLoaded event is an extremely useful event and can make a big impact on the performance of your pages, hence this
+ example. The DOMContentLoaded event fires when the pages HTML and scripts have loaded, but not necessarily any images or CSS.
+ This can make a big improvement on the apparent speed of your page(s).
+ </p>
+
+ <p>
+ You can read more about the <i>DOMContentLoaded</i> event on the Mozilla site, <a href="https://developer.mozilla.org/en/Gecko-Specific_DOM_Events" target="_blank">here</a>,
+ and the Microsoft site <a href="http://ie.microsoft.com/testdrive/HTML5/87DOMContent-Loaded/Default.html" target="_blank">here</a>.
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+function createGraph(func)
+{
+ if(window.addEventListener) {
+ window.addEventListener('DOMContentLoaded', func, false);
+ } else {
+ document.attachEvent("onDOMContentLoaded", func);
+ }
+}
+</pre>
+
+ <h4>Browser support</h4>
+
+ <p>
+ The DOMContentLoaded event is supported by the following browsers:
+ </p>
+
+ <ul>
+ <li>Google Chrome</li>
+ <li><a href="https://developer.mozilla.org/en/Gecko-Specific_DOM_Events" target="_blank">Mozilla Firefox</a></li>
+ <li>Apple Safari</li>
+ <li>Opera ASA. Opera</li>
+ <li><a href="http://ie.microsoft.com/testdrive/HTML5/87DOMContent-Loaded/Default.html" target="_blank">Microsoft Internet Explorer 9</a></li>
+ </ul>
+
+ <h4>See also</h4>
+
+ You might also be interested in <a href="async.html">asynchronous</a> graph creation as an alternative.
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - donut chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs donut chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Donut chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Donut chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Donut chart documentation</h1>
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Donut chart was formerly a separate chart, however it's now simply a variant of the Pie chart.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [45,57,48,32];
+
+ var donut = new RGraph.Pie('myDonut', data);
+ donut.Set('chart.labels', ['Jan', 'Ben', 'Mark', 'Lucy']);
+ donut.Set('chart.linewidth', 5);
+ donut.Set('chart.strokestyle', 'white');
+ donut.Set('chart.tooltips', ['Jan', 'Ben', 'Mark', 'Lucy']);
+ donut.Set('chart.variant', 'donut');
+ donut.Draw();
+ }
+</script>
+</pre>
+
+ <ul>
+ <li><a href="../examples/donut.html">Donut chart examples</a></li>
+ <li><a href="pie.html">Pie chart documentation</a></li>
+ </ul>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php
+ header('Location: /');
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Retrieving a PNG of your graph</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs png image" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library - Retrieving a PNG representation of your graph" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Updating your graphs dynamically
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Updating your graphs dynamically</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <canvas id="cvs" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <script>
+ window.onload = function (e)
+ {
+ d1 = [];
+ d2 = [];
+
+ // Pre-pad the arrays with 100 null values
+ for (var i=0; i<400; ++i) {
+ d1.push(null);
+ d2.push(null);
+ }
+
+ function getGraph(id, d1, d2)
+ {
+ var graph = new RGraph.Line(id, d1, d2);
+ graph.Set('chart.xticks', 100);
+ graph.Set('chart.gutter', 25);
+ graph.Set('chart.background.barcolor1', 'white');
+ graph.Set('chart.background.barcolor2', 'white');
+ graph.Set('chart.title.xaxis', 'Time >>>');
+ graph.Set('chart.title.yaxis', 'Bandwidth (MB/s)');
+ graph.Set('chart.title', 'Bandwidth used by servers 1 and 2');
+ graph.Set('chart.filled', true);
+ graph.Set('chart.fillstyle', ['#daf1fa', '#faa']);
+ graph.Set('chart.colors', ['rgb(169, 222, 244)', 'red']);
+ graph.Set('chart.linewidth', 1);
+ //graph.Set('chart.ylabels.inside', true);
+ graph.Set('chart.yaxispos', 'right');
+ graph.Set('chart.ymax', 20);
+ graph.Set('chart.xticks', 25);
+
+ return graph;
+ }
+
+ function drawGraph ()
+ {
+ RGraph.Clear(document.getElementById("cvs"));
+
+ var graph = getGraph('cvs', d1, d2);
+ graph.Draw();
+
+ // Add some data to the data arrays
+ var r1 = RGraph.random(7, 9);
+ var r2 = RGraph.random(7, 10);
+
+ d1.push(r1);
+ d2.push(r2);
+
+ if (d1.length > 400) {
+ d1 = RGraph.array_shift(d1);
+ d2 = RGraph.array_shift(d2);
+ }
+
+ if (document.all && RGraph.isIE8()) {
+ alert('[MSIE] Sorry, Internet Explorer 8 is not fast enough to support animated charts');
+ } else {
+ setTimeout(drawGraph,15);
+ }
+ }
+
+ drawGraph();
+ }
+ </script>
+
+ <p>
+ The example on the right shows a line chart that automatically updates itself every 250 milliseconds. An ideal
+ use for this could be showing a networks bandwidth usage, or a servers load value.
+ </p>
+
+ <p>
+ This particular example shows a stacked line chart with two data series, though if you're showing load/stress values, a
+ non-filled chart might be a better choice.
+ </p>
+
+ <p>
+ To get up-to-date data from your server you could simply have the page refresh itself, storing the data on the server,
+ or use <a href="index.html#ajax">AJAX</a> if you want the data stored client-side.
+ </p>
+
+ <p>
+ Be careful of the data types you use to pass the data to RGraph - you should use numbers to represent values, not strings.
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+
+<script>
+ d1 = [];
+ d2 = [];
+
+ // Pre-pad the arrays with 100 null values
+ for (var i=0; i< 100; ++i) {
+ d1.push(null);
+ d2.push(null);
+ }
+
+ function getGraph(id, d1, d2)
+ {
+ var graph = new RGraph.Line(id, d1, d2);
+ graph.Set('chart.gutter', 25);
+ graph.Set('chart.background.barcolor1', 'white');
+ graph.Set('chart.background.barcolor2', 'white');
+ graph.Set('chart.title.xaxis', 'Time');
+ graph.Set('chart.filled', true);
+ graph.Set('chart.fillstyle', ['#daf1fa', '#faa']);
+ graph.Set('chart.colors', ['rgb(169, 222, 244)', 'red']);
+ graph.Set('chart.linewidth', 3);
+ graph.Set('chart.ymax', 20);
+ graph.Set('chart.xticks', 25);
+
+ return graph;
+ }
+
+ function drawGraph (e)
+ {
+ // Clear the canvas and redraw the graph
+ RGraph.Clear(document.getElementById("cvs"));
+ var graph = getGraph('cvs', d1, d2);
+ graph.Draw();
+
+ // Add some data to the data arrays
+ d1.push(RGraph.random(5, 10));
+ d2.push(RGraph.random(5, 10));
+
+ // Get rid of the first values of the arrays
+ if (d1.length > 100) {
+ d1 = RGraph.array_shift(d1);
+ d2 = RGraph.array_shift(d2);
+ }
+
+ setTimeout(drawGraph,250);
+ }
+
+ drawGraph();
+</script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Custom RGraph events</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs custom events" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the custom RGraph events" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="../css/ModalDialog.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Custom RGraph events
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Custom RGraph events</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <ul>
+ <li><a href="#introduction">Introduction</a></li>
+ <li>
+ <a href="#available.events">Available events</a>
+ <ul>
+ <li><a href="#event.ontooltip">ontooltip</a></li>
+ <li><a href="#event.oncontextmenu">oncontextmenu</a></li>
+ <li><a href="#event.onbeforedraw">onbeforedraw</a></li>
+ <li><a href="#event.ondraw">ondraw</a></li>
+ <li><a href="#event.onzoom">onzoom</a></li>
+ <li><a href="#event.onmodaldialog">onmodaldialog</a></li>
+ <li><a href="#event.onresize">onresize</a></li>
+ <li><a href="#event.onadjust">onadjust</a></li>
+ <li><a href="#event.onannotatestart">onannotatestart</a></li>
+ <li><a href="#event.onannotate">onannotate</a></li>
+ <li><a href="#event.onannotateend">onannotateend</a></li>
+ </ul>
+ </li>
+ </ul>
+
+ <a name="introduction"></a>
+ <h4>Introduction</h4>
+
+ <p>
+ Custom events allow you to easily interact with and extend RGraph for your own purposes. The list of available events is below,
+ as is an example of how to make use of them with the <i>RGraph.AddCustomEventListener()</i> function. Event handler functions (ie your
+ functions) are passed a single parameter - the graph object. With this you can get references to the canvas and context. There's
+ an example of this below.
+ </p>
+
+<pre class="code"><script>
+ window.onload = function ()
+ {
+ var line = new RGraph.Line('myLine', [45,12,16,18,44,54,23,21,56]);
+ line.Set('chart.tooltips', ['Fred', 'Barney', 'Jay', 'Pete', 'Frank', 'Bob', 'Ted', 'Lou', 'Kev']);
+ line.Set('chart.labels', ['Fred', 'Barney', 'Jay', 'Pete', 'Frank', 'Bob', 'Ted', 'Lou', 'Kev']);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.tickmarks', 'dot');
+ line.Draw();
+
+ <span style="color: green">/**
+ * This is the call to the RGraph function that registers the event listener
+ *
+ * line: The graph object
+ * ontooltip: The name of the event
+ * myFunc: The function that handles the event
+ */</span>
+ RGraph.AddCustomEventListener(line, 'ontooltip', myFunc);
+ }
+
+ <span style="color: green">/**
+ * The function that is called when the ontooltip event fires. It is passed a single parameter - the graph object.
+ * With this you can get the ID and references to the canvas and context:
+ * o obj.id
+ * o obj.canvas
+ * o obj.context
+ */</span>
+ function myFunc(obj)
+ {
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ alert('This alert was triggered by the custom ontooltip event');
+ }
+</script>
+</pre>
+
+ <a name="available.events"></a>
+ <h4>Available events</h4>
+
+ <p>
+ <a name="event.ontooltip"></a>
+ <b>ontooltip</b><br />
+ This event fires immediately after a tooltip has been created. This event allows you to easily show graphs in your tooltips (tooltip
+ effects that involve moving the tooltip, eg. <i>contract</i>, <i>expand</i> & <i>snap</i>, will not function). You
+ can find the tooltip object in the RGraph registry - <i>RGraph.Registry.Get('chart.tooltip')</i>. Note that if you're testing and
+ using a function that pauses execution (eg alert()), this will also pause any timers (for animation effects etc). If you want to
+ avoid this you should use a function that doesn't block execution, eg the Firebug/WebKit function, <i>console.log()</i> (you can use the
+ <i>cl()</i> shortcut in RGraph).
+ </p>
+
+ <p>
+ <a name="event.oncontextmenu"></a>
+ <b>oncontextmenu</b><br />
+ This event fires immediately after the RGraph context menu is shown. If you want it, you can get at the context menu in the
+ RGraph registry: <i>RGraph.Registry.Get('chart.contextmenu')</i> Like the <i>ontooltip</i> event, using <i>alert()</i> can
+ pause the fade in timers, so you should consider using the Firebug/Webkit <i>console.log</i> functions instead.
+ </p>
+
+ <p>
+ <a name="event.onbeforedraw"></a>
+ <b>onbeforedraw</b><br />
+ Much like the ondraw event, however this fires at the start of the .Draw() method, in effect "before" the method.
+ </p>
+
+ <p>
+ <a name="event.ondraw"></a>
+ <b>ondraw</b><br />
+ The ondraw event fires <i>after</i> the .Draw() method has run. Note that the interactive features of RGraph may call the .Draw()
+ method multiple times - the zoom in area mode is a prime example.
+ A graph with tooltips is also an example. In this case it would demonstrate that the .Draw() method is called twice (and
+ hence the ondraw event), whereas the ontooltip event only fires once.
+
+ <br /><br />
+
+ <b>Note:</b> The <i>ondraw</i> event is not only fired by its own graph,
+ but (if you're using tooltips for example), can also be fired by other graphs on the page.
+ </p>
+
+ <p>
+ <a name="event.onzoom"></a>
+ <b>onzoom</b><br />
+ The onzoom event fires whenever the canvas is zoomed. When the zoom is in <i>area</i> and <i>canvas</i> modes this fires once,
+ but when in <i>thumbnail</i> mode this event is like the onmousemove event in that it fires whenever the mouse is moved.
+ </p>
+
+ <p>
+ <a name="event.onmodaldialog"></a>
+ <b>onmodaldialog</b><br />
+ The onmodaldialog event fires when the ModalDialog is shown. This event is easily replicated yourself, though using this event
+ may help you to keep your code tidy. This event is utilised slightly differently to the other events:
+
+ <pre class="code">ModalDialog.AddCustomEventListener('onmodaldialog', function () {alert('Hello world!');});</pre>
+ </p>
+
+ <p>
+ <a name="event.onresize"></a>
+ <b>onresize</b><br />
+ The onresize event fires when a canvas is resized. It also fires when the canvas is reset to the original size.
+ </p>
+
+ <p>
+ <a name="event.onadjust"></a>
+ <b>onadjust</b><br />
+ The onadjust event fires whenever one of the supported graph types is adjusted. It usually fires in conjunction with the
+ onmousemove event, and can be blocked by alert(). You therefore may need to use a different function (eg console.log())
+ whilst debugging.
+ </p>
+
+ <p>
+ <a name="event.onannotatestart"></a>
+ <b>onannotatestart</b><br />
+ The onannotatestart event fires at the beginning of the annotating procedure (ie in a similar vein to the onmousedown event).
+ </p>
+
+ <p>
+ <a name="event.onannotate"></a>
+ <b>onannotate</b><br />
+ The onannotate event fires when the graph has been annotated. It fires during the annotate procedure.
+ </p>
+
+ <p>
+ <a name="event.onannotateend"></a>
+ <b>onannotateend</b><br />
+ The onannotateend event fires at the end of the annotating procedure (ie in a similar vein to the onmouseup event).
+ </p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Integrating RGraph with external libraries</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs external libraries" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about integrating RGraph with external libraries" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="../css/ModalDialog.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.modaldialog.js" ></script>
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ /**
+ * Draw the line graph
+ */
+ var line = new RGraph.Line('myLine', [45,12,16,18,44,54,23,21,56,58,33,47]);
+ line.Set('chart.background.barcolor1', 'white');
+ line.Set('chart.background.barcolor2', 'white');
+ line.Set('chart.tickmarks', null);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 3);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offset', 2);
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.title', 'A line graph with context menu');
+
+ // This defines a context menu which shows the dialog. The commented out
+ // bit defines an onclick handler on the background, so that when you
+ // click it (the background), the dialog is hidden.
+ line.Set('chart.contextmenu', [
+ ['Login to admin area...', function () {ModalDialog.Show('myDialog', 300);/*ModalDialog.background.onclick = function () {ModalDialog.Close();};*/}],
+ null,
+ ['Cancel', function () {}]
+ ]);
+
+ line.Draw();
+ }
+ </script>
+
+
+ <style>
+ /*
+ * These are the CSS classes that you can use to customise the appearance of the ModalDialog. If you're trying to
+ * override something which the scripts set, then because of the ordering you may need to use the "! important"
+ * modifier.
+ */
+ .ModalDialog_background {
+ }
+
+ .ModalDialog_dialog {
+ -webkit-box-shadow: gray 0 0 15px ! important;
+ -moz-box-shadow: 0 0 15px gray ! important;
+ box-shadow: 0 0 15px gray ! important;
+ }
+
+ .ModalDialog_topbar {
+ }
+ </style>
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Integrating RGraph with external libraries
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Integrating RGraph with external libraries</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <ul>
+ <li><a href="#msie">Note about Microsoft Internet Explorer and the ModalDialog</a></li>
+ <li><a href="#hiding">Hiding the ModalDialog</a></li>
+ <li><a href="#customising">Customising the ModalDialog</a></li>
+ <li><a href="#integration">ModalDialog integration</a></li>
+ </ul>
+
+ <canvas id="myLine" width="400" height="200" style="float: right">[No canvas support]</canvas>
+
+ <p>
+ This page shows you how you can easily integrate the graphs with other external Javascript libraries. This particular example
+ attaches a context menu to the graph, of which the only option is to show a login dialog. This could, for example, be used to
+ allow logging in to an admin area.
+ </p>
+
+ <p>
+ The dialog doesn't need to require user input - it could just be a static "Please wait..." type dialog, which is shown while a
+ subsequent page loads that takes a few seconds.
+ </p>
+
+ <p>
+ The ModalDialog was originally an external library, however it's now part of the RGraph package. It's also covered by the
+ RGraph license - so if you have an <a href="licensing.html">RGraph license</a>, then the ModalDialog is part of that.
+ </p>
+
+ <br /><br />
+
+ <pre class="code">
+<script src="RGraph.common.core.js">
+<script src="RGraph.common.context.js">
+<script src="RGraph.line.js">
+<script src="RGraph.modaldialog.js">
+
+<script>
+ window.onload = function ()
+ {
+ /**
+ * Draw the line graph
+ */
+ var line = new RGraph.Line('myLine', [45,12,16,18,44,54,23,21,56,58,33,47]);
+ line.Set('chart.background.barcolor1', 'white');
+ line.Set('chart.background.barcolor2', 'white');
+ line.Set('chart.tickmarks', null);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 3);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offset', 2);
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.title', 'A line graph with context menu');
+ <span style="color: green">
+ // This defines a context menu which calls the given function. This function in turn shows the dialog
+ line.Set('chart.contextmenu', [['Login to admin area...', function () {ModalDialog.Show('myDialog', 300);}}]]);
+ </span>
+ line.Draw();
+ }
+</script></pre>
+
+ <p>
+ If you're interested in using this modal dialog, then you'll probably also want the CSS that styles it. This can be found in the
+ "css" directory.
+ </p>
+
+ <a name="msie"></a>
+ <h3>Note about Microsoft Internet Explorer 8 and the ModalDialog</h3>
+
+ <p>
+ Microsoft Internet Explorer 8 only supports fixed positioning in strict rendering mode, therefore you must specify a DTD
+ when using this browser. Eg:
+ </p>
+
+ <pre class="code">
+<!DOCTYPE html >
+</pre>
+
+ <a name="hiding"></a>
+ <h3>Hiding the ModalDialog</h3>
+ <p>
+ To hide the ModalDialog (from a "Cancel" button for example), you can use the Close() method:
+ </p>
+
+ <pre class="code">
+<input type="reset" value="Cancel" onclick="ModalDialog.Close()">
+</pre>
+
+ <a name="customising"></a>
+ <h3>Customising the ModalDialog</h3>
+ <p>
+ You can customise the appearance of the ModalDialog by using three CSS classes, which are documented <a href="css.html">here</a>.
+ This page customises the dialog slightly by changing the shadow X/Y offsets:
+ </p>
+
+ <pre class="code">
+<style>
+ /*
+ * These are the CSS classes that you can use to customise the appearance of the ModalDialog. If you're trying to
+ * override something which the scripts set, then because of the ordering you may need to use the "! important"
+ * modifier.
+ */
+
+ /**
+ * This is the semi-opaque background
+ */
+ .ModalDialog_background {
+ }
+
+
+ /**
+ * This is the dialog itself
+ */
+ .ModalDialog_dialog {
+ -webkit-box-shadow: gray 0 0 15px ! important;
+ -moz-box-shadow: 0 0 15px gray ! important;
+ box-shadow: 0 0 15px gray ! important;
+ }
+
+
+ /**
+ * This is gray bar at the top of the dialog
+ */
+ .ModalDialog_topbar {
+ }
+</style>
+</pre>
+
+ <a name="integration"></a>
+ <h3>ModalDialog integration</h3>
+ <p>
+ To integrate the ModalDialog look at the sample code above (the key line is where the context menu is defined). The method you should call is <b>ModalDialog.Show(id, width)</b>.
+ The <i>id</i> is the <i>id</i> of the layer to use. Only the <i>.innerHTML</i> is used, not the layer itself, so it can be hidden by
+ setting the display CSS <i>display</i> property to <i>none</i>. The <i>width</i> is a number which is used as the width of the dialog.
+ </p>
+
+ <p>
+ The only library needed for the ModalDialog to work is <i>RGraph.modaldialog.js</i> - you do not need to use
+ <i>RGraph.common.js</i>. This makes for far smaller download requirements.
+
+ </p>
+
+ <!-- This is the popup dialog-->
+
+ <div id="myDialog" class="modalDialog" style="display: none">
+
+ <b>Please login</b>
+ <p>
+ <table border="0">
+ <tr>
+ <td align="right" style="padding-top: 4px">Email</td>
+ <td><input type="text" size="20" name="email" style="width: 150px" /></td>
+ </tr>
+
+ <tr>
+ <td align="right" style="padding-top: 4px">Password</td>
+ <td><input type="password" size="20" name="password" style="width: 150px" /></td>
+ </tr>
+
+ <tr>
+ <td colspan="2" align="right">
+ <input type="reset" value="Cancel" onclick="ModalDialog.Close()">
+ <input type="submit" name="submit" value="Login »" onclick="alert('This is just an example'); if (document.all) event.cancelBubble = true; else event.stopPropagation()">
+ </td>
+ </tr>
+ </table>
+ </p>
+ </div>
+
+ <!-- End of dialog -->
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - funnel chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs funnel chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Funnel chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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"><b>Tweet about RGraph</b></a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Funnel chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Funnel chart documentation</h1>
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ This is a funnel chart. It can be used to illustrate stages of a sales or order fulfillment process, and in doing so highlight any bottlenecks
+ or steps where large amounts of customers are lost.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/funnel.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var funnel = new RGraph.Funnel('funnel1', [100,45,45,26,21,5]);
+ funnel.Set('chart.text.boxed', false);
+ funnel.Set('chart.title', 'Leads through to sales');
+ funnel.Set('chart.labels', ['A', 'B', 'C', 'D', 'E', 'F']);
+ funnel.Set('chart.shadow', true);
+ funnel.Draw();
+ }
+</script>
+</pre>
+
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the Funnel chart appears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myFunnel.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the chart. This is the whitespace area around the chart.<br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ These are the colors used for each segment.<br /><i>Default: ['red', 'green', 'gray', 'blue', 'black', 'white']</i><br /><br />
+<a name="labels and text"></a>
+<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>
+<b>chart.labels</b><br />
+ An array of the labels to be used on the graph. <br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size (in points) of the labels. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.boxed"></a>
+<b>chart.text.boxed</b><br />
+ Whether the text is contained within a white bounding box. In some cases this can help readability.<br /><i>Default: true</i><br /><br />
+ <a name="chart.text.halign"></a>
+<b>chart.text.halign</b><br />
+ The horizontal alignment of the text. Can be <i>center</i> or <i>left</i>.<br /><i>Default: left</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the graph, if any. <br /><i>Default: null</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether a drop shadow is applied to the Funnel chart. The funnel is the first to use the canvas shadow API, and as such they won't be supported on all browsers. Currently only Safari 4+ (possibly earlier versions too), Firefox 3.5+ and Chrome 2+ support canvas shadows.<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the drop shadow.<br /><i>Default: #666</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the shadow.<br /><i>Default: 3</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array of tooltips for the Funnel chart segments.<br /><i>Default: null</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect that tooltips use - <i>fade</i> or <i>expand</i><br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - gantt chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs gantt chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Gantt chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Gantt chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Gantt chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Gantt chart can be used to easily represent schedules, making visualising this information far more straightfoward.
+ </p>
+
+ <ul>
+ <li><a href="#events">Adding events to your Gantt chart</a></li>
+ <li><a href="#vbars">Adding vertical bars to your Gantt chart</a></li>
+ </ul>
+
+ <h2>Example</h2>
+
+ <p>
+ The example file is <a href="../examples/gantt.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var gantt = new RGraph.Gantt('gantt');
+ gantt.Set('chart.xmax', 365);
+ gantt.Set('chart.gutter', 35);
+ gantt.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ gantt.Set('chart.title', 'Holiday schedule for Xyz Ltd');
+ gantt.Set('chart.defaultcolor', 'rgba(255,0,0,1)');
+ gantt.Set('chart.tooltips', ["<b>Richard</b><br />Richard is going on holiday to Malta.<br />He'll be away for 28 days.",
+ "<b>Fred</b><br />Fred is also going away for 28 days",
+ "<b>Barney</b><br />Barney is off work for two weeks",
+ "<b>Gloria</b><br />Gloria is off for 3 weeks",
+ "<b>Paul</b><br /> Away for 31 days",
+ "<b>Harry</b><br />Away for three weeks",
+ "<b>Shane</b><br />Away for one week",
+ "<b>Barry</b><br />Away for two weeks",
+ "<b>Cynthia</b><br />Away for two weeks",
+ "<b>Graham</b><br />Away for August and September",
+ "<b>Paul</b><br />Away for 31 days"]);
+ gantt.Set('chart.events'[
+ [31, 28, null, 'Richard'],
+ [31, 28, null, 'Fred'],
+ [59, 14, null, 'Barney'],
+ [59, 21, null, 'Gloria'],
+ [59, 31, null, 'Paul'],
+ [80, 21, null, 'Harry'],
+ [94, 7, null, 'Shane'],
+ [120, 14, null, 'Barry'],
+ [130, 14, null, 'Cynthia'],
+ [211, 61, null, 'Graham'],
+ [334, 31, null, 'Paul'],
+ ]);
+ gantt.Set('chart.vbars', [
+ [0, 31, 'rgba(192,255,192,0.5)'],
+ [59, 31, 'rgba(192,255,192,0.5)'],
+ [120, 31, 'rgba(192,255,192,0.5)'],
+ [181, 31, 'rgba(192,255,192,0.5)'],
+ [243, 30, 'rgba(192,255,192,0.5)'],
+ [304, 30, 'rgba(192,255,192,0.5)'],
+ ]);
+
+ gantt.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the bar graph apears.
+ </p>
+
+ <ul>
+ <li><a href="#chart configuration">Chart configuration</a></li>
+ <li><a href="#background">Background</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ </ul>
+
+
+
+ <a name="chart configuration"></a>
+ <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">Chart configuration</h3>
+ <a name="chart.xmax"></a>
+ <b>chart.xmax</b><br />
+ Required. This determines how many "units" wide the Gantt chart is. For example to represent a year, you would use 365, giving
+ a granularity of one day.<br />
+ <i>Default: none</i><br /><br />
+
+ <a name="chart.xmin"></a>
+ <b>chart.xmin</b><br />
+ This option can sometimes make using a Gantt chart spread over several pages easier.<br />
+ <i>Default: 0</i><br /><br />
+
+
+<a name="background"></a>
+<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>
+<b>chart.background.barcolor1</b><br />
+ Color of the background bars<br /><i>Default: white</i><br /><br />
+ <a name="chart.background.barcolor2"></a>
+<b>chart.background.barcolor2</b><br />
+ Color of the background bars<br /><i>Default: white</i><br /><br />
+ <a name="chart.background.grid"></a>
+<b>chart.background.grid</b><br />
+ Whether a grid is shown as part of the background<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.color"></a>
+<b>chart.background.grid.color</b><br />
+ The color of the background grid.<br /><i>Default: #eee</i><br /><br />
+ <a name="chart.background.grid.hsize"></a>
+<b>chart.background.grid.hsize</b><br />
+ The size of the horizontal grid.<br /><i>Default: 20</i><br /><br />
+ <a name="chart.background.grid.vsize"></a>
+<b>chart.background.grid.vsize</b><br />
+ The size of the vertical grid.<br /><i>Default: 20</i><br /><br />
+ <a name="chart.background.grid.width"></a>
+<b>chart.background.grid.width</b><br />
+ The line width of the background grid.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.background.grid.autofit"></a>
+<b>chart.background.grid.autofit</b><br />
+ 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 />
+ <a name="chart.background.grid.autofit.numhlines"></a>
+<b>chart.background.grid.autofit.numhlines</b><br />
+ When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 7</i><br /><br />
+ <a name="chart.background.grid.autofit.numvlines"></a>
+<b>chart.background.grid.autofit.numvlines</b><br />
+ When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ How big the gutter is. This is the top, bottom and right gutters. The left gutter is three times the gutter wide, to accomodate the labels.<br /><i>Default: 25</i><br /><br />
+<a name="labels and text"></a>
+<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.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points).<br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ An array of the labels which are applied to the chart.<br /><i>Default: [] (An empty array)</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the chart.<br /><i>Default: not set</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array of tooltips that are shown when the bars are clicked. They can contain HTML.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. Cannot be used in conjunction with tooltips.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="miscellaneous"></a>
+<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.borders"></a>
+<b>chart.borders</b><br />
+ Whether a border is shown on the event bars<br /><i>Default: true</i><br /><br />
+ <a name="chart.defaultcolor"></a>
+<b>chart.defaultcolor</b><br />
+ The default color of bars. If you don't specify a color for the event, this will be used.<br /><i>Default: white</i><br /><br />
+ <a name="chart.events"></a>
+<b>chart.events</b><br />
+ An array of event information that is displayed on the gantt. See below for further information.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.vbars"></a>
+<b>chart.vbars</b><br />
+ Vertical bars used for decorative purposes, or for marking something on the chart (an event for example). See below for further information.<br /><i>Default: [] (An empty array)</i><br /><br />
+</div><!-- /DOCS --><br /><br />
+
+ <a name="events"></a>
+ <h2>Adding events to your Gantt chart</h2>
+
+ <p>
+ To add events, you specify them using the <i>chart.events</i> property. You could use the following to set some events on your gantt chart:
+ </p>
+
+ <pre class="code">gantt.Set('chart.events', [
+ [31, 28, 75, 'Richard'],
+ [12, 28, 67, 'Fred'],
+ [59, 14, 0, 'Barney'],
+ [59, 21, 5, 'Gloria'],
+ [46, 31, 94, 'Paul'],
+ [80, 21, 46, 'Harry'],
+ [94, 17, 84, 'Shane'],
+ [34, 14, 32, 'Barry'],
+ [64, 14, 28, 'Cynthia', 'red', 'yellow'],
+ [13, 61, 74, 'Graham'],
+ [84, 31, 16, 'Paul']
+ ]);
+</pre>
+
+ <p>
+ The first value is the (zero indexed) start number relative to your <i>chart.xmax</i>. So if you have set your <i>chart.xmax</i> to 62, (to represent
+ two months), and this value is 31, the start will be the start of the second month. In this case you could give two labels -
+ <i>['July', 'August']</i>.
+ </p>
+
+ <p>
+ The second value is the duration. So using the previous example, if you set this to 7, you would have an event lasting a week.
+ </p>
+
+ <p>
+ The third value is the "percentage complete" indicator. This is shown to the right of the event, and is optional - you can
+ specify <i>null</i> if you wish.
+ </p>
+
+ <p>
+ The fourth value is the label that is used on the left hand side.
+ </p>
+
+ <p>
+ The optional fifth value stipulates the background colour that the bar is. Default is white.
+ </p>
+
+ <p>
+ And the last optional 6th value is the foreground color of the bar. Defaulting to #0c0.
+ </p>
+
+ <a name="vbars"></a>
+ <h2>Adding vertical bars to your Gantt chart</h2>
+
+ <p>
+ You can add decorative vertical bars like so:
+ </p>
+
+ <pre class="code">gantt.Set('chart.vbars', [
+ [0, 31, 'rgba(192,255,192,0.5)'],
+ [59, 31, 'rgba(192,255,192,0.5)'],
+ [120, 31, 'rgba(192,255,192,0.5)'],
+ [181, 31, 'rgba(192,255,192,0.5)'],
+ [243, 30, 'rgba(192,255,192,0.5)'],
+ [304, 30, 'rgba(192,255,192,0.5)'],
+ ]);
+</pre>
+
+ <p>
+ You can use these for decorative purposes, or to mark events/limits. The first value is the start index, as above.
+ The second value is the unit length, again as above. The third value is the color of the vertical bar.
+ </p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - horizontal bar chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs hbar horizontal bar" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Horizontal Bar (HBar) chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Horizontal bar chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Horizontal bar chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The horizontal bar graph is a variation on the bar chart which can be useful when you have larger labels, since you have
+ more space available to you for them.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/hbar.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [280,45,133,166,84,259,266,960,219,311];
+
+ var hbar = new RGraph.HBar('myCanvas', data);
+ hbar.Set('chart.labels', ['Richard', 'Alex', 'Nick', 'Scott', 'Kjnell', 'Doug', 'Charles', 'Michelle', 'Mark', 'Alison']);
+ hbar.Set('chart.gutter', 45);
+ hbar.Set('chart.background.barcolor1', 'rgba(255,255,255,1)');
+ hbar.Set('chart.background.barcolor2', 'rgba(255,255,255,1)');
+ hbar.Set('chart.background.grid', true);
+ hbar.Set('chart.colors', ['rgba(255,0,0,1)']);
+ hbar.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the bar graph apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myHBar.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#background">Background</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#scale and axes">Scale and axes</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the graph. This is the area outside of the X and Y axis - where the labels go. If you're short on space for your labels, try increasing this. <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ An array of the colors of the actual bars. <br /><i>Default: An array - ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0']</i><br /><br />
+<a name="background"></a>
+<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>
+<b>chart.background.barcolor1</b><br />
+ The color of the background bars, (1 of 2). <br /><i>Default: white</i><br /><br />
+ <a name="chart.background.barcolor2"></a>
+<b>chart.background.barcolor2</b><br />
+ The color of the background bars, (2 of 2). <br /><i>Default: white</i><br /><br />
+ <a name="chart.background.grid"></a>
+<b>chart.background.grid</b><br />
+ Whether to show the background grid or not. <br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.color"></a>
+<b>chart.background.grid.color</b><br />
+ The color of the background grid. <br /><i>Default: #ddd</i><br /><br />
+ <a name="chart.background.grid.hsize"></a>
+<b>chart.background.grid.hsize</b><br />
+ The horizontal background grid size. <br /><i>Default: 40</i><br /><br />
+ <a name="chart.background.grid.vsize"></a>
+<b>chart.background.grid.vsize</b><br />
+ The vertical background grid size. <br /><i>Default: 18</i><br /><br />
+ <a name="chart.background.grid.width"></a>
+<b>chart.background.grid.width</b><br />
+ The width that the background grid lines are. Decimals (eg 0.5) are permitted.<br /><i>Default: 0.5</i><br /><br />
+ <a name="chart.background.grid.border"></a>
+<b>chart.background.grid.border</b><br />
+ Determines whether a border line is drawn around the grid.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.hlines"></a>
+<b>chart.background.grid.hlines</b><br />
+ Determines whether to draw the horizontal grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.vlines"></a>
+<b>chart.background.grid.vlines</b><br />
+ Determines whether to draw the vertical grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.autofit"></a>
+<b>chart.background.grid.autofit</b><br />
+ 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 />
+ <a name="chart.background.grid.autofit.numhlines"></a>
+<b>chart.background.grid.autofit.numhlines</b><br />
+ When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 14</i><br /><br />
+ <a name="chart.background.grid.autofit.numvlines"></a>
+<b>chart.background.grid.autofit.numvlines</b><br />
+ When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
+<a name="labels and text"></a>
+<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>
+<b>chart.labels</b><br />
+ An array of the labels to be used on the graph. <br /><i>Default: An empty array</i><br /><br />
+
+ <a name="chart.labels.above"></a>
+ <b>chart.labels.above</b><br />
+ This is a boolean which if true, will cause labels to be shown to the right of the bars. (It's called "above"
+ for API compatibility).<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.labels.above.decimals"></a>
+ <b>chart.labels.above.decimals</b><br />
+ This is a number which controls how many decimals are shown. It defaults to 0, and since it was added (4th December 2010)
+ you may need to set this, otherwise no decimals will be shown.<br />
+ <i>Default: 0</i><br /><br />
+
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size (in points) of the labels. <br /><i>Default: 10</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the graph, if any. <br /><i>Default: null</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.xaxis"></a>
+<b>chart.title.xaxis</b><br />
+ This allows to specify a title for the X axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.yaxis"></a>
+<b>chart.title.yaxis</b><br />
+ This allows to specify a title for the Y axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.xaxis.pos"></a>
+<b>chart.title.xaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the X axis title.<br /><i>Default: 0.25</i><br /><br />
+ <a name="chart.title.yaxis.pos"></a>
+<b>chart.title.yaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the Y axis title.<br /><i>Default: 0.5</i><br /><br />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+<a name="scale and axes"></a>
+<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 and axes</h3> <a name="chart.scale.point"></a>
+<b>chart.scale.point</b><br />
+ The character used as the decimal point.<br /><i>Default: .</i><br /><br />
+ <a name="chart.scale.thousand"></a>
+<b>chart.scale.thousand</b><br />
+ The character used as the thousand separator<br /><i>Default: ,</i><br /><br />
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+ <a name="chart.xmax"></a>
+<b>chart.xmax</b><br />
+ (Optional) An optional max figure for the X scale.<br /> <i>Default: none (one is calculated)</i><br /><br />
+ <a name="chart.yaxispos"></a>
+<b>chart.yaxispos</b><br />
+ The position of the Y axis. Works with regular and grouped charts. Can be either <i>center</i> or <i>left</i>.<br /> <i>Default: left</i><br /><br />
+ <a name="chart.axis.color"></a>
+<b>chart.axis.color</b><br />
+ The color of the axes.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the X axis is measured in. This string is displayed BEFORE the actual number, allowing you to specify values such as "$50".<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the X axis is measured in. This string is displayed AFTER the actual number, allowing you to specify values such as "50ms".<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.ingraph"></a>
+<b>chart.units.ingraph</b><br />
+ If your units are long, setting this stipulates them to be used for ingraph labels only.<br /><i>Default: false</i><br /><br />
+<a name="miscellaneous"></a>
+<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.grouping"></a>
+<b>chart.grouping</b><br />
+ How the bars are grouped, and it should be one of: <b>grouped</b> or <b>stacked</b><br /><i>Default: grouped</i><br /><br />
+ <a name="chart.vmargin"></a>
+<b>chart.vmargin</b><br />
+ The vertical margin that is applied to each individual bar.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.strokestyle"></a>
+<b>chart.strokestyle</b><br />
+ The color of the outlines of the bars.<br /><i>Default: black</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether a small drop shadow is applied. <br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow. <br /><i>Default: #666</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect. <br /><i>Default: 3</i><br /><br />
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. You cannot have context menus AND tooltips, only one or the other. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array of tooltips for the chart.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The visual effect used when showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for personal, |
+ * | charity and educational purposes it is free to use. You can read the full |
+ * | license here: |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - horizontal progress bar documentation</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Horizontal Progress bar
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Horizontal Progress bar documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The example file is <a href="../examples/hprogress.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var myProgress = new RGraph.HProgess('myProgress', 78, 100);
+ myProgress.Set('chart.colors', ['red']);
+ myProgress.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the progress bar apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myProgress.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#chart configuration">Chart configuration</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="chart configuration"></a>
+<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">Chart configuration</h3> <a name="chart.tickmarks"></a>
+<b>chart.tickmarks</b><br />
+ Whether the tickmarks are drawn. <br /><i>Default: true</i><br /><br />
+ <a name="chart.tickmarks.color"></a>
+<b>chart.tickmarks.color</b><br />
+ The color used for tickmarks.<br /><i>Default: black</i><br /><br />
+ <a name="chart.tickmarks.inner"></a>
+<b>chart.tickmarks.inner</b><br />
+ This controls whether the bar has inner tickmarks<br /><i>Default: false</i><br /><br />
+ <a name="chart.value"></a>
+<b>chart.value</b><br />
+ The indicated value. You don't need to set this because it's one of the arguments to the constructor.<br /><br />
+ <a name="chart.max"></a>
+<b>chart.max</b><br />
+ The maximum value. You don't need to set this because it's one of the arguments to the constructor.<br /><br />
+ <a name="chart.numticks"></a>
+<b>chart.numticks</b><br />
+ How many tick marks there are. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.numticks.inner"></a>
+<b>chart.numticks.inner</b><br />
+ How many inner tick marks there are. <br /><i>Default: 50</i><br /><br />
+ <a name="chart.arrows"></a>
+<b>chart.arrows</b><br />
+ This stipulates that two indicator arrows are drawn. It works best if you have tickmarks off, and no title.<br><i>Default: false</i><br /><br />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The size of the gutter. <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ The colors of the bar(s). This can be a solid color, or a gradient that you create. <br /><i>Default: [#0c0]</i><br /><br />
+ <a name="chart.background.color"></a>
+<b>chart.background.color</b><br />
+ The background color. <br /><i>Default: #eee</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether the progress bar has a shadow. This uses the canvas shadow API and therefore is only supported on Chrome 2, Safari 3.1 and Firefox 3.1 (and above).<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the progress bar shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the progress bar shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow.<br /><i>Default: rgba(0,0,0,0.5)</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The blurring effect that is applied to the shadow.<br /><i>Default: 3</i><br /><br />
+<a name="labels and text"></a>
+<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.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points). <br /><i>Default: 10</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ Labels that are applied to the graph. <br /><i>Default: An empty array</i><br /><br />
+<a name="scale"></a>
+<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.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the Y scale is measured in (these are preppend to the number). <br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the Y scale is measured in (these are appended to the number). <br /><i>Default: none</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the progress bar. <br /><i>Default: An empty string</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array, albeit one element only. This is shown when the progress bar is clicked on. This can contain HTML.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing the tooltip. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.adjustable"></a>
+<b>chart.adjustable</b><br />
+ Defaulting to false, this determines whether your progress bar will be adjustable (click the bar and drag it). <br /><i>Default: false</i><br /><br />
+<a name="zoom"></a>
+<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.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library - Documentation index" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <meta name="keywords" content="rgraph graph html5 javascript canvas" />
+ <meta name="description" content="RGraph: The HTML5 graphing library for websites on all platforms" />
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ Documentation
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+<p>
+ The following documentation is available:
+</p>
+
+ <div style="float: left; width: 202px">
+ <h4>Chart types</h4>
+ <ul>
+ <li><a href="bar.html">Bar chart</a></li>
+ <li><a href="bipolar.html">Bi-polar chart</a></li>
+ <li><a href="donut.html">Donut chart</a></li>
+ <li><a href="funnel.html">Funnel chart</a></li>
+ <li><a href="gantt.html">Gantt chart</a></li>
+ <li><a href="hbar.html">Horizontal bar chart</a></li>
+ <li><a href="hprogress.html">Horizontal progress bar</a></li>
+ <li><a href="led.html">LED Grid</a></li>
+ <li><a href="line.html">Line chart</a></li>
+ <li><a href="meter.html">Meter</a></li>
+ <li><a href="odo.html">Odometer</a></li>
+ <li><a href="pie.html">Pie chart</a></li>
+ <li><a href="rose.html">Rose chart</a></li>
+ <li><a href="rscatter.html">Radial scatter chart</a></li>
+ <li><a href="scatter.html">Scatter graph</a></li>
+ <li><a href="tradar.html">Traditional radar chart</a></li>
+ <li><a href="vprogress.html">Vertical progress bar</a></li>
+ </ul>
+ </div>
+
+ <div style="float: left; width: 435px">
+ <h4>Features</h4>
+ <ul>
+ <li><a href="setconfig.html">The RGraph.SetConfig() function</a></li>
+ <li><a href="keys.html">Examples of keys</a></li>
+ <li><a href="dynamic.html">Updating your graphs dynamically</a></li>
+ <li><a href="png.html">Retrieving a PNG of your graph</a></li>
+ <li><a href="domcontentloaded.html">DOMContentLoaded example</a></li>
+ <li><a href="events.html">Custom RGraph events</a></li>
+ <li><a href="adjusting.html">Adjusting your graphs interactively</a></li>
+ <li><a href="tooltips.html">Using tooltips</a></li>
+ <li><a href="resizing.html">Resizing your graphs</a></li>
+ <li><a href="msie.html">Microsoft Internet Explorer support</a></li>
+ <li><a href="async.html">Asynchronous processing</a></li>
+ <li><a href="zoom.html">Zooming your graphs</a></li>
+ <li><a href="annotating.html">Annotating your graphs</a></li>
+ <li><a href="combine.html">Combining charts</a></li>
+ <li><a href="external.html">Integrating RGraph with external libraries (ModalDialog)</a></li>
+ <li><a href="animation.html">Animating your graphs</a></li>
+ <li><a href="css.html">Available CSS classes</a></li>
+ <li><a href="color.html">About canvas color definitions</a></li>
+ <li><a href="context.html">Context menus</a></li>
+ <li><a href="misc.html">Miscellaneous documentation</a></li>
+ <li><a href="issues.html">Common issues</a></li>
+ <li><a href="api.html">API Documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="float: left; width: 338px">
+ <h4>Miscellaneous</h4>
+ <ul>
+ <li><a href="licensing.html"><b>Licensing FAQs</b></a></li>
+ <li><a href=".CHANGELOG.txt">The changelog</a></li>
+ <li><a href=".BC.txt">Backwards compatibility breaks</a></li>
+ </ul>
+
+ <h4>On this page:</h4>
+
+ <ul>
+ <li><a href="#benefits" title="Benefits of HTML5 canvas graphs">Benefits of HTML5 canvas graphs</a></li>
+ <li><a href="#browser" title="Information about browser support">Browser support</a></li>
+ <li><a href="#performance" title="Things you may want to look at concerning performance">Improving the performance of your graphs</a></li>
+ <li><a href="#implementation" title="Implementing RGraph on your website">Implementing RGraph</a></li>
+ <li><a href="#structure" title="Suggested structure for RGraph">Suggested structure for RGraph</a></li>
+ <li>
+ <a href="#integration" title="Information on integrating RGraph with server side scripting">Integration with server side scripting</a>
+ <ul>
+ <li><a href="#mysql" title="Integration with PHP & MySQL">Integration with PHP & MySQL</a></li>
+ <li><a href="#ajax" title="Making AJAX requests">Making AJAX requests</a></li>
+ </ul>
+ </li>
+ <li><a href="#support" title="Need support? Get it here">Support forum</a></li>
+ </ul>
+ </div>
+
+
+
+<!------------------------------------------------------------------------------------------------------------------------>
+
+
+
+ <br clear="all" />
+ <hr />
+
+
+
+ <a name="benefits"></a>
+ <br /> <br /> <br />
+ <h2>Benefits of HTML5 canvas graphs</h2>
+
+ <p>
+ HTML5 introduces a new HTML element - the CANVAS tag. This tag allows for two dimensional drawing easily using Javascript.
+ This makes it perfect for producing graphs. Because Javascript runs on your users computer, none of the stress on your server
+ normally associated with producing graphs is incurred. Not only that but because
+ of the greater processing power that is typically available on users' computers, they will be much faster. And,
+ because the code can be both compressed (for example if you're using Apache, mod_gzip will do this automatically for you) and
+ cached, bandwidth usage can be massively reduced. This makes it economically attractive to employ, (ie <b>it can save you
+ money...</b>).
+ </p>
+
+ <p>
+ Imagine, you are creating 100,000 graphs a day and the data is such that the resulting graphs cannot be cached. With the RGraph
+ library you can reduce that figure to zero. All the processing and graph creation is done by each individual client, much like
+ rendering the HTML you send to them. So you don't have to send any images, you simply send them the Javascript libraries once.
+ So, much lower bandwidth bills and far less strain on your webserver.
+ </p>
+
+ <p>
+ And if that wasn't enough, because the graphs are created using Javascript, they will work offline if you view a .html page
+ on your own PC. Download the archive and see! Useful if you need to do a presentation for example and want to use the same
+ graph(s) as your website.
+ </p>
+
+ <div>
+ <div style="width: 45%; background-color: #fff; display: inline; display: inline-block">
+ <ul>
+ <li>Cross browser support.</li>
+ <li>17 Different base graph types (<a href="../examples/index.html">Examples</a>).</li>
+ <li>Graphs work on and off-line.</li>
+ <li>Interactive features.</li>
+ </ul>
+ </div>
+
+ <div style="width: 45%; display: inline; display: inline-block">
+ <ul>
+ <li>Graphs are created on the client - no server overhead.</li>
+ <li>Very easy setup (see <a href="#implementation">Implementing RGraph</a>).</li>
+ <li>Fully documented.</a></li>
+ <li>Very easy to learn.</li>
+ </ul>
+ </div>
+ </div>
+
+
+ <a name="browser"></a>
+ <br /> <br /> <br />
+ <h2>Browser support</h2>
+
+ <p>
+ Since the graphs are produced using HTML5 features (the new <b>canvas</b> tag), client support is currently:
+ </p>
+
+ <ul>
+ <li>Mozilla Firefox 3.0+</li>
+ <li>Google Chrome 1+</li>
+ <li>Apple Safari 3+</li>
+ <li>Opera 9.5+</li>
+ <li>Microsoft Internet Explorer 8+ (see note)</li>
+ <li>iPhone (text support from iOS v4+)</li>
+ <li>iPad (text support from iOS v4.2+)</li>
+ </ul>
+
+ <p>
+ The HTML5 canvas tag is part of the <a href="http://www.w3.org/html/wg/html5/" target="_blank">HTML5 specification</a>,
+ and all of the above browsers have some sort of support for it.
+ </p>
+
+ <p>
+ <b>Canvas & Microsoft Internet Explorer (MSIE)</b><br />
+ Microsoft Internet Explorer 8 doesn't natively support the HTML5 <canvas> tag. To support
+ MSIE 8 you will need to use either
+ <a href="http://code.google.com/chrome/chromeframe/" target="_blank">Google Chrome Frame</a> or
+ <a href="http://code.google.com/p/explorercanvas/" target="_blank">ExCanvas from Google</a>
+ (which is included in the RGraph archive). Read more about Internet Explorer compatibility
+ <a href="msie.html">here</a>.
+
+ <p />
+
+ <span style="color: #090">
+ Starting with preview 3 <b style="color: black">Microsoft Internet Explorer 9</b> has full support for <canvas>. You can view some screenshots
+ <a href="http://groups.google.com/group/rgraph/browse_thread/thread/c5651ff8c56b8f3c#" target="_blank">here</a>.
+ MSIE 6 and 7 are supported by way of Google Chrome Frame.
+ </span>
+ </p>
+
+ <p>
+ <b>RGraph and older browsers</b><br />
+ Older browsers (eg Chrome 1, Firefox 3, Safari 3, Opera 9.5) are supported, however if they don't support the canvas shadow or
+ text APIs, these will naturally be unavailable. Earlier versions of these browsers may work, but are untested.
+ </p>
+
+ <a name="performance"></a>
+ <br /> <br /> <br />
+ <h2>Improving the performance of your graphs</h2>
+
+ <p>
+ Although performance is excellent, (traditionally your webserver has been
+ producing all of your graphs, and now the client produces them, and typically only one at a time), you may still want to tune
+ RGraph further. The biggest thing you can do is use compression, which reduces the initial download time of the libraries, but
+ there are a number of things you can do:
+ </p>
+
+ <ul>
+ <li>
+ <b>Compression</b><br />HTTP compression can dramatically reduce your bandwidth bills and increase the speed
+ of your website. The RGraph.common.core.js file for example used to be over 100k, but with compression this was reduced
+ to around 17k. Less than a fifth of the original size! <span style="color: red">If you do only one thing to aid performance,
+ then it should be this.</span>
+
+ <p>
+ To achieve this with Apache you have a few options:
+ </p>
+
+ <ul style="list-style-type: disc">
+ <li>You can use the Apache module mod_gzip which compresses the libraries on the fly.</li>
+ <li>
+ You can compress the libraries manually using the gzip command, rename them to remove the .gz suffix
+ and add the header using an Apache directive
+ (eg <span style="background-color: #C5FFC5; padding: 1px">AddEncoding gzip .js</span>). If you have some sort of
+ release process/script, it would make sense to add this to it to automate the procedure.
+ </li>
+ </ul>
+ <p>
+ </li>
+
+ <li>
+ <b>Minification</b><br />
+ Minification reduces the size of the library before compression takes effect, removing unnecessary spaces and comments etc.
+ A combination of minification and compression will give superb results. For example, before being split up into seperate files,
+ minification combined with compression reduced the common library from over 100k to roughly 10k (!). There is a PHP shell
+ script that you can use to minify the libraries in the scripts directory.
+
+ <p>
+ You can get pre-minified versions of the libraries <a href="http://www.rgraph.net/RGraph.minified.zip">here</a>.
+ </p>
+ </li>
+
+ <p>
+
+ <li>
+ <b>Pre-emptive caching</b><br />
+ Slightly different to caching itself, is pre-emptive caching. This involves downloading the libraries before the page that requires
+ them is shown. This way, they're already in the users browser cache and the graph will subsequently appear to be much much
+ quicker. An example of this would be having the library included at the bottom of your index page of your website (optionally
+ with the <b>defer="defer"</b> attribute). The script can be downloaded at will because the page doesn't actually use it, but
+ for subsequent pages it will already be in the users browser cache.
+
+ <p>
+ </li>
+
+ <li>
+ <b>Caching</b><br />
+ Since the libraries you're using won't change that often, you can set distant Expires: headers on them, or appropriate
+ Cache-Control: headers, and the client will not even have to contact your server for it. When you want to make sure
+ the library is re-downloaded (eg. you update the library), then simply change the filename.
+
+ <p>
+ </li>
+
+ <li>
+ <b>Script tag placement</b><br />
+ According to <a href="http://developer.yahoo.com/performance/" target="_blank">Yahoo! guidelines</a> placing the <SCRIPT>
+ tag at the bottom of the page can increase the percieved load time. If you do this, then your graphs should be
+ created in the window.onload event, otherwise the browser may try to create them without the library
+ having been loaded, and will therefore subsequently fail.
+
+ <p>
+
+ You should also consider the effect that this has when your page is rather weighty. If the page is weighty there
+ will be a small delay before the onload event fires, and therefore creates the graph. This might not be so bad if the
+ graph is not immediately visible, however if it is then you should carefully consider using the onload event. You
+ may wish to load the library in the page header, define the canvas tag and then immediately define the javascript that creates the graph. This way
+ the graph will be created and shown, and then the rest of the page loads. The end result is that your graph
+ appears to be faster.
+
+ <p />
+
+ Between the onload event, asychronous Javascript and careful tag placement, you will need to experiment to get the right result
+ for you.
+ </li>
+
+ <li>
+ <b>Document structure</b><br />
+ The structure of your document can have a significant impact on how fast your graphs are displayed. If, for example, you use
+ tables for layout, this can delay the display of elements that are affected by the size of the table. Where possible, you
+ should consider trying to convert your layout to DIVs. An example of this is the front page of this website. The graphs
+ were right aligned using a table as a container. This caused a visible delay when showing them. In this case it was a
+ simple matter to convert the page to use DIVs, and the page subsequently displays much faster.
+ <p />
+ </li>
+
+ <li>
+ <b>Creating your graphs asynchronously</b><br />
+ Where possible, you may wish to create your graphs asynchronously. This allows the browser to continue rendering the page
+ immediately after getting to the code that creates the graph. This might not be perceptible if you don't have a lot of
+ graphs, or your page is small. You can read a little more about this and see example code <a href="async.html">here</a>.
+
+ <p />
+
+ Note that recent releases of Google Chrome (from a dev release of version 4) have had an issue with creating graphs
+ asynchronously, which presents itself by not drawing text sometimes (it's not consistent). Simply not using
+ asynchronous graph production in this case resolves the issue.
+ </li>
+
+ <li>
+ <b>DOMContentLoaded event</b><br />
+ Using this event can speed up the display of your graphs signifcantly compared to the more well known <i>onload</i> event.
+ It is supported by Chrome, Gecko based browsers (ie Firefox), Safari, Opera and Internet Explorer 9. This event fires when
+ the structure of the page is loaded, but not necessarily the images or CSS. This means that if your page is laden with
+ images, this event will fire before the onload event, thus creating your graphs quicker. The effect can be very noticeable.
+
+ <pre class="code">
+function addListener(func)
+{
+ if(window.addEventListener) {
+ window.addEventListener('DOMContentLoaded', func, false);
+ } else {
+ document.attachEvent("onDOMContentLoaded", func);
+ }
+}
+</pre>
+ You can read more about the <i>DOMContentLoaded</i> event on the Mozilla site, <a href="https://developer.mozilla.org/en/Gecko-Specific_DOM_Events" target="_blank">here</a>,
+ and the Microsoft site <a href="http://ie.microsoft.com/testdrive/HTML5/87DOMContent-Loaded/Default.html" target="_blank">here</a>.
+ There's an example <a href="domcontentloaded.html">here</a>.
+ <p />
+ </li>
+
+ <li>
+ <b>AJAX requests</b><br />
+ If you can take advantage of AJAX, you can use this method to retrieve data from your server. If, for example, you have a graph that
+ shows ongoing information, instead of simply refreshing the entire page, you could use an AJAX request to just retrieve the
+ data that you want and update the graph that way. This reduces the amount of data needed to be transferred, thus reducing the
+ bandwidth used, and will be quicker than a full page refresh, particularly if your page is weighty. There's a simple AJAX
+ function that you can use <a href="#ajax">below</a>.
+ <p />
+ </li>
+
+ <li>
+ <b>Combining libraries</b><br />
+ If your performance requirements are extreme, then you may wish to consider combining the libraries into a single file.
+ This won't save on the size of the individual libraries, but will save on the headers that are sent as part of the response.
+ If a typical response sends 500 bytes worth of headers, and you send four graph libraries, then combining the libraries
+ would save 1500 bytes. Multiple factors need to be considered though, including things like caching, which can circumvent
+ the unneccessary repeated downloading of the libraries.
+
+ <p>
+ Another effect of combining libraries is reducing the amount of HTTP connections needed to retrieve them. Most browsers
+ have a limit on how many connections they can create simultaneously, so if they're not being used to retrieve your
+ graph libraries, they can be used for something else. Reducing the number of HTTP connections also eliminates the time
+ spent setting up those connections.
+ </p>
+ </li>
+ </ul>
+
+ <b>A reasonable performance strategy</b>
+
+ <p>
+ Although there's a lot you can do in regards to performance, a few of the points here will suffice for most
+ websites:
+
+ <ul>
+ <li>Compression</li>
+ <li>Minification</li>
+ <li>Pre-emptive caching</li>
+ <li>Caching</li>
+ </ul>
+
+ The number one thing you should do is compress your libraries. This has multiple benefits and provides by far the most gain,
+ effectively for free. Secondly, use the minified libraries. Since you can download them <a href="../RGraph.minified.zip">here</a>,
+ you might as well use them. Then we have pre-emptive caching. Since most websites won't show graphs on the front page or will
+ have a login page that is shown before any graphs, this effectively eliminates the graph library download. And lastly caching
+ should be done as a matter of course. There's no reason to keep downloading the same library so even caching for only 30 minutes
+ (or the duration of an average visit to your website) will produce results.
+ </p>
+
+ <p>
+
+ </p>
+
+ <a name="implementation"></a>
+ <br /> <br /> <br />
+ <h2>Implementing RGraph</h2>
+
+ <p>
+ Getting RGraph up and running is very easy and consists of three steps. If you're having trouble I suggest you get hold of a copy of
+ <a href="http://www.mozilla.com" target="_blank">Firefox</a> along with <a href="http://www.getfirebug.com" target="_blank">Firebug</a> - its
+ Javascript error console will make debugging your issue much easier. Many problems are down to a library not having been included or
+ not using the onload event when you need to. You might also benefit from using the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer toolbar</a>
+ for Firefox. This allows you to easily disable caching, thus eliminating any problems that that causes. You could equally use
+ the Chrome developer tools (CTRL+SHIFT+J), optionally in docked mode, which also provides a good quality Javascript console.
+ </p>
+
+ <ol>
+ <li>
+ Include the libraries (put this in your documents <HEAD>):
+<pre class="code">
+<script src="RGraph.common.core.js"></script>
+
+<script src="RGraph.common.adjusting.js"></script> <!-- Just needed for adjusting -->
+<script src="RGraph.common.annotate.js"></script> <!-- Just needed for annotating -->
+<script src="RGraph.common.context.js"></script> <!-- Just needed for context menus -->
+<script src="RGraph.common.resizing.js"></script> <!-- Just needed for resizing -->
+<script src="RGraph.common.tooltips.js"></script> <!-- Just needed for tooltips -->
+<script src="RGraph.common.zoom.js"></script> <!-- Just needed for zoom -->
+
+<script src="RGraph.bar.js"></script> <!-- Just needed for bar graphs -->
+<script src="RGraph.bipolar.js"></script> <!-- Just needed for bi-polar graphs -->
+<script src="RGraph.funnel.js"></script> <!-- Just needed for funnel charts -->
+<script src="RGraph.gantt.js"></script> <!-- Just needed for gantt charts -->
+<script src="RGraph.hbar.js"></script> <!-- Just needed for horizontal bar charts -->
+<script src="RGraph.hprogress.js"></script> <!-- Just needed for horizontal progress bars -->
+<script src="RGraph.led.js"></script> <!-- Just needed for LED charts -->
+<script src="RGraph.line.js"></script> <!-- Just needed for line graphs -->
+<script src="RGraph.meter.js"></script> <!-- Just needed for meter charts -->
+<script src="RGraph.odo.js"></script> <!-- Just needed for odometers -->
+<script src="RGraph.pie.js"></script> <!-- Just needed for pie AND donut charts -->
+<script src="RGraph.rose.js"></script> <!-- Just needed for rose charts -->
+<script src="RGraph.rscatter.js"></script> <!-- Just needed for rscatter charts -->
+<script src="RGraph.scatter.js"></script> <!-- Just needed for scatter graphs -->
+<script src="RGraph.tradar.js"></script> <!-- Just needed for traditional radar charts -->
+<script src="RGraph.vprogress.js"></script> <!-- Just needed for vertical progress bars -->
+</pre>
+ </li>
+
+ <li>
+ Add the canvas tag (put it where you want the graph to appear):
+<pre class="code">
+<canvas id="myCanvas" width="600" height="250">[No canvas support]</canvas>
+</pre>
+ </li>
+
+ <li>
+ Create the graph (since it is using the onload event, you can put this anywhere):
+
+<pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [280, 45, 133, 166, 84, 259, 266, 960, 219, 311, 67, 89];
+
+ var bar = new RGraph.Bar('myCanvas', data);
+ bar.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ bar.Set('chart.gutter', 35);
+ bar.Draw();
+ }
+</script>
+</pre>
+ </li>
+ </ol>
+
+ <p>
+ There's also a very <a href="../examples/basic.html">basic example</a> of using RGraph, that does very little. It can be helpful to
+ illustrate how you can get RGraph up and running.
+ </p>
+
+ <h4>Common library split (17th April 2010)</h4>
+ <p>
+ The common library has now been split into separate files. This was because the single common library had become far too large.
+ If you don't use any of the dynamic features, then you still need to change your code, as <i>RGraph.common.js</i> is now
+ called <i>RGraph.common.core.js</i>.
+ </p>
+
+ <a name="structure"></a>
+ <br /> <br /> <br />
+ <h2>Suggested structure for RGraph</h2>
+
+ <img src="../images/structure.png" width="175" height="205" alt="Suggested structure for RGraph" style="float: right" />
+
+ <p>
+ The suggested layout structure for the RGraph libraries is shown on the right. The <b>www.example.com</b> folder represents
+ the root/top level of your website with the <b>javascript</b> directory beneath that. The <b>css</b> and <b>images</b>
+ folders are shown for
+ illustrative purposes only. If you follow this layout then your URLs to the RGraph libraries would be:
+ </p>
+
+ <p>
+ <b>/javascript/rgraph/RGraph.common.core.js</b><br />
+ <b>/javascript/rgraph/RGraph.bar.js</b><br />
+ etc
+ </p>
+
+ <p>
+ By using this structure you make RGraph easy to update should you need to, and also keep all the RGraph libraries in
+ one, easy to find, place.
+ </p>
+
+ <br clear="all" />
+
+ <a name="integration"></a>
+ <br /> <br /> <br />
+ <h2>Integration with server side scripting</h2>
+
+ <p>
+ This is a very easy process, as easy as sending content to the browser. All you need to do is make the <i>data</i> variable
+ (as in the example below) contain the data you want to be displayed. Eg:
+ </p>
+
+ <pre class="code">
+<script src="RGraph.common.core.js"></script>
+<script src="RGraph.line.js"></script>
+
+<canvas id="myCanvasTag" width="600" height="200">[No canvas support]</canvas>
+
+<script>
+ data = [78,16,26,23,25,51,34,64,84,84];
+
+ line = new RGraph.Line("myCanvasTag", data);
+ line.Set("chart.labels", ["Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov"]);
+ line.Draw();
+</script>
+</pre>
+
+ <p>
+ To get the above using PHP you could do this:
+ </p>
+
+ <pre class="code"><?php
+ // This simply makes a string out of the array of data
+ $myData = join(',', array(78,16,26,23,25,51,34,64,84,84));
+
+ // This prints out the required HTML markup
+ print('<script src="RGraph.common.core.js"></script>' . "\n");
+ print('<script src="RGraph.line.js"></script>' . "\n\n");
+ print('<canvas id="myCanvasTag" width="600" height="200">[No canvas support]</canvas>' . "\n\n");
+ print('<script>' . "\n");
+ print(' var data = [' . $myData . '];' . "\n\n");
+ print(' var line = new RGraph.Line("myCanvasTag", data);' . "\n");
+ print(' line.Set("chart.labels", ["Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov"]);' . "\n");
+ print(' line.Draw();' . "\n");
+ print('</script>');
+?>
+</pre>
+
+ <p>
+ Strictly speaking the <span style="font-family: Monospace">var</span> isn't necessary, however if you put the code inside a
+ function (like window.onload), it's probably best to do so as using <span style="font-family: Monospace">var</span> will
+ make the variable local, and not global. So doing so will help prevent naming clashes.
+ </p>
+
+
+ <a name="mysql"></a>
+ <br /> <br /> <br />
+ <h4>Integration with PHP & MySQL</h4>
+
+ <p>
+ This is a simple matter of formatting what you get back from MySQL into a string, as the MySQL dump and PHP code
+ below shows (it's based on a database called RGraph_example):
+ </p>
+
+ <pre class="code">
+#
+# Table structure for table `daily_statistics`
+#
+
+CREATE TABLE `daily_statistics` (
+ `st_day` char(9) NOT NULL,
+ `st_statistics` tinyint(4) NOT NULL,
+ UNIQUE KEY `st_day` (`st_day`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+#
+# Dumping data for table `daily_statistics`
+#
+
+INSERT INTO `daily_statistics` VALUES ('Mon', 124);
+INSERT INTO `daily_statistics` VALUES ('Tue', 95);
+INSERT INTO `daily_statistics` VALUES ('Wed', 64);
+INSERT INTO `daily_statistics` VALUES ('Thu', 94);
+INSERT INTO `daily_statistics` VALUES ('Fri', 75);
+INSERT INTO `daily_statistics` VALUES ('Sat', 98);
+INSERT INTO `daily_statistics` VALUES ('Sun', 84);
+</pre>
+
+ <pre class="code">
+<?php
+ /**
+ * Change these to your own credentials
+ */
+ $hostname = "localhost";
+ $username = "root";
+ $password = "PASSWORD";
+ $database = "RGraph_example";
+
+ $connection = mysql_connect($hostname, $username, $password) OR die('Could not connect to MySQL: ' . mysql_error());
+ mysql_select_db($database);
+
+ $result = mysql_query("SELECT st_day, st_statistics FROM daily_statistics");
+ if ($result) {
+
+ $labels = array();
+ $data = array();
+
+ while ($row = mysql_fetch_assoc($result)) {
+ $labels[] = $row["st_day"];
+ $data[] = $row["st_statistics"];
+ }
+
+ // Now you can aggregate all the data into one string
+ $data_string = "[" . join(", ", $data) . "]";
+ $labels_string = "['" . join("', '", $labels) . "']";
+ } else {
+ print('MySQL query failed with error: ' . mysql_error());
+ }
+?>
+<html>
+<head>
+
+ <!-- Don't forget to update these paths -->
+
+ <script src="libraries/RGraph.common.core.js" ></script>
+ <script src="libraries/RGraph.line.js" ></script>
+
+</head>
+<body>
+
+ <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+ <script>
+ graph = new RGraph.Line('cvs', <?php print($data_string) ?>);
+ graph.Set('chart.background.grid.autofit', true);
+ graph.Set('chart.gutter', 17);
+ graph.Set('chart.hmargin', 10);
+ graph.Set('chart.tickmarks', 'endcircle');
+ graph.Set('chart.labels', <?php print($labels_string) ?>);
+
+ graph.context.translate(12, 0);
+
+ graph.Draw();
+ </script>
+
+</body>
+</html>
+</pre>
+
+ <p>
+ This PHP code provides the data in two strings - <i>$labels_string</i> and <i>$data_string</i>. These variables are then used
+ in the RGraph code to provide the data and the labels.
+ </p>
+
+ <p><b>Remember:</b></p>
+
+ <ul>
+ <li>Change the database hostname/username/password/database to match your own.</li>
+ <li>Ensure you have the correct paths to the RGraph libraries.</li>
+ </ul>
+
+ <a name="ajax"></a>
+ <br /> <br /> <br />
+ <h4>Making AJAX requests</h4>
+
+ <p style="background-color: #ffa; padding: 3px; border: 1px dashed black">
+ <b>Note:</b>
+ It is important that you're careful with types when making AJAX requests. Since the response is initially a string,
+ and your AJAX function/library may not do conversions for you, you may need to convert these strings to numbers. To
+ do this you can use the <i>Number()</i> or <i>parseInt()</i> functions. For example:
+ </p>
+
+ <pre class="code">
+<script>
+ num = Number('23');
+ num = parseInt('43');
+</script>
+</pre>
+
+ <p>
+ Here is a simple function that you could use to get data from your server using AJAX:
+ </p>
+
+ <pre class="code">
+<script>
+ /**
+ * Makes an AJAX call. It calls the given callback (a function) when ready
+ *
+ * @param string url The URL to retrieve
+ * @param function callback A function object that is called when the response is ready, there's an example below
+ * called "myCallback".
+ */
+ function AjaxCall (url, callback)
+ {
+ // Mozilla, Safari, ...
+ if (window.XMLHttpRequest) {
+ var httpRequest = new XMLHttpRequest();
+
+ // MSIE
+ } else if (window.ActiveXObject) {
+ var httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ httpRequest.onreadystatechange = callback;
+
+ httpRequest.open('GET', url, true);
+ httpRequest.send();
+ }
+
+
+ /**
+ * This sample callback function is called when the data is ready (readyState=4)
+ */
+ function myCallback ()
+ {
+ if (this.readyState == 4 && this.status == 200) {
+ // Everything is good, the response is received
+ alert(this.responseText);
+ }
+ }
+</script>
+</pre>
+
+ <p>And you would use it like this:</p>
+
+ <pre class="code">
+<script>
+ AjaxCall('http://www.example.com/getSomething.php', myCallback);
+</script>
+</pre>
+
+ <p>
+ There's an example <a href="dynamic.html">here</a> that shows updating your graph dynamically.
+ </p>
+
+
+ <a name="support"></a>
+ <br /> <br /> <br />
+ <h2>Support forum</h2>
+
+ <!-- Google Groups code -->
+ <table border="0" style="float: right; background-color: #eee; border: 2px dashed gray; padding: 5px" cellspacing=0>
+ <tr>
+ <td>
+ <img src="../images/googlegroups.png" height="26" width="132" alt="Google Groups" />
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left: 5px">
+ <b>Subscribe to RGraph support</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left: 5px;">
+ <form action="http://groups.google.com/group/rgraph/boxsubscribe" method="get">
+ Email: <input type=text name=email>
+ <input type=submit name="sub" value="Subscribe">
+ </form>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">
+ <a href="http://groups.google.com/group/rgraph/topics?gvc=2" target="_blank">Visit this group</a>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <a href="http://groups.google.com/group/rgraph/feed/rss_v2_0_msgs.xml" target="_blank"><img src="../images/rss.png" alt="RSS Feed" width="39" height="23" /></a>
+ <a href="http://groups.google.com/group/rgraph/feed/atom_v1_0_msgs.xml" target="_blank"><img src="../images/atom.png" alt="Atom XML Feed" width="45" height="23" /></a>
+ </td>
+ </tr>
+ </table>
+ <!-- End of Google Groups code -->
+
+ <p>
+ Support is available via a Google Groups forum. If you think that the issue you have is common, try the <a href="issues.html">issues</a>
+ page first, and then try searching the forum in case your question has been answered previously. If that all yields nothing,
+ post a question to the forum.
+ </p>
+
+ <p>
+ If you want to keep up-to-date on RGraph, then subscribe to the group, as I post update notifications here. You can also follow me on
+ <a href="http://twitter.com/_rgraph"><b>Twitter</b></a>. I post update notifications here along with HTML5 related news.
+ </p>
+
+ <br />
+ <br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - In-graph labels</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs ingraph in-graph" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about in-graph labels" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ In-graph labels
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - In-graph labels</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <br />
+
+ <p>
+ This page shows the various options for in-graph labels. The in-graph labels can be set like this:
+ </p>
+
+ <pre class="code">obj.Set('chart.labels.ingraph', [,,'Hoolio',,'Olga']);</pre>
+
+ <p>
+ Or like this if you want to be more specific:
+ </p>
+
+ <pre class="code">obj.Set('chart.labels.ingraph', [,,<span style="color: green">['Hoolio', 'red', 'yellow', -1, 60]</span>,,'Olga']);</pre>
+
+ <p>
+ The array can consist of:
+ </p>
+
+ <ul>
+ <li>The label text</li>
+ <li>The text color</li>
+ <li>The background color</li>
+ <li>This can be 1 or -1 and denotes whether the label should be above or below the line. This has no effect in Bar charts</li>
+ <li>The length of the label pointer/arrow</li>
+ </ul>
+
+ <h4>Example line chart</h4>
+
+ <canvas id="line" width="600" height="250">[No canvas support]</canvas>
+ <script>
+ myGraph = new RGraph.Line('line', [4,5,6,3,2,5,6,4,2,4,1]);
+ myGraph.Set('chart.title', 'Line chart with in-graph labels');
+ myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']);
+ myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']);
+ myGraph.Draw();
+ </script>
+
+ <h4>Example bar chart</h4>
+
+ <canvas id="bar" width="600" height="250">[No canvas support]</canvas>
+ <script>
+ myGraph = new RGraph.Bar('bar', [4,5,6,3,2,5,6,4,2,4,1]);
+ myGraph.Set('chart.colors', ['#fcc']);
+ myGraph.Set('chart.title', 'Bar chart with in-graph labels');
+ myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']);
+ myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']);
+ myGraph.Draw();
+ </script>
+
+ <h4>Example bar chart (arrow variant)</h4>
+
+ <canvas id="bar1" width="600" height="250">[No canvas support]</canvas>
+ <script>
+ myGraph = new RGraph.Bar('bar1', [4,5,6,3,2,5,6,4,2,4,1]);
+ myGraph.Set('chart.colors', ['#fcc']);
+ myGraph.Set('chart.title', 'Bar chart with in-graph labels (arrow variant)');
+ myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']);
+ myGraph.Set('chart.variant', 'arrow');
+ myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']);
+ myGraph.Draw();
+ </script>
+
+
+ <h4>Example bar chart (dot variant)</h4>
+ <canvas id="bar2" width="600" height="250">[No canvas support]</canvas>
+ <script>
+ myGraph = new RGraph.Bar('bar2', [4,5,6,3,2,5,6,4,2,4,1]);
+ myGraph.Set('chart.colors', ['#fcc']);
+ myGraph.Set('chart.title', 'Bar chart with in-graph labels (dot variant)');
+ myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']);
+ myGraph.Set('chart.labels.ingraph', [6,['Foo', 'red', 'yellow', null, 75],3,'Bar']);
+ myGraph.Set('chart.variant', 'dot');
+ myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']);
+ myGraph.Draw();
+ </script>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Common issues</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs common issues" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about common issues" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Common issues
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Common issues</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <!-- Google Groups code -->
+ <table border="0" style="float: right; background-color: #eee; border: 2px dashed gray; padding: 5px" cellspacing=0>
+ <tr>
+ <td>
+ <img src="../images/googlegroups.png" height="26" width="132" alt="Google Groups" />
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left: 5px">
+ <b>Subscribe to RGraph support</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left: 5px;">
+ <form action="http://groups.google.com/group/rgraph/boxsubscribe" method="get">
+ Email: <input type=text name=email>
+ <input type=submit name="sub" value="Subscribe">
+ </form>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">
+ <a href="http://groups.google.com/group/rgraph/topics?gvc=2" target="_blank">Visit this group</a>
+ </td>
+ </tr>
+ </table>
+ <!-- End of Google Groups code -->
+
+ <p>
+ These are some common issues that you should be aware of. If you're having trouble, you may want to look through these to see
+ if any apply to you or may be the source of your problem.
+ </p>
+
+ <a name="tooltips"></a>
+ <h4>Tooltips not working as of the October 2010 release</h4>
+
+ <p>
+ If you're specifying numbers instead of strings for your tooltips, they will not work any more. Simply cast them to
+ strings, like this:
+ </p>
+
+ <pre class="code">
+<span style="color: red">
+// This WILL NOT work any more
+myBar.Set('chart.tooltips', [56, 67, 53]);
+</span>
+<span style="color: green">
+// Do any of these instead
+myBar.Set('chart.tooltips', ['56', (67).toString(), String(53)]);</span>
+</pre>
+
+ <a name="annotations"></a>
+ <h4>Annotations aren't saved when running locally in Mozilla Firefox</h4>
+
+ <p>
+ The solution here is to run the graphs using a web server. At this time (March 2010) only Safari, Chrome and Opera
+ support saving annotations when running locally.
+ </p>
+
+ <a name="missing.text"></a>
+ <h4>Missing text in Google Chrome</h4>
+
+ <p>
+ Since one of the Chrome 4 dev releases there has been an issue with Google Chrome 4 and 5, asynchronous processing and not rendering
+ graph labels. This has been remedied by simply not using asynchronous processing. Because of the tag placement on the front page,
+ the effect shouldn't be apparent. Other browsers (eg Firefox, Safari, Opera, MSIE) are fine.
+ </p>
+
+ <a name="firefox.tooltips.clipboard"></a>
+ <h4>Firefox, tooltips and the clipboard</h4>
+
+ <p>
+ Firefox, tooltips and using the clipboard is a little convoluted. To copy the text in a tooltip you must do the following:
+ </p>
+
+ <ol>
+ <li style="margin-top: 0">Select the text you want with the mouse.</li>
+ <li style="margin-top: 0">Press CTRL+C (it may be a different key combination if you're not using Windows) to copy the text to the clipboard.</li>
+ </ol>
+
+ <p>
+ <b>Note:</b> Recent versions of Firefox 4 (from beta 6 onwards) appear to work as expected, and you can copy text with the mouse as normal.
+ </p>
+
+ <h4>Shadows in Google Chrome and the line chart</h4>
+
+ <p>
+ Shadows in recent versions of Google Chrome are somewhat broken. Firefox, MSIE, Opera and Safari are fine. The reason for this
+ error is a combination of factors it seems - shadow blurring and line width. Fixes have been added to allow shadow blurring and
+ a 1 pixel linewidth, though some graph types may still be affected.
+ </p>
+
+<!--
+
+ <p>
+ <b></b><br />
+ </p>
+-->
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Examples of keys</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="../libraries/RGraph.pie.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var pie = new RGraph.Pie('myPie', [45,43,23,68,84,41]);
+ pie.Set('chart.title', 'A pie chart showing graph mode');
+ pie.Set('chart.key', ['John','Fred','Lou','Pete','Kevin','Gary']);
+ pie.Set('chart.key.rounded', false);
+
+ pie.Set('chart.key.shadow', true);
+ pie.Set('chart.key.shadow.offsetx', 3);
+ pie.Set('chart.key.shadow.offsety', 3);
+ pie.Set('chart.key.shadow.blur', 0);
+ pie.Set('chart.key.shadow.color', '#aaa');
+
+ pie.Draw();
+
+ 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]);
+ line.Set('chart.key', ['Richard', 'Fred']);
+ line.Set('chart.title', 'A line chart showing the key in gutter mode');
+ line.Set('chart.key.position', 'gutter');
+ line.Set('chart.key.position.y', line.canvas.height - 45); // 45 pixels from the bottom
+ line.Set('chart.key.shadow', true);
+ line.Set('chart.key.shadow.offsetx', 0);
+ line.Set('chart.key.shadow.offsety', 0);
+ line.Set('chart.key.shadow.blur', 15);
+ line.Set('chart.key.shadow.color', '#ccc');
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.linewidth', 3);
+ line.Set('chart.labels', ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']);
+ line.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Examples of keys
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Examples of keys</h1>
+
+ <div style="float: right; display: inline-block; width: 650px">
+ <canvas id="myLine" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <canvas id="myPie" width="450" height="250" style="float: right">[No canvas support]</canvas>
+ </div>
+
+ <p>
+ As of 4th December 2010 the code that produces the keys has been rewritten. There are two variants of keys available,
+ a horizontal one designed to sit in the gutter, and a vertical one that is designed to sit on top of (ie over) the graph.
+ </p>
+
+ <p>
+ The actual positioning is now configurable though, so you could have a horizontal key and position it to sit on top
+ of the chart.
+ </p>
+
+ <h4>Key properties</h4>
+
+ <p>
+ The available key properties and their defaults are listed below (some graph types have slightly different defaults to
+ suit):
+ </p>
+
+
+ <ul>
+ <li>chart.key (<i>[] (An empty array)</i>)</li>
+ <li>chart.key.position (<i>graph</i>)</li>
+ <li>chart.key.position.gutter.boxed (<i>true</i>)</li>
+ <li>chart.key.position.x (<i>null</i>)</li>
+ <li>chart.key.position.y (<i>null</i>)</li>
+ <li>chart.key.shadow (<i>false</i>)</li>
+ <li>chart.key.shadow.offsetx (<i>2</i>)</li>
+ <li>chart.key.shadow.offsety (<i>2</i>)</li>
+ <li>chart.key.shadow.color (<i>#666</i>)</li>
+ <li>chart.key.shadow.blur (<i>3</i>)</li>
+ <li>chart.key.color.shape (<i>square</i>)</li>
+ <li>chart.key.background (<i>white</i>)</li>
+ <li>chart.key.rounded (<i>true</i>)</li>
+ <li>chart.key.text.size (<i>10</i>)</li>
+ </ul>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - LED Grid documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs LED chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the LED chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ LED Grid
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - LED Grid documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The LED grid can be used to represent simple letters and numbers.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/led.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var led = new RGraph.LED('myCanvas', '456461');
+ led.Set('chart.dark', '#666');
+ led.Set('chart.light', 'rgba(255,255,255,1)');
+ led.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the LED grid apears.
+ </p>
+
+ <ul>
+ <li><a href="#chart configuration">Chart configuration</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="chart configuration"></a>
+<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">Chart configuration</h3> <a name="chart.dark"></a>
+<b>chart.dark</b><br />
+ Color of the darkened (ie unlit) lights<br /><i>Default: #eee</i><br /><br />
+ <a name="chart.light"></a>
+<b>chart.light</b><br />
+ Color of lit lights<br /><i>Default: #f66</i><br /><br />
+ <a name="chart.background"></a>
+<b>chart.background</b><br />
+ The color of the background.<br /><i>Default: white</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Licensing FAQs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph licensing" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about licensing" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body id="licensing">
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Licensing FAQs
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Licensing FAQs</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div style="padding-top: 35px; float: right; margin-right: 50px">
+ <div style="float: right">
+ <form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/456239608328156" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">
+ <input name="item_name_1" type="hidden" value="RGraph and PHPGuru License" />
+ <input name="item_description_1" type="hidden" value="License for RGraph: HTML5 canvas graph library and www.phpguru.org" />
+ <input name="item_quantity_1" type="hidden" value="1" />
+ <input name="item_price_1" type="hidden" value="49.0" />
+ <input name="item_currency_1" type="hidden" value="GBP" />
+ <input name="_charset_" type="hidden" value="utf-8" />
+ <input alt="" width="116" height="61" src="../images/buy.png" type="image" />
+ </form>
+ </div>
+ </div>
+
+ <p>
+ If you have any questions regarding licensing, these are some FAQs that should help answer them.
+ </p>
+
+ <h2>FAQs</h2>
+
+ <ul>
+ <li><a href="#need"><b>Do I need to buy a license?</b></a></li>
+ <li><a href="#howmuch">How much is a license?</a></li>
+ <li><a href="#read">Where can I read the license?</a></li>
+ <li><a href="#cover">What does the license cover?</a></li>
+ <li><a href="#invoice">Can you send me an invoice?</a></li>
+ <li><a href="#paypal">Can I use PayPal?</a></li>
+ </ul>
+
+ <a name="need"></a>
+
+ <ul>
+ <li><a href="#contact">Contact</a></li>
+ <li><a href="#licensetext">License</a></li>
+ </ul>
+
+
+
+ <div class="code">
+ <b>Do I need to buy a license?</b><br /><br />
+ For commercial/business use yes, you need a license to use RGraph. RGraph is not free software.
+ For non-commercial use (eg personal, charity and educational), RGraph is freely usable and you
+ don't need to buy a license though. You can read the license itself
+ <a href="#licensetext">here</a>.
+ </div>
+
+ <a name="howmuch"></a>
+ <p> </p>
+
+
+ <b>How much is a license?</b><br /><br />
+ A license is a one-time fee of <b>£49</b> (UK pounds). That's roughly $70 (US dollars) at
+ the time of writing.
+
+
+ <a name="read"></a>
+ <p> </p>
+
+ <b>Where can I read the license?</b><br /><br />
+ The license is further down this page.
+
+ <br /><br />
+
+ <a name="cover"></a>
+ <p> </p>
+ <b>What does the license cover?</b><br /><br />
+ The RGraph license covers RGraph as a whole. Excepting ExCanvas, all code that you find in the RGraph archive is
+ covered by the RGraph license. The license also covers code that I've written that is available from <a href="http://www.phpguru.org" target="_blank">phpguru.org</a>.
+ This is a mainly
+ PHP focused website, but also plays host to a fair amount of Javascript too. So if your development language of choice is not PHP,
+ you may still find something of use there.<br /><br />
+
+ <br /><br />
+
+ <a name="invoice"></a>
+ <p> </p>
+ <b>Can you send me an invoice?</b><br /><br />
+ Of course, simply go here: <a href="http://www.rgraph.net/invoice.html">http://www.rgraph.net/invoice.html</a>, enter your email
+ address and you'll be sent an invoice that you can use for tax purposes.
+
+ <br /><br />
+
+ <a name="paypal"></a>
+ <p> </p>
+ <b>Can I use PayPal?</b><br /><br />
+ <div style="float: right">
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
+ <input type="hidden" name="cmd" value="_s-xclick">
+ <input type="hidden" name="hosted_button_id" value="JWZ9VN8ZPQZZW">
+ <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
+ <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
+ </form>
+ </div>
+ Yes, you can use PayPal if you prefer. Please use the PayPal button shown here to start the process.
+
+ <br /><br />
+
+
+ <a name="contact"></a>
+ <p> </p>
+ <h2>Contact</h2>
+ <p>
+ If you have a question about RGraph licensing, you can send it to <a href="mailto:licensing@rgraph.net">licensing@rgraph.net</a>
+ or you can order directly using <a href="https://checkout.google.com" onclick="document.getElementById('BB_BuyButtonForm').submit(); return false">Google Checkout</a>.
+ </p>
+
+ <a name="licensetext"></a>
+ <p> </p>
+ <h2>License</h2>
+
+ <p>
+ The license text:
+ </p>
+ <iframe width="100%" height="400" src="../LICENSE.txt"></iframe>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - line chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs line chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Line chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Line chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Line chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The line chart, along with the bar chart, is probably the most configurable of all the charts available.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/line.html">here</a>.
+ </p>
+
+ <ul>
+ <li><a href="#available.properties">Properties</a></li>
+ <li><a href="#available.methods">Methods</a></li>
+ <li><a href="#combining.line.bar">Combining the Line and Bar charts</a></li>
+ <li><a href="#alternative.colors">Alternative colors</a></li>
+ <li><a href="#custom.tickmarks">Custom tickmarks</a></li>
+ </ul>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [10,4,17,50,25,19,20,25,30,29,30,29];
+
+ var line = new RGraph.Line("myLine", data);
+ line.Set('chart.background.barcolor1', 'rgba(255,255,255,1)');
+ line.Set('chart.background.barcolor2', 'rgba(255,255,255,1)');
+ line.Set('chart.background.grid.color', 'rgba(238,238,238,1)');
+ line.Set('chart.colors', ['rgba(255,0,0,1)']);
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.filled', true);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.gutter', 40);
+ line.Draw();
+ }
+</script>
+</pre>
+
+ <a name="available.properties"></a>
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the bar graph apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myLine.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#background">Background</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#margins">Margins</a></li><li><a href="#colors">Colors</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#titles">Titles</a></li><li><a href="#key">Key</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#axis properties">Axis properties</a></li>
+ <li><a href="#zoom">Zoom</a></li><li><a href="#miscellaneous">Miscellaneous</a>
+ </li>
+ </ul>
+
+
+<a name="background"></a>
+<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>
+<b>chart.background.barcolor1</b><br />
+ The color of the background bars (1 of 2).<br /><i>Default: rgba(0,0,0,0)</i><br /><br />
+ <a name="chart.background.barcolor2"></a>
+<b>chart.background.barcolor2</b><br />
+ The color of the background bars (2 of 2).<br /><i>Default: rgba(0,0,0,0)</i><br /><br />
+ <a name="chart.background.grid"></a>
+<b>chart.background.grid</b><br />
+ Whether to show the background grid or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.color"></a>
+<b>chart.background.grid.color</b><br />
+ The color of the background grid.<br /><i>Default: #eee</i><br /><br />
+ <a name="chart.background.hbars"></a>
+<b>chart.background.hbars</b><br />
+ An array of information stipulating horizontal colored bars. You can use these to indicate limits. Eg: <i>myLine.Set('hbars', [[75, 10, 'yellow'], [85, 15, 'red']]);</i> This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the starting point and the height.<br /><i>Default: null</i><br /><br />
+ <a name="chart.background.grid.hsize"></a>
+<b>chart.background.grid.hsize</b><br />
+ The horizontal size of the grid.<br /><i>Default: 25</i><br /><br />
+ <a name="chart.background.grid.vsize"></a>
+<b>chart.background.grid.vsize</b><br />
+ The vertical size of the grid.<br /><i>Default: 25</i><br /><br />
+ <a name="chart.background.grid.width"></a>
+<b>chart.background.grid.width</b><br />
+ The width of the background grid.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.background.grid.border"></a>
+<b>chart.background.grid.border</b><br />
+ Determines whether a border line is drawn around the grid.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.hlines"></a>
+<b>chart.background.grid.hlines</b><br />
+ Determines whether to draw the horizontal grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.vlines"></a>
+<b>chart.background.grid.vlines</b><br />
+ Determines whether to draw the vertical grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.autofit"></a>
+<b>chart.background.grid.autofit</b><br />
+ 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 />
+ <a name="chart.background.grid.autofit.numhlines"></a>
+<b>chart.background.grid.autofit.numhlines</b><br />
+ When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 7</i><br /><br />
+ <a name="chart.background.grid.autofit.numvlines"></a>
+<b>chart.background.grid.autofit.numvlines</b><br />
+ When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
+ <a name="chart.backdrop"></a>
+<b>chart.backdrop</b><br />
+ When enabled this specifies that the line(s) will have a backdrop effect. You can control the transparency with the other backdrop settings).<br /><i>Default: false</i><br /><br />
+ <a name="chart.backdrop.size"></a>
+<b>chart.backdrop.size</b><br />
+ This controls the size/extent of the backdrop effect.<br /><i>Default: 30</i><br /><br />
+ <a name="chart.backdrop.alpha"></a>
+<b>chart.backdrop.alpha</b><br />
+ This controls how much transparency the backdrop effect has. It can go from 0 - 1.<br /><i>Default: 0.2</i><br /><br />
+<a name="labels and text"></a>
+<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.above"></a>
+ <b>chart.labels.above</b><br />
+ Whether the values are shown in labels drawn above the line.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.labels.above.size"></a>
+ <b>chart.labels.above.size</b><br />
+ The size of the labels which are drawn above the line.<br />
+ <i>Default: 8</i><br /><br />
+
+ <a name="chart.labels"></a>
+ <b>chart.labels</b><br />
+ An array of the X labels for the graph. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.labels.ingraph"></a>
+<b>chart.labels.ingraph</b><br />
+ An array of labels for the graph which are drawn "inside" the graph. If you have 5 data points then this should have a corresponding number of elements, though there is a <a href="misc.html#shorthand.ingraph.labels">shorthand available</a>.<br /><i>Default: null</i><br /><br />
+ <a name="chart.ylabels"></a>
+<b>chart.ylabels</b><br />
+ Can be <i>true</i> or <i>false</i> and determines whether the chart has Y axis labels.<br /><i>Default: true</i><br /><br />
+ <a name="chart.ylabels.invert"></a>
+<b>chart.ylabels.invert</b><br />
+ Reverses the Y axis so that 0 is at the top, instead of the bottom.<br /><i>Default: false</i><br /><br />
+ <a name="chart.ylabels.count"></a>
+<b>chart.ylabels.count</b><br />
+ A value (<i>1, 3 or 5</i>) that controls how many Y labels there are. <br /><i>Default: 5</i><br /><br />
+ <a name="chart.ylabels.inside"></a>
+<b>chart.ylabels.inside</b><br />
+ This controls whether the Y labels are drawn inside the Y axis or not. If your labels are large, this may help.<br /><i>Default: false</i><br /><br />
+ <a name="chart.ylabels.inside.color"></a>
+<b>chart.ylabels.inside.color</b><br />
+ If the Y labels are to be drawn inside the Y axis, this is used as the background color.<br /><i>Default: rgba(255,255,255,0.5)</i><br /><br />
+ <a name="chart.xlabels.inside"></a>
+<b>chart.xlabels.inside</b><br />
+ This controls whether the X labels are drawn inside the X axis or not. By using this you can significantly reduce the size of the gutter needed. <br /><i>Default: false</i><br /><br />
+ <a name="chart.xlabels.inside.color"></a>
+<b>chart.xlabels.inside.color</b><br />
+ If the X labels are to be drawn inside the X axis, this is used as the background color.<br /><i>Default: rgba(255,255,255,0.5)</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points).<br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.angle"></a>
+<b>chart.text.angle</b><br />
+ The angle of the horizontal text labels (at the bottom of the graph). Previously this could be 0, 45 or 90, but now (31st July 2010) this can be any angle.<br /><i>Default: 0 (Horizontal)</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the graph. This is the bit of the graph that the labels are in.<br /><i>Default: 25</i><br /><br />
+ <a name="chart.hmargin"></a>
+<b>chart.hmargin</b><br />
+ The size of the horizontal margin. This is on the inside of the axes.<br /><i>Default: 0</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ An array of line colors.<br /><i>Default: ['#f00', '#0f0', '', '#00f', '#f0f', '#ff0', '#0ff'] 9</i><br /><br />
+ <a name="chart.colors.alternate"></a>
+<b>chart.colors.alternate</b><br />
+ Set this to true if you want your line color(s) to be alternated. <a href="#note.colors">See note</a><br /><i>Default: false</i><br /><br />
+ <a name="chart.fillstyle"></a>
+<b>chart.fillstyle</b><br />
+ A single color or an array of colors that filled line charts will use.<br /><br /><b>Important:</b> This used to be a string, and still can be, but can now also be an array.<br /><i>Default: null</i><br /><br />
+ <a name="chart.filled"></a>
+<b>chart.filled</b><br />
+ Whether the area under the graph is filled or not. This looks best when there is no horizontal margin.<br /><i>Default: false</i><br /><br />
+ <a name="chart.filled.range"></a>
+<b>chart.filled.range</b><br />
+ This is useful for indicating a range. Exactly two datasets are required, with the space between them filled. This is useful for indicating a range.The <a href="../examples/line.html">line chart examples</a> page demonstrates this in action.<br /><i>Default: false</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ If true a shadow will be applied to the line.<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow. As well as a single color definition, this can also be an array of colors. This means that if you have multiple lines on your chart, each can have a different shadow color. <br /><i>Default: rgba(0,0,0,0.5)</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset in pixels for the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset in pixels for the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect.<br /><i>Default: 3</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ These are tooltips for the line(s). It should be an array of tooltips. If you have multiple lines, simply pass multiple arrays to the Set() method. <br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.coords.adjust"></a>
+<b>chart.tooltips.coords.adjust</b><br />
+ 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 />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.tooltips.highlight"></a>
+<b>chart.tooltips.highlight</b><br />
+ If you don't want/need the graph to be highlighted and thus avoid redrawing, (eg When <a href="combine.html">combining charts</a>), then set this to false.<br /><i>Default: true</i><br /><br />
+ <a name="chart.crosshairs"></a>
+<b>chart.crosshairs</b><br />
+ If true, you will get a crosshair centering on the current mouse position.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.linewidth"></a>
+<b>chart.crosshairs.linewidth</b><br />
+ This controls the linewidth of the crosshairs.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.crosshairs.color"></a>
+<b>chart.crosshairs.color</b><br />
+ The color of the crosshairs.<br /><i>Default: #333</i><br /><br />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. Unlike the bar chart, you CAN have context menus at the same time as tooltips. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only color allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.adjustable"></a>
+<b>chart.adjustable</b><br />
+ Defaulting to false, this determines whether your graph will be adjustable (click a point and drag it). <br /><i>Default: false</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the chart.<br /><i>Default: none</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.xaxis"></a>
+<b>chart.title.xaxis</b><br />
+ This allows to specify a title for the X axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.yaxis"></a>
+<b>chart.title.yaxis</b><br />
+ This allows to specify a title for the Y axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.xaxis.pos"></a>
+<b>chart.title.xaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the X axis title.<br /><i>Default: 0.25</i><br /><br />
+ <a name="chart.title.yaxis.pos"></a>
+<b>chart.title.yaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the Y axis title.<br /><i>Default: 0.25</i><br /><br />
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+<a name="scale"></a>
+<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.units.post"></a>
+<b>chart.units.post</b><br />
+ The units (if any) that the Y axis is measured in (gets appended to the number)<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units (if any) that the Y axis is measured in (gets preppended to the number)<br /><i>Default: none</i><br /><br />
+ <a name="chart.scale.decimals"></a>
+<b>chart.scale.decimals</b><br />
+ Determines the precision of the numbers used as the scale.<br /><i>Default: 0</i><br /><br />
+ <a name="chart.scale.point"></a>
+<b>chart.scale.point</b><br />
+ The character used as the decimal point.<br /><i>Default: .</i><br /><br />
+
+ <a name="chart.scale.thousand"></a>
+ <b>chart.scale.thousand</b><br />
+ The character used as the thousand separator<br /><i>Default: ,</i><br /><br />
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+ <a name="chart.ymin"></a>
+<b>chart.ymin</b><br />
+ The optional minimum Y scale value. If not specified then it will be zero.<br /><i>Default: null</i><br /><br />
+ <a name="chart.ymax"></a>
+
+ <b>chart.ymax</b><br />
+ The optional maximum Y scale value. If not specified then it will be calculated.<br />
+ <i>Default: null (It's calculated)</i><br /><br />
+
+ <b>chart.outofbounds</b><br />
+ Normally, out-of-bounds values are not drawn. By setting this to <i>true</i> you can change this behaviour.<br />
+ <i>Default: false</i><br /><br />
+
+<a name="axis properties"></a>
+<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.xticks"></a>
+<b>chart.xticks</b><br />
+ The number of X tickmarks.<br /><i>Default: null (linked to number of datapoints)</i><br /><br />
+ <a name="chart.ticksize"></a>
+<b>chart.ticksize</b><br />
+ The size of the tick marks. This only affects certain styles of tickmarks.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.tickdirection"></a>
+<b>chart.tickdirection</b><br />
+ Whether the ticks are above or below the axis.<br /><i>Default: -1 (-1 is below, 1 is above)</i><br /><br />
+ <a name="chart.axis.color"></a>
+<b>chart.axis.color</b><br />
+ The color of the axes.<br /><i>Default: black</i><br /><br />
+ <a name="chart.xaxispos"></a>
+<b>chart.xaxispos</b><br />
+ The position of the X axis. It can be either <i>bottom</i> or <i>center</i>.<br /><i>Default: bottom</i><br /><br />
+ <a name="chart.yaxispos"></a>
+<b>chart.yaxispos</b><br />
+ Specifies the Y axis position. Can be <i>left</i> or <i>right</i>.<br /><i>Default: left</i><br /><br />
+ <a name="chart.axesontop"></a>
+<b>chart.axesontop</b><br />
+ A minor option, this sets the axes to be redrawn after the graph has been drawn. This is only useful in a certain set of circumstances - the graph is filled and the line width is small.<br /><i>Default: false</i><br /><br />
+ <a name="chart.noaxes"></a>
+<b>chart.noaxes</b><br />
+ Whether the axes are drawn<br /><i>Default: false (the axes ARE drawn)</i><br /><br />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="miscellaneous"></a>
+<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.tickmarks"></a>
+<b>chart.tickmarks</b><br />
+ What kind of tickmarks to use on the graph. This can be:<ul><li>dot</li><li>circle</li><li>filledcircle</li><li>endcircle</li><li>square</li><li>endsquare</li><li>filledsquare</li><li>filledendsquare</li><li>tick</li><li>halftick</li><li>endtick</li><li>cross</li><li>borderedcircle (same as dot)</li><li>arrow</li><li>filledarrow</li></ul><p>Note that "arrow" and "filledarrow" look better with a thinner (1 or 2) linewidth setting. Also note that now (10th August 2010) as well as a string, this can be an array of different tickmark styles.<br /><i>Default: null</i><br /><br />
+ <a name="chart.tickmarks.dot.color"></a>
+<b>chart.tickmarks.dot.color</b><br />
+ This is the color of the BORDER around the dot/borderedcircle style tickmarks. <br /><i>Default: #fff</i><br /><br />
+ <a name="chart.stepped"></a>
+<b>chart.stepped</b><br />
+ Draws the line as stepped. Useful for showing stock performance for example.<br /><i>Default: false</i><br /><br />
+ <a name="chart.linewidth"></a>
+<b>chart.linewidth</b><br />
+ The width of the line (ie the actual line on the line graph). Note: If your line is stepped and filled, and you don't want a trailing line indicating the last value, you can set this to zero.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.variant"></a>
+<b>chart.variant</b><br />
+ At present this can only be <i>3d</i>, and gives a small 3D effect.<br /><i>Default: null</i><br /><br />
+</div><!-- /DOCS --><br /><br />
+
+ <b>chart.chromefix</b><br />
+ Since version 6, Chrome has had a shadow bug, which becomes apparent when you use shadow blurring. This value defaults
+ to true and means that RGraph will skirt the bug with a small fix.<br /><i>Default: true</i><br /><br />
+
+ </div><!-- /DOCS --><br /><br />
+
+
+ <a name="available.methods"></a>
+ <h2>Methods</h2>
+
+ <a href="getPoint"></a>
+ <b>obj.getPoint()</b><br /><br />
+ This method makes it easier to get hold of which point on the Line chart has been hovered over. It returns an array of:
+
+ <ul>
+ <li>The graph object</li>
+ <li>The X coordinate</li>
+ <li>The Y coordinate</li>
+ <li>The numerical index of the point. This corresponds (for example) to the tooltips array, and the coordinates array</li>
+ </ul>
+
+ An example usage is:
+
+ <pre class="code">
+<canvas id="cvs" width="600" height="300">[No canvas support]</canvas>
+
+<script src="RGraph.common.core.js"></script>
+<script src="RGraph.line.js"></script>
+
+<script>
+ myGraph = new RGraph.Line('cvs', [10,4,2,4,1]);
+ myGraph.Set('chart.hmargin', 10);
+ myGraph.Set('chart.tickmarks', 'endcircle');
+ myGraph.Set('chart.labels', ['Fred','John','Kev','Lou','Pete']);
+ myGraph.Draw();
+
+
+ RGraph.Register(myGraph);
+
+ myGraph.canvas.onmousemove = function (e)
+ {
+ RGraph.FixEventObject(e);
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = e.target.__object__;
+
+ // This is the new method which simplifies getting coordinates
+ var point = obj.getPoint(e);
+
+
+ if (point) {
+
+ canvas.style.cursor = 'pointer';
+
+ // Is this the same tooltip as the one (if any) that's already being shown
+ if (RGraph.Registry.Get('chart.tooltip') && RGraph.Registry.Get('chart.tooltip').__index__ == point[3]) {
+ return;
+ }
+
+ // Start afresh
+ RGraph.Redraw();
+
+ // Show the tooltip
+ RGraph.Tooltip(canvas, obj.Get('chart.labels')[point[3]], e.pageX, e.pageY, point[3]);
+
+ // Highlight the point
+ context.strokeStyle = 'gray';
+ context.fillStyle = 'white';
+ context.beginPath();
+ context.moveTo(point[1], point[2]);
+ context.arc(point[1], point[2], 2, 0, 6.26, 0);
+ context.stroke();
+ context.fill();
+
+ return;
+ }
+
+ canvas.style.cursor = 'default';
+ }
+
+ window.onclick = function ()
+ {
+ RGraph.Redraw();
+ }
+</script>
+</pre>
+
+ <a name="combining.line.bar"></a>
+ <h2>Combining the Line and Bar charts</h2>
+
+ <p>
+ You can combine the Bar and Line charts with a bit of magic. It's actually quite easy to do. <a href="combine.html">Find out more here</a>.
+ In the same vein, you can have Y axes on both the left and right.
+ </p>
+
+
+ <a name="alternative.colors"></a>
+ <h2>Alternative colors</h2>
+
+ <p>
+ Instead of a string stipulating the color, each element of the colors array can itself be a two element array,
+ stipulating the up color, and the down color. To use alternating colors you must also stipulate the alternate property:
+ </p>
+
+
+ <pre class="code">
+myLine.Set('chart.colors.alternate', true);
+myLine.Set('chart.colors', ['red', ['blue', 'yellow'], 'green]);
+</pre>
+
+ <a name="custom.tickmarks"></a>
+ <h2>Custom tickmarks</h2>
+ <p>
+ If none of the available tickmark styles are suitable, you can instead specify a function object that draws the tickmark,
+ enabling you to draw the tickmark yourself. For example:
+ </p>
+
+ <pre class="code">
+<script>
+ line.Set('chart.tickmarks', myTick);
+
+ /**
+ * The function that is called once per tickmark, to draw it
+ *
+ * @param object obj The graph object
+ * @param array data The entire line data
+ * @param number value The individual points value
+ * @param number index The current index, in the data array
+ * @param number x The X coordinate
+ * @param number y The Y coordinate
+ * @param string color The color of the line
+ * @param number prevX The previous X coordinate
+ * @param number prevY The previous Y coordinate
+ */
+ function myTick (obj, data, value, index, x, y, color, prevX, prevY)
+ {
+ // Draw your custom tick here
+ }
+</script>
+</pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - meter documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas docs meter chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Meter chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Meter
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Meter documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ This is the Meter chart. Similar to half the Odometer. The difference is purely visual, but may well be more suited to
+ a control panel type application.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/meter.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var meter = new RGraph.Meter('myCanvas', 50, 100, 60);
+ meter.Set('chart.contextmenu', [
+ ['Show palette', RGraph.Showpalette],
+ ['Clear annotations', function () {RGraph.Clear(meter.canvas); meter.Draw();}],
+ null,
+ ['Cancel', function () {}]
+ ]);
+ meter.Set('chart.annotatable', true);
+ meter.Set('chart.label.position', 'inside');
+ meter.Set('chart.title', 'A sample measurement');
+ meter.Set('chart.title.vpos', 0.5);
+ meter.Set('chart.units.post', 'k');
+ meter.Set('chart.red.start', 0);
+ meter.Set('chart.red.end', 3);
+ meterSet('chart.yellow.start', 3);
+ meter.Set('chart.yellow.end', 6);
+ meter.Set('chart.green.start', 6);
+ meter.Set('chart.green.end', 10);
+ meter.Draw();
+ }
+</script>
+</pre>
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the Meter apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myMeter.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ </ul>
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the graph. <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.border.color"></a>
+<b>chart.border.color</b><br />
+ The color of the outline (including tickmarks).<br /><i>Default: black</i><br /><br />
+ <a name="chart.green.start"></a>
+<b>chart.green.start</b><br />
+ The value that the green area should begin at. <br /><i>Default: 35% of the maximum value</i><br /><br />
+ <a name="chart.green.end"></a>
+<b>chart.green.end</b><br />
+ The value that the green area should end at. <br /><i>Default: The maximum value</i><br /><br />
+ <a name="chart.green.color"></a>
+<b>chart.green.color</b><br />
+ The color of the green area, (can be any color).. <br /><i>Default: #207A20</i><br /><br />
+ <a name="chart.yellow.start"></a>
+<b>chart.yellow.start</b><br />
+ The value that the yellow area should begin at. <br /><i>Default: 10% of the maximum value</i><br /><br />
+ <a name="chart.yellow.end"></a>
+<b>chart.yellow.end</b><br />
+ The value that the yellow area should end at. <br /><i>Default: 35% of the maximum value</i><br /><br />
+ <a name="chart.green.color"></a>
+<b>chart.green.color</b><br />
+ The color of the yellow area, (can be any color).. <br /><i>Default: #D0AC41</i><br /><br />
+ <a name="chart.red.start"></a>
+<b>chart.red.start</b><br />
+ The value that the red area should begin at. <br /><i>Default: The minimum value</i><br /><br />
+ <a name="chart.red.end"></a>
+<b>chart.red.end</b><br />
+ The value that the red area should end at. <br /><i>Default: 10% of the maximum value</i><br /><br />
+ <a name="chart.red.color"></a>
+<b>chart.red.color</b><br />
+ The color of the red area, (can be any color).. <br /><i>Default: #9E1E1E</i><br /><br />
+<a name="labels and text"></a>
+<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.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size (in points) of the labels. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the graph, if any. <br /><i>Default: null</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+<a name="scale"></a>
+<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.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the labels are measured in. This string is displayed BEFORE the actual number, allowing you to specify values such as "$50".<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the labels are measured in. This string is displayed AFTER the actual number, allowing you to specify values such as "50ms".<br /><i>Default: none</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively).<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only color allowed for annotations.<br /><i>Default: black</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ If true a shadow will be applied to the meter.<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow. <br /><i>Default: rgba(0,0,0,0.5)</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset in pixels for the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset in pixels for the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect.<br /><i>Default: 3</i><br /><br />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="miscellaneous"></a>
+<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.linewidth"></a>
+<b>chart.linewidth</b><br />
+ The width of the outline of the Meter. <br /><i>Default: 2</i><br /><br />
+</div><!-- /DOCS --><br /><br />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Miscellaneous</title>
+
+ <meta name="keywords" content="rgraph html5 canvas misc docs" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Miscellaneous documentation" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Miscellaneous documentation
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Miscellaneous documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <ul>
+ <li><a href="#fallback.content">Canvas fallback content and visually impaired users</a></li>
+ <li><a href="#limits">Upper and lower limits for horizontal bars</a></li>
+ <li><a href="#canvas.width.height">Setting the canvas width and height</a></li>
+ <li><a href="#older.browsers">RGraph and older browsers</a></li>
+ <li><a href="#msie">RGraph and Microsoft Internet Explorer</a></li>
+ <li><a href="#debugging">Debugging tips</a></li>
+ <li><a href="#inspecting">Inspecting an RGraph graph</a></li>
+ <li><a href="#context.menus">Double click context menus</a></li>
+ <li><a href="#event.handlers">Adding your own event handlers</a></li>
+ <li><a href="#crlf">Carriage returns and newlines in labels</a></li>
+ <li><a href="#tradar">Why is the Traditional Radar chart so called?</a></li>
+ <li><a href="#character.set">Character set issues</a></li>
+ <li><a href="#rgraph.identify">How to identify an RGraph object</a></li>
+ <li><a href="#static.y.axis">Static Y axis</a></li>
+ <li><a href="#reducing.white.space">Reducing white space</a></li>
+ <li><a href="#in.graph">In-graph labels</a></li>
+ <li><a href="#shorthand.ingraph.labels">Shorthand for in-graph labels</a></li>
+ <li><a href="#dom2.events">DOM2 Event handlers</a></li>
+ <li><a href="#gutter.suggest">Gutter suggestion function</a></li>
+ <li><a href="#data.types">Data types</a></li>
+ <li><a href="#create.your.own">Creating your own Graph type</a></li>
+ <li><a href="#known.issues">Known issues</a></li>
+ </ul>
+
+ <a name="fallback.content"></a>
+ <br /> <br /> <br />
+ <h4>Canvas fallback content and visually impaired users</h4>
+
+ <p>
+ When using the canvas element you should be aware of the accessibility of your graphs, for example where vision limited users are
+ concerned. Screen readers, for example, may not be able to convert a graph into something that is reasonable, so you should
+ consider
+ doing this yourself, possibly using the canvas fallback content (ie the content in between the canvas tags). A possible example
+ would be to put a table of data inside the canvas tag that the graph on the canvas represents. Doing this goes a long way
+ towards making the data available to everyone. You might also wish to consider using the <a href="zoom.html">full canvas
+ zoom</a> or the <a href="resizing.html">resizing feature</a> to enable people to enlarge the graph.
+ </p>
+
+ <a name="limits"></a>
+ <br /> <br /> <br />
+ <h4>Upper and lower limits for horizontal bars</h4>
+
+ <p>
+ If you don't wish to specify an upper or lower limit for horizontal bars, and you just want them to extend to the upper or lower
+ limits of the graph, whatever they may be, you can specify null for the value determining how far they extend. For cases where
+ the X axis is in the middle and you're specifying a negative start value, or you want the bar to extend all the way to the
+ bottom, you can simply specify an arbitrary length (eg -999999). Eg:
+ </p>
+
+ <pre class="code">myBar.Set('chart.background.hbars', [[0, null, 'green'], [0,-999999,'red']]);</pre>
+
+ <a name="canvas.width.height"></a>
+ <br /> <br /> <br />
+ <h4>Setting the canvas width and height</h4>
+
+ <p>
+ To set the canvas width and height you must use the HTML width/height attributes and NOT CSS. If you do use CSS, the canvas
+ will be scaled, and not enlarged, to fit the new width/height. Eg:
+ </p>
+
+ <pre class="code"><canvas id="myCanvas" width="200" height="100">[No canvas support]<canvas></pre>
+
+ <p />
+
+ <a name="older.browsers"></a>
+ <br /> <br /> <br />
+ <h4>RGraph and older browsers</h4>
+
+ <p>
+ Older versions of browsers are supported (assuming they have canvas support), however, if they don't support the canvas text
+ or shadow APIs these will naturally be unavailable. The graphs will still be drawn, though without shadows or text.
+ </p>
+
+ <a name="msie"></a>
+ <br /> <br /> <br />
+ <h4>RGraph and Microsoft Internet Explorer</h4>
+
+ <p>
+ You can now use RGraph with Internet Explorer 8 in conjunction with ExCanvas, (which brings a degree of <canvas> support to MSIE).
+ Bear in mind though that shadows are not available and thus are simulated. Microsoft Internet Explorer 9 has native <canvas>
+ support. You can see some screenshots of it <a href="http://groups.google.com/group/rgraph/browse_thread/thread/3cce2cd655918b0c#" target="_blank">here</a>.
+ </p>
+
+ <a name="debugging"></a>
+ <br /> <br /> <br />
+ <h4>Debugging tips</h4>
+
+ <p>
+ If you're having a hard time debugging your graph, try these:
+ </p>
+
+ <ul>
+ <li>Ensure you have only one graph on the page</li>
+ <li>Make sure you have disabled your web browsers cache (the Firefox <a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer toolbar</a> can do this for Firefox)</li>
+ <li>Try using <a href="http://www.getfirebug.com" target="_blank">Firebug</a> (for Firefox) or the Webkit developer tools (for Google Chrome and Safari)</li>
+ <li>Reduce the page to the bare minimum.</li>
+ <li>Start with a very basic graph and build it up slowly.</li>
+ </ul>
+
+
+
+ <a name="inspecting"></a>
+ <br /> <br /> <br />
+ <h4>Inspecting an RGraph graph</h4>
+
+ <p>
+ To help when debugging your RGraph graphs and canvas elements, you can use you browsers built in debugging tools.
+ An example is the WebKit developer tools which are available in Google Chrome and Apple Safari. There is a screenshot
+ of these tools (in docked mode) <a href="../images/introspection.png" target="_blank"><b>here</b></a>. To view these
+ tools in Google Chrome press CTRL+SHIFT+J. Inspect the canvas, and then the associated object can be found via
+ the <i>__object__</i> property.
+ </p>
+
+
+ <a name="context.menus"></a>
+ <br /> <br /> <br />
+ <h4>Double click context menus</h4>
+
+ <p>
+ Windows Opera, Windows Safari, Mac Safari and Mac Firefox all attach the context menu to the double click event (left mouse button),
+ not the right, in order to make it more reliable.
+ </p>
+
+
+ <a name="event.handlers"></a>
+ <br /> <br /> <br />
+ <h4>Adding your own event handlers</h4>
+
+ <p>
+ Because each RGraph object exposes the canvas element (the same as what you get from <i>document.getElementById()</i>),
+ you can use normal procedures to add your own event handlers. Eg If you wanted to add your own onclick handler you could
+ do this:
+ </p>
+
+ <pre class="code">
+<script>
+ var myBar = new RGraph.Bar('cvs', [7,4,2,6,3,4,8]);
+ myBar.Draw();
+
+ myBar.canvas.onclick = function ()
+ {
+ }
+</script>
+</pre>
+ <p>
+ But what if, for example, you're using an RGraph feature which
+ uses the event handler that you need? In this case you can use the standard DOM method <i>addEventListener()</i>. This will add
+ your new event handler without replacing any existing one (ie the one installed by RGraph). For example:
+ </p>
+
+ <pre class="code">
+<script>
+ var myBar = new RGraph.Bar('cvs', [7,4,2,6,3,4,8]);
+ myBar.Draw();
+
+ function myFunc ()
+ {
+ }
+
+ myBar.canvas.addEventListener('click', myFunc, false)
+</script>
+</pre>
+
+
+ <a name="crlf"></a>
+ <br /> <br /> <br />
+ <h4>Carriage returns and newlines in labels</h4>
+
+ <p>
+ You can put carriage returns in your labels by using the string <i>\r\n</i>. This means your labels will span multiple lines.
+ Like so:
+ </p>
+
+ <pre class="code">myBar.Set('chart.labels', 'John\r\n(Winner!)', ...)</pre>
+
+
+ <a name="tradar"></a>
+ <br /> <br /> <br />
+ <h4>Why is the Traditional Radar chart so called?</h4>
+
+ <p>
+ Historical reasons. There used to be two Radar charts in RGraph - the TRadar and an older one called the Pseudo radar chart.
+ The Pseudo Radar chart was converted into the Rose chart. Renaming the TRadar will only cause problems and there's no pressing
+ reason to do so, so for the moment it remains the TRadar chart.
+ </p>
+
+
+ <a name="character.set"></a>
+ <br /> <br /> <br />
+ <h4>Character set issues</h4>
+
+ <p>
+ If you're seeing strange, unrecognised characters in your text labels or titles, you may need to specify the correct
+ character set that the browser should use. In PHP you can do this with the <i>header()</i> function (which, as the
+ name suggests, sends a HTTP header):
+ </p>
+
+ <pre class="code"><?php
+ header("Content-Type: text/html; charset=ISO-8859-1");
+?></pre>
+
+ <p>
+ If you use Apache, you could use the <i>header</i> directive, though this may be overridden by other directives,
+ eg <i>AddDefaultCharset</i>.
+ </p>
+
+ <a name="rgraph.identify"></a>
+ <br /> <br /> <br />
+ <h4>How to identify an RGraph object</h4>
+
+ <p>
+ Because identity can sometimes be a tricky affair, there are a few RGraph properties that you can use to check whether an object
+ is an RGraph object:
+ </p>
+
+ <ul>
+ <li><i>obj.isRGraph</i> - This is a boolean that you can use to clearly identify an RGraph object.</li>
+ <li><i>obj.type</i> - This identifies the type of an RGraph object. It is a string which contains a one word description of the objects graph type, eg bar/line/pie.</li>
+ </ul>
+
+
+ <!------------------------------------------------------------------------------------------------------------->
+
+
+ <!--
+ The HTML and script necessary for a graph with a static Y axis. The libraries are included at the top of the page
+ in the <HEAD>
+ -->
+ <div style="position: relative; float: right; margin-right: 10px; margin-top: 10px">
+ <!-- The width here is set further down the page in script -->
+ <canvas id="axes" width="0" height="200" style="position: absolute; top: 0; left: 0; z-index: 100"></canvas>
+ <div style="width: 600px; overflow: auto">
+ <canvas id="cvs" width="1000" height="200"></canvas>
+ </div>
+ </div>
+
+
+
+ <a name="static.y.axis"></a>
+ <br /> <br /> <br />
+ <h4>Static Y axis</h4>
+
+
+ <script>
+ ShowGraphOne = function ()
+ {
+ /**
+ * This is the script that draws the graph
+ */
+ line = new RGraph.Line('cvs', [3,15,22,26,28,24,22,25,23,24,26,23,24,25,27,28,29,26,23,22,24,21,24,25]);
+ line.Set('chart.noaxes', true); // We draw the Y axis ourselves further down the page
+ line.Set('chart.gutter', 27);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.linewidth', 3);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Set('chart.shadow.color', 'red');
+ line.Set('chart.text.angle', 15);
+ line.Set('chart.tooltips', [
+ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December',
+ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
+ ]);
+ line.Set('chart.labels', [
+ '','Feb 09', 'Mar 09','Apr 09','May 09','Jun 09','Jul 09','Aug 09','Sep 09','Oct 09','Nov 09', 'Dec 09',
+ 'Jan 10', 'Feb 10', 'Mar 10','Apr 10','May 10','Jun 10','Jul 10','Aug 10','Sep 10','Oct 10','Nov 10', 'Dec 10'
+ ]);
+ line.Draw();
+
+
+
+ /**
+ * And this is the script that draws the left axis, on the other canvas (that doesn't move)
+ */
+ ca = document.getElementById("axes")
+ co = ca.getContext('2d');
+
+
+ /**
+ * This sets the smaller canvas to cover the whole of the graphs left gutter
+ */
+ ca.width = line.Get('chart.gutter') + 1;
+
+
+ RGraph.Clear(ca, 'white');
+
+
+ /**
+ * This draws the static axis
+ */
+ co.beginPath();
+ co.moveTo(line.Get('chart.gutter'), line.Get('chart.gutter'));
+ co.lineTo(line.Get('chart.gutter'), line.canvas.height - line.Get('chart.gutter'));
+
+ // Draw the tickmarks on the axis
+ var numTicks = 10;
+ for (var i=0; i<=numTicks; ++i) {
+ co.moveTo(line.Get('chart.gutter'), line.Get('chart.gutter') + (((ca.height - (2 * line.Get('chart.gutter'))) / numTicks) * i));
+ co.lineTo(line.Get('chart.gutter') - 3, line.Get('chart.gutter') + (((ca.height - (2 * line.Get('chart.gutter'))) / numTicks) * i));
+ }
+
+ co.stroke();
+
+
+
+ /**
+ * This draws the labels for the static axis
+ */
+ co.beginPath();
+ var color = 'black';
+ var size = 10;
+
+ for (var i=0; i<5; ++i) {
+ co.fillStyle = color;
+ co.textAlign = 'right';
+ co.textBaseline = 'middle';
+ var h = line.canvas.height - (2 * line.Get('chart.gutter'));
+
+ RGraph.Text(co, 'Verdana', size, line.Get('chart.gutter') - 4, line.Get('chart.gutter') + (h * (i/5)), line.max - (line.max * (i/5)));
+ }
+ co.fill();
+ }
+ </script>
+
+ A static Y axis is useful if you have a wide chart but limited space. Whilst not part of the RGraph libraries itself, it can be
+ achieved with a little HTML, like the graph shown. The HTML and the script to achieve this is documented in the source
+ of this page. It involves placing an extra canvas above the graph with the Y axis drawn on it. This canvas doesn't
+ move when the main canvas scrolls left and right.
+
+ <p />
+
+ <b>Note:</b> Because Firefox doesn't support the event.offsetX and event.offsetY properties, and they have to be simulated,
+ scrolling and tooltips in this case and this browser doesn't work.
+
+
+ <!------------------------------------------------------------------------------------------------------------->
+
+
+ <br clear="all" />
+ <br clear="all" />
+
+
+ <!-- This graph is an example of how you can eliminate the gutter white space by translating before you draw the graph. -->
+
+ <a name="reducing.white.space"></a>
+ <br /> <br /> <br />
+ <h4>Reducing white space</h4>
+
+ <canvas id="myc" width="600" height="250" style="float: right; border: dashed 1px gray; margin-right: 10px"></canvas>
+
+ <script>
+ ShowGraphTwo = function ()
+ {
+ // First translate to eliminate the top and gutters
+ document.getElementById("myc").getContext('2d').translate(15, -30);
+
+
+ var arg1 = [73, 65, 76, 75, 69, 73, 54, 61, 89, 77];
+ var arg2 = [264, 240, 240, 256, 200, 208, 240, 216, 248, 240]
+
+ var line1 = new RGraph.Line('myc', arg1 , arg2);
+ line1.Set('chart.colors', ['red', 'silver']);
+ line1.Set('chart.background.barcolor1', 'white');
+ line1.Set('chart.background.barcolor2', 'white');
+ line1.Set('chart.labels', ['Jan 2000',
+ 'Feb 2001',
+ 'Mar 2002',
+ 'Apr 2003',
+ 'May 2004',
+ 'Jun 2005',
+ 'Jul 2006',
+ 'Aug 2007',
+ 'Sep 2008',
+ 'Oct 2009'])
+ line1.Set('chart.filled', true);
+ line1.Set('chart.fillstyle', ['#fcc', '#cfc']);
+ line1.Set('chart.gutter', 45);
+ line1.Set('chart.background.grid', true);
+ line1.Set('chart.ymax', 365)
+ line1.Set('chart.yaxispos', 'right');
+ line1.Set('chart.title.xaxis', 'Month');
+ line1.Set('chart.title.yaxis', 'Temperature');
+ line1.Set('chart.title.xaxis.pos', -0.3);
+ line1.Set('chart.title.yaxis.pos', 0.3);
+ line1.Set('chart.text.angle', 30);
+ line1.Set('chart.tooltips', [
+ 'January 2000','February 2001','March 2002','April 2003','May 2004','June 2005','July 2006','August 2007','September 2008','October 2009',
+ 'January 2000','February 2001','March 2002','April 2003','May 2004','June 2005','July 2006','August 2007','September 2008','October 2009'
+ ]);
+ line1.Set('chart.tooltips.coords.adjust', [15,-30]);
+ line1.Draw();
+ }
+
+ window.onload = function ()
+ {
+ ShowGraphOne();
+ ShowGraphTwo();
+ }
+ </script>
+
+ <p>
+ If the labels that you have require a large gutter you can reduce the amount of wasted space by using the standard 2D
+ context method <i>translate()</i>. This effectively moves the coordinate system so that (0,0) is no longer in the top
+ left corner, but whereever you put it. For example if you translate by (15,-15), the origin will then be 15 pixels right and
+ 15 pixels up compared to where it was.
+ </p>
+
+ <p>
+ Because the coordinate system is being changed things that rely on coordinates, eg tooltips, will be affected. For this reason
+ there is the property <i>chart.tooltips.coords.adjust</i> which you can use to tell RGraph that you've translated and the
+ tooltip coordinates will be adjusted appropriately.
+ </p>
+
+ <pre class="code">
+// This moves the graph to the right by 15px, and up by 15px. Do this before the call to .Draw()
+myObject.context.translate(15,-15);
+</pre>
+
+
+
+ <br clear="all" />
+
+
+ <a name="in.graph"></a>
+ <br /> <br /> <br />
+ <h4>In-graph labels</h4>
+
+ <p>
+ As well as an array of strings, like this:
+ </p>
+
+ <pre class="code">obj.Set('chart.labels.ingraph', ['First label','Second label']);</pre>
+
+ <p>
+ The string can also be an array, consisting of color and placement information, like this:
+ </p>
+
+ <pre class="code">obj.Set('chart.labels.ingraph', ['First label',<span style="color: green">['Second label', 'red', 'yellow', -1, 50]</span> ]);</pre>
+
+
+ <p>
+ You can read more information about this <a href="ingraph.html">here</a>.
+ </p>
+
+ <a name="shorthand.ingraph.labels"></a>
+ <br /> <br /> <br />
+ <h4>Shorthand for in-graph labels</h4>
+ <p>
+ Instead of providing a full array of <i>null</i> elements for in-graph labels which may get a little unwieldy,
+ you can instead specify an integer that specifies how many elements to skip. Like this:
+ </p>
+
+ <pre class="code">line.Set('chart.labels.ingraph', [6, 'July', 3, 'November']);</pre>
+
+ <br clear="all" />
+ <br clear="all" />
+
+ <a name="dom2.events"></a>
+ <br /> <br /> <br />
+ <h4>DOM2 Event handlers</h4>
+ <p>
+ All the graphs have now (1st October 2010) been converted to DOM2 for tooltips event registration. This allows them to
+ be far more co-operative if you're using events. Tooltips will not be compatible with MSIE8 - the graphs will still be
+ drawn, albeit without tooltips.
+ </p>
+
+
+
+ <br clear="all" />
+
+ <a name="gutter.suggest"></a>
+ <br /> <br /> <br />
+ <h4>Gutter suggestion function</h4>
+ <p>
+ RGraph now contains a function (<i>RGraph.getGutterSuggest()</i>) that will provide a simple suggestion for the gutter setting. This function is based on the
+ left gutter and labels and should be considered an approximate value.
+ </p>
+
+ <br clear="all" />
+
+
+
+ <a name="data.types"></a>
+ <br /> <br /> <br />
+ <h4>Data types</h4>
+ <p>
+ If your data values aren't the correct type - ie numbers - it can cause problems. Pay particular attention to this
+ when you're getting your data from data sources which may be classed as strings, such as JSON or AJAX requests.
+ </p>
+
+
+
+
+ <a name="create.your.own"></a>
+ <br /> <br /> <br />
+ <h4>Creating your own Graph type</h4>
+ <p>
+ If you wish to create your own graph type, there is a skeleton file
+ <a href="../libraries/RGraph.skeleton.js" target="_blank"><b>here</b></a> that you can use as a starting point.
+ This file contains the bare bones of an RGraph object, such as the .Get() and .Set() methods, as well as examples
+ of common properties.
+ </p>
+
+ <a name="known.issues"></a>
+ <br /> <br /> <br />
+ <h4>Known issues</h4>
+
+ <p>
+ There's a few known issues documented <a href="issues.html">here</a>
+ </p>
+
+
+ <p />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Microsoft Internet Explorer support</title>
+
+ <meta name="keywords" content="rgraph html5 canvas docs msie" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about Microsoft Internet Explorer (MSIE) support" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <script src="../libraries/RGraph.modaldialog.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ div#msie9 {
+ background-color: #dfd;
+ padding: 5px;
+ border: 2px dashed green;
+ }
+ </style>
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ MSIE support
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Microsoft Internet Explorer (MSIE) support</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p />
+
+ <div id="msie9">
+ <b>Microsoft Internet Explorer 9</b>
+
+ <p>
+ Starting from preview 3, Internet Explorer 9 has support for canvas, including the text and shadow APIs. It also
+ benefits from hardware acceleration, and quick rendering times. You can see some screenshots
+ <a href="http://groups.google.com/group/rgraph/browse_thread/thread/c5651ff8c56b8f3c#" target="_blank">here</a>.
+ </p>
+ </div>
+
+ <br />
+
+ <canvas id="myLine" width="600" height="250" style="float: right">[No canvas support]</canvas>
+
+ <script>
+
+ window.onload = function ()
+ {
+ var data1 = [4,3,6,8,4,2,1,4,9,8,7,8];
+ var data2 = [1,2,4,2,1,3,5,6,6,5,3,5];
+
+ // No "var" as the variable has to be global
+ line = new RGraph.Line('myLine', data1, data2);
+ line.Set('chart.title', 'Sales for Acme Inc. (context menu)');
+ line.Set('chart.title.vpos', 0.5);
+ line.Set('chart.colors', ['red', 'black']);
+ line.Set('chart.linewidth', 5);
+
+ // Odd, but this seems to fix an odd MSIE bug where the text is truncated
+ line.Set('chart.units.post', '% .');
+
+ line.Set('chart.yaxispos', 'right');
+ line.Set('chart.key', ['2007', '2008']);
+ line.Set('chart.key.background', 'white');
+ line.Set('chart.noaxes', true);
+ line.Set('chart.gutter', 35);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.background.barcolor1', 'white');
+ line.Set('chart.background.barcolor2', 'white');
+ line.Set('chart.shadow', true);
+ line.Set('chart.background.grid.autofit', true);
+ line.Set('chart.contextmenu', [['Show dialog', function () {ModalDialog.Show('myDialog', 300);}], ['Cancel', function () {}]]);
+ line.Draw();
+ }
+ </script>
+
+ <ul>
+ <li><a href="#introduction">Introduction</a></li>
+ <li><a href="#getting">Getting hold of ExCanvas</a></li>
+ <li><a href="#caveats">Caveats</a></li>
+ <li><a href="#frame">Google Chrome Frame</a></li>
+ <li><a href="#dynamic.canvas">Using a dynamically created canvas</a></li>
+ </ul>
+
+ <a name="introduction"></a>
+ <h4>Introduction</h4>
+
+ <p>
+ As of December 2009 RGraph now works partially with Internet Explorer without Google Chrome Frame.
+ Graphs are rendered as VML. You are still recommended to use
+ <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a> to get the best results.
+ The interactive features are unlikely to work correctly. RGraph only works with Microsoft
+ Internet Explorer 8.
+ </p>
+
+ <p>
+ Thanks go to everyone involved with the <a href="http://code.google.com/p/explorercanvas/" target="_blank" rel="nofollow">ExCanvas project</a> for providing the ExCanvas library.
+ </p>
+
+ <a name="getting"></a>
+ <h4>Getting hold of ExCanvas</h4>
+
+ <p>
+ Google ExCanvas is distributed with RGraph in the "excanvas" directory. There is a minified gzip compressed version, along
+ with the original.
+ </p>
+
+ <a name="caveats"></a>
+ <h4>Caveats</h4>
+
+ <ul>
+ <li>The interactive features of RGraph are unlikely to work correctly with MSIE 8.</li>
+ <li>Shadows are now available (on some graph types), albeit without blurring.</li>
+ <li>You must reference the Javascript libraries in the documents <head>.</li>
+ <li>You must use the window.onload event to create your graph.</li>
+ <li>
+ Inside the window.onload function your graph must be created as a <i>local</i> variable (ie you must use the <i>var</i> keyword). Eg:
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ <span style="color: green">var</span> myGraph = new RGraph.Bar('myCanvas', [1,9,8,7,3,4,8,4,9,5,7,8]);
+ myGraph.Set('chart.labels', ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']);
+ myGraph.Draw();
+ }
+</script>
+</pre>
+ </li>
+ <li>If your page is large, there may be a slight pause before the window.onload event fires and thus creates the graph.</li>
+ <li>Changing the font that text is shown in is not available.</li>
+ </ul>
+
+ <a name="frame"></a>
+ <h4>Google Chrome Frame</h4>
+ <p>
+ Instead of ExCanvas you can also use Google Chrome Frame. This basically turns Internet Explorer into Google Chrome, and fully
+ supports RGraph. Since it involves a plugin installation, this is a better option if you can fully influence the users PC. If you
+ can fully influence the users PC however, a better option might be to simply use one of the browsers with native
+ support.
+ </p>
+
+
+ <br />
+
+
+ <a name="dynamic.canvas"></a>
+ <h4>Using a dynamically created canvas</h4>
+ <p>
+ If you're creating your canvas dynamically there is an extra step that you must perform to allow it to be recognised by
+ ExCanvas:
+ </p>
+
+ <pre class="code">
+var canvas = document.createElement('CANVAS');
+ canvas.id = 'cvs';
+ canvas.width = 600;
+ canvas.height = 250;
+ canvas.style.border = '1px dashed black';
+document.body.appendChild(canvas);
+
+<span style="color: green">G_vmlCanvasManager.initElement(canvas);</span>
+</pre>
+
+
+
+ <br />
+ <br />
+ <br />
+
+ <!-- This is the ModdalDialog -->
+ <div id="myDialog" style="display: none">
+ <div style="text-align: center; font-family: Arial">
+ <h4>Please wait...</h4>
+ <span style="font-size: 8pt">(Nothing is going to happen, this is simply an example <a href="" onclick="ModalDialog.Close(); return false">Close</a>)</span>
+ </div>
+ </div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Odometer documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas docs odometer chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Odometer chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Odometer
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Odometer documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The example file is <a href="../examples/odo.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ // ID, MINIMUM, MAXIMUM, INDICATED VALUE
+ var odo = new RGraph.Odometer('myOdo', 0, 100, 18);
+
+ odo.Set('chart.green.max', 75);
+ odo.Set('chart.red.min', 90);
+ odo.Set('chart.label.area', 50);
+ odo.Set('chart.needle.thickness', 2);
+
+ odo.Draw();
+ }
+</script>
+</pre>
+
+ <!--
+ <div class="warning">
+ <p>Note</p>
+ As of 20th March 2010, how you specify the start and end values has changed. The chart.green.start, chart.green.end, chart.yellow.start,
+ chart.yellow.end, chart.red.start and chart.red.end have all been replaced by chart.green.max and chart.red.min. Now the
+ green area always starts at zero and goes to chart.green.max, and the red area starts (by default - you can customise this by using
+ chart.red.min) at 90% of the maximum value and goes to the maximum value. The yellow area is between the two.
+ </div>
+ -->
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the bar graph apears. You can set these properties using the <b>Set()</b> method.
+ </p>
+
+ <ul>
+ <li><a href="#chart configuration">Chart configuration</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#needle">Needle</a></li>
+ <li><a href="#title">Title</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li><li><a href="#scale">Scale</a></li>
+ </ul>
+
+
+<a name="chart configuration"></a>
+<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">Chart configuration</h3> <a name="chart.value.text"></a>
+<b>chart.value.text</b><br />
+ Controls whether the value is indicated as a text label in the center of the dial.<br /><i>Default: false</i><br /><br />
+ <a name="chart.value.units.pre"></a>
+<b>chart.value.units.pre</b><br />
+ The pre units used on the textual value.<br /><i>Default: nothing (An empty string)</i><br /><br />
+ <a name="chart.value.units.post"></a>
+<b>chart.value.units.post</b><br />
+ The post units used on the textual value.<br /><i>Default: nothing (An empty string)</i><br /><br />
+ <a name="chart.border"></a>
+<b>chart.border</b><br />
+ This controls the gray border of the Odometer.<br /><i>Default: false</i><br /><br />
+ <a name="chart.tickmarks.highlighted"></a>
+<b>chart.tickmarks.highlighted</b><br />
+ This controls whether the tickmarks are highlighted in red/yellow/green.<br /><i>Default: false</i><br /><br />
+ <a name="chart.zerostart"></a>
+<b>chart.zerostart</b><br />
+ If you want the top value on your chart to be zero instead of the maximum value, set this to true.<br /><i>Default: false</i><br /><br />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The width of the area outside the odometer. <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.green.max"></a>
+<b>chart.green.max</b><br />
+ This is the point at which the green area ends.<br /><i>Default: 75% of the maximum value</i><br /><br />
+ <a name="chart.red.min"></a>
+<b>chart.red.min</b><br />
+ This is the point at which the red area starts. The yellow area is between the green and red areas.<br /> <i>Default: 90% of the maximum value</i><br /><br />
+<a name="labels and text"></a>
+<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>
+<b>chart.labels</b><br />
+ Instead of using computed numbers, which uses the maximum value, you can specify the Odometer to use textual labels instead, with this option.<br /> <i>Default: null</i><br /><br />
+ <a name="chart.label.area"></a>
+<b>chart.label.area</b><br />
+ The width of the area that labels are put in. <br /><i>Default: 35</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points). <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+<a name="needle"></a>
+<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">Needle</h3> <a name="chart.needle.width"></a>
+<b>chart.needle.width</b><br />
+ How thick the needle is. <br /><i>Default: 2</i><br /><br />
+ <a name="chart.needle.color"></a>
+<b>chart.needle.color</b><br />
+ The color that is applied to the needle. <br /><i>Default: black</i><br /><br />
+ <a name="chart.needle.head"></a>
+<b>chart.needle.head</b><br />
+ This controls whether the arrow head on the end of the needle is displayed. <br /><i>Default: true</i><br /><br />
+ <a name="chart.needle.type"></a>
+<b>chart.needle.type</b><br />
+ This determines which type of needle is used. It can be <i>pointer</i> or <i>triangle</i>. <br /><i>Default: pointer</i><br /><br />
+ <a name="chart.needle.extra"></a>
+<b>chart.needle.extra</b><br />
+ With this you can specify a number of extra pointers that will be drawn on the Odometer. An example would be a meter that's used to show upload and download data. An example use:<pre class="code">odo.Set('chart.needle.extra', [[16, 'red'], [24, 'blue']]);</pre><br /><i>Default: [] (An empty array)</i><br /><br />
+<a name="title"></a>
+<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">Title</h3> <a name="chart.title"></a>
+<b>chart.title</b><br />
+ The title text. <br /><i>Default: no title set</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow.inner"></a>
+<b>chart.shadow.inner</b><br />
+ Whether a drop shadow is applied to the inner circle of the Odometer<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.outer"></a>
+<b>chart.shadow.outer</b><br />
+ Whether a drop shadow is applied to the whole Odometer.<br /><i>Default: false</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="scale"></a>
+<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.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the value is measured in. This string is displayed BEFORE the actual value, allowing you to specify values such as "$50".<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the value is measured in. This string is displayed AFTER the actual value, allowing you to specify values such as "50ms".<br /><i>Default: none</i><br /><br />
+ <a name="chart.scale.decimals"></a>
+<b>chart.scale.decimals</b><br />
+ The number of decimal places to display for the labels.<br /><i>Default: 0</i><br /><br />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Pie chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs pie chart" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the Pie chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Pie chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Pie chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The pie chart can be used, for example, to represent something that is akin to percentages. ie A set of data that
+ should be taken as part of a whole.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/pie.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [564,155,499,611,322];
+
+ var pie = new RGraph.Pie('myPie', data);
+ pie.Set('chart.labels', ['Abc', 'Def', 'Ghi', 'Jkl', 'Mno']);
+ pie.Set('chart.linewidth', 5);
+ pie.Set('chart.stroke', '#fff');
+ pie.Draw();
+ }
+</script>
+</pre>
+
+ <a name="available.properties"></a>
+ <ul>
+ <li><a href="#available.properties">Properties</a></li>
+ <li><a href="#available.methods">Methods</a></li>
+ </ul>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the pie chart looks. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myPie.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#shadows">Shadows</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ </ul>
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the graph (for text labels). <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ Colors to be used for the pie segments. <br /><i>Default: ['rgb(255,0,0)', '#ddd', 'rgb(0,255,0)', 'rgb(0,0,255)', 'rgb(255,255,0)', 'rgb(0,255,255)', 'red', 'pink', 'black', 'white']</i><br /><br />
+ <a name="chart.strokestyle"></a>
+<b>chart.strokestyle</b><br />
+ The color of the seperating lines. By setting this to your background color, and setting the linewidth to approx. 5, it will make the pie chart look "exploded". <br /><i>Default: #999</i><br /><br />
+<a name="labels and text"></a>
+<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.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points). <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ An array of labels to be used for the chart. <br /><i>Default: [] (an empty array)</i><br /><br />
+ <a name="chart.labels.sticks"></a>
+<b>chart.labels.sticks</b><br />
+ Stipulates that small sticks for the labels are shown. The <a href="../examples/pie.html">example page</a> has an example of this.<br /><i>Default: false</i><br /><br />
+ <a name="chart.labels.sticks.color"></a>
+<b>chart.labels.sticks.color</b><br />
+ Sets the color of the label sticks.<br /><i>Default: #aaa</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the pie chart. <br /><i>Default: none</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+<a name="shadows"></a>
+<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">Shadows</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether a simple shadow effect is applied. <br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow. <br /> <i>Default: rgba(0,0,0,0.5)</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The severity of the shadow blurring effect. <br /> <i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the shadow.<br /><i>Default: 3</i><br /><br />
+<a name="interactive features"></a>
+<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>
+
+ <a name="chart.tooltips"></a>
+ <b>chart.tooltips</b><br />
+ An array of tooltips, starting from the middle right (ie east) axis, and going clockwise sequentially.<br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.tooltips.event"></a>
+ <b>chart.tooltips.event</b><br />
+ This can be <i>onclick</i> or <i>onmousemove</i> and determines which event is used for tooltips.<br />
+ <i>Default: onclick</i><br /><br />
+
+ <a name="chart.tooltips.effect"></a>
+ <b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br />
+ <i>Default: fade</i><br /><br />
+
+ <a name="chart.tooltips.css.class"></a>
+ <b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br />
+ <i>Default: RGraph_tooltip</i><br /><br />
+
+ <a name="chart.tooltips.override"></a>
+ <b>chart.tooltips.override</b><br />
+ 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 />
+
+
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="scale"></a>
+<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.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units that the value is measured in. This string is displayed BEFORE the actual number, allowing you to specify values such as "$50" and is only used if chart.value.text is <i>true</i>.<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units that the value is measured in. This string is displayed AFTER the actual number, allowing you to specify values such as "50ms" and is only used if chart.value.text is <i>true</i>.<br /><i>Default: none</i><br /><br />
+<a name="miscellaneous"></a>
+<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.align"></a>
+<b>chart.align</b><br />
+ Whether to left, center or right align the pie chart.<br /><i>Default: center</i><br /><br />
+ <a name="chart.linewidth"></a>
+<b>chart.linewidth</b><br />
+ By setting this to roughly 5, and setting the strokestyle to the same colour as your background colour,you will get a segment separation effect.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.variant"></a>
+<b>chart.variant</b><br />
+ This can be either <i>pie</i> (the default) or <i>donut</i>. Setting this to <i>donut</i> is how you get a donut chart.<br /><i>Default: pie</i><br /><br />
+ <a name="chart.value.text"></a>
+<b>chart.value.text</b><br />
+ Set this to true if you want the value displayed in text beow the center of the pointer.<br /><i>Default: false</i><br /><br />
+
+ <a name="chart.highlight.style"></a>
+ <b>chart.highlight.style</b><br />
+ Can be either <i>2d</i> or <i>3d</i> and determines which style of segment highlighting is used in
+ conjunction with tooltips.<br />
+ <i>Default: 2d</i><br /><br />
+
+ <a name="chart.highlight.style.2d.color"></a>
+ <b>chart.highlight.style.2d.color</b><br />
+ When 2D highlighting for tooltips is used, this controls the color of the highlighting.<br />
+ <i>Default: rgba(255,255,255,0.5)</i><br /><br />
+</div>
+
+ <a name="available.methods"></a>
+ <br /> <br />
+ <h2>Methods</h2>
+
+ <b>RGraph.getSegment()</b><br /><br />
+
+ RGraph.getSegment() makes it easy to determine which segment of the Pie chart was clicked on. It provides:
+
+ <ul>
+ <li>Originating X coordinate</li>
+ <li>Originating Y coordinate</li>
+ <li>The radius of the segment</li>
+ <li>The starting angle (in degrees)</li>
+ <li>The ending angle (in degrees)</li>
+ </ul>
+
+ <pre class="code">
+<script>
+ RGraph.Register(myGraph);
+
+ myGraph.canvas.onclick = function (e)
+ {
+ RGraph.FixEventObject(e);
+ RGraph.Redraw();
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ <span style="color: green">var segment = RGraph.getSegment(e);</span>
+
+ if (segment) {
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.beginPath();
+
+ // Angles are provided in degrees, so convert them to radians
+ segment[3] /= 57.29;
+ segment[4] /= 57.29;
+
+ context.moveTo(segment[0], segment[1]);
+ context.arc(segment[0], segment[1], segment[2], segment[3], segment[4], 0);
+ context.stroke();
+ context.fill();
+
+ e.stopPropagation();
+ }
+ }
+
+ window.onclick = function (e)
+ {
+ RGraph.Redraw();
+ }
+</script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Retrieving a PNG of your graph</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs png image" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library - Retrieving a PNG representation of your graph" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var line = new RGraph.Line('cvs', [4,3,null,4,5,6,7,4,8,9]);
+ line.Set('chart.labels', ['Dez', 'Fliss','Geoff','Hoolio','John','Rich','Kev','Charles','Lou','Bob']);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.title', 'Retrieving a PNG of your graph (context menu)');
+ line.Set('chart.tickmarks', 'endcircle');
+
+ line.Set('chart.contextmenu', [
+ ['Get PNG', RGraph.showPNG],
+ null,
+ ['Cancel', function () {}]
+ ]);
+
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Set('chart.shadow.color', 'red');
+
+ RGraph.Clear(line.canvas, 'white'); // This effectively sets the background color to be white
+
+ line.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Retrieving a PNG of your graph
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Retrieving a PNG of your graph</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <style>
+ span#png_link {
+ position: absolute;
+ left: 500px;
+ top: 30px;
+ border: 1px black solid;
+ padding: 1px;
+ background-color: rgba(225,225,225,0.5);
+ cursor: pointer;
+ color: blue;
+ font-size: 12pt;
+ }
+ </style>
+
+ <div style="position: relative">
+ <span id="png_link" onclick="RGraph.showPNG(document.getElementById('cvs'), event);">Get PNG</span>
+ <canvas id="cvs" width="600" height="250" style="float: left">[No canvas support]</canvas>
+ </div>
+
+
+ <p>
+ RGraph provides an easy way to get a PNG image of your graph. This allows you to
+ easily save the image locally to use in (for example) a document, spreadsheet or presentation.
+ </p>
+
+ <p>
+ Originally, the function was designed to be used with a context menu, so it is located in the <i>RGraph.common.context.js</i>.
+ Now though, you do not have to use the function with a context menu, and can instead pass in the canvas as the optional argument. There's an
+ example of its usage on the first <a href="../examples/tradar.html">Tradar example</a href>.
+ </p>
+
+ <br clear="all" />
+
+ <p>Include the context menu code:</p>
+ <pre class="code"><script src="../libraries/RGraph.common.context.js" ></script></pre>
+
+ <p>Add the context menu:</p>
+ <pre class="code">
+myGraph.Set('chart.contextmenu', [
+ <span style="color: green">['Get PNG', RGraph.showPNG]</span>,
+ null,
+ ['Cancel', function () {}]
+ ]);</pre>
+
+ <h4>Using the function without a context menu</h4>
+
+ <p>
+ If you want to use the function with a piece of text (or an image) as the "link", optionally positioned over the canvas, you can pass
+ the canvas into the function as an argument, along with the event object.
+ </p>
+
+ <pre class="code">
+<!-- This CSS positions the link over the top right of the canvas -->
+<style>
+ span#png_link {
+ position: absolute;
+ left: 450px;
+ top: 30px;
+ border: 1px black solid;
+ padding: 1px;
+ background-color: #eee;
+ cursor: pointer;
+ }
+</style>
+
+<div style="position: relative">
+ <span id="png_link" <span style="color: green">onclick="RGraph.showPNG(myCanvas, event)"</span>>Get PNG</span>
+ <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+</div>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+This version released on: Fri, 24 Dec 2010 12:51:38 +0000
+
+A RGraph
+A RGraph/RGraph_ChromeExtension_sample.zip
+A RGraph/tests.old
+A RGraph/tests.old/ramon.html
+A RGraph/tests.old/animated_meter.html
+A RGraph/tests.old/context.html
+A RGraph/tests.old/zoom.html
+A RGraph/tests.old/kwong.html
+A RGraph/tests.old/clear.html
+A RGraph/tests.old/key.html
+A RGraph/tests.old/getPoint.html
+A RGraph/tests.old/grafica.html
+A RGraph/tests.old/lots-of-points.html
+A RGraph/tests.old/above.bar.html
+A RGraph/tests.old/set.config.html
+A RGraph/tests.old/getSegment.html
+A RGraph/tests.old/ralphoid.html
+A RGraph/tests.old/pointers.html
+A RGraph/tests.old/test4.html
+A RGraph/tests.old/scatter_crosshairs.html
+A RGraph/tests.old/test6.html
+A RGraph/tests.old/browsers.html
+A RGraph/tests.old/smoothing.html
+A RGraph/tests.old/null.values.html
+A RGraph/tests.old/scale2.html
+A RGraph/tests.old/boxplots.html
+A RGraph/tests.old/sparklines.html
+A RGraph/tests.old/getGutterSuggest.html
+A RGraph/tests.old/ymin.html
+A RGraph/tests.old/scatter_yvalues.html
+A RGraph/tests.old/tooltips.html
+A RGraph/tests.old/crosshairs.html
+A RGraph/tests.old/ajax.html
+A RGraph/tests.old/rose.ymin.html
+A RGraph/tests.old/gantt-xmin.html
+A RGraph/tests.old/scale.html
+A RGraph/tests.old/tickmarks.html
+A RGraph/tests.old/noxaxis.html
+A RGraph/tests.old/ingraph.labels.html
+A RGraph/tests.old/animated_line.html
+A RGraph/tests.old/line.arguments.html
+A RGraph/tests.old/msie.html
+A RGraph/tests.old/ie-events.html
+A RGraph/tests.old/chrome-text.html
+A RGraph/tests.old/trends.html
+A RGraph/tests.old/3D-effect.html
+A RGraph/tests.old/out-of-bounds.html
+A RGraph/tests.old/resize.html
+A RGraph/tests.old/mfrancis.html
+A RGraph/tests.old/rscatter.ymin.html
+A RGraph/tests.old/scatter_vbars.html
+A RGraph/tests.old/test3.html
+A RGraph/tests.old/smallrunedex.html
+A RGraph/tests.old/getBar.html
+A RGraph/tests.old/scatter.html
+A RGraph/tests.old/log-scale.html
+A RGraph/tests.old/kwong2.html
+A RGraph/tests.old/highlight.html
+A RGraph/tests.old/shadows.html
+A RGraph/tests.old/missing.html
+A RGraph/tests.old/animated_rose.html
+A RGraph/tests.old/scale3.html
+A RGraph/robots.txt
+A RGraph/scripts
+A RGraph/scripts/makedocs.sh
+A RGraph/scripts/generate_xml.php
+A RGraph/scripts/diff.sh
+A RGraph/scripts/makexml.sh
+A RGraph/scripts/generate_docs.php
+A RGraph/scripts/tests.php
+A RGraph/scripts/release.sh
+A RGraph/scripts/index.html
+A RGraph/scripts/minify
+A RGraph/docs
+A RGraph/docs/hprogress.html
+A RGraph/docs/meter.html
+A RGraph/docs/gantt.html
+A RGraph/docs/.BC.txt
+A RGraph/docs/async.html
+A RGraph/docs/tradar.html
+A RGraph/docs/color.html
+A RGraph/docs/animation.html
+A RGraph/docs/.CHANGELOG.txt
+A RGraph/docs/odo.html
+A RGraph/docs/external.html
+A RGraph/docs/context.html
+A RGraph/docs/zoom.html
+A RGraph/docs/downloads
+A RGraph/docs/adjusting.html
+A RGraph/docs/css.html
+A RGraph/docs/ingraph.html
+A RGraph/docs/vprogress.html
+A RGraph/docs/.htaccess
+A RGraph/docs/licensing.html
+A RGraph/docs/hbar.html
+A RGraph/docs/combine.html
+A RGraph/docs/pie.html
+A RGraph/docs/tooltips.html
+A RGraph/docs/setconfig.html
+A RGraph/docs/domcontentloaded.html
+A RGraph/docs/dynamic.html
+A RGraph/docs/png.html
+A RGraph/docs/forum
+A RGraph/docs/funnel.html
+A RGraph/docs/line.html
+A RGraph/docs/rscatter.html
+A RGraph/docs/zoom_thumbnail.html
+A RGraph/docs/bipolar.html
+A RGraph/docs/donut.html
+A RGraph/docs/resizing.html
+A RGraph/docs/misc.html
+A RGraph/docs/msie.html
+A RGraph/docs/.TODO.txt
+A RGraph/docs/annotating.html
+A RGraph/docs/events.html
+A RGraph/docs/bar.html
+A RGraph/docs/led.html
+A RGraph/docs/scatter.html
+A RGraph/docs/index.html
+A RGraph/docs/forums
+A RGraph/docs/rose.html
+A RGraph/docs/api.html
+A RGraph/docs/keys.html
+A RGraph/docs/issues.html
+A RGraph/docs/examples
+A RGraph/css
+A RGraph/css/common.css
+A RGraph/css/ModalDialog.css
+A RGraph/css/website.css
+A RGraph/css/index.html
+A RGraph/css/.htaccess
+A RGraph/analog.css
+A RGraph/downloads
+A RGraph/example-images
+A RGraph/example-images/gauge.png
+A RGraph/example-images/fuel.png
+A RGraph/invoice.html
+A RGraph/LICENSE.txt
+A RGraph/screenshots
+A RGraph/screenshots/led.png
+A RGraph/screenshots/bar.png
+A RGraph/screenshots/scatter.png
+A RGraph/screenshots/rose.png
+A RGraph/screenshots/meter.png
+A RGraph/screenshots/hprogress.png
+A RGraph/screenshots/hbar.png
+A RGraph/screenshots/tradar.png
+A RGraph/screenshots/pie.png
+A RGraph/screenshots/gantt.png
+A RGraph/screenshots/odo.png
+A RGraph/screenshots/rscatter.png
+A RGraph/screenshots/line.png
+A RGraph/screenshots/funnel.png
+A RGraph/screenshots/bipolar.png
+A RGraph/screenshots/donut.png
+A RGraph/screenshots/vprogress.png
+A RGraph/sitemap.xml
+A RGraph/tests
+A RGraph/tests/_pie.html
+A RGraph/tests/_odo.html
+A RGraph/tests/eric.html
+A RGraph/tests/chrome6-shadow.html
+A RGraph/tests/_rscatter.html
+A RGraph/tests/_line.html
+A RGraph/tests/css-2D-transforms.html
+A RGraph/tests/_bipolar.html
+A RGraph/tests/thermometer
+A RGraph/tests/thermometer/RGraph.thermometer.js
+A RGraph/tests/thermometer/index.html
+A RGraph/tests/_vprogress.html
+A RGraph/tests/thomas.html
+A RGraph/tests/border-radius.html
+A RGraph/tests/_bar.html
+A RGraph/tests/_scatter.html
+A RGraph/tests/scatter_animated.html
+A RGraph/tests/GetHeight.html
+A RGraph/tests/_hprogress.html
+A RGraph/tests/_hbar.html
+A RGraph/images
+A RGraph/images/barg2.png
+A RGraph/images/barg4.png
+A RGraph/images/analogo.gif
+A RGraph/images/twitter.png
+A RGraph/images/barg8.png
+A RGraph/images/barc1.gif
+A RGraph/images/bara32.png
+A RGraph/images/barg2.gif
+A RGraph/images/bare32.png
+A RGraph/images/bard16.png
+A RGraph/images/barg4.gif
+A RGraph/images/bari32.png
+A RGraph/images/barh16.png
+A RGraph/images/barg8.gif
+A RGraph/images/html2.png
+A RGraph/images/alex.png
+A RGraph/images/bard2.png
+A RGraph/images/sqg.png
+A RGraph/images/bara32.gif
+A RGraph/images/bard4.png
+A RGraph/images/barh1.png
+A RGraph/images/bare32.gif
+A RGraph/images/bard16.gif
+A RGraph/images/bard8.png
+A RGraph/images/bari32.gif
+A RGraph/images/barh16.gif
+A RGraph/images/html2.gif
+A RGraph/images/download-stable-sml.png
+A RGraph/images/bard2.gif
+A RGraph/images/bard4.gif
+A RGraph/images/barh1.gif
+A RGraph/images/bard8.gif
+A RGraph/images/bara2.png
+A RGraph/images/bara4.png
+A RGraph/images/bare1.png
+A RGraph/images/bara8.png
+A RGraph/images/bari2.png
+A RGraph/images/bari4.png
+A RGraph/images/bari8.png
+A RGraph/images/download.png
+A RGraph/images/bara2.gif
+A RGraph/images/download-beta-sml.png
+A RGraph/images/bara4.gif
+A RGraph/images/bare1.gif
+A RGraph/images/favicon.ico
+A RGraph/images/icons_combined.png
+A RGraph/images/reddit.png
+A RGraph/images/bard32.png
+A RGraph/images/bara8.gif
+A RGraph/images/barc16.png
+A RGraph/images/bari2.gif
+A RGraph/images/barh32.png
+A RGraph/images/bari4.gif
+A RGraph/images/barg16.png
+A RGraph/images/context.png
+A RGraph/images/bari8.gif
+A RGraph/images/barb1.png
+A RGraph/images/.htaccess
+A RGraph/images/barf2.png
+A RGraph/images/chrome_logo.png
+A RGraph/images/barf4.png
+A RGraph/images/bard32.gif
+A RGraph/images/barj1.png
+A RGraph/images/barc16.gif
+A RGraph/images/introspection.png
+A RGraph/images/border-radius.png
+A RGraph/images/barh32.gif
+A RGraph/images/barf8.png
+A RGraph/images/barg16.gif
+A RGraph/images/sq0.png
+A RGraph/images/sq2.png
+A RGraph/images/coins.jpg
+A RGraph/images/sq4.png
+A RGraph/images/barb1.gif
+A RGraph/images/facebook.png
+A RGraph/images/sq6.png
+A RGraph/images/png.icon.png
+A RGraph/images/sq8.png
+A RGraph/images/barf2.gif
+A RGraph/images/barf4.gif
+A RGraph/images/barj1.gif
+A RGraph/images/barf8.gif
+A RGraph/images/favicon.png
+A RGraph/images/barc2.png
+A RGraph/images/barc4.png
+A RGraph/images/barg1.png
+A RGraph/images/barc8.png
+A RGraph/images/structure.png
+A RGraph/images/barc2.gif
+A RGraph/images/stumble.png
+A RGraph/images/barc32.png
+A RGraph/images/barc4.gif
+A RGraph/images/barg1.gif
+A RGraph/images/barb16.png
+A RGraph/images/barg32.png
+A RGraph/images/barc8.gif
+A RGraph/images/download-beta.png
+A RGraph/images/barf16.png
+A RGraph/images/barj16.png
+A RGraph/images/bard1.png
+A RGraph/images/barc32.gif
+A RGraph/images/barh2.png
+A RGraph/images/barb16.gif
+A RGraph/images/barh4.png
+A RGraph/images/barg32.gif
+A RGraph/images/barf16.gif
+A RGraph/images/barh8.png
+A RGraph/images/barj16.gif
+A RGraph/images/rss.png
+A RGraph/images/merry-christmas-snowman.png
+A RGraph/images/bard1.gif
+A RGraph/images/barh2.gif
+A RGraph/images/barh4.gif
+A RGraph/images/barh8.gif
+A RGraph/images/bara1.png
+A RGraph/images/bare2.png
+A RGraph/images/friendfeed.png
+A RGraph/images/bare4.png
+A RGraph/images/bari1.png
+A RGraph/images/logo.png
+A RGraph/images/bare8.png
+A RGraph/images/bara1.gif
+A RGraph/images/unicef.png
+A RGraph/images/barb32.png
+A RGraph/images/bara16.png
+A RGraph/images/bare2.gif
+A RGraph/images/googlegroups.png
+A RGraph/images/bare4.gif
+A RGraph/images/bari1.gif
+A RGraph/images/barf32.png
+A RGraph/images/bare16.png
+A RGraph/images/bn.personal.png
+A RGraph/images/bare8.gif
+A RGraph/images/barj32.png
+A RGraph/images/bari16.png
+A RGraph/images/barb2.png
+A RGraph/images/bn.business.png
+A RGraph/images/barb4.png
+A RGraph/images/barf1.png
+A RGraph/images/barb32.gif
+A RGraph/images/bara16.gif
+A RGraph/images/barb8.png
+A RGraph/images/buy.png
+A RGraph/images/barj2.png
+A RGraph/images/barf32.gif
+A RGraph/images/atom.png
+A RGraph/images/bare16.gif
+A RGraph/images/barj4.png
+A RGraph/images/barj32.gif
+A RGraph/images/sq1.png
+A RGraph/images/bari16.gif
+A RGraph/images/barj8.png
+A RGraph/images/sq3.png
+A RGraph/images/sq5.png
+A RGraph/images/barb2.gif
+A RGraph/images/sq7.png
+A RGraph/images/barb4.gif
+A RGraph/images/barf1.gif
+A RGraph/images/sq9.png
+A RGraph/images/barb8.gif
+A RGraph/images/download-stable.png
+A RGraph/images/analogo.png
+A RGraph/images/delicious.png
+A RGraph/images/barj2.gif
+A RGraph/images/barj4.gif
+A RGraph/images/barj8.gif
+A RGraph/images/index.html
+A RGraph/images/barc1.png
+A RGraph/images/rss_big.png
+A RGraph/images/buzz.png
+A RGraph/captcha.html
+A RGraph/favicon.png
+A RGraph/excanvas
+A RGraph/excanvas/EXCANVAS-LICENSE.txt
+A RGraph/excanvas/excanvas.compressed.js
+A RGraph/excanvas/excanvas.original.js
+A RGraph/excanvas/.htaccess
+A RGraph/excanvas/HTACCESS-SAMPLE
+A RGraph/info.txt
+A RGraph/index.html
+A RGraph/404.html
+A RGraph/.htaccess
+A RGraph/libraries
+A RGraph/libraries/RGraph.skeleton.js
+A RGraph/libraries/RGraph.line.js
+A RGraph/libraries/RGraph.funnel.js
+A RGraph/libraries/RGraph.rscatter.js
+A RGraph/libraries/RGraph.bipolar.js
+A RGraph/libraries/RGraph.vprogress.js
+A RGraph/libraries/RGraph.common.annotate.js
+A RGraph/libraries/RGraph.led.js
+A RGraph/libraries/RGraph.common.tooltips.js
+A RGraph/libraries/RGraph.bar.js
+A RGraph/libraries/RGraph.scatter.js
+A RGraph/libraries/RGraph.rose.js
+A RGraph/libraries/RGraph.common.zoom.js
+A RGraph/libraries/RGraph.common.context.js
+A RGraph/libraries/RGraph.hprogress.js
+A RGraph/libraries/RGraph.hbar.js
+A RGraph/libraries/RGraph.meter.js
+A RGraph/libraries/RGraph.modaldialog.js
+A RGraph/libraries/RGraph.gantt.js
+A RGraph/libraries/RGraph.pie.js
+A RGraph/libraries/RGraph.tradar.js
+A RGraph/libraries/index.html
+A RGraph/libraries/.htaccess
+A RGraph/libraries/RGraph.common.core.js
+A RGraph/libraries/RGraph.common.adjusting.js
+A RGraph/libraries/RGraph.common.resizing.js
+A RGraph/libraries/RGraph.odo.js
+A RGraph/examples
+A RGraph/examples/meter.html
+A RGraph/examples/hprogress.html
+A RGraph/examples/hbar.html
+A RGraph/examples/showcase.html
+A RGraph/examples/pie.html
+A RGraph/examples/gantt.html
+A RGraph/examples/tradar.html
+A RGraph/examples/odo.html
+A RGraph/examples/basic.html
+A RGraph/examples/text.html
+A RGraph/examples/line.html
+A RGraph/examples/funnel.html
+A RGraph/examples/rscatter.html
+A RGraph/examples/bipolar.html
+A RGraph/examples/donut.html
+A RGraph/examples/vprogress.html
+A RGraph/examples/led.html
+A RGraph/examples/bar.html
+A RGraph/examples/scatter.html
+A RGraph/examples/index.html
+A RGraph/examples/rose.html
+A RGraph/examples/.htaccess
+A RGraph/common.php
+Exported revision 1358.
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Resizing your graphs</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ /**
+ * Draw the line chart
+ */
+ var line = new RGraph.Line('myLine', [4,6,3,7,8,4,9,5,6,4,8,5] );
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.title', 'A resizable line chart (tooltips)');
+ line.Set('chart.colors', ['red']);
+ line.Set('chart.resizable', true);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.blur', 5);
+ line.Set('chart.shadow.offsetx', 1);
+ line.Set('chart.shadow.offsety', 1);
+ line.Set('chart.contextmenu', [['Sample!', function () {alert('A sample item');}]]);
+ line.Set('chart.background.grid.autofit', true);
+ line.Set('chart.background.grid.autofit.numhlines', 10);
+ line.Set('chart.linewidth', 3);
+ //line.Set('chart.tooltips', ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']);
+ line.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Resizing your graphs
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Resizing your graphs</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <canvas id="myLine" width="400" height="200" style="float: left">[No canvas support]</canvas>
+
+ <p> </p>
+
+ <p>
+ RGraph has the facility to allow you to resize your graphs. This is new as of 10th April 2010. Because of the
+ numerous events it has to install code on, it is unlikely to work with other dynamic features. The context
+ menu does though, and now that tooltips use DOM2 events, so do they. It can be useful if you are,
+ for example, doing a presentation and need to enlarge the graph.
+ </p>
+
+ <p>
+ All you need to do to enable it is set <i>chart.resizable</i> to true. There are certain caveats that you should be aware of though:
+ </p>
+
+ <br clear="all" />
+
+ <ul>
+ <li>
+ Graphs can only be enlarged down and to the right, so you will get better results if your graph is not placed at the
+ right of the page.
+ </li>
+
+ <li>
+ The minimum you can resize your graphs to is 50% of the original graph width/height.
+ </li>
+
+ <li>
+ <b>Note:</b> Resizing can change the layout of your page (reflows). As such you will need to be careful when laying out your
+ page, and you may need to experiment with things like CSS float:, width, height etc so that the effect is either not apparent
+ or is minimal.
+ </li>
+
+ <li>
+ If your canvas is nested within a table, resizing can result in very minor (1-2px for example) positioning changes. These
+ can be mitigated by turning off table borders, setting the cellspacing to 0 and also setting the cellpadding to 0.
+ </li>
+ </ul>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for personal, |
+ * | charity and educational purposes it is free to use. You can read the full |
+ * | license here: |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - rose chart documentation</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Rose chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Rose chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The example file is <a href="../examples/rose.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [41,37,16,3,3];
+
+ var rose = new RGraph.Rose('myRose', data);
+ rose.Set('chart.labels', ['MSIE 7 (41%)',
+ 'MSIE 6 (37%)',
+ 'Firefox (16%)',
+ 'Safari (3%)',
+ 'Other (3%)']);
+ rose.Draw();
+ }
+</script>
+</pre>
+
+ <a name="available.properties"></a>
+ <ul>
+ <li><a href="#available.properties">Properties</a></li>
+ <li><a href="#available.methods">Methods</a></li>
+ </ul>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the Rose chart appears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myRose.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#axis properties">Axis properties</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter used on the chart<br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.colors"></a>
+<b>chart.colors</b><br />
+ An array of colors to be used by the chart. <br /><i>Default: ['rgb(255,0,0)', 'rgb(0,255,255)', 'rgb(0,255,0)', 'rgb(127,127,127)', 'rgb(0,0,255)', 'rgb(255,128,255)']</i><br /><br />
+ <a name="chart.colors.alpha"></a>
+<b>chart.colors.alpha</b><br />
+ Instead of using <i>rgba()</i>, you can use color definitions such as <i>red</i> along with this setting to add transparency. <br /><i>Default: null</i></i><br /><br />
+<a name="labels and text"></a>
+<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.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points).<br /> <i>Default: 10</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ The labels, if any, for the graph.<br /><i>Default: none</i><br /><br />
+ <a name="chart.labels.axes"></a>
+<b>chart.labels.axes</b><br />
+ This controls the axes that show the scale labels. Each letter stands for the appropriate axis (North, South, East and West)<br /><i>Default: nsew</i><br /><br />
+ <a name="chart.labels.position"></a>
+<b>chart.labels.position</b><br />
+ This can be either <i>center</i> or <i>edge</i> and determines the position of the labels.<br /><i>Default: center</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the chart. <br /><i>Default: none</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+
+<a name="axis properties"></a>
+ <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.ymax"></a>
+ <b>chart.ymax</b><br />
+ This can be set to control the maximum value of the scale. It's so called to maintain a degree of API compatibility across graph libraries.<br /><i>Default: null</i><br /><br />
+
+<a name="scale"></a>
+ <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.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array of tooltips. You can use HTML if you so wish.<br /> <i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The tooltip effect used. Can be either <b>fade</b> or <b>expand</b>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.adjustable"></a>
+<b>chart.adjustable</b><br />
+ Defaulting to false, this determines whether your rose chart will be adjustable (click the edge of a segment and drag to adjust it). <br /><i>Default: false</i><br /><br />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div>
+
+ <a name="available.methods"></a>
+ <br /> <br />
+ <h2>Methods</h2>
+
+ <b>RGraph.getSegment()</b><br /><br />
+
+ RGraph.getSegment() makes it easy to determine which segment of the Rose chart was clicked on. It provides:
+
+ <ul>
+ <li>Originating X coordinate</li>
+ <li>Originating Y coordinate</li>
+ <li>The radius of the segment</li>
+ <li>The starting angle (in degrees)</li>
+ <li>The ending angle (in degrees)</li>
+ </ul>
+
+ <pre class="code">
+<script>
+ RGraph.Register(myGraph);
+
+ myGraph.canvas.onclick = function (e)
+ {
+ RGraph.FixEventObject(e);
+ RGraph.Redraw();
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ <span style="color: green">var segment = RGraph.getSegment(e);</span>
+
+ if (segment) {
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.beginPath();
+
+ // Angles are provided in degrees, so convert them to radians
+ segment[3] /= 57.29;
+ segment[4] /= 57.29;
+
+ context.moveTo(segment[0], segment[1]);
+ context.arc(segment[0], segment[1], segment[2], segment[3], segment[4], 0);
+ context.stroke();
+ context.fill();
+
+ e.stopPropagation();
+ }
+ }
+
+ window.onclick = function (e)
+ {
+ RGraph.Redraw();
+ }
+</script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Radial scatter chart documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs radial scatter chart" />
+ <meta name="description" content="RGraph: Documentation about the Radial scatter chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Radial scatter chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Radial scatter chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Radial scatter graph is, as the name suggests, a circular variant of the scatter graph.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/rscatter.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [
+ [15,53,'red'],
+ [45,63,null, 'The tooltip'],
+ [48,45,'green'],
+ [52,38],
+ [51,61]
+ ];
+
+ var rscatter= new RGraph.Rscatter('myCanvas', data);
+ rscatter.Set('chart.labels', ['NE','E','SE','S','SW','W','NW','N']);
+ rscatter.Set('chart.gutter', 35);
+ rscatter.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the chart appears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myRscatter.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter of the graph. This is the area outside of the X and Y axis - where the labels go. If you're short on space for your labels, try increasing this. <br /><i>Default: 25</i><br /><br />
+<a name="labels and text"></a>
+<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.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size (in points) of the labels. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.labels"></a>
+<b>chart.labels</b><br />
+ The labels, if any, for the graph.<br /><i>Default: none</i><br /><br />
+ <a name="chart.labels.axes"></a>
+<b>chart.labels.axes</b><br />
+ This controls the axes that show the scale labels. Each letter stands for the appropriate axis (North, South, East and West)<br /><i>Default: nsew</i><br /><br />
+ <a name="chart.labels.position"></a>
+<b>chart.labels.position</b><br />
+ This can be either <i>center</i> or <i>edge</i> and determines the position of the labels.<br /><i>Default: center</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the graph, if any. <br /><i>Default: null</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+
+
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.event"></a>
+<b>chart.tooltips.event</b><br />
+ This is the event that triggers the tooltips. It can be either <i>onclick</i> or <i>onmousemove</i>.<br /><i>Default: onclick</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+<br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for personal, |
+ * | charity and educational purposes it is free to use. You can read the full |
+ * | license here: |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - scatter graph documentation</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+ <a name="top"></a>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Scatter graph
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Scatter graph documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ A scatter graph. Used to represent many data points over a period of time. For example, events occurring in a given year.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/scatter.html">here</a>.
+ </p>
+
+ <ul>
+ <li><a href="#properties">Properties</a></li>
+ <li><a href="#boxplots">Box plots</a></li>
+ <li><a href="#labelpoints">Specific points for labels on the X axis</a></li>
+ <li><a href="#custom.tickmarks">Custom tickmarks</a></li>
+ <li><a href="#colors">Note about colors and the key</a></li>
+ </ul>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [
+ [67,78,null, 'The winner!'], [67,40,'red'], [58,12], [78,56], [365,90], [360,300], [320,150], [15,45],
+ [16,43], [84,12], [67,89,'green'], [90,23,'green'], [23,80], [80,66], [55,66], [88,12], [43,45], [61,12],
+ [15,89], [13,16]
+ ];
+ var sg = new RGraph.Scatter('myScatter', data);
+ sg.Set('chart.background.barcolor1','rgba(255,255,255,1)');
+ sg.Set('chart.background.barcolor2', 'rgba(255,255,255,1)');
+ sg.Set('chart.grid.color', 'rgba(238,238,238,1)');
+ sg.Set('chart.gutter', 30);
+ sg.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ sg.Set('chart.xmax', 365); // Important!
+ sg.Draw();
+ }
+</script>
+</pre>
+
+ <p>
+ As you can see each mark on the Scatter chart is made by supplying an array of up to 4 elements:
+ </p>
+
+ <ul>
+ <li>The X value (required)</li>
+ <li>The Y value (required)</li>
+ <li>The color (optional)</li>
+ <li>The tooltip for this mark (optional)</li>
+ </ul>
+
+ <p>
+ 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.
+ </p>
+
+
+ <a name="properties"></a>
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the Scatter apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myScatter.Set('chart.xmax', 365);</b>
+ </p>
+
+ <ul>
+ <li><a href="#background">Background</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#axis properties">Axis properties</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#line properties">Line properties</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ </ul>
+
+
+<a name="background"></a>
+<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>
+<b>chart.background.barcolor1</b><br />
+ The color of the background bars. <br /><i>Default: rgba(0,0,0,0)</i><br /><br />
+ <a name="chart.background.barcolor2"></a>
+<b>chart.background.barcolor2</b><br />
+ The color of the background bars. <br /><i>Default: rgba(0,0,0,0)</i><br /><br />
+ <a name="chart.background.grid"></a>
+<b>chart.background.grid</b><br />
+ Whether to show the background grid or not. <br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.color"></a>
+<b>chart.background.grid.color</b><br />
+ The color of the background grid. <br /><i>Default: #eee</i><br /><br />
+
+ <a name="chart.background.hbars"></a>
+ <b>chart.background.hbars</b><br />
+ An array of information stipulating horizontal coloured bars. You can use these to indicate limits. Eg:
+
+ <pre class="code">myScatter.Set('chart.background.hbars', [[75, 10, 'yellow'], [85, 15, 'red']]);</pre>
+
+ This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the
+ starting point and the height.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.background.vbars</b><br />
+ An array of vertical bar information. They're specified like his:
+ <pre class="code">myScatter.Set('chart.background.vbars', [[0, 181, 'rgba(0,255,0,0.5)']]);</pre>
+ <i>Default: null</i><br /><br />
+
+ <a name="chart.background.grid.border"></a>
+<b>chart.background.grid.border</b><br />
+ Determines whether a border line is drawn around the grid.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.hlines"></a>
+<b>chart.background.grid.hlines</b><br />
+ Determines whether to draw the horizontal grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.vlines"></a>
+<b>chart.background.grid.vlines</b><br />
+ Determines whether to draw the vertical grid lines.<br /><i>Default: true</i><br /><br />
+ <a name="chart.background.grid.autofit"></a>
+<b>chart.background.grid.autofit</b><br />
+ 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 />
+ <a name="chart.background.grid.autofit.numhlines"></a>
+<b>chart.background.grid.autofit.numhlines</b><br />
+ When using autofit this allows you to specify how many horizontal grid lines you want. <br /><i>Default: 7</i><br /><br />
+ <a name="chart.background.grid.autofit.numvlines"></a>
+<b>chart.background.grid.autofit.numvlines</b><br />
+ When using autofit this allows you to specify how many vertical grid lines you want. <br /><i>Default: 20</i><br /><br />
+<a name="labels and text"></a>
+<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>
+<b>chart.labels</b><br />
+ An array of the X labels for the graph. <br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.ylabels"></a>
+<b>chart.ylabels</b><br />
+ A boolean (<i>true</i> or <i>false</i>) that controls whether the graph has Y labels. <br /><i>Default: true</i><br /><br />
+ <a name="chart.ylabels.count"></a>
+<b>chart.ylabels.count</b><br />
+ A value (<i>1, 3 or 5</i>) that controls how many Y labels there are. <br /><i>Default: 5</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points).<br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.angle"></a>
+<b>chart.text.angle</b><br />
+ 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 />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter on the graph (the area outside of the axes). <br /><i>Default: 25</i><br /><br />
+<a name="axis properties"></a>
+<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>
+<b>chart.xmax</b><br />
+ 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 />
+ <a name="chart.ymax"></a>
+<b>chart.ymax</b><br />
+ The optional maximum Y scale value. If not specified then it will be calculated.<br /><i>Default: null (It's calculated)</i><br /><br />
+ <a name="chart.ymin"></a>
+<b>chart.ymin</b><br />
+ The optional minimum Y scale value. If not specified it will be zero.<br /><i>Default: null</i><br /><br />
+ <a name="chart.ticksize"></a>
+<b>chart.ticksize</b><br />
+ The size of the tickmarks. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.tickmarks"></a>
+<b>chart.tickmarks</b><br />
+ 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 />
+ <a name="chart.xticks"></a>
+<b>chart.xticks</b><br />
+ This controls whether the X axis tickmarks are drawn.<br /><i>Default: true</i><br /><br />
+ <a name="chart.xaxispos"></a>
+<b>chart.noendxtick</b><br />
+ Whether to draw an end X tick. Usually used when combining Scatter charts<br /><i>Default: false</i><br /><br />
+ <a name="chart.xaxispos"></a>
+<b>chart.xaxis</b><br />
+ This controls whether the X axis is drawn.<br /><i>Default: true</i><br /><br />
+ <a name="chart.xaxispos"></a>
+<b>chart.xaxispos</b><br />
+ Where the X axis should be drawn. Can be either <i>center</i> or <i>bottom</i>.<br /><i>Default: bottom</i><br /><br />
+ <a name="chart.yaxispos"></a>
+<b>chart.yaxispos</b><br />
+ Where the Y axis should be drawn. Can be either <i>left</i> or <i>right</i>.<br /><i>Default: left</i><br /><br />
+ <a name="chart.yaxispos"></a>
+<b>chart.yaxispos</b><br />
+ Where the Y axis should be drawn. Can be either <i>left</i> or <i>right</i>.<br /><i>Default: left</i><br /><br />
+ <a name="chart.axis.color"></a>
+<b>chart.axis.color</b><br />
+ The color of the axes.<br /><i>Default: black</i><br /><br />
+ <a name="chart.noaxes"></a>
+<b>chart.noaxes</b><br />
+ If this is set to true, no axes will be drawn. <br /><i>Default: false</i><br /><br />
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the scatter graph. <br /><i>Default: none</i><br /><br />
+
+<a name="chart.title.background"></a>
+<b>chart.title.background</b><br />
+The background color (if any) for the title.<br />
+<i>Default: null</i><br /><br />
+
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.xaxis"></a>
+<b>chart.title.xaxis</b><br />
+ This allows to specify a title for the X axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.yaxis"></a>
+<b>chart.title.yaxis</b><br />
+ This allows to specify a title for the Y axis.<br /><i>Default: none</i><br /><br />
+ <a name="chart.title.xaxis.pos"></a>
+<b>chart.title.xaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the X axis title.<br /><i>Default: 0.25</i><br /><br />
+ <a name="chart.title.yaxis.pos"></a>
+<b>chart.title.yaxis.pos</b><br />
+ This is multiplied with the gutter to give the position of the Y axis title.<br /><i>Default: 0.25</i><br /><br />
+
+<a name="scale"></a>
+<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>
+<b>chart.scale.decimals</b><br />
+ The number of decimal places to display for the Y scale.<br /><i>Default: 0</i><br /><br />
+ <a name="chart.scale.point"></a>
+<b>chart.scale.point</b><br />
+ The character used as the decimal point.<br /><i>Default: .</i><br /><br />
+ <a name="chart.scale.thousand"></a>
+<b>chart.scale.thousand</b><br />
+ The character used as the thousand separator<br /><i>Default: ,</i><br /><br />
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+ <a name="chart.units.pre"></a>
+<b>chart.units.pre</b><br />
+ The units (if any) that the Y axis is measured in (these are preppended to the number).<br /><i>Default: none</i><br /><br />
+ <a name="chart.units.post"></a>
+<b>chart.units.post</b><br />
+ The units (if any) that the Y axis is measured in (these are appended to the number).<br /><i>Default: none</i><br /><br />
+
+<a name="interactive features"></a>
+<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>
+
+ <p style="background-color: #ffe; padding: 3px; border: 1px black solid; border-radius: 5px">
+ <b>Note:</b> Unlike other charts, the Scatter chart tooltips are specified as part of the data array. See <a href="#top">above</a>.
+ </p>
+
+ <a name="chart.tooltips.effect"></a>
+ <b>chart.tooltips.effect</b><br />
+ The animated effect used for showing tooltips.<br />
+ <i>Default: fade</i><br /><br />
+
+ <a name="chart.tooltips.hotspot"></a>
+<b>chart.tooltips.hotspot</b><br />
+ This controls the size of the hotspot on the chart for tooltips.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.tooltips.coords.adjust"></a>
+<b>chart.tooltips.coords.adjust</b><br />
+ 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 />
+ <a name="chart.crosshairs"></a>
+<b>chart.crosshairs</b><br />
+ If true, you will get a crosshair centering on the current mouse position.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.linewidth"></a>
+<b>chart.crosshairs.linewidth</b><br />
+ This controls the linewidth of the crosshairs.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.crosshairs.color"></a>
+<b>chart.crosshairs.color</b><br />
+ The color of the crosshairs.<br /><i>Default: #333</i><br /><br />
+ <a name="chart.crosshairs.coords"></a>
+<b>chart.crosshairs.coords</b><br />
+ If true, this will show the coordinates that the crosshairs are currently over.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.fixed"></a>
+<b>chart.crosshairs.fixed</b><br />
+ If true, this makes the coordinates static (attached), instead of following the pointer around.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.fadeout"></a>
+<b>chart.crosshairs.fadeout</b><br />
+ If true, when you move your mouse off of the canvas the coordinates will fade out.<br /><i>Default: false</i><br /><br />
+ <a name="chart.crosshairs.labels.x"></a>
+<b>chart.crosshairs.labels.x</b><br />
+ Instead ox X and Y, you can specify more meaningful labels.<br /><i>Default: X</i><br /><br />
+ <a name="chart.crosshairs.labels.y"></a>
+<b>chart.crosshairs.labels.y</b><br />
+ Instead ox X and Y, you can specify more meaningful labels.<br /><i>Default: Y</i><br /><br />
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ 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 />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ 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 />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="line properties"></a>
+<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>
+<b>chart.line</b><br />
+ Whether to show a connecting line (like in the sixth example). <br /><i>Default: false</i><br /><br />
+ <a name="chart.line.colors"></a>
+<b>chart.line.colors</b><br />
+ The colors of the lines connecting the tick marks. <br /><i>Default: ['green', 'red']</i><br /><br />
+ <a name="chart.line.shadow.color"></a>
+<b>chart.line.shadow.color</b><br />
+ The color of the lines shadow (if any). <br /><i>Default: rgba(0,0,0,0) (invisible)</i><br /><br />
+ <a name="chart.line.shadow.offsetx"></a>
+<b>chart.line.shadow.offsetx</b><br />
+ The X offset of the lines shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.line.shadow.offsety"></a>
+<b>chart.line.shadow.offsety</b><br />
+ The Y offset of the lines shadow. <br /><i>Default: 3</i><br /><br />
+ <a name="chart.line.shadow.blur"></a>
+<b>chart.line.shadow.blur</b><br />
+ The severity of the line shadows blurring effect. <br /><i>Default: 2</i><br /><br />
+ <a name="chart.line.stepped"></a>
+<b>chart.line.stepped</b><br />
+ Like the line chart, Scatter chart lines can be stepped by setting this to true <br /><i>Default: false</i><br /><br />
+
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+
+
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+<a name="miscellaneous"></a>
+<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>
+<b>chart.defaultcolor</b><br />
+ This is the default color of tick marks, which is used if a color isn't given.<br /><i>Default: #000</i><br /><br />
+ <a name="chart.boxplot.width"></a>
+<b>chart.boxplot.width</b><br />
+ This stipulates the default width of boxes. For more on boxplots, see <a href="#boxplots">here</a>.<br /><i>Default: 8</i><br /><br />
+</div><!-- /DOCS --><br /><br />
+
+ <a name="boxplots"></a>
+ <h2>Box plots</h2>
+
+ <p>
+ 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.
+ The <a href="../examples/scatter.html#boxplots">example page shows a box plot</a>. These values are (in order):
+
+ <ul>
+ <li>Lower whisker</li>
+ <li>Bottom of box</li>
+ <li>Middle value (which isn't necessarily in the center of the box - this depends on your data)</li>
+ <li>Top of box</li>
+ <li>Upper whisker</li>
+ <li>Upper color (optional)</li>
+ <li>Lower color (optional)</li>
+ <li>Width (optional)</li>
+ </ul>
+
+ <pre class="code">
+<script>
+ scatter8 = new RGraph.Scatter('scatter8', [
+ [10,<span style="color: green">[1,1,16,24,24, 'red', 'green']</span>],
+ [105,<span style="color: green">[5,10,15,25,25, 'red', 'green']</span>],
+ [125,<span style="color: green">[10,15,25,35,45, 'red', 'green']</span>],
+ [325,<span style="color: green">[10,15,25,35,45, 'red', 'green', 30]</span>]
+ ]);
+ scatter8.Set('chart.title', 'An example of a boxplot');
+ scatter8.Set('chart.labels', ['Q1', 'Q2', 'Q3', 'Q4']);
+ scatter8.Set('chart.xmax', 365);
+ scatter8.Set('chart.ymax', 50);
+ scatter8.Set('chart.boxplot.width', 12); // The default width
+ scatter8.Draw();
+</script>
+</pre>
+ </p>
+
+
+ <a name="labelpoints"></a>
+ <h2>Specific points for labels on the X axis</h2>
+
+ <p>
+ Instead of a simple string which is used as the label, each entry of the chart.labels array can be a two element array
+ consisting of the label, and the X value that the label should be placed at. For example:
+ </p>
+
+ <pre class="code">
+scatter.Set('chart.labels', [
+ ['Quarter 1', 0],
+ ['Quarter 2', 90],
+ ['Quarter 3', 181],
+ ['Quarter 4', 273]
+ ]);
+</pre>
+
+
+
+ <a name="custom.tickmarks"></a>
+ <h2>Custom tickmarks</h2>
+
+ <p>
+ If none of the available tickmark styles are suitable, you can instead specify a function object that draws the tickmark,
+ enabling you to draw the tickmark yourself. For example:
+ </p>
+
+ <pre class="code">
+<script>
+ line.Set('chart.tickmarks', myTick);
+
+ /**
+ * The function that is called once per tickmark, to draw it
+ *
+ * @param object obj The graph object
+ * @param object data The graph data
+ * @param number x The X coordinate
+ * @param number y The Y coordinate
+ * @param number xVal The X value
+ * @param number yVal The Y value
+ * @param number xMax The maximum X scale value
+ * @param number xMax The maximum Y scale value
+ * @param string color The color of the tickmark
+ */
+ function myTick (obj, data, x, y, xVal, yVal, xMax, yMax, color)
+ {
+ // Draw your custom tick here
+ }
+</script>
+</pre>
+
+ <a name="colors"></a>
+ <h2>Note about colors and the key</h2>
+
+ <p>
+ 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:
+ </p>
+
+ <pre class="code">myObj.Set('chart.line.colors', ['red','green','blue']);</pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - API documentation</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs api" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about the RGraph API" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ The RGraph.SetConfig() function
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - The RGraph.SetConfig() function</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+
+ <div style="text-align: center; float: right; font-family: Verdana">
+ <b>A graph showing RGraph.SetConfig()</b><br />
+ <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+ </div>
+
+ <script>
+ window.onload = function ()
+ {
+ var config = {
+ 'chart.colors': ['red', 'green'],
+ 'chart.labels': ['John','Fred','June','Charles','Lou', 'Olga'],
+ 'chart.title.yaxis': 'Amount',
+ 'chart.title.yaxis.pos': -0.2,
+ 'chart.title.xaxis': 'Person',
+ 'chart.background.grid.autofit': true,
+ 'chart.strokestyle': 'rgba(0,0,0,0)'
+ }
+ var bar = new RGraph.Bar('cvs', [48,56,52,49,43,51]);
+ RGraph.SetConfig(bar, config);
+ bar.context.translate(20,-20);
+ bar.Draw();
+ }
+ </script>
+
+ <p>
+ Instead of using a number of .Set() calls, you may find that using the <i>RGraph.SetConfig()</i> method more to your tastes. The
+ method is an alternative to setting the configuration of your graph. It can also facilitate reuse better, so that the
+ appearance of all of your websites charts is the same. There's an example of its use below:
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ /**
+ * This configuration could be stored in a central configuration file, making its reuse easier. You could also have
+ * several different configurations that you pick and choose from depending on the requirements. Values in
+ * subsequent calls to .SetConfig() will overwrite previous ones.
+ */
+ var config = {
+ 'chart.colors': ['red', 'green'],
+ 'chart.labels': ['John','Fred','June','Charles','Lou', 'Olga'],
+ 'chart.title.yaxis': 'Amount',
+ 'chart.title.yaxis.pos': -0.2,
+ 'chart.title.xaxis': 'Person',
+ 'chart.background.grid.autofit': true
+ }
+ var bar = new RGraph.Bar('cvs', [48,56,52,49,43,51]);
+ RGraph.SetConfig(bar, config);
+ bar.context.translate(20,-20);
+ bar.Draw();
+ }
+</script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Tooltips</title>
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js"></script>
+ <script src="../libraries/RGraph.common.tooltips.js"></script>
+ <script src="../libraries/RGraph.line.js"></script>
+ <script src="../libraries/RGraph.bar.js"></script>
+ <script src="../libraries/RGraph.pie.js"></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ .bar_chart_tooltips_css {
+ background-color: white ! important;
+ border: 2px solid black ! important;
+ padding: 3px;
+ -webkit-box-shadow: 0 0 15px gray ! important;
+ -moz-box-shadow: 0 0 15px gray ! important;
+ box-shadow: 0 0 15px gray ! important;
+ }
+ </style>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Tooltips
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Tooltips</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div style="float: right; text-align: right">
+ <canvas width="600" height="250" id="cvs">[No canvas support]</canvas><br />
+ Tooltip effect:
+ <select id="effect" onchange="RGraph.Clear(line.canvas); line.Set('chart.tooltips.effect', this.options[this.selectedIndex].value); line.Draw();">
+ <option>none</option>
+ <option selected>fade</option>
+ <option>expand</option>
+ <option>contract</option>
+ <option>snap</option>
+ </select>
+ </div>
+
+ <script>
+ /**
+ * This is the function which handles the display of all the tooltips (for the line chart) - it is passed the
+ * zero-indexed number of the tooltip. Here, that index is just used to get the text from an array, but you
+ * could do anything with it. You could even perform an AJAX request to get the tooltip. Note that at this
+ * point, ie when the text is being retrieved, the tooltip DIV doesn't exist yet.
+ */
+ function myTooltipFunc (idx)
+ {
+ var tooltips = ['<b>Winner!</b><br />John','Fred','Jane','Lou','Pete','Kev'];
+ return tooltips[idx];
+ }
+
+
+ window.onload = function ()
+ {
+ // Has to be a global variable
+ line = new RGraph.Line('cvs', [64,34,26,35,51,24]);
+
+ /**
+ * These lines show you some of the alternative methods of specifying tooltips:
+ *
+ * o An array of strings - one per tooltip
+ * o An array of functions - one per tooltip
+ * o A single function that handles all of the tooltips
+ * o An "id:xxx" string (xxx being the ID tag of a div whose contents are used as the tooltip)
+ *
+ * Functions are passed a single argument - the zero-indexed number of the tooltip
+ */
+ //line.Set('chart.tooltips', ['John', 'Fred', 'Jane', 'Lou', 'Pete', 'Kev']);
+ //line.Set('chart.tooltips', [myTooltipFunc, myTooltipFunc, myTooltipFunc, myTooltipFunc, myTooltipFunc, myTooltipFunc]);
+ line.Set('chart.tooltips', myTooltipFunc);
+ line.Set('chart.tooltips.effect', 'fade');
+ line.Set('chart.gutter', 30);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Set('chart.colors', ['green']);
+ line.Set('chart.tickmarks', 'circle');
+ line.Set('chart.labels', ['John', 'Fred', 'Jane', 'Lou', 'Pete', 'Kev']);
+ line.Draw();
+
+
+ /* -------------------------------------------------------------------------------------------------------- */
+
+
+ /**
+ * Create and display the bar chart
+ */
+ bar = new RGraph.Bar('cvs2', [41.2,51.3,64.2,42.1,32.2,43.2,45.8,45.1,61.1]);
+
+ var gradient = bar.context.createLinearGradient(0,25,0,225);
+ gradient.addColorStop(1, 'white');
+ gradient.addColorStop(0, 'blue');
+
+ bar.Set('chart.hmargin', 15);
+ bar.Set('chart.colors', [gradient]);
+ bar.Set('chart.linewidth', 2);
+ bar.Set('chart.tickmarks', 'endsquare');
+ bar.Set('chart.labels', ['John', 'Pete', 'Glynn', 'Kev', 'Youssef', 'Lou', 'Kiff', 'Liz', 'Fred']);
+ bar.Set('chart.background.grid.autofit', true);
+ bar.Set('chart.strokecolor', 'rgba(0,0,0,0)');
+ bar.Set('chart.tooltips', getTooltip); // The getTooltip() function (defined below) provides the tooltip text ONLY
+ bar.Set('chart.tooltips.css.class', 'bar_chart_tooltips_css');
+ bar.Set('chart.tooltips.effect', 'fade');
+ bar.Draw();
+
+ /**
+ * This installs the RGraph ontooltip event handler. The CreateTooltipGraph() function is defined below
+ */
+ RGraph.AddCustomEventListener(bar, 'ontooltip', CreateTooltipGraph);
+ }
+
+
+ /*
+ * Used by the bar chart to get the tooltip text.
+ *
+ * @param idx int The zero indexed number of the tooltip
+ */
+ function getTooltip(idx)
+ {
+ return '<b>' + bar.Get('chart.labels')[idx] + 's stats:</b><br /><canvas id="__tooltip_canvas__" width="400" height="150" style="background-color: white; margin: 5px">[No canvas support</canvas>';
+ }
+
+
+ /**
+ * This is the function that is called (by the ontooltip event) to create the tooltip charts
+ *
+ * @param obj object The graph object
+ */
+ function CreateTooltipGraph(obj)
+ {
+ // These are the statistics that are shown in the tooltips. This data could quite easily
+ // come from your server.
+ var stats = [
+ [5,8,7,6,9,5,4,6,3,5,4,4],
+ [4,6,7,8,6,5,4,4,2,5,8,4],
+ [3,2,1,3,4,5,1,5,6,7,4,1],
+ [3,5,1,2,4,8,9,6,7,4,5,1],
+ [9,6,7,8,7,9,4,5,6,3,5,8],
+ [4,8,5,6,4,3,5,4,6,5,7,8],
+ [4,3,4,9,8,7,8,6,4,3,5,1],
+ [1,2,3,1,2,4,5,1,6,5,3,1],
+ [2,3,5,4,3,5,1,3,5,2,6,4]
+ ];
+
+ var idx = RGraph.Registry.Get('chart.tooltip').__index__;
+ var data = stats[idx];
+
+ // This data could be dynamic
+ var g = new RGraph.Line('__tooltip_canvas__', data);
+ g.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ g.Set('chart.gutter', 20);
+ g.Set('chart.hmargin', 5);
+ g.Set('chart.tickmarks', 'endcircle');
+ g.Set('chart.background.grid.autofit', true);
+ g.Draw();
+ }
+
+
+ </script>
+
+ <ul>
+ <li><a href="#introduction">Introduction</a></li>
+ <li><a href="#hold">What can they hold?</a></li>
+ <li><a href="#how">How can I specify them?</a></li>
+ <li><a href="#what">What can I specify?</a></li>
+ <li><a href="#graphs">Can I show graphs in tooltips?</a></li>
+ <li><a href="#customise">Can I customise the appearance of tooltips?</a></li>
+ <li><a href="#effects">What tooltip effects are available?</a></li>
+ <li><a href="#firefox">Tooltips, the clipboard and Firefox</a></li>
+ <li><a href="#override">Can I override the tooltip function?</a></li>
+ </ul>
+
+ <a name="introduction"></a>
+ <h4>Introduction</h4>
+
+ <p>
+ Tooltips are a very effective and straight forward way to extend your graphs and add more information to them, without overloading
+ the user.
+ </p>
+
+ <a name="hold"></a>
+ <h4>What can they hold?</h4>
+
+ <p>
+ At the base level, tooltips are DIVs, so they can hold a multitude of HTML - images, videos etc. See <a href="#graphs">below</a>
+ for information on showing graphs in tooltips.
+ </p>
+
+ <a name="how"></a>
+ <h4>How can I specify them?</h4>
+
+ <p>
+ You can specify them by including the tooltips code and then using the <i>chart.tooltips</i> property. For example:
+ </p>
+
+ <ol>
+ <li>
+ Include the RGraph libraries.
+ <pre class="code">
+<script src="RGraph.common.core.js"></script>
+<script src="RGraph.common.tooltips.js"></script>
+<script src="RGraph.line.js"></script>
+</pre>
+ </li>
+
+ <li>
+ Define your graph and set the tooltips property.
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var line = new RGraph.Line('cvs', [64,34,26,35,51,24]);
+ <span style="color: green">line.Set('chart.tooltips', ['<b>Winner!</b><br />John', 'Fred', 'Jane', 'Lou', 'Pete', 'Kev']);</span>
+ line.Set('chart.tooltips.effect', 'expand');
+ line.Set('chart.gutter', 30);
+ line.Set('chart.hmargin', 10);
+ line.Set('chart.linewidth', 2);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.color', 'green');
+ line.Set('chart.shadow.blur', 25);
+ line.Set('chart.colors', ['green']);
+ line.Set('chart.tickmarks', 'circle');
+ line.Set('chart.labels', ['John', 'Fred', 'Jane', 'Lou', 'Pete', 'Kev']);
+ line.Draw();
+ }
+</script>
+</pre>
+ </li>
+ </ol>
+
+ <a name="what"></a>
+ <h4>What can I specify?</h4>
+
+ <p>
+ The tooltips that you specify are usually strings (which can contain HTML). They can however also be functions which are called when they're about
+ to be displayed. The function should return the text that is used as the tooltip. You have the option to either specify
+ one function per data point, or just one function for all of the tooltips. You can mix functions and strings if you wish.
+ These functions are passed the numerical, zero-indexed tooltip index and the return value is used as the tooltip
+ text. So to summarise:
+ </p>
+
+ <ul>
+ <li>
+ An array of strings. The string is used as the tooltip. Eg:
+ <pre class="code">myGraph.Set('chart.tooltips', ['John', 'Fred', 'Lou']);</pre>
+ </li>
+
+ <li>
+ An array of function objects. Each function is called and should return the text to be used. Eg:
+ <pre class="code">myGraph.Set('chart.tooltips', [getJohnTooltip, getFredTooltip, getLouTooltip]);</pre>
+ </li>
+
+ <li>
+ A single function object. This is probably the most useful. This function is called whenever a tooltip
+ is about to be displayed, and passed the numerical, zero-indexed tooltip index of the graph. The function should
+ return the text to be used as the tooltip. Note that the function you specify is called <i>before</i>
+ the tooltip DIV has been created, so you cannot access it. If you wish to customise the appearance
+ of the tooltip, you can use either the tooltip <a href="css.html">CSS class</a> or a call to <i>setTimeout()</i>. Eg:
+ <pre class="code">myGraph.Set('chart.tooltips', getTooltip);</pre>
+ </li>
+
+ <li>
+ An array of DIV ids. This will make working with large tooltips easier. You basically specify the id of a DIV whose
+ .innerHTML is then used as the tooltip. Only the contents of the DIV are used, not the DIV itself, so you can hide
+ the DIV by setting its <i>display</i> CSS value to <i>none</i>. An example of this in action is the
+ <a href="../examples/line.html">first line chart</a>. For example:
+
+ <pre class="code">myBar.Set('chart.tooltips', ['id:myDiv', ...])</pre>
+ </li>
+ </ul>
+
+ <a name="graphs"></a>
+ <h4>Can I show graphs in tooltips?</h4>
+
+ <canvas style="float: right" id="cvs2" width="600" height="250">[No canvas support]</canvas>
+
+ <p>
+ You can, and with the custom event support that RGraph has (as of 10th July 2010), it's reasonably easy. Simply attach your function that
+ creates the graph to the <i>ontooltip</i> event. This allows the tooltip HTML to be created and added to the page
+ so that the code that creates the graph can run. The sequence is:
+ </p>
+
+ <ol>
+ <li style="margin-top: 0">Specify the HTML for the tooltip as normal (including the <canvas> tag).</li>
+ <li style="margin-top: 0">Use the <i>ontooltip</i> RGraph event so that a function is called when a tooltip is shown.</li>
+ <li style="margin-top: 0">This function should subsequently create the graph.</li>
+ </ol>
+
+ <p>
+ The tooltip DIV is to be found in the RGraph registry - <i>RGraph.Registry.Get('chart.tooltip')</i>. And if you want it the
+ numerical zero indexed count of the tooltip is to be found in the <i>__index__</i> property:
+ <i>RGraph.Registry.Get('chart.tooltip').__index__</i>
+ </p>
+
+ <pre class="code">
+<script src="RGraph.common.core.js" ></script>
+<script src="RGraph.common.tooltips.js" ></script>
+<script src="RGraph.bar.js" ></script>
+<script src="RGraph.line.js" ></script>
+
+<style>
+ .RGraph_tooltip {
+ background-color: white ! important;
+ }
+</style>
+
+<canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+
+<script>
+ window.onload = function ()
+ {
+ labels = ['Gary','Pete','Lou','Ned','Kev','Fred'];
+
+ bar = new RGraph.Bar("cvs", [4.5,28,13,26,35,36]);
+ bar.Set('chart.tooltips', function (idx) {return labels[idx] + 's stats<br/><canvas id="__tooltip_canvas__" width="400" height="150">[No canvas support]</canvas>';});
+ bar.Set('chart.hmargin', 10);
+ bar.Set('chart.tickmarks', 'endcircle');
+ bar.Set('chart.colors', ['blue']);
+ bar.Set('chart.ymax', 100);
+ bar.Set('chart.gutter', 30);
+ bar.Set('chart.labels', labels);
+ bar.Draw();
+
+ <span style="color: green">RGraph.AddCustomEventListener(line, 'ontooltip', CreateTooltipGraph);</span>
+ }
+
+
+ <span style="color: green">
+ /**
+ * This is the function that is called by the ontooltip event to create the tooltip charts
+ *
+ * @param obj object The graph object
+ */
+ function CreateTooltipGraph(obj)
+ {
+ // This data could be dynamic
+ var line = new RGraph.Line('__tooltip_canvas__', [5,8,7,6,9,5,4,6,3,5,4,4]);
+ line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line.Set('chart.gutter', 20);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.tickmarks', 'endcircle');
+ line.Set('chart.background.grid.autofit', true);
+ line.Draw();
+ }
+ </span>
+</script>
+</pre>
+
+ <p>
+ If you want to see more source code, simply view the source of this page and look at the code that creates the bar chart.
+ </p>
+
+ <br clear="all" />
+
+ <a name="customise"></a>
+ <h4>Can I customise the appearance of tooltips?</h4>
+
+ <p>
+ Yes. You can either use the default CSS class <i>RGraph_tooltip</i>, or you can specify a specific CSS class that a
+ graphs tooltips should use with the property <i>chart.tooltips.css.class</i>. The two graphs on this page have
+ different looking tooltips by using this method - the line graph uses the default look, whilst the bar chart
+ overrides the CSS class name and sets it to <i>bar_chart_tooltips_css</i>. For example:
+ </p>
+
+ <pre class="code">bar.Set('chart.tooltips.css.class', 'bar_chart_tooltips_css');</pre>
+
+ <pre class="code">
+<style>
+ .bar_chart_tooltips_css {
+ background-color: white ! important;
+ border: 2px solid black ! important;
+ padding: 3px;
+ }
+</style>
+</pre>
+
+ <p>
+ You can read more about RGraph CSS classes <a href="css.html">here</a>.
+ </p>
+
+ <a name="effects"></a>
+ <h4>What tooltip effects are available?</h4>
+
+ <p>
+ These effects are available to you:
+ </p>
+
+ <ul>
+ <li>fade</li>
+ <li>expand</li>
+ <li>contract</li>
+ <li>snap</li>
+ <li>none</li>
+ </ul>
+
+ <p>
+ All of them are as their names imply. <i>fade</i> is a straight forward fade in effect, <i>expand</i> is another effect
+ which expands outward from the center of the tooltip, <i>contract</i> is like the <i>expand</i> effect but in reverse, <i>snap</i> is an effect which can be used in a limited set of circumstances
+ and "snaps" to the current mouse position and <i>none</i> is simply no effect at all. The default effect used
+ by all graph types is <i>fade</i>. Note: If you're showing canvases in your tooltips then the <i>expand</i>, <i>contract</i> and <i>snap</i>
+ effects will not work - you must use <i>fade</i> or <i>none</i>.
+ </p>
+
+ <p>
+ <b>Note:</b> The snap effect is only available to graph types where the tooltip is triggered using the onmousemove event.
+ Currently this means the <i>Line chart</i>, <i>Rscatter graph</i>, <i>Scatter graph</i> and Tradar chart. It can also
+ be negatively effected when using multiple graphs on one page.
+ </p>
+
+
+ <a name="firefox"></a>
+ <h4>Tooltips, the clipboard and Firefox</h4>
+
+ <p>
+ If you're using Firefox, there's a note about tooltips and the clipboard (ie copying text) on the <a href="issues.html">issues page</a>.
+ </p>
+
+ <a name="override"></a>
+ <h4>Can I override the tooltip function?</h4>
+
+ <p>
+ You can by stipulating <i>chart.tooltips.override</i>. This should be a function object that handles everything with regard
+ to showing the tooltip. Highlighting the graph is still done for you - the override function is only concerned with showing
+ the tooltip. The override function is passed these arguments:
+ </p>
+
+ <ul>
+ <li>canvas - The HTML canvas element, the same as what you get from document.getElementById()</li>
+ <li>text - The tooltip text (id:xxx strings are NOT expanded)</li>
+ <li>x - The X coordinate in relation to the entire page</li>
+ <li>y - The Y coordinate in relation to the entire page</li>
+ <li>index - The numerical index of the tooltip in the original tooltip array</li>
+ </ul>
+
+ <p>
+ <b>Note:</b> Although "id:xxx" strings are not expanded for you, you can easily do this yourself by using the
+ <i>RGraph.getTooltipText('id:xxx')</i> function.
+ </p>
+
+ <pre class="code">
+<script>
+ function tooltip_override (canvas, text, x, y, idx)
+ {
+ alert('In tooltip override function...');
+ }
+ myObj.Set('chart.tooltips.override', tooltip_override);
+</script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for personal, |
+ * | charity and educational purposes it is free to use. You can read the full |
+ * | license here: |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Traditional radar chart documentation</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Traditional radar chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Traditional radar chart documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ A traditional radar chart.
+ </p>
+
+ <p>
+ The example file is <a href="../examples/tradar.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var data = [3, 3, 41, 37, 16];
+
+ var tradar = new RGraph.Tradar('myTradar', data);
+ tradar.Set('chart.background.circles', true);
+ tradar.Set('chart.color', 'rgba(255,0,0,0.5)');
+ tradar.Set('chart.circle', 20);
+ tradar.Set('chart.circle.fill', 'rgba(200,255,200,0.5)');
+ tradar.Set('chart.labels', ['Safari (3%)', 'Other (3%)', 'MSIE 7 (41%)', 'MSIE 6 (37%)', 'Firefox (16%)']);
+ tradar.Set('chart.key', ['Market share', 'A made up figure']);
+ tradar.Draw();
+ }
+</script>
+</pre>
+
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the chart apears. You can set these properties by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myTradar.Set('color', 'rgba(255,0,0,0.5)');</b>
+ </p>
+
+ <ul>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#title">Title</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#miscellaneous">Miscellaneous</a></li>
+ <li><a href="#key">Key</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The gutter that the chart uses. This is effectively the margin.<br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.color"></a>
+<b>chart.color</b><br />
+ The color of the radar chart.<br /><i>Default: rgba(255,0,0,0.5)</i><br /><br />
+<a name="title"></a>
+<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">Title</h3> <a name="chart.title"></a>
+<b>chart.title</b><br />
+ The title, if any, of the chart.<br /><i>Default: Not set</i><br /><br />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+<a name="labels and text"></a>
+<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>
+<b>chart.labels</b><br />
+ The labels to use for the chart.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.labels.axes"></a>
+<b>chart.labels.axes</b><br />
+ This controls the axes that show the scale labels. Each letter stands for the appropriate axis (North, South, East and West)<br /><i>Default: nsew</i><br /><br />
+ <a name="chart.labels.offsetx"></a>
+<b>chart.labels.offsetx</b><br />
+ The X pixel offset for the labels.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.labels.offsety"></a>
+<b>chart.labels.offsety</b><br />
+ The Y pixel offset for the labels.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points).<br /><i>Default: 10</i><br /><br />
+<a name="scale"></a>
+
+<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.ymax"></a>
+ <b>chart.ymax</b><br />
+ The optional maximum Y scale value. If not specified then it will be calculated.<br /><i>Default: null (It's calculated)</i><br /><br />
+
+ <a name="chart.scale.round"></a>
+ <b>chart.scale.round</b><br />
+ Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.<br />
+ <i>Default: null</i><br /><br />
+
+<a name="miscellaneous"></a>
+<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.background.circles"></a>
+<b>chart.background.circles</b><br />
+ Whether to draw the grey background circles.<br /><i>Default: true</i><br /><br />
+ <a name="chart.linewidth"></a>
+<b>chart.linewidth</b><br />
+ The width of the outline.<br /><i>Default: 1</i><br /><br />
+ <a name="chart.circle"></a>
+<b>chart.circle</b><br />
+ What value to draw a circle at. Defaults to zero (off). You could use this to represent a threshold of some sort.<br /><i>Default: 0</i><br /><br />
+ <a name="chart.circle.fill"></a>
+<b>chart.circle.fill</b><br />
+ What color to fill the circle with.<br /><i>Default: red</i><br /><br />
+ <a name="chart.circle.stroke"></a>
+<b>chart.circle.stroke</b><br />
+ What color to stroke (ie The outline) the circle with.<br /><i>Default: black</i><br /><br />
+
+
+
+
+
+
+ <a name="key"></a>
+ <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>
+
+ <a name="chart.key"></a>
+ <b>chart.key</b><br />
+ An array of key information. <br />
+ <i>Default: [] (An empty array)</i><br /><br />
+
+ <a name="chart.key.background"></a>
+ <b>chart.key.background</b><br />
+ 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>
+ <i>Default: white</i><br /><br />
+
+ <a name="chart.key.position"></a>
+ <b>chart.key.position</b><br />
+ Determines the position of the key.Either <b>graph</b> (default), or <b>gutter</b>.<br />
+ <i>Default: graph</i><br /><br />
+
+ <b>chart.key.position.x</b><br />
+ This allows you to specify a specific X coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.y</b><br />
+ This allows you to specify a specific Y coordinate for the key.<br />
+ <i>Default: null</i><br /><br />
+
+ <b>chart.key.position.gutter.boxed</b><br />
+ If you have the key in gutter mode (ie horizontal), this allows you to give a background color.<br />
+ <i>Default: true</i><br /><br />
+
+ <a name="chart.key.shadow"></a>
+ <b>chart.key.shadow</b><br />
+ Whether a small drop shadow is applied to the key.<br />
+ <i>Default: false</i><br /><br />
+
+ <a name="chart.key.shadow.color"></a>
+ <b>chart.key.shadow.color</b><br />
+ The color of the shadow.<br />
+ <i>Default: #666</i><br /><br />
+
+ <a name="chart.key.shadow.blur"></a>
+ <b>chart.key.shadow.blur</b><br />
+ The extent of the blurring effect used on the shadow.<br />
+ <i>Default: 3</i><br /><br />
+
+ <a name="chart.key.shadow.offsetx"></a>
+ <b>chart.key.shadow.offsetx</b><br />
+ The X offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <a name="chart.key.shadow.offsety"></a>
+ <b>chart.key.shadow.offsety</b><br />
+ The Y offset of the shadow.<br />
+ <i>Default: 2</i><br /><br />
+
+ <b>chart.key.rounded</b><br />
+ This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.<br />
+ <i>Default: false</i><br /><br />
+
+ <b>chart.key.color.shape</b><br />
+ This can be <i>square</i>, <i>circle</i> or <i>line</i> and controls how the color indicators in the key appear.<br />
+ <i>Default: square</i><br /><br />
+
+
+
+
+
+
+
+<a name="interactive features"></a>
+<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> <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ A numerically indexed array of tooltips that are shown when a hotspot is hovered over. These can contain HTML.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The visual effect used when showing tooltips. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+ <a name="chart.tooltips.override"></a>
+<b>chart.tooltips.override</b><br />
+ 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 />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+<a name="zoom"></a>
+<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>
+<b>chart.zoom.mode</b><br />
+ 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 />
+ <a name="chart.zoom.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.thumbnail.width"></a>
+<b>chart.zoom.thumbnail.width</b><br />
+ When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.thumbnail.height"></a>
+<b>chart.zoom.thumbnail.height</b><br />
+ When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for personal, |
+ * | charity and educational purposes it is free to use. You can read the full |
+ * | license here: |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - progress bar documentation</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="/favicon.png">
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Vertical Progress bar
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Vertical Progress bar documentation</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The example file is <a href="../examples/vprogress.html">here</a>.
+ </p>
+
+ <pre class="code">
+<script>
+ window.onload = function ()
+ {
+ var myProgress = new RGraph.VProgess('myProgress', 78, 100);
+ myProgress.Set('chart.colors', ['red']);
+ myProgress.Draw();
+ }
+</script>
+</pre>
+
+ <h2>Properties</h2>
+
+ <p>
+ You can use these properties to control how the progress bar apears. You can set them by using the Set() method. Eg:
+ </p>
+
+ <p>
+ <b>myProgress.Set('name', 'value');</b>
+ </p>
+
+ <ul>
+ <li><a href="#chart configuration">Chart configuration</a></li>
+ <li><a href="#margins">Margins</a></li>
+ <li><a href="#colors">Colors</a></li>
+ <li><a href="#shadow">Shadow</a></li>
+ <li><a href="#labels and text">Labels and text</a></li>
+ <li><a href="#scale">Scale</a></li>
+ <li><a href="#titles">Titles</a></li>
+ <li><a href="#interactive features">Interactive features</a></li>
+ <li><a href="#zoom">Zoom</a></li>
+ </ul>
+
+
+<a name="chart configuration"></a>
+<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">Chart configuration</h3> <a name="chart.tickmarks"></a>
+<b>chart.tickmarks</b><br />
+ Whether the tickmarks are drawn. <br /><i>Default: true</i><br /><br />
+
+ <a name="chart.labels.count"></a>
+ <b>chart.labels.count</b><br />
+ This controls how many labels there are.
+ <br /><i>Default: 10</i><br /><br />
+
+ <a name="chart.tickmarks.color"></a>
+<b>chart.tickmarks.color</b><br />
+ The color used for tickmarks.<br /><i>Default: black</i><br /><br />
+
+ <a name="chart.tickmarks.inner"></a>
+<b>chart.tickmarks.inner</b><br />
+ This controls whether the bar has inner tickmarks<br /><i>Default: false</i><br /><br />
+
+ <a name="chart.value"></a>
+ <b>chart.value</b><br />
+ The indicated value. You don't need to set this because it's one of the arguments to the constructor.<br />
+ <i>Default: none (An argument to the constructor)</i>
+ <br /><br />
+
+ <a name="chart.min"></a>
+ <b>chart.min</b><br />
+ The minimum value. Setting a minimum value allows to show a more detailed progress bar.<BR />
+ <i>Default: 0</i><br /><br />
+
+ <a name="chart.max"></a>
+ <b>chart.max</b><br />
+ The maximum value. You don't need to set this because it's one of the arguments to the constructor.<br /><br />
+
+ <a name="chart.numticks"></a>
+<b>chart.numticks</b><br />
+ How many tick marks there are. <br /><i>Default: 10</i><br /><br />
+ <a name="chart.numticks.inner"></a>
+<b>chart.numticks.inner</b><br />
+ How many inner tick marks there are. <br /><i>Default: 50</i><br /><br />
+ <a name="chart.arrows"></a>
+<b>chart.arrows</b><br />
+ This stipulates that two indicator arrows are drawn. It works best if you have tickmarks off, and no title.<br><i>Default: false</i><br /><br />
+<a name="margins"></a>
+<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>
+<b>chart.gutter</b><br />
+ The size of the gutter. <br /><i>Default: 25</i><br /><br />
+<a name="colors"></a>
+<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">Colors</h3> <a name="chart.color"></a>
+<b>chart.color</b><br />
+ The color of the bar. This can be a solid color, or a gradient that you create. <br /><i>Default: #0c0</i><br /><br />
+ <a name="chart.background.color"></a>
+<b>chart.background.color</b><br />
+ The background color. <br /><i>Default: #eee</i><br /><br />
+<a name="shadow"></a>
+<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">Shadow</h3> <a name="chart.shadow"></a>
+<b>chart.shadow</b><br />
+ Whether the progress bar has a shadow. This uses the canvas shadow API and therefore is only supported on Chrome 2, Safari 3.1 and Firefox 3.1 (and above).<br /><i>Default: false</i><br /><br />
+ <a name="chart.shadow.offsetx"></a>
+<b>chart.shadow.offsetx</b><br />
+ The X offset of the progress bar shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.offsety"></a>
+<b>chart.shadow.offsety</b><br />
+ The Y offset of the progress bar shadow.<br /><i>Default: 3</i><br /><br />
+ <a name="chart.shadow.color"></a>
+<b>chart.shadow.color</b><br />
+ The color of the shadow.<br /><i>Default: rgba(0,0,0,0.5)</i><br /><br />
+ <a name="chart.shadow.blur"></a>
+<b>chart.shadow.blur</b><br />
+ The blurring effect that is applied to the shadow.<br /><i>Default: 3</i><br /><br />
+<a name="labels and text"></a>
+<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.text.font"></a>
+<b>chart.text.font</b><br />
+ The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
+ <a name="chart.text.color"></a>
+<b>chart.text.color</b><br />
+ The color of the labels. <br /><i>Default: black</i><br /><br />
+ <a name="chart.text.size"></a>
+<b>chart.text.size</b><br />
+ The size of the text (in points). <br /><i>Default: 10</i><br /><br />
+
+ <a name="chart.labels"></a>
+ <b>chart.labels</b><br />
+ Labels that are applied to the graph. <br /><i>Default: An empty array</i><br /><br />
+
+ <a name="chart.labels.position"></a>
+ <b>chart.labels.position</b><br />
+ Can be <i>left</i> or <i>right</i> and controls which side the labels are positioned on.<br />
+ <i>Default: right</i><br /><br />
+
+
+<a name="scale"></a>
+<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.units.pre"></a>
+ <b>chart.units.pre</b><br />
+ The units that the Y scale is measured in (these are preppend to the number). <br /><i>Default: none</i><br /><br />
+
+ <a name="chart.units.post"></a>
+ <b>chart.units.post</b><br />
+ The units that the Y scale is measured in (these are appended to the number). <br /><i>Default: none</i><br /><br />
+
+ <a name="chart.scale.decimals"></a>
+ <b>chart.scale.decimals</b><br />
+ This stipulates how many decimal places there are.
+ <br /><i>Default: 0</i><br /><br />
+
+
+<a name="titles"></a>
+<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>
+<b>chart.title</b><br />
+ The title of the progress bar. <br /><i>Default: An empty string</i><br /><br />
+ <a name="chart.title.hpos"></a>
+<b>chart.title.hpos</b><br />
+ 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 />
+ <a name="chart.title.vpos"></a>
+<b>chart.title.vpos</b><br />
+ 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 />
+ <a name="chart.title.color"></a>
+<b>chart.title.color</b><br />
+ The color of the title.<br /> <i>Default: black</i><br /><br />
+<a name="interactive features"></a>
+<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> <a name="chart.tooltips"></a>
+<b>chart.tooltips</b><br />
+ An array, albeit one element only. This is shown when the progress bar is clicked on. Tooltips can contain HTML.<br /><i>Default: An empty array</i><br /><br />
+ <a name="chart.tooltips.effect"></a>
+<b>chart.tooltips.effect</b><br />
+ The animated effect used for showing the tooltip. Can be either <i>fade</i> or <i>expand</i>.<br /><i>Default: fade</i><br /><br />
+ <a name="chart.tooltips.css.class"></a>
+<b>chart.tooltips.css.class</b><br />
+ This is the name of the CSS class the graph uses.<br /><i>Default: RGraph_tooltip</i><br /><br />
+
+ <a name="chart.tooltips.override"></a>
+ <b>chart.tooltips.override</b><br />
+ 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 />
+
+ <a name="chart.tooltips.coords.adjust"></a>
+ <b>chart.tooltips.coords.adjust</b><br />
+ If you translate to gain space, then you can use this to tell RGraph that you have, so that the coordinates for the
+ tooltip(s) are accurate.<br />
+ <i>Default: [0, 0]</i><br /><br />
+
+ <a name="chart.contextmenu"></a>
+<b>chart.contextmenu</b><br />
+ An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
+ <a name="chart.annotatable"></a>
+<b>chart.annotatable</b><br />
+ Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
+ <a name="chart.annotate.color"></a>
+<b>chart.annotate.color</b><br />
+ If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
+ <a name="chart.resizable"></a>
+<b>chart.resizable</b><br />
+ 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 />
+ <a name="chart.adjustable"></a>
+<b>chart.adjustable</b><br />
+ Defaulting to false, this determines whether your progress bar will be adjustable (click the bar and drag it). <br /><i>Default: false</i><br /><br />
+<a name="zoom"></a>
+<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.factor"></a>
+<b>chart.zoom.factor</b><br />
+ This is the factor that the graph will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
+ <a name="chart.zoom.fade.in"></a>
+<b>chart.zoom.fade.in</b><br />
+ 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 />
+ <a name="chart.zoom.fade.out"></a>
+<b>chart.zoom.fade.out</b><br />
+ 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 />
+ <a name="chart.zoom.hdir"></a>
+<b>chart.zoom.hdir</b><br />
+ 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 />
+ <a name="chart.zoom.vdir"></a>
+<b>chart.zoom.vdir</b><br />
+ 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 />
+ <a name="chart.zoom.delay"></a>
+<b>chart.zoom.delay</b><br />
+ The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
+ <a name="chart.zoom.frames"></a>
+<b>chart.zoom.frames</b><br />
+ The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
+ <a name="chart.zoom.shadow"></a>
+<b>chart.zoom.shadow</b><br />
+ Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
+ <a name="chart.zoom.background"></a>
+<b>chart.zoom.background</b><br />
+ 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 />
+</div><!-- /DOCS --><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Zooming your graphs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs zoom" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about zooming your charts" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ .RGraph_zoom_window {
+ border: 2px solid #ccc ! important;
+ box-shadow: 0 0 15px #aaa ! important;;
+ -moz-box-shadow: 0 0 15px #aaa ! important;
+ -webkit-box-shadow: 0 0 15px #aaa ! important;
+ }
+ </style>
+</head>
+
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ Zooming your graphs
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Zooming your graphs</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+
+ <ul>
+ <li><a href="#canvas">Canvas mode</a></li>
+ <li><a href="#thumbnail">Thumbnail mode</a></li>
+ <li><a href="#area">Area mode</a></li>
+ </ul>
+
+
+ <a name="canvas"></a>
+ <h2>Canvas mode</h2>
+
+ <table border="0" width="100%">
+ <tr>
+ <td>
+ <p>
+ As of November 2009 RGraph has had the ability to provide a zoom facility. It's designed to be used in
+ conjunction with a context menu as in the example to the right.
+ </p>
+
+ <p>
+ You can control the zoom using these properties:
+ </p>
+
+ <ul>
+ <li>chart.zoom.mode<i>Default: canvas</i></li>
+ <li>chart.zoom.factor<i>Default: 1.5</i></li>
+ <li>chart.zoom.fade.in <i>Default: true</i></li>
+ <li>chart.zoom.fade.out <i>Default: true</i></li>
+ <li>chart.zoom.hdir <i>Default: right</i></li>
+ <li>chart.zoom.vdir <i>Default: down</i></li>
+ <li>chart.zoom.delay <i>Default: 50</i></li>
+ <li>chart.zoom.frames <i>Default: 10</i></li>
+ <li>chart.zoom.shadow <i>Default: true</i></li>
+ <li>chart.zoom.mode <i>Default: canvas</i></li>
+ <li>chart.zoom.thumbnail.width <i>Default: 75</i></li>
+ <li>chart.zoom.thumbnail.height <i>Default: 75</i></li>
+ <li>chart.zoom.background <i>Default: true</i></li>
+ </ul>
+ </td>
+
+ <td style="text-align: center">
+ <canvas width="600" height="250" id="myc">[No canvas support]</canvas>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ The possible values of <i>chart.zoom.hdir</i> are: <i>left</i>, <i>center</i>, <i>right</i>.
+ The possible values of <i>chart.zoom.vdir</i> are: <i>up</i>, <i>center</i>, <i>down</i>. <i>chart.zoom.delay</i>
+ is the delay in between frames (in milliseconds) and <i>chart.zoom.frames</i> is the number of frames in the zoom. <i>chart.zoom.shadow</i>
+ is whether the zoomed canvas has a shadow or not. The possible values of <i>chart.zoom.mode</i> are <i>canvas</i> (default)
+ and <i>thumbnail</i>.
+ </td>
+ </tr>
+ </table>
+
+ <script>
+ window.onload = function ()
+ {
+ var graph = new RGraph.Bar('myc', [[4,6],[6, 8],[8,6],[7,5],[9,4],[4,7],[3,5],[8,6],[7,6],[4,7],[5,4],[5,6],[6,4]]);
+ graph.Set('chart.colors', ['#f66', '#66f']);
+ graph.Set('chart.strokecolor', 'rgba(0,0,0,0)');
+ graph.Set('chart.labels', ['Fry','Hav','Jim','Moo','Io','Olga','Tim','Gaz','Jake','Pippa','Lou','Fred','John']);
+
+ if (!RGraph.isIE8()) {
+ graph.Set('chart.contextmenu', [
+ ['Clear annotations', function () {RGraph.Clear(graph.canvas); graph.Draw();}],
+ ['Zoom in', RGraph.Zoom]
+ ]);
+ graph.Set('chart.annotatable', true);
+ graph.Set('chart.zoom.hdir', 'left');
+ graph.Set('chart.zoom.factor', 1.5);
+ graph.Set('chart.zoom.vdir', 'center');
+ graph.Set('chart.zoom.frames', 50); // Number of frames
+ graph.Set('chart.zoom.delay', 5); // Delay between each frame
+ graph.Set('chart.zoom.shadow', 'rgba(0,0,0,0.7)'); // Show a shadow on the zoomed graph
+ graph.Set('chart.zoom.background', true);
+ }
+
+ graph.Set('chart.title', 'Chart with zoom (context, annotatable)');
+ graph.Set('chart.shadow', true);
+ graph.Set('chart.shadow.color', '#999');
+ graph.Draw();
+
+ var myLine = new RGraph.Line('myc2', [40,48,45,64,34,22,23,56,56,54,84,44], [4,5,6,7,20,21,1,9,9,8,5,4]);
+ myLine.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ myLine.Set('chart.hmargin', 10);
+ myLine.Set('chart.linewidth', 3);
+ myLine.Set('chart.title', 'A sample line chart');
+ myLine.Set('chart.colors', ['red', 'black']);
+ myLine.Set('chart.shadow', true);
+
+ if (!RGraph.isIE8()) {
+ myLine.Set('chart.contextmenu', [['Zoom entire graph', RGraph.Zoom]]);
+ myLine.Set('chart.zoom.delay', 15);
+ myLine.Set('chart.zoom.factor', 1.5);
+ myLine.Set('chart.zoom.mode', 'thumbnail');
+ myLine.Set('chart.zoom.vdir', 'center');
+ myLine.Set('chart.zoom.thumbnail.width', 100);
+ myLine.Set('chart.zoom.thumbnail.height', 100);
+ }
+ myLine.Draw();
+
+ myLine2 = new RGraph.Line('myc3', [15,30,62,26,46,86,48,51,51,35,32, 35]);
+ myLine2.Set('chart.background.grid.width', 0.5);
+ myLine2.Set('chart.shadow.offsetx', 1);
+ myLine2.Set('chart.shadow.offsety', 1);
+ myLine2.Set('chart.shadow.blur', 2);
+ myLine2.Set('chart.shadow', true);
+ myLine2.Set('chart.zoom.mode', 'area');
+ myLine2.Set('chart.hmargin', 10);
+ myLine2.Set('chart.linewidth', 2);
+ myLine2.Set('chart.title', 'A graph with zoom in area mode');
+ myLine2.Set('chart.tickmarks', 'endcircle');
+ myLine2.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ myLine2.Draw();
+ }
+ </script>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script>
+ var graph = new RGraph.Line('myc', [4,6,8,7,9,4,3,8,7,4,5,5,5]);
+ graph.Set('chart.labels', ['Fry','Hav','Jim','Moo','Io','Olga','Tim','Gaz','Jake','Pippa','Lou','Fred','John']);
+ graph.Set('chart.contextmenu', [
+ ['Clear annotations', function () {RGraph.Clear(graph.canvas); graph.Draw();}],
+ ['Zoom in', RGraph.Zoom]
+ ]);
+ graph.Set('chart.title', 'Chart with zoom (context, annotatable)');
+ graph.Set('chart.shadow', true);
+ graph.Set('chart.annotatable', true);
+ graph.Draw();
+</script>
+</pre>
+
+
+ <a name="thumbnail"></a>
+ <h2>Thumbnail mode</h2>
+
+ <canvas id="myc2" width="600" height="250" style="float: left">[No canvas support]</canvas>
+
+ <p>
+ The zoom has an alternative thumbnail mode, which displays a small thumbnail zoom instead of zooming the entire canvas.
+ The graph to the left shows an example of this.
+ </p>
+
+ <p>
+ It uses some of the same properties as the regular zoom, eg <i>chart.fade.in</i>, <i>chart.fade.out</i>, <i>chart.zoom.shadow</i>
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script>
+ var myLine = new RGraph.Line('myc2', [40,48,45,64,34,22,23,56,56,54,84,44], [4,5,6,7,20,21,1,9,9,8,5,4]);
+ myLine.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ myLine.Set('chart.hmargin', 10);
+ myLine.Set('chart.linewidth', 3);
+ myLine.Set('chart.title', 'A sample line chart');
+ myLine.Set('chart.zoom.mode', 'thumbnail');
+ myLine.Set('chart.zoom.vdir', 'center');
+ myLine.Set('chart.zoom.thumbnail.width', 100);
+ myLine.Set('chart.zoom.thumbnail.height', 100);
+ myLine.Set('chart.colors', ['red', 'black']);
+ myLine.Set('chart.shadow', true);
+ myLine.Set('chart.contextmenu', [['Zoom entire graph', RGraph.Zoom]]);
+</script>
+</pre>
+
+ <p>
+ <b>Making the zoom circular</b><br /><br />
+ <img src="../images/border-radius.png" width="171" height="159" alt="A circular zoom window" style="float: right; border: 1px gray solid" />
+ It is possible to make the zoom in area mode circular by utilising the <i>border-radius</i> CSS property. Currently support for
+ this is limited to FireFox 4b7+, so it's not part of the main RGraph software. The CSS ncessary to achieve this is
+ thus:
+ </p>
+
+ <pre class="code" style="width: 700px" />
+<style>
+ .RGraph_zoom_window {
+ border-radius: 50px ! important;
+ }
+</style>
+</pre>
+
+ This a graph demonstrating this technique <a href="zoom_thumbnail.html">here</a>. Note that browser support for this technique is limited.
+
+ <br clear="all" />
+
+
+ <a name="area"></a>
+ <h2>Area mode</h2>
+
+ <canvas id="myc3" width="600" height="250" style="float: right">[No canvas support]</canvas>
+
+ <p>
+ Another type of zoom available is <i>area</i>. This is somewhat similar to thumbnail, but allows you to draw a rectangle around
+ the specific area that you want to zoom.
+ </p>
+
+ <p>
+ Again, this uses some common zoom properties, such as <i>chart.zoom.factor</i>.
+ </p>
+
+ <p>
+ Once visible, you can drag the zoomed area around with the left mouse button (a left drag), and drag the zoomed canvas around
+ within the zoom by using the right mouse button (a right-drag). And a double click will expand the zoomed area to cover the
+ whole canvas.
+ </p>
+
+ <br clear="all" />
+
+ <pre class="code">
+<script>
+ var myLine = new RGraph.Line('myc3', [15,30,62,26,46,86,48,51,51,35,32, 35]);
+ myLine.Set('chart.zoom.mode', 'area');
+ myLine.Set('chart.hmargin', 10);
+ myLine.Set('chart.linewidth', 1);
+ myLine.Set('chart.title', 'A graph with zoom in area mode');
+ myLine.Set('chart.tickmarks', 'endcircle');
+ myLine.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ myLine.Draw();
+<script>
+</pre>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Zooming your graphs</title>
+
+ <meta name="keywords" content="rgraph html5 canvas graph docs zoom" />
+ <meta name="description" content="RGraph: HTML5 canvas graph software - Documentation about zooming your charts" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ .RGraph_zoom_window {
+ box-shadow: 0 0 15px black ! important;
+ -webkit-box-shadow: 0 0 15px black ! important;
+ -moz-box-shadow: 0 0 15px black ! important;
+ border-radius: 50px ! important;
+ }
+ </style>
+</head>
+
+<body>
+
+ <!-- Social networking buttons -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="index.html">Documentation</a>
+ >
+ A circular thumbnail demonstration
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - A circular thumbnail demonstration</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+
+ <canvas id="cvs" width="600" height="250" style="float: right">[No canvas support]</canvas>
+ <script>
+ var line = new RGraph.Line('cvs', [5,3,4,6,5,1,3,4,5,5], [4,8,6,7,4,3,5,1,2,3]);
+ line.Set('chart.colors', ['red', 'black']);
+ line.Set('chart.hmargin', 5);
+ line.Set('chart.linewidth', 5);
+ line.Set('chart.shadow', true);
+ line.Set('chart.shadow.offsetx', 0);
+ line.Set('chart.shadow.offsety', 0);
+ line.Set('chart.shadow.blur', 15);
+ line.Set('chart.shadow.color', ['red','black']);
+ line.Set('chart.labels', ['Hoolio','Gina','Jo','Olga','Kev','John','Lou','Pete','June','Fred']);
+ line.Set('chart.zoom.mode', 'thumbnail');
+ line.Set('chart.zoom.thumbnail.width', 100);
+ line.Set('chart.zoom.thumbnail.height', 100);
+ line.Draw();
+ </script>
+
+ <p>
+ This is a demonstration of the zoom in thumbnail mode with some custom CSS (the <i>border-radius</i> property) which facilitates
+ making the thumbnail circular.
+ </p>
+
+ <p>
+ Remember that browser support for this is limited - currently (18th December 2010) only Firefox 4b7+ supports this.
+ </p>
+
+ <p>
+ <a href="zoom.html#thumbnail">«Back to zoom documentation</a>
+ </p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - bar chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example bar chart" />
+ <meta name="description" content="RGraph: Bar chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ /**
+ * These are the callback functions for the context menu
+ */
+ function Callback1()
+ {
+ alert('Menu item 1 selected!');
+ }
+
+ function Callback2()
+ {
+ alert('Menu item 2 selected!');
+ }
+
+
+ /**
+ * The onload function creates the graph
+ */
+ window.onload = function ()
+ {
+ var bar = new RGraph.Bar('bar1', [1.2, 1.3, 1.4, 1.5,6,1.9,2,2.1,2.5]);
+ bar.Set('chart.units.pre', '$');
+ bar.Set('chart.units.post', 'k');
+ bar.Set('chart.title', 'A sketch bar chart (context, resizable)');
+ bar.Set('chart.gutter', 35);
+ bar.Set('chart.colors', ['rgb(255,0,0)']);
+ bar.Set('chart.labels', ['John', 'Barry', 'Rich', 'Craig', 'Tom', 'Frank', 'Helen', 'Joyce', 'Fred'])
+ bar.Set('chart.background.grid.hsize', 20);
+ bar.Set('chart.background.grid.vsize', 20);
+ bar.Set('chart.background.barcolor1', 'white');
+ bar.Set('chart.background.barcolor2', 'white');
+ bar.Set('chart.text.angle', 30);
+ bar.Set('chart.contextmenu', [['A test!', function () {}], ['Get PNG', RGraph.showPNG]]);
+ bar.Set('chart.labels.above', true);
+
+ if (!RGraph.isIE8()) {
+ bar.Set('chart.resizable', true);
+ }
+
+ bar.Set('chart.variant', 'sketch');
+ bar.Set('chart.linewidth', 2);
+ bar.Set('chart.background.grid.autofit', true);
+ bar.Set('chart.ylabels.count', 10);
+
+ RGraph.Clear(bar.canvas, 'white');
+
+ bar.Draw();
+
+
+ var bar2 = new RGraph.Bar('bar2', [140, 150, 160, 150, 120, 150, 160, 140, 120, 160]);
+ bar2.Set('chart.background.barcolor1', 'white');
+ bar2.Set('chart.background.barcolor2', 'white');
+ bar2.Set('chart.title', 'Sales last quarter (tooltips)');
+ bar2.Set('chart.title.vpos', 0.6);
+ bar2.Set('chart.labels', ['Fred', 'Rich', 'Alex','John','Nick', 'Doug', 'Jaz', 'Pat', 'Baz', 'Bob']);
+ bar2.Set('chart.text.angle', 45);
+ bar2.Set('chart.gutter', 35);
+ bar2.Set('chart.shadow', true);
+ bar2.Set('chart.shadow.blur', 15);
+ bar2.Set('chart.shadow.color', '#ffa0a0');
+ bar2.Set('chart.shadow.offsetx', 0);
+ bar2.Set('chart.shadow.offsety', 0);
+ bar2.Set('chart.colors', ['#FF6060']);
+ bar2.Set('chart.key.position', 'gutter');
+ bar2.Set('chart.text.size', 10);
+ bar2.Set('chart.text.font', 'Georgia');
+ bar2.Set('chart.text.angle', 45);
+ bar2.Set('chart.grouping', 'stacked');
+
+ if (!RGraph.isIE8()) {
+ bar2.Set('chart.tooltips', ['Fred', 'Rich', 'Alex','John','Nick', 'Doug', 'Jaz', 'Pat', 'Baz', 'Bob']);
+ }
+
+ bar2.Draw();
+
+ var bar4 = new RGraph.Bar('bar4', [
+ [0.000092, 0.00008],
+ [0.000034, 0.000057],
+ [0.000056, 0.000062],
+ [0.000055, 0.000045],
+ [0.000036, 0.000012],
+ [0.000044, 0.000056],
+ [0.000051, 0.000066],
+ [0.000068, 0.000088]]);
+ bar4.Set('chart.title', 'A grouped bar chart (small values)');
+ bar4.Set('chart.background.barcolor1', 'white');
+ bar4.Set('chart.background.barcolor2', 'white');
+ bar4.Set('chart.labels', ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th']);
+ bar4.Set('chart.key', ['John', 'Bob']);
+ bar4.Set('chart.key.position', 'graph');
+ bar4.Set('chart.key.shadow', true);
+ bar4.Set('chart.key.background', 'rgb(255,255,255)');
+ bar4.Set('chart.colors', ['#77f', '#7f7']);
+ bar4.Set('chart.shadow', true);
+ bar4.Set('chart.shadow.offsety', -3);
+ bar4.Set('chart.shadow.color', '#aaa');
+ bar4.Set('chart.yaxispos', 'right');
+ bar4.Set('chart.labels.ingraph', [9,'The lowest']);
+ bar4.Set('chart.strokestyle', 'rgba(0,0,0,0)');
+ bar4.context.translate(-20,0);
+ bar4.Draw();
+
+ var bar5 = new RGraph.Bar('bar5', [[30,20,19,21], [23,25, 27, 30], [30,25,29, 32], [27,28,35,33], [26,18,29,30], [31,20,25,27], [39,28,28,35], [27,29,28,29], [26,23,26,27], [30,20,19,21], [30,20,19,21], [30,20,19,21]]);
+ bar5.Set('chart.units.pre', '$');
+ bar5.Set('chart.title', 'Sales in the last 8 months (tooltips)');
+ bar5.Set('chart.colors', ['red', 'yellow', 'green', 'orange']);
+ bar5.Set('chart.gutter', 40);
+ bar5.Set('chart.shadow', true);
+ bar5.Set('chart.shadow.color', '#aaa');
+ bar5.Set('chart.background.barcolor1', 'white');
+ bar5.Set('chart.background.barcolor2', 'white');
+ bar5.Set('chart.background.grid.hsize', 5);
+ bar5.Set('chart.background.grid.vsize', 5);
+ bar5.Set('chart.grouping', 'stacked');
+ bar5.Set('chart.labels', ['\r\nJan', 'Feb', '\r\nMar', 'Apr', '\r\nMay', 'Jun', '\r\nJul', 'Aug', '\r\nSep','Oct','\r\nNov','Dec']);
+ bar5.Set('chart.labels.above', true);
+
+ bar5.Set('chart.key', ['Richard', 'Barbara', 'Johnny', 'Frederick']);
+ bar5.Set('chart.key.background', 'rgba(255,255,255,0.7)');
+ bar5.Set('chart.key.position', 'gutter');
+ bar5.Set('chart.key.position.gutter.boxed', false);
+ bar5.Set('chart.key.position.y', bar5.Get('chart.gutter') - 15);
+ bar5.Set('chart.key.border', false);
+
+ bar5.Set('chart.background.grid.width', 0.3); // Decimals are permitted
+ bar5.Set('chart.text.angle', 0);
+ bar5.Set('chart.strokecolor', 'rgba(0,0,0,0)');
+ bar5.Set('chart.tooltips.event', 'onmousemove');
+
+ if (!RGraph.isIE8()) {
+ bar5.Set('chart.tooltips', [
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick',
+ 'Richard', 'Barbara', 'Johnny', 'Frederick'
+ ]);
+ }
+
+ bar5.Draw();
+
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Bar chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Bar chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+ <p>
+ The bar chart is probably one of the most widely used of charts, and also one of the most versatile. It's defined as a chart with
+ rectangular bars with lengths proportional to the values they represent. The bar chart can be used to represent two
+ or more values. With grouped and stacked bar charts, you can visualise two or more sets of data. For example two years
+ worth of sales figures. Doing this you will be able to easily see differences, for example a better year when it comes
+ to sales. You can also show negative values by having the X axis in the center, like the examples shown. If you use a
+ grouped or stacked bar chart, a key may be helpful to your users.
+ </p>
+
+ <p>
+ By using the tooltips feature, you can provide more detail about what a particular bar represents. The tooltips in
+ <b>RGraph</b> can contain wide range of HTML, so you can use them to show photos or movies for example.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/bar.html">Bar chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="width: 950px">
+ <div style="width: 450px; float: left">
+ <canvas id="bar1" width="450" height="200">[No canvas support]</canvas>
+ <canvas id="bar4" width="450" height="200" style="border: 1px dashed black">[No canvas support]</canvas>
+ </div>
+
+ <div style="width: 450px; float: right">
+ <canvas id="bar2" width="450" height="200">[No canvas support]</canvas>
+ <canvas id="bar5" width="450" height="200">[No canvas support]</canvas>
+ </div>
+ </div>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+
+ <title>RGraph: HTML5 canvas graph library - a basic example</title>
+
+ <meta name="keywords" content="rgraph html5 canvas basic example" />
+ <meta name="description" content="RGraph: A basic example" />
+
+ <!-- 1/3. Include the RGraph libraries -->
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.bar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+</head>
+
+<body>
+
+ <h1>RGraph: HTML5 canvas graph library - A basic example</h1>
+
+ <!-- 2/3. This is the canvas that the graph is drawn on -->
+ <canvas id="myBar" width="1000" height="250">[No canvas support]</canvas>
+
+ <!--
+ 3/3. This creates and displays the graph. As it is here, you can call this from the window.onload event,
+ allowing you to put it in your pages header.
+ -->
+ <script>
+ window.onload = function ()
+ {
+ var bar = new RGraph.Bar('myBar', [12,13,16,15,16,19,19,12,23,16,13,24]);
+ bar.Set('chart.gutter', 35);
+ bar.Set('chart.colors', ['red']);
+ bar.Set('chart.title', 'A basic graph (big, but basic)');
+ bar.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ bar.Draw();
+ }
+ </script>
+
+ <p>
+ This is a very basic example that does little more than display a graph. If you're trying to understand how RGraph
+ works, this should help as there is very little happening on this page. To see the source code of this
+ page simply view the source (Right click > View Source).
+ </p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - bi-polar chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example bipolar chart" />
+ <meta name="description" content="RGraph: Bipolar chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js"></script>
+ <script src="../libraries/RGraph.common.annotate.js"></script>
+ <script src="../libraries/RGraph.common.context.js"></script>
+ <script src="../libraries/RGraph.common.tooltips.js"></script>
+ <script src="../libraries/RGraph.common.zoom.js"></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.bipolar.js"></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var left = [5,6,8,9,12,13,4,9];
+ var right = [5,8,4,11,15,26,13,16];
+
+ var bipolar1 = new RGraph.Bipolar('bipolar1', left, right);
+ bipolar1.Set('chart.colors', ['red']);
+ bipolar1.Set('chart.labels', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']);
+ bipolar1.Set('chart.title.left', '2007');
+ bipolar1.Set('chart.title.right', '2008');
+ bipolar1.Set('chart.title', 'Sales (tooltips, context, zoom)');
+
+ if (!RGraph.isIE8()) {
+ bipolar1.Set('chart.tooltips', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike', 'Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']);
+ bipolar1.Set('chart.tooltips.effect', 'fade');
+ }
+
+ bipolar1.Set('chart.units.post', 'k');
+ bipolar1.Set('chart.contextmenu', [['Zoom', RGraph.Zoom], ['Get PNG', RGraph.showPNG], null, ['Cancel', function () {}]]);
+ bipolar1.Set('chart.xmax', 35);
+ bipolar1.Set('chart.shadow', true);
+ bipolar1.Set('chart.shadow.color', '#aaa');
+ bipolar1.Set('chart.shadow.blur', 3);
+
+ RGraph.Clear(bipolar1.canvas, 'white');
+
+ bipolar1.Draw();
+
+
+
+ var bipolar2 = new RGraph.Bipolar('bipolar2', left, right);
+ bipolar2.Set('chart.labels', ['Fezza', 'Porka', 'CRX', 'RX8', 'DB9', 'Aston', 'F430', 'BMX']);
+ bipolar2.Set('chart.title.left', 'July')
+ bipolar2.Set('chart.title.right', 'August');
+ bipolar2.Set('chart.title', 'Vehicles (context, annotatable)');
+ bipolar2.Set('chart.contextmenu', [['Show palette', function (e) {RGraph.Showpalette(e)}], ['Clear', function () {RGraph.Clear(bipolar2.canvas); bipolar2.Draw()}]]);
+ bipolar2.Set('chart.units.post', 'k');
+ bipolar2.Set('chart.annotatable', true);
+ bipolar2.Draw();
+
+ var bipolar3 = new RGraph.Bipolar('bipolar3', [1,2,3,4,5,6,7], [1,2,3,4,5,6,7]);
+
+ var gradient = bipolar3.context.createLinearGradient(0,0,475,0);
+ gradient.addColorStop(0,'red');
+ gradient.addColorStop(0.5,'white');
+ gradient.addColorStop(1,'red');
+
+ bipolar3.Set('chart.labels', ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh']);
+ bipolar3.Set('chart.title.left', '2007');
+ bipolar3.Set('chart.title.right', '2008');
+ bipolar3.Set('chart.title', 'A red chart (resizable)');
+ bipolar3.Set('chart.colors', [gradient]);
+ bipolar3.Set('chart.gutter', 30);
+ bipolar3.Set('chart.resizable', true);
+
+ if (!document.all) {
+ bipolar3.Set('chart.zoom.mode', 'thumbnail');
+ }
+
+ bipolar3.Draw();
+
+ var bipolar4 = new RGraph.Bipolar('bipolar4', [45,43,46,78,41,42,35], [31,21,25,26,26,26,12]);
+ bipolar4.Set('chart.labels', ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']);
+ bipolar4.Set('chart.title.left', 'January');
+ bipolar4.Set('chart.title.right', 'February');
+ bipolar4.Set('chart.title', 'A bi-polar chart');
+ bipolar4.Set('chart.colors', ['#ff0']);
+ bipolar4.Set('chart.gutter', 20);
+ bipolar4.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Bi-polar chart
+</div>
+
+
+<h1>RGraph: HTML5 canvas graph library - Bi-polar chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+ <p>
+ 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
+ compare two sets of data. For example two years worth of sales figues. Using this type of chart abnormalities will become
+ apparent. Other charts that would also be comparable, include a grouped bar chart, a stacked bar chart, and a multiple
+ line graph.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/bipolar.html">Bi-polar chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="width: 950px">
+ <div style="width: 450px; float: left">
+ <canvas id="bipolar1" width="475" height="250">[No canvas support]</canvas>
+ <canvas id="bipolar2" width="475" height="250">[No canvas support]</canvas>
+ </div>
+
+ <div style="width: 450px; float: right">
+ <canvas id="bipolar3" width="475" height="250">[No canvas support]</canvas>
+ <canvas id="bipolar4" width="475" height="250">[No canvas support]</canvas>
+ </div>
+ </div>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - donut chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example donut chart" />
+ <meta name="description" content="RGraph: Donut chart examples" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.pie.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var donut = new RGraph.Pie('donut1', [41,37,16,3,3], [20,5,60,7,3], [17,3,68,6,3]);
+ donut.Set('chart.variant', 'donut');
+ donut.Set('chart.linewidth', 5);
+ donut.Set('chart.strokestyle', 'white');
+ donut.Set('chart.gutter', 45);
+ donut.Set('chart.title', "Browser share (zoom)");
+
+ donut.Set('chart.key', ['MSIE 7', 'MSIE 6', 'Firefox', 'Safari', 'Other']);
+ donut.Set('chart.key.shadow', true);
+ donut.Set('chart.key.shadow.offsetx', 3);
+ donut.Set('chart.key.shadow.offsety', 3);
+ donut.Set('chart.key.shadow.blur', 3);
+ donut.Set('chart.key.shadow.color', 'gray');
+ donut.Set('chart.key.position', 'graph');
+ donut.Set('chart.align', 'left');
+
+ if (!RGraph.isIE8()) {
+ donut.Set('chart.zoom.mode', 'area');
+ }
+
+ donut.Draw();
+
+
+ function getGradient(obj, color)
+ {
+ var gradient = obj.context.createRadialGradient(obj.canvas.width / 2, obj.canvas.height / 2, 0, obj.canvas.width / 2, obj.canvas.height / 2, 200);
+ gradient.addColorStop(0, 'black');
+ gradient.addColorStop(0.5, color);
+ gradient.addColorStop(1, 'black');
+
+ return RGraph.isIE8() ? color : gradient;
+ }
+
+ var donut2 = new RGraph.Pie('donut2', [8,6,5,3,8,9,9,4]);
+
+ // Create the gradients
+ var gradient = getGradient(donut2, 'red');
+ var gradient2 = getGradient(donut2, 'green');
+ var gradient3 = getGradient(donut2, 'pink');
+ var gradient4 = getGradient(donut2, 'yellow');
+ var gradient5 = getGradient(donut2, 'grey');
+ var gradient6 = getGradient(donut2, 'cyan');
+ var gradient7 = getGradient(donut2, 'red');
+ var gradient8 = getGradient(donut2, '#ddd');
+ var gradient9 = getGradient(donut2, 'blue');
+
+ donut2.Set('chart.variant', 'donut');
+ donut2.Set('chart.labels', ['Flipper', 'Harry', 'Ben', 'Richard', 'Keith', 'Ben', 'George', 'Barry']);
+ donut2.Set('chart.title', "Sales figures for week 43");
+ donut2.Set('chart.gutter', 35);
+ donut2.Set('chart.strokestyle', 'rgba(0,0,0,0)');
+ donut2.Set('chart.colors', [gradient, gradient2, gradient3, gradient4, gradient5, gradient6, gradient7, gradient8, gradient9]);
+ donut2.Draw();
+
+ var donut3 = new RGraph.Pie('donut3', [41,37,16,3,3]);
+ donut3.Set('chart.labels', ['MISE 7', 'MSIE 6', 'Firefox', 'Safari', 'Other']);
+ donut3.Set('chart.strokestyle', 'white');
+ donut3.Set('chart.linewidth', 5);
+ donut3.Set('chart.title', "Browser market share (tooltips)");
+ donut3.Set('chart.tooltips', ['MISE 7', 'MSIE 6', 'Firefox', 'Safari', 'Other']);
+ donut3.Set('chart.variant', 'donut');
+ donut3.Draw();
+
+ var donut4 = new RGraph.Pie('donut4', [5,4,3,5,2,1], [3,1,1,2,1,1]);
+ donut4.Set('chart.variant','donut');
+ donut4.Set('chart.linewidth', 5);
+ donut4.Set('chart.strokestyle', 'white');
+ donut4.Set('chart.linewidth', 5);
+ donut4.Set('chart.labels', ['Bob', 'Charles', 'Fred', 'Julian', 'Mark', 'Gary']);
+ donut4.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Donut chart
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Donut chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+
+ <p>
+ Formerly the Donut chart was a separate class, though now it's a variant of the Pie chart. This means smaller downloads and
+ a much simpler implementation. Essentially it's a Pie chart with a big hole in the middle. If you want to compare multiple
+ datasets you will probably be better off with something like a stacked or grouped bar chart, as you will be able to make
+ comparisons easier.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/pie.html">Pie chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="width: 950px">
+ <div style="width: 450px; float: left">
+ <canvas id="donut1" width="450" height="350">[No canvas support]</canvas>
+ <canvas id="donut2" width="450" height="350">[No canvas support]</canvas>
+ </div>
+
+ <div style="width: 450px; float: right">
+ <canvas id="donut3" width="450" height="350">[No canvas support]</canvas>
+ <canvas id="donut4" width="450" height="350">[No canvas support]</canvas>
+ </div>
+ </div>
+ </div>
+
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - funnel chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example funnel chart" />
+ <meta name="description" content="RGraph: Funnel chart examples" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.funnel.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ /**
+ * The onload function creates the graph
+ */
+ window.onload = function ()
+ {
+ var funnel = new RGraph.Funnel('funnel1', [100,45,45,26,21,5]);
+ funnel.Set('chart.gutter', 40);
+ funnel.Set('chart.text.boxed', false);
+ funnel.Set('chart.title', 'Leads to sales (tooltips, context, zoom)');
+
+ funnel.Set('chart.shadow', true);
+ funnel.Set('chart.shadow.color', 'gray');
+ funnel.Set('chart.shadow.blur', 25);
+ funnel.Set('chart.shadow.offsetx', 0);
+ funnel.Set('chart.shadow.offsety', 0);
+
+ if (!RGraph.isIE8()) {
+ funnel.Set('chart.tooltips', [
+ 'id:tooltip_contact',
+ 'id:tooltip_lead',
+ 'id:tooltip_call',
+ 'id:tooltip_visit',
+ 'id:tooltip_sale',
+ function (idx) {return '<b>After sales concern</b><br />An after sales concern or query was raised by the Customer.';}
+ ]);
+
+ funnel.Set('chart.tooltips.effect', 'fade');
+ funnel.Set('chart.zoom.hdir', 'center');
+ funnel.Set('chart.zoom.vdir', 'up');
+ funnel.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom]]);
+ }
+
+ funnel.Set('chart.labels', ['Initial contact', 'Established lead', 'Telephone contact', 'Site visit', 'Sale', 'After sales']);
+ funnel.Set('chart.text.boxed', true);
+ funnel.Draw();
+
+
+ var funnel3 = new RGraph.Funnel('funnel3', [56,45,12,4,3,2,1]);
+ funnel3.Set('chart.title', 'A funnel (zoom)');
+
+ if (!RGraph.isIE8()) {
+ funnel3.Set('chart.zoom.mode', 'thumbnail');
+ }
+
+ funnel3.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Funnel chart
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Funnel chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The funnel chart can be used to show stages in a sales or order process, from initial lead/contact through to actual sale.
+ It works well if you have a diminishing process, like that shown below. It can show potential revenue in each stage, or
+ like below, it can show actual numbers. It can also highlight potential problems in an organisations sales and/or order fulfillment
+ processes.
+ </p>
+
+ <div>
+ <div>
+ <ul>
+ <li><a href="../docs/funnel.html">Funnel chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="width: 950px">
+ <div style="width: 450px; float: left">
+ <canvas id="funnel3" width="300" height="400">[No canvas support]</canvas>
+ </div>
+
+ <div style="width: 450px; float: right">
+ <canvas id="funnel1" width="400" height="400">[No canvas support]</canvas>
+ </div>
+ </div>
+ </div>
+
+ <div style="display: none">
+ <div id="tooltip_contact"><b>Initial contact</b><br />All potential cutomers were contacted and<br />interest was established.</div>
+ <div id="tooltip_lead"><b>Established lead</b><br />Customers who were interested had their details<br />recorded and passed to the sales team.</div>
+ <div id="tooltip_call"><b>Sales Call</b><br />Interested Customers were called by the<br />sales team.</div>
+ <div id="tooltip_visit"><b>Site visit</b><br />The Customers site was visited by a representative<br />of the sales core.</div>
+ <div id="tooltip_sale"><b>Sale agreed</b><br />A sale was finalised by the sales core.</div>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - gantt chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example gantt chart" />
+ <meta name="description" content="RGraph: Gantt chart examples" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.gantt.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <style>
+ .RGraph_tooltip {
+ color: #00a ! important;
+ }
+
+ .RGraph_tooltip b {
+ color: black ! important;
+ }
+ </style>
+
+ <script>
+ window.onload = function ()
+ {
+ var gantt1 = new RGraph.Gantt('gantt1');
+ gantt1.Set('chart.xmax', 122);
+ gantt1.Set('chart.gutter', 35);
+ gantt1.Set('chart.labels', ['January', 'February', 'March', 'April']);
+ gantt1.Set('chart.title', 'Work schedule for Xyz Ltd (tooltips, context, zoom)');
+ gantt1.Set('chart.defaultcolor', '#faa');
+ gantt1.Set('chart.background.grid', false);
+
+ if (!RGraph.isIE8()) {
+ gantt1.Set('chart.tooltips', ["<b>Richard Crenshaw</b><br />Working through adding something<br /> to the website.",
+ "<b>Fred Bloggs</b><br />Building a new drive",
+ "<b>Barney Rubble</b><br />Not started adding the new garden",
+ "<b>Gloria Honeyford</b><br />Just started dinner",
+ "<b>Paul O'Grady</b><br />Nearly finished the front garden",
+ "<b>Harry Secombe</b><br />Roughly half way through the bible reading",
+ "<b>Shane Ritchy</b><br />Funny man",
+ "<b>Barry McGuigan</b><br />Beating up the gardener",
+ "<b>Cynthia Frances</b><br />Not entirely sure what she's doing",
+ "<b>Mabel Mincy</b><br />Making more mince.",
+ "<b>Paul McKenna</b><br />Putting everyone off their work",
+ "<b>Kiffen Sausage Farmer</b><br />Farming sausages",
+ "<b>John Doe</b><br />A deer"]);
+ gantt1.Set('chart.tooltips.effect', 'expand');
+ gantt1.Set('chart.zoom.hdir', 'center');
+ gantt1.Set('chart.zoom.vdir', 'center');
+ gantt1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom]]);
+ }
+
+ gantt1.Set('chart.events', [
+ [31, 28, 75, 'Richard'],
+ [12, 28, 67, 'Fred'],
+ [59, 14, 0, 'Barney'],
+ [59, 21, 5, 'Gloria'],
+ [46, 31, 92, 'Paul'],
+ [80, 21, 46, 'Harry'],
+ [94, 17, 84, 'Shane'],
+ [34, 14, 32, 'Barry'],
+ [64, 14, 28, 'Cynthia'],
+ [13, 61, 74, 'Mabel'],
+ [84, 31, 16, 'Paul'],
+ [100, 22, 45, 'Kiffen'],
+ [0, 365, 50, 'John']
+ ]);
+ var color = 'rgba(192,255,192,0.5)';
+ gantt1.Set('chart.vbars', [
+ [0, 10, color],
+ [20, 10, color],
+ [40, 10, color],
+ [60, 10, color],
+ [80, 10, color],
+ [100, 10, color]
+ ]);
+ gantt1.Set('chart.borders', false);
+ gantt1.Draw();
+
+
+ var gantt3 = new RGraph.Gantt('gantt3');
+ gantt3.Set('chart.xmax', 365);
+ gantt3.Set('chart.title', 'Training completion (tooltips)');
+ gantt3.Set('chart.gutter', 35);
+ gantt3.Set('chart.color', '#fdd');
+ gantt3.Set('chart.defaultcolor', '#fdd');
+ gantt3.Set('chart.labels', ['Q1', 'Q2', 'Q3', 'Q4']);
+ gantt3.Set('chart.background.grid.autofit', true);
+ gantt3.Set('chart.events', [
+ [0, 98, 78, 'Richard'],
+ [30, 130, 50, 'Pete'],
+ [65, 114, 5, 'Gary'],
+ [88, 210, 97, 'Sean'],
+ [183, 75, 36, 'Michael', 'red']
+ ]);
+
+ if (!RGraph.isIE8()) {
+ gantt3.Set('chart.tooltips', ['<b>Richard</b><br />Richard is a top geezer. Guvnor.', '<b>Pete</b><br />Pete likes going out clubbing', '<b>Gary</b><br />Gary is a top geezer too', '<b>Sean</b><br />Sean is very good at what he does.<br />Backgammon.', '<b>Michael</b><br />Michael is a secret ninja']);
+ }
+
+ gantt3.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Gantt chart
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Gantt chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+ <p>
+ A Gantt chart is used to show scheduling information. It is commonly used in project management but can also be used,
+ for example, to show holiday schedule information. In this case it would be easy to see when someone is unavailable.
+ The Gantt chart can have clickable bars that can be used to provide more detail. It can also show vertical bars
+ that can be used to indicate events, or as in the cases below, can be decorative.
+ </p>
+
+ <p>
+ The chart is made of "units", in this case 365. This represents days in a year. The labels are separate, being equally
+ spaced across the chart. This means you can use more meaningful labels, which are easier to comprehend. As in the
+ example charts.
+ </p>
+ </div>
+
+ <div>
+ <ul>
+ <li><a href="../docs/gantt.html">Gantt chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="text-align: center">
+ <canvas id="gantt1" width="700" height="300">[No canvas support]</canvas>
+ <canvas id="gantt3" width="700" height="200">[No canvas support]</canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - horizontal bar chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example horizontal bar chart" />
+ <meta name="description" content="RGraph: Horizontal Bar chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.hbar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ /**
+ * The onload function creates the graph
+ */
+ window.onload = function ()
+ {
+ var hbar1 = new RGraph.HBar('hbar1', [1000,1000,3000,4000,4000,3600,2000,750,1000,2000,3000,5000]);
+
+ var grad = hbar1.context.createLinearGradient(0,0,450,0);
+ grad.addColorStop(0, 'white');
+ grad.addColorStop(1, 'red');
+
+ hbar1.Set('chart.labels', ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
+ hbar1.Set('chart.title', 'Results (annotatable, context, zoom)');
+ hbar1.Set('chart.title.xaxis', 'Sales');
+ hbar1.Set('chart.title.yaxis', 'Month');
+ hbar1.Set('chart.colors', [grad]);
+ hbar1.Set('chart.strokestyle', 'rgba(0,0,0,0)');
+ hbar1.Set('chart.units.pre', '$');
+ hbar1.Set('chart.units.post', 'k');
+ hbar1.Set('chart.background.barcolor1', 'white');
+ hbar1.Set('chart.background.barcolor2', 'white');
+ hbar1.Set('chart.background.grid.autofit', true);
+ hbar1.Set('chart.vmargin', 2);
+ hbar1.Set('chart.text.style', '#333');
+
+ if (!RGraph.isIE8()) {
+ hbar1.Set('chart.zoom.vdir', 'center');
+ hbar1.Set('chart.contextmenu', [['Get PNG', RGraph.showPNG], ['Zoom in', RGraph.Zoom], ['Clear', function () {RGraph.Clear(hbar1.canvas); hbar1.Draw();}]]);
+ hbar1.Set('chart.annotatable', true);
+ }
+
+ hbar1.Set('chart.grouping', 'grouped');
+ hbar1.Set('chart.gutter', 30);
+ hbar1.Set('chart.labels.above', true);
+
+ var size = RGraph.getGutterSuggest(hbar1, hbar1.data) + 5;
+ hbar1.Set('chart.gutter', size);
+
+ hbar1.Draw();
+
+ var hbar3 = new RGraph.HBar('hbar3', [[3,2,3], [3,4,5], [5,6,7], [7,8,6], [9,10,9], [10,15,3]]);
+ hbar3.Set('chart.labels', ['Fred', 'Barney', 'Julia', 'Francis', 'Hoolio', 'Jemima']);
+ hbar3.Set('chart.labels.above', true);
+ hbar3.Set('chart.units.post', 'k');
+ hbar3.Set('chart.units.pre', '$');
+ hbar3.Set('chart.gutter', 40);
+ hbar3.Set('chart.colors', ['green', 'red', '#ccf']);
+ hbar3.Set('chart.shadow', false);
+
+ hbar3.Set('chart.key', ['Monday', 'Tuesday', 'Wednesday']);
+ hbar3.Set('chart.key.shadow', true);
+ hbar3.Set('chart.key.shadow.blur', 15);
+ hbar3.Set('chart.key.shadow.offsetx', 0);
+ hbar3.Set('chart.key.shadow.offsety', 0);
+ hbar3.Set('chart.key.shadow.color', '#ccc');
+
+ hbar3.Set('chart.shadow', true);
+ hbar3.Set('chart.shadow.offsety', 0);
+ hbar3.Set('chart.shadow.offsetx', 0);
+ hbar3.Set('chart.shadow.color', '#aaa');
+ hbar3.Set('chart.shadow.blur', 10);
+ hbar3.Set('chart.grouping', 'grouped');
+ hbar3.Set('chart.title', 'Drinks consumed last week (tooltips)');
+
+ hbar3.Set('chart.tooltips', [
+ 'Fred on Monday', '...on Tuesday', '...on Wednesday',
+ 'Barney on Monday', '...on Tuesday', '...on Wednesday',
+ 'Julia on Monday', '...on Tuesday', '...on Wednesday',
+ 'Francis on Monday', '...on Tuesday', '...on Wednesday',
+ 'Hoolio on Monday', '...on Tuesday', '...on Wednesday',
+ 'Jemima on Monday', '...on Tuesday', '...on Wednesday'
+ ]);
+
+ hbar3.Set('chart.strokestyle', 'rgba(0,0,0,0)');
+ hbar3.Set('chart.background.grid.autofit', true);
+ hbar3.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Horizontal Bar chart
+ </div>
+
+
+ <h1>RGraph: HTML5 canvas graph library - Horizontal bar chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ A horizontal bar chart can be useful when your labels are too big for a regular bar chart.
+ </p>
+
+ <ul>
+ <li><a href="../docs/hbar.html">The API documentation</a></li>
+ </ul>
+
+ <canvas id="hbar1" width="450" height="400" style="border: 1px dashed gray">[No canvas support]</canvas>
+ <canvas id="hbar3" width="450" height="400">[No canvas support]</canvas>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - horizontal progress bar</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example horizontal progress bar" />
+ <meta name="description" content="RGraph: Horizontal Progress Bar example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js"></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.adjusting.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.hprogress.js"></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var progress1 = new RGraph.HProgress('progress1', 57, 100);
+ progress1.Set('chart.tickmarks', true);
+ progress1.Set('chart.annotatable', true);
+ progress1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show the palette', RGraph.Showpalette], ['Clear', function () {RGraph.Clear(progress1.canvas, '#fff'); progress1.Draw();}]]);
+ progress1.Set('chart.margin', 3);
+ progress1.Set('chart.tickmarks.inner', true);
+ progress1.Set('chart.label.inner', true);
+ progress1.Set('chart.units.post', '%');
+ progress1.Set('chart.min', 50);
+ //progress1.Set('chart.adjustable', true);
+ progress1.Draw();
+
+ var progress2 = new RGraph.HProgress('progress2', [41,22], 100);
+ progress2.Set('chart.colors', ['red', 'yellow']);
+ progress2.Set('chart.shadow', true);
+ progress2.Set('chart.shadow.color', '#666');
+ progress2.Set('chart.shadow.offsetx', 0);
+ progress2.Set('chart.shadow.offsety', 0);
+ progress2.Set('chart.shadow.blur', 15);
+ progress2.Set('chart.margin', 3);
+ progress2.Set('chart.title', 'Disk usage (tooltips)');
+ progress2.Set('chart.units.post', 'Gb');
+ progress2.Set('chart.tooltips', ['<b>Warning!</b><br />Disk usage is high. It might be time to delete<br /> some of your files',
+ 'Second tooltip'
+ ]);
+ progress2.Set('chart.tickmarks', false);
+ progress2.Set('chart.tickmarks.inner', true);
+ progress2.Set('chart.numticks.inner', 25);
+ progress2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Horizontal Progress bar
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Horizontal Progress bar</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ This is a Progress Bar for showing state. You can show anything with it - use it to show load on your server,
+ or percentage space free on your servers disk drive. You could even incorporate it with some AJAX to retrieve status information
+ from your webserver dynamically, making the Progress Bar realtime. To redraw the progress bar simply call <i>RGraph.Clear()</i>
+ (which clears the canvas) and then call <i>myProgress.Draw()</i> again.
+ </p>
+
+ <p>
+ The colours, title and scale are configurable, allowing you to represent a wide range of values.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/hprogress.html">Horizontal Progress bar API documentation</a></li>
+ <li><a href="vprogress.html">Vertical progress bar</a></li>
+ </ul>
+ </div>
+
+ <div>
+ <canvas width="450" height="75" id="progress1">[No canvas support]</canvas>
+ <canvas width="450" height="75" id="progress2">[No canvas support]</canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+-->
+<html>
+<head>
+ <title>RGraph: HTML5 canvas graph library - examples</title>
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <meta name="keywords" content="rgraph graph html5 javascript canvas" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library - examples" />
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ Examples
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Example pages</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+<p>
+ The following example pages are available:
+</p>
+
+<ul>
+ <li><a href="bar.html">Bar chart</a></li>
+ <li><a href="bipolar.html">Bi-polar chart</a></li>
+ <li><a href="donut.html">Donut chart</a></li>
+ <li><a href="funnel.html">Funnel chart</a></li>
+ <li><a href="gantt.html">Gantt chart</a></li>
+ <li><a href="hbar.html">Horizontal Bar chart</a></li>
+ <li><a href="hprogress.html">Horizontal progress bar</a></li>
+ <li><a href="led.html">LED grid</a></li>
+ <li><a href="line.html">Line chart</a></li>
+ <li><a href="meter.html">Meter</a></li>
+ <li><a href="odo.html">Odometer</a></li>
+ <li><a href="pie.html">Pie chart</a></li>
+ <li><a href="rscatter.html">Radial scatter chart</a></li>
+ <li><a href="rose.html">Rose chart</a></li>
+ <li><a href="scatter.html">Scatter graph</a></li>
+ <li><a href="tradar.html">Traditional radar chart</a></li>
+ <li><a href="vprogress.html">Vertical progress bar</a></li>
+</ul>
+
+<ul>
+ <li><a href="basic.html">A basic example (for implementation help)</a></li>
+</ul>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - LED grid</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example led grid" />
+ <meta name="description" content="RGraph: LED grid example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.led.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var led1 = new RGraph.LED('myCanvas1', 'abcdefgh');
+ led1.Set('chart.zoom.hdir', 'center');
+ led1.Set('chart.zoom.vdir', 'center');
+ led1.Set('chart.contextmenu', [['Zoom in', function (e) {if (!RGraph.isIE8()) {RGraph.Zoom(e);} else {alert('[MSIE] This browser does not support zoom');}}]]);
+ led1.Set('chart.light', 'black');
+ led1.Draw();
+
+ var led2 = new RGraph.LED('myCanvas2', 'ijklmnop');
+ led2.Set('chart.light', '#0f0');
+ led2.Draw();
+
+ var led3 = new RGraph.LED('myCanvas3', 'qrstuvwx');
+ led3.Set('chart.light', '#f00');
+ led3.Draw();
+
+ var led4 = new RGraph.LED('myCanvas4', 'yz012345');
+ led4.Set('chart.light', '#ff0');
+ led4.Draw();
+
+ var led5 = new RGraph.LED('myCanvas5', '6789 ');
+ led5.Set('chart.light', '#0ff');
+ led5.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ LED Grid
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - LED Grid</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ An LED grid, that could be used to show a multitude of things. Could be used as a website counter for example.
+ It supports the A-Z, 0-9 and space characters. As you can see the colors are also user-definable. It also
+ supports the context menu, and therefore the zoom. The first LED grid demonstrates this.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/led.html">LED Grid API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="width: 50%; margin-left: 250px; text-align: center">
+ <canvas id="myCanvas1" width="275" height="60">[No canvas support]</canvas>
+ <canvas id="myCanvas2" width="275" height="60">[No canvas support]</canvas>
+ <canvas id="myCanvas3" width="275" height="60">[No canvas support]</canvas>
+ <canvas id="myCanvas4" width="275" height="60">[No canvas support]</canvas>
+ <canvas id="myCanvas5" width="275" height="60">[No canvas support]</canvas>
+ </div>
+
+ <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - line chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example line chart" />
+ <meta name="description" content="RGraph: Line chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.line.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var line1 = new RGraph.Line('line1', [20,25,13,14,16,18,21,32,12,15], [23,25,26,28,29,21,22,25,26,28]);
+ line1.Set('chart.title', 'A line chart (tooltips, labels, context, no axes, zoom)');
+ line1.Set('chart.colors', ['red', 'green']);
+ line1.Set('chart.tickmarks', ['circle', 'square']);
+ line1.Set('chart.linewidth', 1);
+ line1.Set('chart.background.barcolor1', 'white');
+ line1.Set('chart.background.barcolor2', 'white');
+ line1.Set('chart.background.grid.autofit', true);
+ line1.Set('chart.filled', 'true');
+ line1.Set('chart.fillstyle', ['#fcc', '#cfc']);
+ line1.Set('chart.tooltips', ['id:tooltip_china', 'id:tooltip_la', 'id:tooltip_plymouth',
+ 'id:tooltip_meadowhall', 'id:tooltip_sydney', 'id:tooltip_toronto',
+ 'id:tooltip_france', 'id:tooltip_norway', 'id:tooltip_sweden',
+ 'id:tooltip_spain', 'id:tooltip_deli', 'id:tooltip_congo',
+ 'id:tooltip_brazil', 'id:tooltip_california', 'id:tooltip_newyork',
+ 'id:tooltip_paris', 'id:tooltip_uk', 'id:tooltip_antartica',
+ 'id:tooltip_sahara', 'id:tooltip_zagreb']);
+ line1.Set('chart.tooltips.effect', 'contract');
+
+ if (!RGraph.isIE8()) {
+ line1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Cancel', function () {}]]);
+ line1.Set('chart.zoom.delay', 10);
+ line1.Set('chart.zoom.frames', 25);
+ line1.Set('chart.zoom.vdir', 'center');
+ }
+
+ line1.Set('chart.text.angle', 45);
+ line1.Set('chart.gutter', 45);
+ line1.Set('chart.units.post', '%');
+ line1.Set('chart.labels.ingraph', [3,'Meadowhall (48)']);
+ line1.Set('chart.noaxes', true);
+ line1.Set('chart.background.grid', true);
+ line1.Set('chart.yaxispos', 'right');
+ line1.Set('chart.ymax', 100);
+ line1.Set('chart.title.xaxis', 'Location');
+ line1.Set('chart.title.yaxis', 'Percentage');
+ line1.Set('chart.title.xaxis.pos', 0.5);
+ line1.Set('chart.title.yaxis.pos', 0.5);
+ line1.Draw();
+
+ var line4 = new RGraph.Line('line4', [0,300,500,600,100,200,400,500,700,800,400,100],
+ [500,400,500,700,300,300,500,600,700,800,600,300],
+ [400,200,400,500,300,300,400,500,400,100,400,300]);
+ line4.Set('chart.key', ['2008', '2007', '2006']);
+ line4.Set('chart.key.background', 'white');
+ line4.Set('chart.key.shadow', true);
+ line4.Set('chart.key.shadow.offsetx', 0);
+ line4.Set('chart.key.shadow.offsety', 0);
+ line4.Set('chart.key.shadow.blur', 15);
+ line4.Set('chart.key.shadow.color', '#ccc');
+ line4.Set('chart.key.rounded', true);
+ line4.Set('chart.gutter', 45);
+
+ if (!RGraph.isIE8()) {
+ line4.Set('chart.zoom.mode', 'thumbnail');
+ } else {
+ line4.Set('chart.key.shadow.offsetx', 2);
+ line4.Set('chart.key.shadow.offsety', 2);
+ }
+
+ line4.Set('chart.filled', true);
+ line4.Set('chart.tickmarks', null);
+ line4.Set('chart.background.barcolor1', 'white');
+ line4.Set('chart.background.barcolor2', 'white');
+ line4.Set('chart.background.grid.autofit', true);
+ line4.Set('chart.title', 'A line chart (zoom, Y axis on the right)');
+ line4.Set('chart.colors', ['rgba(169, 222, 244, 0.7)', 'red', '#ff0']);
+ line4.Set('chart.fillstyle', ['#daf1fa', '#faa', '#ffa']);
+ line4.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ line4.Set('chart.yaxispos', 'right');
+ line4.Set('chart.linewidth', 5);
+ line4.Draw();
+
+ /**
+ * Create the 9th graphs data
+ */
+ var data1 = [];
+ var data2 = [];
+ var data3 = [];
+
+
+ var line9 = new RGraph.Line('line9', [56,45,43,52,56,65,21,23,34,15,21,-12,-13,-31,-25]);
+ line9.Set('chart.background.barcolor1', 'white');
+ line9.Set('chart.background.barcolor2', 'white');
+ line9.Set('chart.background.grid', true);
+ line9.Set('chart.linewidth', 5);
+ line9.Set('chart.gutter', 35);
+ line9.Set('chart.hmargin', 5);
+ line9.Set('chart.shadow', true);
+ line9.Set('chart.tickmarks', null);
+ line9.Set('chart.units.post', 'k');
+ line9.Set('chart.xticks', 8);
+ line9.Set('chart.colors', ['red', 'green', 'blue']);
+ line9.Set('chart.key', ['Sales (not good)']);
+ line9.Set('chart.key.shadow', true);
+ line9.Set('chart.key.rounded', true);
+ line9.Set('chart.key.position', 'gutter');
+ line9.Set('chart.xaxispos', 'center');
+ line9.Set('chart.background.grid.autofit', true);
+ line9.Set('chart.background.grid.autofit.numhlines', 16);
+
+ // Define a context menu that allows you to toggle the background grid. The two options simply:
+ // 1. Set the appropriate setting on the object
+ // 2. Clear the canvas
+ // 3. Draw the graph again
+ line9.Draw();
+
+ var line13 = new RGraph.Line('line13', [6,5,4,5,6,4,1,2,3], [7,8,9,9,8,7,8,7,6]);
+ line13.Set('chart.labels', ['13th','14th','15th','16th','15th','16th','17th','18th','19th']);
+ line13.Set('chart.title', 'A range chart');
+ line13.Set('chart.gutter', 25);
+ line13.Set('chart.background.barcolor1', 'white');
+ line13.Set('chart.background.barcolor2', 'white');
+ line13.Set('chart.filled', true);
+ line13.Set('chart.filled.range', true);
+ line13.Set('chart.fillstyle', 'rgba(128,255,128,0.5)');
+ line13.Set('chart.linewidth', 2);
+ line13.Set('chart.colors', ['green']);
+ line13.Set('chart.hmargin', 5);
+ line13.Draw();
+
+ var line14 = new RGraph.Line('line13', [1,1.5,1.8,1.1,1.2,1.3,1.5,1,0.7], [3.4,3.1,3,4.1,3.9,3.3,4.1,2.9,3]);
+ line14.Set('chart.background.grid', false);
+ line14.Set('chart.filled', true);
+ line14.Set('chart.filled.range', true);
+ line14.Set('chart.background.barcolor1', 'rgba(0,0,0,0)');
+ line14.Set('chart.background.barcolor2', 'rgba(0,0,0,0)');
+ line14.Set('chart.noaxes', true);
+ line14.Set('chart.ylabels', false);
+ line14.Set('chart.ymax', 10);
+ line14.Set('chart.colors', ['red']);
+ line14.Set('chart.fillstyle', 'rgba(255,0,0,0.5)');
+ line14.Set('chart.linewidth', 2);
+ line14.Set('chart.hmargin', 5);
+ line14.Draw();
+ }
+ </script>
+
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Line chart
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Line chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+ <p>
+ Like the Bar chart, the line chart is one of the most versatile chart types. It is similar, but can indicate chronological
+ data better. The line chart is good if, for example, you want to illustrate sales figures over a year (or any period of
+ time). You'll then be able to easily see whether sales are going up, down or are stagnant. It will also become apparent
+ which months are busier than others. By using a multiple line chart you can add multiple sets of data (eg two or more years
+ of figures) to your chart. You can customise the line chart by stipulating it as being filled, having drop shadows, keys,
+ having the X axis in the centre, different colors, different tickmark styles and tooltips etc.
+ </p>
+
+ <p>
+ The first graph uses external DIVs for the tooltip contents. The DIVs are at the bottom of this page (they're set not to
+ be visible). Using external DIVs for tooltips can make maintenance easier.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/line.html">Line chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div>
+ <canvas id="line1" width="475" height="250">[Please wait...]</canvas>
+ <canvas id="line4" width="475" height="250">[Please wait...]</canvas>
+ <canvas id="line9" width="475" height="350">[Please wait...]</canvas>
+ <canvas id="line13" width="475" height="350">[Please wait...]</canvas>
+ </div>
+ </div>
+
+ <!-- These are the tooltips for the first graph. -->
+ <div style="display: none">
+ <div id="tooltip_china"><b>China</b><br /><a href="http://www.google.com/#q=china">A populous country</a></div>
+ <div id="tooltip_la"><b>Los Angeles</b><br />Home of sexy time!</div>
+ <div id="tooltip_plymouth"><b>Plymouth</b><br />Plenty of surfers dude</div>
+ <div id="tooltip_meadowhall"><b>Meadowhall</b><br />Shopping heaven (or hell...) here</div>
+ <div id="tooltip_sydney"><b>Sydney</b><br />Home of kangeroos</div>
+ <div id="tooltip_toronto"><b>Toronto</b><br />Brrrr, chilly</div>
+ <div id="tooltip_france"><b>France</b><br />Ever had frogs legs?</div>
+ <div id="tooltip_norway"><b>Norway</b><br />Skiing here</div>
+ <div id="tooltip_sweden"><b>Sweden</b><br />Skiing here too</div>
+ <div id="tooltip_spain"><b>Spain</b><br />Hola!</div>
+ <div id="tooltip_deli"><b>Deli</b><br />Hot and humid here</div>
+ <div id="tooltip_congo"><b>Congo</b><br />Not exactly a holiday resort</div>
+ <div id="tooltip_plymouth"><b>Plymouth</b><br />Plenty of surfers here</div>
+ <div id="tooltip_brazil"><b>Brazil</b><br />Fooseball</div>
+ <div id="tooltip_california"><b>Califonia</b><br />"I'll be back..." And he was</div>
+ <div id="tooltip_newyork"><b>New York</b><br />Home of the Friends comedy show</div>
+ <div id="tooltip_paris"><b>Paris</b><br />Ever eaten frogs legs?</div>
+ <div id="tooltip_uk"><b>UK</b><br />Not a place for getting sun-tans</div>
+ <div id="tooltip_antartica"><b>Antartica</b><br />Surprisingly, incorporates the driest place in the world</div>
+ <div id="tooltip_sahara"><b>Sahara</b><br />A questionable film, and a rather hot place</div>
+ <div id="tooltip_zagreb"><b>Zagreb</b><br />Anyone know where this is...?</div>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - meter</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example meter chart" />
+ <meta name="description" content="RGraph: Meter chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.meter.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var meter1 = new RGraph.Meter('meter1', 50, 100, 58);
+
+ var grad1 = meter1.context.createRadialGradient(meter1.canvas.width / 2,meter1.canvas.height - 25,0,meter1.canvas.width / 2,meter1.canvas.height - 25,200);
+ grad1.addColorStop(0, 'green');
+ grad1.addColorStop(1, 'white');
+
+ var grad2 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,200);
+ grad2.addColorStop(0, 'yellow');
+ grad2.addColorStop(1, 'white');
+
+ var grad3 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,200);
+ grad3.addColorStop(0, 'red');
+ grad3.addColorStop(1, 'white');
+
+ //meter1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show palette', RGraph.Showpalette], ['Clear annotations', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}], null, ['Cancel', function () {}]]);
+ meter1.Set('chart.annotatable', true);
+ meter1.Set('chart.labels.position', 'inside');
+ meter1.Set('chart.title', 'A sample measurement (annotatable)');
+ meter1.Set('chart.title.vpos', 0.5);
+ meter1.Set('chart.title.color', 'black');
+ meter1.Set('chart.green.color', grad1);
+ meter1.Set('chart.yellow.color', grad2);
+ meter1.Set('chart.red.color', grad3);
+ meter1.Set('chart.shadow', true);
+ meter1.Set('chart.shadow.color', 'gray');
+ meter1.Set('chart.shadow.offsetx', 0);
+ meter1.Set('chart.shadow.offsety', 0);
+ meter1.Set('chart.shadow.blur', 15);
+ meter1.Set('chart.zoom.hdir', 'center');
+ meter1.Set('chart.zoom.vdir', 'center');
+ meter1.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}]]);
+ meter1.Draw();
+
+ var meter2 = new RGraph.Meter('meter2', 0, 10, 5);
+ meter2.Set('chart.units.post', 'k');
+ meter2.Set('chart.red.start', 0);
+ meter2.Set('chart.red.end', 3);
+ meter2.Set('chart.yellow.start', 3);
+ meter2.Set('chart.yellow.end', 6);
+ meter2.Set('chart.green.start', 6);
+ meter2.Set('chart.green.end', 10);
+ meter2.Set('chart.resizable', true);
+ meter2.Draw();
+
+ var meter3 = new RGraph.Meter('meter3', 0, 500, 210);
+ //meter3.Set('chart.units.post', 'pt');
+ meter3.Set('chart.red.start', 0);
+ meter3.Set('chart.red.end', 100);
+ meter3.Set('chart.yellow.start', 100);
+ meter3.Set('chart.yellow.end', 200);
+ meter3.Set('chart.green.start', 200);
+ meter3.Set('chart.green.end', 500);
+ meter3.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<h1>RGraph: HTML5 canvas graph library - Meter</h1>
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Meter
+ </div>
+
+ <div>
+ <p>
+ The Meter is similar to the Odometer albeit only a semi-circle and not a full circle. It can be better when trying illustrate
+ a particular level, but only have a limited amount of space. It could also be quite effective as part of a control panel.
+ </p>
+
+ <p></p>
+ </div>
+
+ <div>
+ <ul>
+ <li><a href="../docs/meter.html">Meter API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="text-align: center">
+ <canvas id="meter1" width="600" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+ <canvas id="meter2" width="600" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+ <canvas id="meter3" width="600" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - odometer</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example odometer chart" />
+ <meta name="description" content="RGraph: Odometer chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.odo.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ // ID, MINIMUM, MAXIMUM, INDICATED VALUE
+ var odo1 = new RGraph.Odometer('odo1', 0, 12,9.5);
+ odo1.Set('chart.labels', ['12', '1','2','3','4','5','6','7','8','9','10','11']);
+ odo1.Set('chart.needle.thickness', 5);
+ odo1.Set('chart.needle.color', 'black');
+ odo1.Set('chart.needle.extra', [[30, 'black']]);
+ odo1.Set('chart.needle.head', false);
+ odo1.Set('chart.title', 'A clock-esque odometer (zoom)');
+ odo1.Set('chart.label.area', 40);
+ odo1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom],['Cancel', function () {}]]);
+ odo1.Set('chart.shadow.outer', true);
+ odo1.Set('chart.needle.tail', false);
+ odo1.Set('chart.zoom.vdir', 'up');
+
+ odo1.Set('chart.green.color', 'gray');
+ odo1.Set('chart.yellow.color', 'gray');
+ odo1.Set('chart.red.color', 'gray');
+
+ RGraph.AddCustomEventListener(odo1, 'ondraw',
+ function (obj)
+ {
+ var context = obj.context;
+ context.strokeStyle = 'black';
+ context.fillStyle = 'white';
+ context.beginPath();
+ context.moveTo(obj.centerx, obj.centery);
+ context.arc(obj.centerx, obj.centery, 10, 0, 6.28, 0);
+ context.stroke();
+ context.fill();
+ }
+ );
+
+ odo1.Draw();
+
+ // ID, MINIMUM, MAXIMUM, INDICATED VALUE
+ var odo2 = new RGraph.Odometer('odo2', 0, 360, 56);
+ odo2.Set('chart.annotatable', true);
+ //odo2.Set('chart.needle.thickness', 6);
+ odo2.Set('chart.needle.color', 'black');
+ odo2.Set('chart.needle.tail', false);
+ //odo2.Set('chart.needle.type', 'triangle');
+ odo2.Set('chart.label.area', 35);
+ odo2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(odo2.canvas); odo2.Draw();}]]);
+ odo2.Set('chart.border', document.all ? false : true);
+ odo2.Set('chart.title', 'A bordered compas');
+ //odo2.Set('chart.tickmarks.highlighted', true);
+ odo2.Set('chart.labels', ['N','NE','E','SE','S','SW','W','NW']);
+ odo2.Set('chart.red.min', 360);
+ odo2.Set('chart.red.color', 'gray');
+ odo2.Set('chart.value.text', true);
+ odo2.Set('chart.value.units.post', ' degrees');
+ odo2.Draw();
+
+
+ var odo3 = new RGraph.Odometer('odo3',0, 200, 160);
+ odo3.Set('chart.green.max', 150);
+ odo3.Set('chart.red.min', 175);
+ odo3.Set('chart.title', 'An odometer');
+ odo3.Set('chart.shadow.inner', true);
+ odo3.Set('chart.value.text', true);
+ odo3.Set('chart.value.units.post', ' litres');
+ odo3.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<h1>RGraph: HTML5 canvas graph library - Odometer</h1>
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Odometer
+ </div>
+
+ <div>
+ <p>
+ The Odometer can be used to provide an indication of a particular value. For example you could easily use it to
+ represent values for a control panel that shows information about a server. An Odometer indicating how much disk
+ space is used for example, would be more visual than a simple number.
+ </p>
+
+ <p>
+ The green, yellow and red areas are configurable, allowing you to add some level of urgency into your figures. The
+ figures are also configurable, so it can go from 0-10, or from 0-100.
+ </p>
+ </div>
+
+ <div>
+ <ul>
+ <li><a href="../docs/odo.html">Odometer API documentation</a></li>
+ </ul>
+ </div>
+
+ <canvas id="odo1" width="300" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+ <canvas id="odo2" width="300" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+ <canvas id="odo3" width="300" height="300"><div class="canvasfallback">[No canvas support]</div></canvas>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - pie chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example pie chart" />
+ <meta name="description" content="RGraph: Pie chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.pie.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ /**
+ * These are not angles - these are values. The appropriate angles are calculated
+ */
+ var pie1 = new RGraph.Pie('pie1', [41,37,16,3,3]); // Create the pie object
+ pie1.Set('chart.labels', ['MSIE 7 (41%)', 'MSIE 6 (37%)', 'Firefox (16%)', 'Safari (3%)', 'Other (3%)']);
+ pie1.Set('chart.gutter', 30);
+ pie1.Set('chart.title', "Browsers (tooltips, context, zoom)");
+ pie1.Set('chart.shadow', false);
+ pie1.Set('chart.tooltips.effect', 'fade');
+ pie1.Set('chart.tooltips.event', 'onmousemove');
+ pie1.Set('chart.tooltips', [
+ 'Internet Explorer 7 (41%)',
+ 'Internet Explorer 6 (37%)',
+ 'Mozilla Firefox (16%)',
+ 'Apple Safari (3%)',
+ 'Other (3%)'
+ ]
+ );
+ pie1.Set('chart.highlight.style', '3d'); // Defaults to 3d anyway; can be 2d or 3d
+
+ if (!RGraph.isIE8()) {
+ pie1.Set('chart.zoom.hdir', 'center');
+ pie1.Set('chart.zoom.vdir', 'up');
+ pie1.Set('chart.labels.sticks', true);
+ pie1.Set('chart.labels.sticks.color', '#aaa');
+ pie1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom]]);
+ }
+
+ pie1.Set('chart.linewidth', 5);
+ pie1.Set('chart.labels.sticks', true);
+ pie1.Set('chart.strokestyle', 'white');
+ pie1.Draw();
+
+ var pie2 = new RGraph.Pie('pie2', [2,29,45,17,7]); // Create the pie object
+ pie2.Set('chart.gutter', 45);
+ pie2.Set('chart.title', "Some data (context, annotatable)");
+ pie2.Set('chart.linewidth', 1);
+ pie2.Set('chart.strokestyle', '#333');
+ pie2.Set('chart.shadow', true);
+ pie2.Set('chart.shadow.blur', 3);
+ pie2.Set('chart.shadow.offsetx', 3);
+ pie2.Set('chart.shadow.offsety', 3);
+ pie2.Set('chart.shadow.color', 'rgba(0,0,0,0.5)');
+ pie2.Set('chart.colors', ['red', 'pink', '#6f6', 'blue', 'yellow']);
+ pie2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(pie2.canvas); pie2.Draw();}]]);
+ pie2.Set('chart.key', ['John (2%)', 'Richard (29%)', 'Fred (45%)', 'Brian (17%)', 'Peter (7%)']);
+ pie2.Set('chart.key.background', 'white');
+ pie2.Set('chart.key.shadow', true);
+ pie2.Set('chart.annotatable', true);
+ pie2.Set('chart.align', 'left');
+ pie2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Pie chart
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Pie chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div>
+
+ <p>
+ The Pie chart can be used when you need to represent value as part of a whole. It is commonly used to represent percentages,
+ relative magnitudes or relative frequencies. If your intent is to compare a particular value (slice) against the whole of
+ the Pie chart, then it can be quite effective. If however you want to compare two seperate segments, then it can get
+ more difficult. If this is the case, you may want to consider a bar chart for example.
+ </p>
+
+ <p>
+ The colours can of course be customised, as can the borders (using the same color as the background and a line width of
+ about 5 gives the effect of segment separation. The chart can also have a drop shadow if you want one, but this shouldn't
+ be used in conjunction with segment seperation.
+ </p>
+
+ <p>
+ The first pie chart has a fade-in effect. This not part of the RGraph library but is very easy to implement.
+ </p>
+ </div>
+
+ <div>
+ <ul>
+ <li><a href="../docs/pie.html">Pie chart API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="text-align: center">
+ <canvas id="pie1" width="420" height="300">[No canvas support]</canvas>
+ <canvas id="pie2" width="440" height="300">[No canvas support]</canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - rose chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example rose chart" />
+ <meta name="description" content="RGraph: Rose chart example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.rose.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var rose1 = new RGraph.Rose('rose1', [41,37,16,3,3,45,26,25,24,12,34,60,36,24,23,12]);
+ rose1.Set('chart.colors', ['rgba(0,255,0,0.5)']);
+ rose1.Set('chart.gutter', 30);
+ rose1.Set('chart.title', "Market share (context, zoom)");
+ if (!RGraph.isIE8()) {
+ rose1.Set('chart.zoom.vdir', 'center');
+ rose1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom]]);
+ }
+ rose1.Draw();
+
+
+
+ var rose2 = new RGraph.Rose('rose2', [10,15,13,12,11,26,14,13,24,12,26,23]);
+ rose2.Set('chart.colors', ['red', 'blue','green','yellow','black','pink','gray','cyan','blue','red','green','green']);
+ rose2.Set('chart.colors.alpha', 0.5);
+ rose2.Set('chart.labels', ['45','90','135','180','235','270','315','360']);
+ rose2.Set('chart.tooltips', ['John','Kyle','Kiffen','Jeff','Barney','Kev','Kiffen','Lou','Pete','Jane','Richard','Jake']);
+ rose2.Set('chart.labels.axes', 'n');
+ rose2.Set('chart.labels.position', 'edge');
+ rose2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Rose chart
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Rose chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Rose chart was formally called the Radar chart.
+ </p>
+
+ <ul>
+ <li><a href="../docs/rose.html">Rose chart API documentation</a></li>
+ </ul>
+
+ <canvas id="rose1" width="450" height="350">[No canvas support]</canvas>
+ <canvas id="rose2" width="450" height="350">[No canvas support]</canvas>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html >
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+
+ <title>RGraph: HTML5 canvas graph library - Radial scatter graph</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example radial scatter chart" />
+ <meta name="description" content="RGraph: Radial scatter graph example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.rscatter.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ // Create the data
+ var data = [];
+ for (var i=0; i<75; i++) {
+ data.push([RGraph.random(0, 360), i * RGraph.random(0, 10), null, 'Index: ' + String(i)]);
+ }
+
+ var rscatter1 = new RGraph.Rscatter('cvs', data);
+ rscatter1.Set('chart.labels.axes', 'n');
+ rscatter1.Set('chart.labels.position', 'edge');
+ rscatter1.Set('chart.labels', ['NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', '']);
+ rscatter1.Set('chart.tickmarks', 'plus');
+ rscatter1.Set('chart.tooltips.effect', 'contract');
+ rscatter1.Set('chart.title', 'A Radial scatter graph');
+ rscatter1.Set('chart.title.color', 'black');
+ rscatter1.Set('chart.title.vpos', 0.3);
+ rscatter1.Draw();
+
+ rscatter2 = new RGraph.Rscatter('cvs2', [[30, 120, 'red'], [350, 100, 'blue']]);
+ rscatter2.Set('chart.contextmenu', [['Palette', RGraph.Showpalette], ['Clear', function () {RGraph.Clear(rscatter2.canvas);rscatter2.Draw();}]]);
+ rscatter2.Set('chart.title', 'A(nother) Radial scatter graph');
+ rscatter2.Set('chart.title.color', 'black');
+ rscatter2.Set('chart.title.vpos', 0.3);
+ rscatter2.Set('chart.annotatable', true);
+ rscatter2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Radial scatter graph
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Radial scatter graph</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Radial scatter chart is a circular variant of the regular Scatter chart, and as the name suggests, circular. It
+ may be more suited to your dataset than the regular scatter chart.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/rscatter.html">Radial scatter graph API documentation</a></li>
+ </ul>
+ </div>
+
+ <div style="text-align: center">
+ <canvas id="cvs" width="350" height="350">[No canvas support]</canvas>
+ <canvas id="cvs2" width="350" height="350">[No canvas support]</canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+
+ <title>RGraph: HTML5 canvas graph library - scatter graph</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example scatter chart" />
+ <meta name="description" content="RGraph: Scatter graph example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.scatter.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var data = [
+ [1,9, 'red'], [360,5, 'red'], [150,16, 'red'], [132,12, 'red'],
+ [43,15, 'green'], [12,16, 'green'], [96,11, 'green'], [45,13, 'green'],
+ [61,9, 'blue'], [133,7, 'blue'], [166,1, 'blue'], [333,18, 'blue'],
+ [45,16], [166,4], [12,3], [45,15],
+ [16,16], [98,9], [46,8], [43,4]
+ ];
+
+ var scatter1 = new RGraph.Scatter('scatter1', data);
+ scatter1.Set('chart.ticksize', 4);
+ scatter1.Set('chart.background.barcolor1', 'white');
+ scatter1.Set('chart.background.barcolor2', 'white');
+ scatter1.Set('chart.background.grid.autofit', true);
+ scatter1.Set('chart.background.grid.autofit.numhlines', 10);
+ scatter1.Set('chart.labels', [
+ ['Q1', 0],
+ ['Q2', 90],
+ ['Q3', 180],
+ ['Q4', 270]
+ ]);
+ scatter1.Set('chart.xmax', 365); // Necessary
+ scatter1.Set('chart.title', 'A scatter graph (zoom)');
+ scatter1.Set('chart.gutter', 40);
+ scatter1.Set('chart.ylabels.count', 5);
+ scatter1.Set('chart.title.xaxis', 'Quarter');
+ scatter1.Set('chart.title.yaxis', 'Total pieces');
+
+
+ if (!RGraph.isIE8()) {
+ scatter1.Set('chart.zoom.factor', 2);
+ scatter1.Set('chart.zoom.mode', 'area');
+ }
+ scatter1.Draw();
+
+ var data2 = [
+ [10,15,'red'],[13,16,'red'],[12,11,'red'],[15,16,'red'],[20,19,'red'],[19,16,'red'],[13,15,'red'],[11,12,'red'],[13,16,'red'],[5,19,'red'],[16,15,'red'],[13,15,'red'],[14,14,'red'],[12,12,'red'],
+ [5,4,'green'],[6,14,'green'],[19,12,'green'],[3,5,'green'],[1,16,'green'],[13,5,'green'],[15,15,'green'],[13,5,'green'],[4,9,'green'],[16,6,'green'],[13,18,'green'],[18,12,'green'],[19,18,'green'],[13,16,'green'],[15,14,'green'],
+ [12,4,'blue'],[4,23,'blue'],[13,8,'blue'],[12,12,'blue'],[18,4,'blue'],[4,18,'blue'],[11,2,'blue'],[4,3,'blue'],[5,8,'blue'],[1,9,'blue'],[4,6,'blue'],[16,8,'blue'],[17,8,'blue'],[19,9,'blue'],[13,5,'blue'],[16,21,'blue'],
+ [12,4],[13,12],[11,16],[4,19],[4,3],[5,6],[1,9],[4,12],[6,12],[8,8],[16,6],[13,5],[15,13],[23,23,'red'], [1,1, 'gray'],
+ [1,4,'gray'], [2,3,'gray'], [1,6,'gray'], [2,3,'gray'], [2,5,'gray'], [3,7,'gray'], [1,4,'gray'], [2,7,'gray']
+ ];
+
+ var scatter2 = new RGraph.Scatter('scatter2', data2);
+ scatter2.Set('chart.ylabels.count', 10);
+ scatter2.Set('chart.background.barcolor1', 'white');
+ scatter2.Set('chart.background.barcolor2', 'white');
+ scatter2.Set('chart.background.hbars', [
+ [0,null,'rgba(0,255,0,0.3)']
+ ]);
+ scatter2.Set('chart.background.grid.autofit', true);
+ scatter2.Set('chart.background.grid.autofit.numhlines', 10);
+ scatter2.Set('chart.labels', ['Wk1', 'Wk2', 'Wk3', 'Wk4']);
+ scatter2.Set('chart.xmax', 28); // Necessary
+ scatter2.Set('chart.defaultcolor', 'black'); // Optional
+ scatter2.Set('chart.title', 'A scatter chart (center X axis, context, crosshairs)');
+ scatter2.Set('chart.gutter', 40);
+ scatter2.Set('chart.tickmarks', 'square');
+ scatter2.Set('chart.ticksize', 4);
+ scatter2.Set('chart.ymax', 30);
+ scatter2.Set('chart.units.pre', '$');
+ scatter2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(scatter2.canvas); scatter2.Draw();}]]);
+
+ if (!RGraph.isIE8()) {
+ scatter2.Set('chart.crosshairs', true);
+ scatter2.Set('chart.crosshairs.coords', true);
+ scatter2.Set('chart.crosshairs.coords.labels.x', 'Day');
+ scatter2.Set('chart.crosshairs.coords.labels.y', 'Amount');
+ }
+
+ scatter2.Set('chart.line.colors', ['red','blue','black']);
+ scatter2.Set('chart.key', ['Bob','Fred','Gaz']);
+
+ scatter2.Draw();
+
+
+
+ var scatter8 = new RGraph.Scatter('scatter8', [
+ [10,[21,22,26,31,35, 'red', 'green']],
+ [105,[10,10,15,25,30, 'red', 'green']],
+ [125,[10,15,25,35,45, 'red', 'green']],
+ [325,[10,15,25,35,45, 'yellow', 'green', 30]] // The last value is the width (in pixels)
+ ]);
+ scatter8.Set('chart.title', 'An example of a boxplot (minimum Y value)');
+ scatter8.Set('chart.tickmarks', null);
+ scatter8.Set('chart.labels', ['Q1', 'Q2', 'Q3', 'Q4']);
+ scatter8.Set('chart.xmax', 365);
+ scatter8.Set('chart.ymax', 50);
+ scatter8.Set('chart.ymin', 10);
+ scatter8.Set('chart.boxplot.width', 12); // The default width
+ scatter8.Set('chart.background.vbars', [[182.5, 91.125, 'rgba(0,255,0,0.5)']]);
+ scatter8.Draw();
+
+ var scatter9 = new RGraph.Scatter('scatter9',
+ [[50,31, null, '<b>Fred</b><br />Fred is at the start'], [80,49, null, '<b>Juan</b><br />Juan is in the middle'], [280,45, null, '<b>Hoolio</b><br />Hoolio is at the end']],
+ [[25,21], [67,22], [289,35]]);
+ scatter9.Set('chart.title', 'A stepped scatter chart (minimum Y value)');
+ scatter9.Set('chart.labels', ['Q1', 'Q2', 'Q3', 'Q4']);
+ scatter9.Set('chart.xmax', 365);
+ scatter9.Set('chart.ymax', 50);
+ scatter9.Set('chart.line', true);
+ scatter9.Set('chart.line.stepped', [true, false]);
+ scatter9.Set('chart.line.linewidth', [1,1]);
+ scatter9.Set('chart.line.colors', ['red', 'blue']);
+ scatter9.Set('chart.ticksize', 5);
+ scatter9.Set('chart.key', ['Richard', 'Robert']);
+ scatter9.Set('chart.key.position', 'gutter');
+ scatter9.Set('chart.key.position.y', scatter9.canvas.height - scatter9.Get('chart.gutter') - 20);
+ scatter9.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Scatter graph
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Scatter graph</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ The Scatter graph uses two variables to plot points and makes it clear where there are congregations. The data points
+ make up the X and Y coordinates. The labels on the X axis are separate from the X units, allowing you to "group" them. For
+ example, like the example, you could set the maxium X value to be 365, but only have four labels. That way you would
+ have a granularity of a day, but the X axis would only have four labels. Like the example.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/scatter.html">Scatter graph API documentation</a></li>
+ </ul>
+ </div>
+
+ <canvas id="scatter1" width="450" height="250">[No canvas support]</canvas>
+ <canvas id="scatter2" width="450" height="250">[No canvas support]</canvas>
+
+ <a name="boxplots"></a>
+ <table border="0" style="float: left; width: 450px">
+ <tr>
+ <td><canvas id="scatter8" width="450" height="250">[No canvas support]</canvas></td>
+ </tr>
+
+ <tr>
+ <td>
+ <div style="background-color: #eee; border: 2px dashed gray; padding: 3px">
+ This is an example of a box plot. You can read about them <a href="../docs/scatter.html#boxplots">here</a>.
+ </div>
+ </td>
+ </tr>
+ </table>
+
+ <canvas id="scatter9" width="450" height="250">[No canvas support]</canvas>
+
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - shwowcase page</title>
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+</head>
+<body>
+ <div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Showcase
+ </div>
+
+ <h1>RGraph: HTML5 canvas graph library - Showcase page</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ Since the showcase page was becoming too slow and heavy and producing an awful lot of graphs, each graph type now has its
+ own example page.
+ </p>
+
+ <ul>
+ <li><a href="bar.html">Bar chart</a></li>
+ <li><a href="bipolar.html">Bi-polar chart</a></li>
+ <li><a href="donut.html">Donut chart</a></li>
+ <li><a href="funnel.html">Funnel chart</a></li>
+ <li><a href="gantt.html">Gantt chart</a></li>
+ <li><a href="led.html">LED grid</a></li>
+ <li><a href="line.html">Line chart</a></li>
+ <li><a href="odo.html">Odometer</a></li>
+ <li><a href="pie.html">Pie chart</a></li>
+ <li><a href="progress.html">Progress bar</a></li>
+ <li><a href="radar.html">Radar chart</a></li>
+ <li><a href="scatter.html">Scatter graph</a></li>
+ <li><a href="tradar.html">Traditional radar chart</a></li>
+ </ul>
+
+ <ul>
+ <li><a href="basic.html">A basic example (for implementation help)</a></li>
+ </ul>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - Animated rotating text with the RGraph software</title>
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+
+ <script>
+ __pause = false; // Provide a way to pause the rotation
+ __RGraph_rotate = 0; // A record of the angle (IN DEGREES) we're at currently
+ __RGraph_rotate2 = 0; // Ditto, but this is controlled by the buttons
+
+ window.onload = function ()
+ {
+
+ if (!__pause) {
+ var canvas = document.getElementById("myc");
+ var context = canvas.getContext('2d');
+
+ RGraph.Clear(canvas); // Clears the canvas
+
+ context.beginPath();
+ context.fillStyle = 'black';
+
+ RGraph.Text(context, 'Verdana',10,canvas.width/2,canvas.height/2,'Magic text! (' + __RGraph_rotate + ')','center','center',false, ++__RGraph_rotate);
+ RGraph.Text(context, 'Verdana', 16, 50, 50, 'This is making me dizzy... (' + (__RGraph_rotate * 5) + ')', 'center', 'left', false, __RGraph_rotate * 2);
+ RGraph.Text(context, 'Verdana', 20, 50, 200, 'Some user controllable text (' + __RGraph_rotate2 + ')', 'center', 'center', false, __RGraph_rotate2);
+
+ context.stroke();
+ context.fill();
+ }
+
+ setTimeout(window.onload, 1);
+ }
+ </script>
+</head>
+<body>
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Rotating text
+</div>
+
+<h1>RGraph: A text function that does horizontal and vertical alignment (and spins)</h1>
+
+
+
+<table border="0" style="float: left; margin-right: 10px">
+ <tr>
+ <td colspan="2"><canvas id="myc" width="300" height="300" style="border: 1px dashed gray">The fallback HTML</canvas></td>
+ </tr>
+
+ <tr>
+ <td align="center">
+ <button style="width: 100px; margin: 5px" onclick="__RGraph_rotate2 -= 5">« Rotate left</button>
+ <button style="margin: 5px" onclick="if (this.innerHTML == 'Pause') {__pause = true; this.innerHTML = 'Play'} else {this.innerHTML = 'Pause'; __pause = false; }">Pause</button>
+ <button style="width: 100px; margin: 5px" onclick="__RGraph_rotate2 += 5">Rotate right»</button>
+ </td>
+ </tr>
+</table>
+
+<p>
+ RGraph.Text() is a text drawing function that allows vertical and horizontal alignment, and allows you to specify the angle of the
+ text too. The animation is done by a simple gobal variable, setTimeout() and redrawing the entire
+ canvas every frame. Perhaps not the most efficient of methods, but remember that your Javascript will likely be
+ running on computers that have more processing power than
+ some small countries... <a href="javascript: location.href = location.href">Reset the page</a>
+</p>
+
+<p>
+ In a similar vein you could easily make some text that bounces from one side of the screen to the other,
+ hurrah - the return of <marquee>!
+</p>
+
+ <div>
+ More examples can be found on the individual <a href="/examples/index.html">example pages</a>, and a more complete
+ reference to the Text() function can be found in the <a href="../docs/api.html#functions.other">API docs</a>.
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+
+ <title>RGraph: HTML5 canvas graph library - Traditional radar chart</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example tradar radar chart" />
+ <meta name="description" content="RGraph: Traditional radar chart" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.tradar.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ if (RGraph.isIE8()) {
+ ShowGraph1();
+ ShowGraph2();
+ }
+ }
+
+ function ShowGraph1 ()
+ {
+ var tradar5 = new RGraph.Tradar('tradar5', [43,84,54,64,34,21,21]);
+ tradar5.Set('chart.labels.axes', 'n');
+ tradar5.Set('chart.circle', 50);
+ tradar5.Set('chart.circle.fill', 'rgba(0, 0, 255, 0.3)');
+ tradar5.Set('chart.tooltips', ['Dave (43)', 'John (84)', 'Kiffen (54)', 'Peter (64)', 'Lou (34)', 'Igor (21)', 'John (21)']);
+ tradar5.Set('chart.tooltips.effect', 'fade');
+ tradar5.Set('chart.title', 'The results of the competition (tooltips)');
+ tradar5.Set('chart.labels', ['Dave (43)', 'John (84)', 'Kiffen (54)', 'Peter (64)', 'Lou (34)', 'Igor (21)', 'John (21)']);
+ tradar5.Draw();
+ }
+
+ function ShowGraph2 ()
+ {
+ var tradar = new RGraph.Tradar('tradar1', [3,3,41,37,16]);
+ tradar.Set('chart.background.circles', true);
+ tradar.Set('chart.color', 'rgba(255,0,0,0.3)');
+ tradar.Set('chart.circle.fill', 'rgba(200,255,200,0.9)');
+ tradar.Set('chart.labels', ['Safari (3%)', 'Other (3%)', 'MSIE 7 (41%)', 'MSIE 6 (37%)', 'Firefox (16%)']);
+ tradar.Set('chart.title', "Browser share (annotatable, context, zoom)" );
+ tradar.Set('chart.linewidth', 1);
+ tradar.Set('chart.labels.axes', 'n');
+
+ if (!RGraph.isIE8()) {
+ tradar.Set('chart.zoom.vdir', 'up');
+ tradar.Set('chart.contextmenu', [
+ ['Zoom in', RGraph.Zoom],
+ ['Clear', function () {RGraph.Clear(tradar.canvas); tradar.Draw()}],
+ ['Show PNG', RGraph.showPNG]
+ ]);
+ tradar.Set('chart.annotatable', true);
+ }
+
+ tradar.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Traditional radar chart
+</div>
+
+<h1>RGraph: HTML5 canvas graph library - Traditional radar chart</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <div style="float: right; width: 450px">
+ </div>
+
+ <p>
+ A traditional radar chart, that is similar to the Rose chart. Each of the data points is
+ arranged equally in terms of angle, whilst the magnitude of each point is shown by the distance from the centre. Thus,
+ data points of a higher magnitude can be seen as they are more distant from the centre.
+ </p>
+
+ <p>
+ Suitable for many datasets, but not all. If not, then the Rose chart may be more apt.
+ </p>
+
+ <p>
+ The circle, as can be seen in the second example, could be used to indicate a threshold of sorts. In the example,
+ it could be minimum sales required for a particular month. Months that fall below this threshold can be clearly seen.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/tradar.html">Traditional radar chart API documentation</a></li>
+ <li><a href="rose.html">Rose chart example</a></li>
+ </ul>
+ </div>
+
+ <div style="position: relative">
+ <canvas id="tradar1" width="450" height="350" style="float: left">[No canvas support]</canvas>
+ <span onclick="RGraph.showPNG(document.getElementById('tradar1'), event)" style="position: absolute; left: 350px; top: 30px; border: 1px black solid; padding: 1px; background-color: #eee; cursor: pointer">Get PNG</span>
+ <canvas id="tradar5" width="475" height="350" style="float: right">[No canvas support]</canvas>
+ </div>
+
+ <script>
+ if (!RGraph.isIE8()) {
+ ShowGraph1();
+ ShowGraph2();
+ }
+ </script>
+
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+ <title>RGraph: HTML5 canvas graph library - vertical progress bar</title>
+
+ <meta name="keywords" content="rgraph html5 canvas example vertical progress bar" />
+ <meta name="description" content="RGraph: Vertical Progress Bar example" />
+
+ <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="../images/favicon.png">
+
+ <script src="../libraries/RGraph.common.core.js"></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.vprogress.js"></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var progress1 = new RGraph.VProgress('progress1', 63, 100);
+ progress1.Set('chart.tickmarks', false);
+ progress1.Set('chart.annotatable', true);
+ progress1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show the palette', RGraph.Showpalette], ['Clear', function () {RGraph.Clear(progress1.canvas, '#fff'); progress1.Draw();}]]);
+ progress1.Set('chart.margin', 3);
+ progress1.Set('chart.tickmarks.inner', true);
+ progress1.Set('chart.label.inner', true);
+ progress1.Set('chart.gutter', 30);
+ progress1.Set('chart.units.post', '%');
+
+ progress1.Draw();
+
+ var progress2 = new RGraph.VProgress('progress2', [6.5, 1, 2], 10);
+ progress2.Set('chart.colors', ['red', '#cfc', 'blue']);
+ progress2.Set('chart.shadow', true);
+ progress2.Set('chart.shadow.color', '#666');
+ progress2.Set('chart.shadow.offsetx', 0);
+ progress2.Set('chart.shadow.offsety', 0);
+ progress2.Set('chart.shadow.blur', 15);
+ progress2.Set('chart.margin', 3);
+ progress2.Set('chart.tooltips', ['John', 'Fred', 'Pete']);
+ progress2.Set('chart.tooltips.effect', 'contract');
+ progress2.Set('chart.tickmarks', true);
+ progress2.Set('chart.tickmarks.inner', true);
+ progress2.Set('chart.tickmarks.color', '#333');
+ progress2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <!-- Social networking buttons -->
+
+ <script>
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+ </script>
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+
+ <div id="social">
+ <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%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">
+ <img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+
+ <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">
+ <img src="../images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="../images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="../images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+ </div>
+ <!-- /Social networking buttons -->
+
+
+<div id="breadcrumb">
+ <a href="../index.html">RGraph: HTML5 canvas graph library</a>
+ >
+ <a href="./index.html">Examples</a>
+ >
+ Vertical Progress bar
+</div>
+
+ <h1>RGraph: HTML5 canvas graph library - Vertical Progress bar</h1>
+
+ <script>
+ if (RGraph.isIE8()) {
+ 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>');
+ }
+ </script>
+
+ <p>
+ This is a Progress Bar for showing state. You can show anything with it - use it to show load on your server,
+ or percentage space free on your servers disk drive. You could even incorporate it with some AJAX to retrieve status information
+ from your webserver dynamically, making the Progress Bar realtime. To redraw the progress bar simply call <i>RGraph.Clear()</i>
+ (which clears the canvas) and then call <i>myProgress.Draw()</i> again.
+ </p>
+
+ <p>
+ The colours, title and scale are configurable, allowing you to represent a wide range of values.
+ </p>
+
+ <div>
+ <ul>
+ <li><a href="../docs/vprogress.html">Vertical Progress bar API documentation</a></li>
+ <li><a href="hprogress.html">Horizontal Progress bar</a></li>
+ </ul>
+ </div>
+
+ <div>
+ <canvas width="125" height="450" id="progress1">[No canvas support]</canvas>
+ <canvas width="125" height="450" id="progress2">[No canvas support]</canvas>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php
+ require('common.php');
+ ob_start('ob_gzhandler');
+?>
+<!DOCTYPE html>
+<html>
+<head>
+
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+ <!--
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+ -->
+
+ <title>RGraph: HTML5 canvas graph library based on the HTML5 canvas tag</title>
+
+ <script src="libraries/RGraph.common.adjusting.js" ></script>
+ <script src="libraries/RGraph.common.core.js" ></script>
+ <script src="libraries/RGraph.common.context.js" ></script>
+ <script src="libraries/RGraph.common.tooltips.js" ></script>
+ <script src="libraries/RGraph.common.zoom.js" ></script>
+ <script src="libraries/RGraph.modaldialog.js" ></script>
+
+ <script src="libraries/RGraph.line.js" ></script>
+ <script src="libraries/RGraph.bar.js" ></script>
+ <script src="libraries/RGraph.rose.js" ></script>
+ <!--[if IE 8]><script src="excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <link rel="stylesheet" href="css/website.css" type="text/css" media="screen" />
+ <link rel="icon" type="image/png" href="images/favicon.png">
+ <link rel="alternate" type="application/rss+xml" title="RGraph: HTML5 canvas graph library" href="http://groups.google.com/group/rgraph/feed/rss_v2_0_msgs.xml">
+
+ <meta name="verify-v1" content="5y8rHGO/NPFDYU8jBgyT3qI7CSiEoPaeB+4x2TXan+4=" />
+ <meta name="keywords" content="html5 canvas graph rgraph javascript line chart bar graphs" />
+ <meta name="description" content="RGraph: HTML5 canvas graph library for websites on all platforms" />
+
+
+ <style>
+ .RGraph_zoom_window {
+ border-radius: 0 ! important;
+ -moz-border-radius: 0 ! important;
+ -webkit-border-radius: 0 ! important;
+ box-shadow: 0 0 15px gray ! important;
+ -moz-box-shadow: 0 0 15px gray ! important;
+ -webkit-box-shadow: 0 0 15px gray ! important;
+ border: 1px gray solid ! important;
+ }
+
+ .RGraph_zoomed_canvas {
+ -webkit-box-shadow: 0 0 15px gray ! important;
+ }
+
+ .ModalDialog_dialog {
+ -webkit-box-shadow: gray 0 0 15px ! important;
+ -moz-box-shadow: 0 0 15px gray ! important;
+ box-shadow: 0 0 15px gray ! important;
+ }
+ </style>
+
+ <script>
+ cover = {div: null};
+
+ function ShowWarning ()
+ {
+ if (document.all && !RGraph.isIE8() && !RGraph.isIE9up()) {
+ cover.div = document.createElement('DIV');
+ cover.div.style.position = 'absolute';
+ cover.div.style.top = 0;
+ cover.div.style.left = 0;
+ cover.div.style.width = (document.body.clientWidth + 20) + 'px';
+ cover.div.style.height = Math.max(document.documentElement.scrollHeight, screen.height) + 'px';
+ cover.div.style.filter = 'Alpha(opacity=50)';
+ cover.div.style.backgroundColor = 'gray';
+ document.body.appendChild(cover.div);
+
+
+ cover.messageDiv = document.createElement('DIV');
+ cover.messageDiv.style.left = ((parseInt(document.body.clientWidth) / 2) - 200) + 'px';
+ cover.messageDiv.style.top = '200px';
+ cover.messageDiv.style.width = '400px';
+ cover.messageDiv.style.padding = '5px';
+ cover.messageDiv.style.position = 'absolute';
+ cover.messageDiv.style.backgroundColor = 'yellow';
+ cover.messageDiv.style.textAlign = 'center';
+ cover.messageDiv.style.fontFamily = 'Arial';
+ cover.messageDiv.style.fontSize = '12pt';
+ cover.messageDiv.style.border = '2px black solid';
+ cover.messageDiv.style.filter = 'filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135);';
+ document.body.appendChild(cover.messageDiv);
+
+ cover.messageDiv.innerHTML = "<h2>Yikes!</h2>Your version of Microsoft Internet Explorer appears to be less than 8, which is required to view these graphs. You can still view the website, but it will look odd and the graphs won't work.<br /><br /><a onclick=\"cover.div.style.display = 'none'; cover.messageDiv.style.display = 'none';\" href=\"javascript:\">Close</a>"
+ }
+ }
+
+ window.onload = function (e)
+ {
+ if (RGraph.isIE8()) {
+ CreateLineChart();
+ CreateBarChart();
+ CreateRoseChart();
+ }
+
+ ShowWarning();
+ }
+
+ window.onresize = function (e)
+ {
+ if (cover.div) {
+ cover.messageDiv.style.display = 'none';
+ cover.div.style.display = 'none';
+ cover.div = null;
+ }
+
+ ShowWarning();
+ }
+
+
+ function HideTwitterDIV ()
+ {
+ document.getElementById("twitter_div").style.opacity = 0;
+ document.getElementById("twitter_div").style.display = 'none';
+ }
+
+
+ function ShowTwitterDIV (e)
+ {
+ var e = RGraph.FixEventObject(document.all ? event : e);
+ var div = document.getElementById("twitter_div");
+ var img = document.getElementById("twitter_icon");
+
+ div.style.display = 'block';
+ div.style.left = (RGraph.getCanvasXY(img)[0] + img.offsetWidth - div.offsetWidth + 110) + 'px';
+ div.style.top = (RGraph.getCanvasXY(img)[1] - 1) + 'px';
+
+ /**
+ * Fade it in
+ */
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.2;', 25);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.4;', 50);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.6;', 100);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 0.8;', 125);
+ setTimeout('document.getElementById("twitter_div").style.opacity = 1.0;', 150);
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ /**
+ * This code installs the event handler that hides the Twitter DIV
+ */
+ if (RGraph.isIE8()) {
+ window.attachEvent('onload', function () {document.body.attachEvent('onclick', HideTwitterDIV);});
+ } else {
+ window.addEventListener('click', HideTwitterDIV, false);
+ }
+
+ </script>
+
+</head>
+<body>
+
+ <!-- "Preload" images -->
+ <div style="position: absolute; top: -100px">
+ <img src="images/delicious.png">
+ <img src="images/twitter.png">
+ <img src="images/buzz.png">
+ <img src="images/facebook.png">
+ <img src="images/friendfeed.png">
+ <img src="images/stumble.png">
+ </div>
+
+
+ <div id="title">
+ <div id="image">
+ <br />
+ <img src="images/logo.png" align="absmiddle" alt="RGraph: HTML5 canvas graphing library" width="64" height="64" style="position: relative; top: 15px" />
+ </div>
+
+ <div id="text">
+ <h1>RGraph: HTML5 canvas graph library based on the HTML5 canvas tag</h1>
+ <i style="position: relative; top: -20px; left: 5px">Interactive javascript/HTML5 canvas graphs using the <b>HTML5 canvas</b> tag for all platforms</i>
+
+ <br />
+
+ <div style="display: inline; display: inline-block; float: left">
+ <a href="#download" style="text-decoration: none">
+ <img src="images/download-stable-sml.png" width="32" height="32" alt="Download the beta version" border="0" align="absmiddle" />
+ <b style="text-decoration: underline">Download the stable version</b>
+ </a>
+
+ <a href="#download" style="text-decoration: none">
+ <img src="images/download-beta-sml.png" width="32" height="32" alt="Download the beta version" border="0" align="absmiddle" />
+ <b style="text-decoration: underline">Download the beta version</b>
+ </a>
+ </div>
+
+
+ <!-- The twitter DIV -->
+ <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;">
+ <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 about RGraph</a><br>
+ <a href="http://twitter.com/_rgraph" style="text-decoration: none" rel="nofollow" target="_blank">Follow for HTML5 news</a>
+ </div>
+
+ <div id="social_icons" class="warning" style="top: 0; left: 5px; position: absolute">
+ <script>
+ // Opera fix
+ if (navigator.userAgent.indexOf('Opera') == -1) {
+ document.getElementById("social_icons").style.position = 'fixed';
+ document.getElementById("twitter_div").style.position = 'fixed';
+
+ }
+ </script>
+
+ <b style="display: inline-block; position: relative; top: 1px">Bookmark and share:</b>
+
+ <!-- Social networking buttons -->
+
+ <div id="social">
+ <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%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">
+ <img src="images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+ <a href="" target="_blank" onmouseover="if (document.getElementById('twitter_div').style.display == 'none') ShowTwitterDIV(event);" onclick="event.stopPropagation(); event.cancelBubble = true; return false">
+ <img src="images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+
+
+<!--
+ <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">
+ <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"/>
+ </a>
+
+ <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">
+ <img src="images/facebook.png" width="22" height="22" alt="Post to Facebook" align="absmiddle" style="position: relative; top: -2px; border: 0" border="0"/>
+ </a>
+
+ <a href="mailto:share@friendfeed.com" title="Share on FriendFeed">
+ <img src="images/friendfeed.png" width="22" height="22" alt="Share on FriendFeed" border="0" align="absmiddle" />
+ </a>
+
+ <a href="http://www.stumbleupon.com/submit?url=http://www.rgraph.net" target="_blank" title="Share on StumbleUpon" >
+ <img src="images/stumble.png" alt="Stumble! this site" width="22" height="22" border="0" align="absmiddle" />
+ </a>
+-->
+ </div>
+
+ <!-- Social networking buttons -->
+ </div>
+
+
+ </div>
+ </div>
+
+ <br />
+
+ <div>
+ <div style="margin-top: 25px">
+ <center><b>Note:</b> Starting from preview 3, <b>Internet Explorer 9</b> has <a href="http://groups.google.com/group/rgraph/browse_thread/thread/c5651ff8c56b8f3c#" target="_blank" rel="nofollow">canvas support</a>.</center>
+ </div>
+ </div>
+
+
+
+ <!-- END HEADER -->
+
+
+ <br clear="all" />
+
+ <div style="width: 475px; float: right">
+
+
+ <div style="float: right; width: 480px; text-align: center">
+ <canvas id="myLine" width="480" height="230">[Please wait for the onload event to fire...]</canvas>
+ <script async>
+ /**
+ * Create the line graph
+ */
+ function CreateLineChart ()
+ {
+ var data1 = [14,13,16,18,14,12,11,14,19,18,17,18];
+ var data2 = [11,12,14,12,11,13,13,15,14,15,13,14];
+
+ var myLine = new RGraph.Line('myLine', data1, data2);
+ myLine.Set('chart.colors', ['red', 'black']);
+ myLine.Set('chart.units.post', '%');
+ myLine.Set('chart.tickmarks', null);
+ myLine.Set('chart.shadow', true);
+ myLine.Set('chart.shadow.offsety', RGraph.isIE8() ? 3 : 0);
+ myLine.Set('chart.shadow.offsetx', RGraph.isIE8() ? 3 : 0);
+ myLine.Set('chart.shadow.blur', 15);
+ myLine.Set('chart.shadow.color', ['#f66', '#666']);
+ myLine.Set('chart.linewidth', 5);
+ myLine.Set('chart.hmargin', 10);
+ myLine.Set('chart.background.grid.width', 1);
+ myLine.Set('chart.background.grid.color', '#ddd');
+ myLine.Set('chart.background.grid.hsize', 25);
+ myLine.Set('chart.background.grid.vsize', 25);
+ myLine.Set('chart.background.barcolor1', 'white');
+ myLine.Set('chart.background.barcolor2', 'white');
+ myLine.Set('chart.title', 'An example line chart with zoom');
+ myLine.Set('chart.title.xaxis', 'Previous year');
+ myLine.Set('chart.title.yaxis.pos', 0.5);
+ myLine.Set('chart.title.xaxis.pos', 0.5);
+ myLine.Set('chart.title.yaxis', 'Percentage');
+ myLine.Set('chart.title.color', '#333');
+ myLine.Set('chart.text.color', '#333');
+ myLine.Set('chart.noaxes', true);
+ myLine.Set('chart.gutter', 40);
+ myLine.Set('chart.yaxispos', 'right');
+ myLine.Set('chart.ymin', 10);
+
+ myLine.Set('chart.key', ['Robert', 'Daniel']);
+ myLine.Set('chart.key.shadow', true);
+ myLine.Set('chart.key.shadow.blur', navigator.userAgent.indexOf('Chrome') > 0 ? 15 : 5);
+ myLine.Set('chart.key.shadow.offsetx', 0);
+ myLine.Set('chart.key.shadow.offsety', 0);
+ myLine.Set('chart.key.shadow.color', navigator.userAgent.indexOf('Chrome') > 0 ? '#ccc' : 'black');
+ myLine.Set('chart.key.rounded', true);
+
+ if (!RGraph.isIE8()) {
+ myLine.Set('chart.zoom.frames', 15);
+ myLine.Set('chart.zoom.delay', 20);
+ myLine.Set('chart.zoom.hdir', 'left');
+ myLine.Set('chart.zoom.vdir', 'center');
+ myLine.Set('chart.zoom.mode', 'area');
+ myLine.Set('chart.zoom.factor', 2);
+
+ } else {
+ myLine.Set('chart.contextmenu', [['Show modal dialog', function() {ModalDialog.Show('myDialog', 300);}],['Cancel', function () {}]]);
+ // Change the shadow color
+ myLine.Set('chart.shadow.color', '#666');
+ }
+
+ // Chrome shadow bug
+ myLine.Set('chart.chromefix', location.href.indexOf('chromefix=0') > 0 ? false : true);
+
+ myLine.Draw();
+ }
+ </script>
+
+
+ <div class="description">
+ An example of the line chart. This chart has zoom functionality enabled in area mode. Simply draw a rectangle around
+ the area you wish to zoom in on. Once the zoom appears you can move it around with the left mouse button, move the
+ canvas around within the zoom using the right mouse button and double click the zoom to expand it full size.<br />
+ <a href="examples/line.html">More Line charts...</a>
+ </div>
+
+
+ <br />
+
+
+ <canvas id="myBar" width="480" height="230">[Please wait for the onload event to fire...]</canvas>
+ <script async>
+ function CreateBarChart ()
+ {
+ var bar = new RGraph.Bar('myBar', [[23,25], [30,25], [27,28], [26,18], [31,20], [39,28], [27,29], [26,23]]);
+
+ /**
+ * Create the gradients
+ */
+ var grad1 = bar.context.createLinearGradient(0,25,0,205);
+ grad1.addColorStop(0, 'blue');
+ grad1.addColorStop(1, '#6F72FF');
+
+ var grad2 = bar.context.createLinearGradient(0,25,0,205);
+ grad2.addColorStop(0, 'pink');
+ grad2.addColorStop(1, '#FFDDFF');
+
+ if (!RGraph.isIE8()) {
+ bar.Set('chart.tooltips', ['<b>2000</b><br />Girls only had an average<br />year in 2000',
+ '<b>2000</b><br />Boys had a slightly better<br />year in 2000',
+ '<b>2001</b><br />Girls had a good year',
+ '<b>2001</b><br />Boys had an average year',
+ '<b>2002</b><br />Both girls and boys had an average year',
+ '<b>2002</b><br />Both girls and boys had an average year',
+ '<b>2003</b><br />Girls had an average year in 2003',
+ '<b>2003</b><br />Boys had a rather poor showing in 2003',
+ '<b>2004</b><br />Girls had a good showing in 2004',
+ '<b>2004</b><br />Slightly better than than last year,<br />but still not good',
+ '<b>2005</b><br />Girls had a particularly good year',
+ '<b>2005</b><br />Boys got back up to par this year',
+ '<b>2006</b><br />Girls were back to average',
+ '<b>2006</b><br />Boys remained at an average level',
+ '<b>2007</b><br />Girls were more or less the same as last month',
+ '<b>2007</b><br />Boys were starting to drop again'
+ ]);
+ bar.Set('chart.tooltips.effect', 'contract');
+ //bar.Set('chart.tooltips.event', 'onmousemove');
+ bar.Set('chart.zoom.vdir', 'center');
+ bar.Set('chart.zoom.hdir', 'left');
+ bar.Set('chart.zoom.frames', 50);
+ bar.Set('chart.zoom.delay', 5);
+ bar.Set('chart.zoom.factor', 2);
+ bar.Set('chart.contextmenu', [
+ ['Zoom', RGraph.Zoom],
+ ['Get PNG', RGraph.showPNG],
+ ['Application',
+ [
+ ['Login...', function () {ModalDialog.Show('modaldialog_login', 300);}]
+ ]
+ ],
+ null,
+ ['Cancel', function () {}]
+ ]);
+ }
+
+ bar.Set('chart.title', 'Population by gender (tooltips, context, zoom)');
+ bar.Set('chart.gutter', 35);
+ bar.Set('chart.background.barcolor1', 'white');
+ bar.Set('chart.background.barcolor2', 'white');
+ bar.Set('chart.background.grid.autofit', true);
+ bar.Set('chart.colors', [grad2, grad1]);
+ bar.Set('chart.labels', ['2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007']);
+ bar.Set('chart.text.angle', 30);
+ bar.Set('chart.units.post', 'm');
+
+ bar.Set('chart.shadow', true);
+ bar.Set('chart.shadow.color', '#ccc');
+ bar.Set('chart.shadow.blur', 15);
+ bar.Set('chart.shadow.offsetx', 0);
+ bar.Set('chart.shadow.offsety', 0);
+
+ bar.Set('chart.strokecolor', 'rgba(0,0,0,0)');
+ bar.Set('chart.labels.above', true);
+ bar.Set('chart.xlabels.offset', 3);
+
+ RGraph.Clear(bar.canvas, 'white');
+
+ if (RGraph.isIE8()) {
+ bar.Set('chart.shadow.offsetx', 3);
+ bar.Set('chart.shadow.offsety', 3);
+ }
+
+ bar.Draw();
+ }
+ </script>
+
+
+ <div class="description">
+ The bar chart has tooltips, along with a context menu. The context menu has options to zoom the canvas (in full
+ canvas mode) and shows an example of the ModalDialog which is part of RGraph. The context menu shows one
+ level of submenus. It also shows how you can add an option to get a PNG version of the graph.<br />
+ <a href="examples/bar.html">More Bar charts...</a>
+ </div>
+
+ <br />
+
+
+ <canvas id="rose" width="450" height="300">[Please wait for the onload event to fire...]</canvas>
+ <script async>
+ /**
+ * Show the funnel chart
+ */
+ function CreateRoseChart ()
+ {
+ var rose = new RGraph.Rose('rose', [41,37,16,3,3,45,26,25,24,12,34,60]);
+ rose.Set('chart.colors', ['rgba(0,255,0,0.5)']);
+ rose.Set('chart.gutter', 25);
+ rose.Set('chart.labels', ['30','60','90','120','150','180','210','240','270','300','330','360']);
+ rose.Set('chart.labels.axes', 'n'); // North axis only
+ rose.Set('chart.labels.position', 'edge');
+
+ if (!RGraph.isIE8()) {
+ rose.Set('chart.zoom.vdir', 'center');
+ rose.Set('chart.zoom.hdir', 'left');
+ rose.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Get PNG', RGraph.showPNG]]);
+ rose.Set('chart.adjustable', true);
+ rose.Set('chart.tooltips', ['Lucy','Kelly','Bart','Abu','Anne','Hoolio','Richard','Pete','Lou','Kev','Fred','Jan']);
+ }
+
+ rose.Draw();
+ }
+ </script>
+
+
+ <div class="description">
+ The Rose chart is a less well known chart but can be very effective in showing information in some circumstances. This
+ example shows tooltips and adjusting.<br />
+ <a href="examples/rose.html">More Rose charts...</a>
+ </div>
+ </div>
+ </div>
+
+ <a name="intro"></a>
+
+ <script>
+ if (!RGraph.isIE8()) {
+ CreateLineChart();
+ CreateBarChart();
+ CreateRoseChart();
+ }
+ </script>
+
+ <div style="float: left; width: 480px">
+
+ <h2>Introduction to RGraph</h2>
+
+ <p>
+ RGraph is a HTML5 canvas graph library. It uses features that became available in HTML5 (specifically, the CANVAS tag)
+ to produce a wide variety of graph types: bar chart, bi-polar chart (also known as an age frequency chart), donut chart,
+ funnel chart, gantt chart, horizontal bar chart, LED display, line graph, meter, odometer, pie chart, progress bar, rose chart,
+ scatter graph and traditional radar chart. RGraph is covered by the <b><a href="#license">RGraph License</a></b>.
+ </p>
+
+ <img src="images/chrome_logo.png" align="left" alt="Ideal for Chrome extensions!" width="61" height="58" style="margin-right: 10px" />
+
+ <p>
+ Being Javascript, RGraph is ideal for use in <b>Chrome extensions</b> and <b>Web Apps</b>. You can download a sample
+ extension <a href="http://www.rgraph.net/RGraph_ChromeExtension_sample.zip"><b>here</b></a>.
+ </p>
+
+ <p style="float: right">
+ <a href="docs/index.html"><b>Full documentation »</b></a>
+ </p>
+
+ <br clear="all" />
+
+ <h2>Contents</h2>
+
+ <ul>
+ <li><a href="#intro" title="A short description of RGraph">Introduction to RGraph</a></li>
+ <li><a href="docs/index.html#benefits" title="Benefits of using RGraph over more traditional server based graph/chart libraries">Benefits of HTML5 canvas graphs</a></li>
+ <li>
+ <a href="examples/index.html" title="Look at the examples">Examples</a> & <a href="docs/index.html" title="Look at the documentation">documentation</a><br />
+
+ <div style="padding-left: 20px">
+ <div class="list-item label">Bar chart</div>
+ <div class="list-item">
+ [<a href="examples/bar.html">examples</a>]
+ [<a href="docs/bar.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Bi-polar chart</div>
+ <div class="list-item link">
+ [<a href="examples/bipolar.html">examples</a>]
+ [<a href="docs/bipolar.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Donut chart</div>
+ <div class="list-item">
+ [<a href="examples/donut.html">examples</a>]
+ [<a href="docs/donut.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Funnel chart</div>
+ <div class="list-item">
+ [<a href="examples/funnel.html">examples</a>]
+ [<a href="docs/funnel.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Gantt chart</div>
+ <div class="list-item link">
+ [<a href="examples/gantt.html">examples</a>]
+ [<a href="docs/gantt.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Horizontal Bar chart</div>
+ <div class="list-item link">
+ [<a href="examples/hbar.html">examples</a>]
+ [<a href="docs/hbar.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Horizontal Progress bar</div>
+ <div class="list-item link">
+ [<a href="examples/hprogress.html">examples</a>]
+ [<a href="docs/hprogress.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">LED grid</div>
+ <div class="list-item link">
+ [<a href="examples/led.html">examples</a>]
+ [<a href="docs/led.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Line chart</div>
+ <div class="list-item link">
+ [<a href="examples/line.html">examples</a>]
+ [<a href="docs/line.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Meter</div>
+ <div class="list-item link">
+ [<a href="examples/meter.html">examples</a>]
+ [<a href="docs/meter.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Odometer</div>
+ <div class="list-item link">
+ [<a href="examples/odo.html">examples</a>]
+ [<a href="docs/odo.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Pie chart</div>
+ <div class="list-item link">
+ [<a href="examples/pie.html">examples</a>]
+ [<a href="docs/pie.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Rose chart</div>
+ <div class="list-item link">
+ [<a href="examples/rose.html">examples</a>]
+ [<a href="docs/rose.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Radial scatter chart</div>
+ <div class="list-item link">
+ [<a href="examples/rscatter.html">examples</a>]
+ [<a href="docs/rscatter.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Scatter chart</div>
+ <div class="list-item link">
+ [<a href="examples/scatter.html">examples</a>]
+ [<a href="docs/scatter.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Traditional radar chart</div>
+ <div class="list-item link">
+ [<a href="examples/tradar.html">examples</a>]
+ [<a href="docs/tradar.html">documentation</a>]
+ </div>
+
+ <br />
+
+ <div class="list-item label">Vertical Progress bar</div>
+ <div class="list-item link">
+ [<a href="examples/vprogress.html">examples</a>]
+ [<a href="docs/vprogress.html">documentation</a>]
+ </div>
+
+ <br /><br />
+ </li>
+ </ul>
+
+ <h3 style="margin-left: 20px">Features</h3>
+
+ <ul>
+ <li><a href="docs/setconfig.html">The RGraph.SetConfig() function</a></li>
+ <li><a href="docs/keys.html">Examples of keys</a></li>
+ <li><a href="docs/dynamic.html">Updating your graphs dynamically</a></li>
+ <li><a href="docs/png.html">Retrieving a PNG of your graph</a></li>
+ <li><a href="docs/domcontentloaded.html">The DOMContentLoaded event</a></li>
+ <li><a href="docs/events.html">Custom RGraph events</a></li>
+ <li><a href="docs/adjusting.html">Adjusting your graphs interactively</a></li>
+ <li><a href="docs/tooltips.html">Using tooltips</a></li>
+ <li><a href="docs/resizing.html">Resizing your graphs</a></li>
+ <li><a href="docs/msie.html">Microsoft Internet Explorer support</a></li>
+ <li><a href="docs/async.html">Asynchronous processing</a></li>
+ <li><a href="docs/zoom.html">Zooming your graphs</a></li>
+ <li><a href="docs/annotating.html">Annotating your graphs</a></li>
+ <li><a href="docs/combine.html">Combining charts</a></li>
+ <li><a href="docs/external.html">Integrating RGraph with external libraries (ModalDialog)</a></li>
+ <li><a href="docs/animation.html">Animating your graphs</a></li>
+ <li><a href="examples/basic.html">A basic example</a></li>
+ <li><a href="docs/css.html">Available CSS classes</a></li>
+ <li><a href="docs/color.html">About canvas color definitions</a></li>
+ <li><a href="docs/context.html">About context menus</a></li>
+ </ul>
+
+ <h3 style="margin-left: 20px">Implementation information</h3>
+
+ <ul>
+ <li><a href="docs/index.html#browser" title="Information about browser support">Browser support</a></li>
+ <li><a href="docs/index.html#performance" title="Things you may want to look at concerning performance">Improving the performance of your graphs</a></li>
+ <li><a href="docs/index.html#implementation" title="Implementing RGraph on your website">Implementing RGraph</a></li>
+ <li><a href="docs/index.html#structure" title="Suggested structure for RGraph">Suggested structure for RGraph</a></li>
+ <li>
+ <a href="docs/index.html#integration" title="Information on integrating RGraph with server side scripting">Integration with server side scripting</a>
+ <ul>
+ <li><a href="docs/index.html#mysql" title="Integration with PHP & MySQL">Integration with PHP & MySQL</li>
+ <li><a href="docs/index.html#ajax" title="Making AJAX requests">Making AJAX requests</a></li>
+ </ul>
+ </li>
+
+ <li><a href="docs/issues.html" title="If you're having trouble, have a look through these">Common issues</a></li>
+ </ul>
+
+ <h3 style="margin-left: 20px">Other</h3>
+
+ <ul>
+ <li><a href="docs/misc.html">Miscellaneous documentation</a></li>
+ <li><a href="docs/api.html">API documentation</a></li>
+ <li><a href="docs/index.html#support" title="Need support? Get it here">Support forum</a></li>
+ <li><a href="#download" title="Download RGraph">Download</a></li>
+ <li><a href="#license" title="">License</a> (<a href="docs/licensing.html">Licensing FAQs</a>)</li>
+ </ul>
+ </div>
+
+ <br clear="all" />
+
+
+ <a name="download"></a>
+ <br /> <br /> <br />
+ <h2>Download</h2>
+
+ <?php if($_SERVER['SERVER_NAME'] == 'www.rgraph.net' OR $_SERVER['SERVER_NAME'] == 'www.rgraph.org'): ?>
+ <div id="downloadlinks">
+ <p>
+ The latest download is below. It's a .zip file which you'll be able to download to your computer and open with Winzip
+ (or equivalent). This is not a time limited demo or a branded trial - it's the full version.
+ </p>
+
+ <?php ShowDownloadLinks() ?>
+
+ <p style="background-color: #ff0; border: 2px dashed black; padding: 5px; box-shadow: 0 0 15px #ccc; -moz-box-shadow: 0 0 15px #ccc; -webkit-box-shadow: 0 0 15px #ccc">
+ The website is based on the latest version of RGraph. If you're only interested in the stable version of RGraph, you should
+ download the stable archive and use that. All of the documentation is included in the archive.
+ </p>
+ </div>
+
+ <?php else: ?>
+
+ <span style="color: red">
+ [Only available on <a href="http://www.rgraph.net#download">http://www.rgraph.net</a>]
+ </span>
+ <?php endif ?>
+
+ <script>
+ /**
+ * Hide the download links if not online
+ */
+ if (location.host != 'www.rgraph.net' && location.host != 'www.rgraph.org') {
+ var downloadlinks = document.getElementById("downloadlinks");
+
+ if (downloadlinks) {
+ document.getElementById("downloadlinks").style.display = 'none';
+ }
+ }
+ </script>
+
+
+ <a name="license"></a>
+ <h2>License</h2>
+
+ <div style="float: right; padding-left: 15px; padding-right: 40px">
+
+ <div style="float: right">
+ <form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/456239608328156" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">
+ <input name="item_name_1" type="hidden" value="RGraph and PHPGuru License" />
+ <input name="item_description_1" type="hidden" value="License for RGraph: HTML5 canvas graph library and www.phpguru.org" />
+ <input name="item_quantity_1" type="hidden" value="1" />
+ <input name="item_price_1" type="hidden" value="49.0" />
+ <input name="item_currency_1" type="hidden" value="GBP" />
+ <input name="_charset_" type="hidden" value="utf-8" />
+ <input alt="" width="116" height="61" src="images/buy.png" type="image" />
+ </form>
+ </div>
+ </div>
+
+ <p>
+ RGraph is covered by the RGraph license. A summary is that for commercial/business use
+ there is a small one-time licensing fee to pay. For non-commercial purposes it's freely usable.
+
+ There are some
+ <a href="docs/licensing.html"><b>licensing FAQs</b></a> that should help to answer any
+ questions you might have. If you need one, you can <a href="http://www.rgraph.net/invoice.html">get an invoice here</a>.
+ </p>
+
+ <p>
+ If you have any questions about RGraph licensing, you can send your question to: <a href="mailto:licensing@rgraph.net">licensing@rgraph.net</a>.
+ If your question is of a support nature though, please use the <a href="http://groups.google.com/group/rgraph/topics?gvc=2" target="_blank">support forum</a>.
+ </p>
+
+ <iframe width="100%" height="300" src="LICENSE.txt"></iframe>
+
+ <p>
+
+ <div id="rgraph"></div>
+
+ <script>
+ if (location.host.match(/^dev\.rgraph/)) {
+ document.getElementById("rgraph").innerHTML = '<div id="devtag">DEVELOPMENT<br /><a href="http://www.rgraph.net">Go to the live version »</a></div>';
+ }
+ </script>
+
+ <script>
+ if (location.host == 'www.rgraph.net') {
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ }
+ </script>
+
+ <script>
+
+ if (location.host == 'www.rgraph.net') {
+ try {
+ var pageTracker = _gat._getTracker("UA-54706-2");
+ pageTracker._trackPageview();
+ } catch(err) {}
+ }
+ </script>
+
+
+ <div id="myDialog" class="ModalDialog_dialog" style="display: none">
+ <div style="font-weight: bold; font-face: Verdana; text-align: center">A modal dialog</div>
+ <p>
+ This is an example of the ModalDialog that comes as part of RGraph. More information on it
+ can be found <a href="docs/external.html">here</a>.
+ </p>
+ <small><a href="javascript: ModalDialog.Close()">Close</a></small>
+ </div>
+
+ <!-- Login dialog -->
+ <div style="display: none" class="ModalDialog" id="modaldialog_login">
+
+ <b>Login to admin area</b><br /><br />
+
+ <table border="0">
+ <tr>
+ <td align="right">Email:</td>
+ <td><input type="text" name="email" /></td>
+ </tr>
+ <tr>
+ <td align="right">Password:</td>
+ <td><input type="password" name="password" /></td>
+ </tr>
+
+ <tr>
+ <td> </td>
+ <td align="right"><input type="submit" value="Login »" /></td>
+ </tr>
+ </table>
+
+ <div style="font-size: 8pt; float: right"><a href="" onclick="ModalDialog.Hide(); return false">Dismiss</a></div>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+#!/usr/bin/php -q
+<?php
+ /**
+ * This is a minification script. It minifies the desired script "in-place"
+ *
+ * Usage (Unix): ./minify file1 file2 ...
+ * Usage (Windows): C:\php\php.exe minify file1 file2 ...
+ *
+ * The minification is medium, and it can over halve a scripts size.
+ * Combined with subsequent gzip compression the results can be excellent. For
+ * example a 70k script of mine was reduced to just 7k. (!) Substantial
+ * bandwidth savings for you, and much improved performance for your users.
+ *
+ * NOTE: Usage on Windows works, but is less tested
+ */
+
+ /**
+ * Check for arg
+ */
+ if (empty($_SERVER['argv'][1])) {
+ echo "RGraph minification script\n";
+ echo "==========================\n";
+ echo "Usage (Unix): " . $_SERVER['argv'][0] . " file1 file2 ...\n";
+ echo "Usage (Windows): C:\php\php.exe " . $_SERVER['argv'][0] . " file1 file2 ...\n\n";
+ exit;
+
+ } else {
+
+ for ($i=1; $i<count($_SERVER['argv']); ++$i) {
+ Minify($_SERVER['argv'][$i]);
+ }
+ }
+
+
+ /**
+ * This is the function that does the work of minifying the file
+ *
+ * @param $filename string The filename to be minified
+ */
+ function Minify($filename)
+ {
+ /**
+ * Begin
+ */
+ $original = file_get_contents($filename);
+ $new = preg_replace('/^ +/m', '', $original); // Lose spaces at the start of lines
+ $new = preg_replace('/ *\/\/.*$/m', '', $new); // Lose comments of the style: "// ..."
+ $new = preg_replace("/;\r?\n/m", ";\r\n", $new); // Make all lines end with \r\n
+ //$new = preg_replace("|\r\n\*|", "", $new);
+
+ /**
+ * Get rid of block comments
+ */
+ $out = '';
+ $inBlock = false; // Are we in a block comment
+ for ($i=0; $i<strlen($new); $i++) {
+ if (substr($new, $i, 1) == '/') {
+ // Read the next char
+ if (!$inBlock AND substr($new, $i, 2) == '/*') {
+ $inBlock = true;
+ }
+ } elseif (substr($new, $i, 2) == '*/') {
+ $inBlock = false;
+ $i++;
+ continue;
+ }
+
+ if (!$inBlock) {
+ $out .= substr($new, $i, 1);
+ }
+ }
+
+ /**
+ * Get rid of double line breaks
+ *
+ * NOTE: Is this necessary?
+ */
+ $out = preg_replace('|\n+|', "\n", $out);
+
+ /**
+ * Further tweaks
+ * UPDATED: 28th March 2009 - Line endings have been changed - they should all be \r\n
+ */
+ $out = str_replace(";\r\n}", ';}', $out);
+ $out = str_replace(";\r\nRGraph", ';RGraph', $out);
+ $out = preg_replace('/;\r\n([a-z])/i', ';$1', $out);
+ $out = str_replace('if (', 'if(', $out);
+ $out = str_replace(') {', '){', $out);
+ $out = str_replace("}\r\n", '}', $out);
+ $out = str_replace("{\r\n", '{', $out); // UPDATED
+ $out = str_replace("{\r\n", '{', $out); // UPDATED
+ $out = str_replace("}\r\n}", '}}', $out); // UPDATED
+ $out = str_replace("}\r\n}", '}}', $out); // UPDATED
+ $out = str_replace("}\r\n}", '}}', $out); // UPDATED
+ $out = preg_replace('/ {2,}= /', ' = ', $out);
+
+ // Mark the file as minified
+ $out = "// THIS FILE HAS BEEN MINIFIED\r\n" . $out;
+
+ file_put_contents($filename, $out);
+
+ printf(" Minifying {$filename} Before: %s After: %s Saving: %d%%\n", number_format(strlen($original)), number_format(strlen($out)), number_format((((strlen($original) - strlen($out)) / strlen($original)) * 100), 1));
+ }
+?>
\ No newline at end of file
--- /dev/null
+<?
+
+include("includes.php");
+
+if (summon_status("russ")>=1) {
+ echo "<font color='red'><blink><strong>Russ- You're being summoned!</strong></blink></font><br>";
+}
+if (summon_status("beth")>=1) {
+ echo "<font color='red'><blink><strong>Beth- You're being summoned!</strong></blink></font><br>";
+}
+?>
--- /dev/null
+0
\ No newline at end of file
--- /dev/null
+<?
+include("xml2array.php");
+
+$ch = curl_init();
+
+curl_setopt($ch, CURLOPT_URL,"http://isy99/rest/nodes/[node]");
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+$output = curl_exec($ch);
+
+#echo "<pre>";
+$array=xml2array($output);
+#print_r($array);
+
+echo "<table>";
+ echo "<tr><td>Set Temperature:</td><td>".$array['nodeInfo']['node']['property']['2_attr']['formatted']."</td></tr>";
+ echo "<tr><td>Current Temperature:</td><td>".($array['nodeInfo']['node']['property']['0_attr']['formatted'])."</td></tr>";
+ echo "<tr><td>Temperature Mode:</td><td>".($array['nodeInfo']['node']['property']['1_attr']['formatted'])."</td></tr>";
+ $mode=$array['nodeInfo']['node']['property']['1_attr']['formatted'];
+ echo "<tr><td>Fan Status:</td><td>".($array['nodeInfo']['properties']['property']['0_attr']['formatted'])."</td></tr>";
+ $fan=$array['nodeInfo']['properties']['property']['0_attr']['formatted'];
+ echo "<tr><td>Humidity:</td><td>".($array['nodeInfo']['properties']['property']['2_attr']['formatted'])."</td></tr>";
+ echo "<tr><td> </td><td> </td></tr>";
+ echo "<tr><td>Mode <select name='CLIMD' onChange=\"thermostatMode(this.value)\"><option value='0' ";
+ if ($mode=="Off") { echo "selected='selected'"; }
+ echo ">Off</option><option value='1' ";
+ if ($mode=="Heat") { echo "selected='selected'"; }
+ echo ">Heat</option><option value='2' ";
+ if ($mode=="Cool") { echo "selected='selected'"; }
+ echo ">Cool</option><option value='3' ";
+ if ($mode=="Auto") { echo "selected='selected'"; }
+ echo ">Auto</option><option value='4' ";
+ if ($mode=="Fan") { echo "selected='selected'"; }
+ echo ">Fan</option></select></td><td>Fan <select name='CLIFS' onChange=\"thermostatFan(this.value)\"><option value='7' ";
+ if ($fan=="On") { echo "selected='selected'"; }
+ echo ">On</option><option value='8' ";
+ if ($fan=="Auto") { echo "selected='selected'"; }
+ echo ">Auto</option></select></td></tr>";
+echo "</table>";
+?>
--- /dev/null
+<?
+
+include("includes.php");
+
+if (($_GET['person']) or ($_GET['status'])) {
+ $person=$_GET['person'];
+ $state=$_GET['status'];
+
+ summon($person,$status);
+ sleep(1);
+}
+
+include("xml2array.php");
+
+$programs=array("001F","0021","0022","0020","0024","0023","003D","003E","0042","0044","0043","0047","0045","0046","0048");
+
+$i=0;
+echo "<table border=0>";
+echo "<tr><td><table border=1>";
+foreach ($programs as $program) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL,"http://isy99/rest/programs/$program");
+
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+ $output = curl_exec($ch);
+ $array=xml2array($output);
+ #echo "<pre>";
+ #$array=xml2array($output);
+ #print_r($array);
+ #exit;
+
+ echo "<tr><td>".$array['programs']['program']['name']."</td>";
+ $status=($array['programs']['program_attr']['status']);
+ if ($status=="true") {
+ echo "<td><img src='icons/button_On.png'></td></tr>";
+ } else {
+ echo "<td><img src='icons/button_Off.png'></td></tr>";
+ }
+ $i++;
+ if ($i==5) {
+ echo "</table></td><td><table border=1>";
+ $i=0;
+ $colspan++;
+ }
+}
+$colspan++;
+echo "</td></tr></table>";
+echo "</td></tr><tr><td colspan='$colspan'>";
+echo "<center><table border=1>";
+echo "<tr><td>Summon Russ</td>";
+if (summon_status("russ")>=1) {
+ echo "<td><a href=\"javascript:ajaxpage('check_isy99i_occupancy_status.php?person=russ&status=0','contentarea');\">
+<img src='icons/button_On.png'></a></td>";
+} else {
+ echo "<td><a href=\"javascript:ajaxpage('check_isy99i_occupancy_status.php?person=russ&status=1','contentarea');\">
+<img src='icons/button_Off.png'></a></td>";
+}
+echo "<td>Summon Beth</td>";
+if (summon_status("beth")>=1) {
+ echo "<td><a href=\"javascript:ajaxpage('check_isy99i_occupancy_status.php?person=beth&status=0','contentarea');\">
+<img src='icons/button_On.png'></a></td>";
+} else {
+ echo "<td><a href=\"javascript:ajaxpage('check_isy99i_occupancy_status.php?person=beth&status=1','contentarea');\">
+<img src='icons/button_Off.png'></a></td>";
+}
+echo "</table></center>";
+echo "</table>";
+?>
--- /dev/null
+<?
+
+include("xml2array.php");
+
+$scenes=array("0F%20D5%2040%201");
+$blacklist=array("11 BE 54 1","11 BE 54 2","11 BE 54 3","11 BE 54 4","13 DF E6 1","13 DF E6 2","13 DF E6 3","13 DF E6 4","13 DF E6 5","13 DF E6 6","14 1F FD 1","14 1F FD 2","14 1F FD 3","14 1F FD 4","14 1F FD 5","14 1F FD 6","14 10 BE 1","14 10 BE 2","14 10 BE 3","14 2F 81 1","14 2F 81 2","14 2F 81 3","14 33 9A 1","14 33 9A 2","14 33 9A 3","14 33 A5 1","14 33 A5 2","14 33 A5 3","14 33 AB 1","14 33 AB 2","14 33 AB 3","14 F 11 1","14 F 11 2","14 F 11 3","2C B 2B 1","2C B 2B 2","2C B 2B 3","21 26 AC 1","21 26 AC 2","21 26 AC 3","21 26 AC 4","21 26 AC 5","21 26 AC 6","21 26 AC 7","21 26 AC 8","17 78 13 1","17 79 A4 1");
+$programs=array("");
+
+#echo "<pre>";
+#$array=xml2array($output);
+#print_r($array);
+#exit;
+
+$device=$_GET['device'];
+$i=0;
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,"http://isy99/rest/nodes");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+$output = curl_exec($ch);
+$array=xml2array($output);
+
+echo "<table><tr><td>";
+echo "<table border=1>";
+foreach ($array[nodes][node] as $device) {
+ $match=0;
+ foreach ($blacklist as $item) {
+ if ($device[address] == $item) {
+ $match=1;
+ }
+ }
+ if ($match == 0) {
+ $address = "nodes/".str_replace(' ', '%20', ($device[address]));
+ $name = $device[name];
+ $status = $device['property_attr']['formatted'];
+ if ($status=="On" or $status=="true") {
+ $i++;
+ echo "<tr><td>".$name."</td>";
+ echo "<td><a href=\"javascript:insteon('set_isy99i_status.php?device=".$address."&state=DOF');update_isy99();\"><img src='icons/button_$status.png'></a></td></tr>";
+ } elseif ($status=="Off" or $status=="false") {
+ $i++;
+ echo "<tr><td>".$name."</td>";
+ echo "<td><a href=\"javascript:insteon('set_isy99i_status.php?device=".$address."&state=DON');update_isy99();\"><img src='icons/button_$status.png'></a></td></tr>";
+ }
+ if ($i==8) {
+ echo "</table></td><td><table border=1>";
+ $i=0;
+ }
+ }
+}
+
+echo "</td></tr></table>";
+
+?>
--- /dev/null
+<?
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,"http://TED/api/LiveData.xml");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+$output = curl_exec($ch);
+
+#echo "<pre>";
+$array=xml2array($output);
+#print_r($array);
+
+echo "AC Line Power Now:" . ($array['LiveData']['Voltage']['Total']['VoltageNow']/10)."<br>";
+#echo "Current Kw:" . ($array['LiveData']['Power']['Total']['PowerNow']/1000)."<br>";
+echo "Server Kw Draw:" . ($array['LiveData']['Power']['MTU1']['PowerNow']/1000)."<br>";
+echo "House Kw Draw:" . abs(($array['LiveData']['Power']['MTU1']['PowerNow']/1000)-($array['LiveData']['Power']['MTU2']['PowerNow']/1000))."<br>";
+echo "Total Kw Draw:" . ($array['LiveData']['Power']['MTU2']['PowerNow']/1000)."<br>";
+
+
+
+
+
+
+
+
+function xml2array($contents, $get_attributes=1, $priority = 'tag') {
+ if(!$contents) return array();
+
+ if(!function_exists('xml_parser_create')) {
+ //print "'xml_parser_create()' function not found!";
+ return array();
+ }
+
+ //Get the XML parser of PHP - PHP must have this module for the parser to work
+ $parser = xml_parser_create('');
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
+ xml_parse_into_struct($parser, trim($contents), $xml_values);
+ xml_parser_free($parser);
+
+ if(!$xml_values) return;//Hmm...
+
+ //Initializations
+ $xml_array = array();
+ $parents = array();
+ $opened_tags = array();
+ $arr = array();
+
+ $current = &$xml_array; //Refference
+
+ //Go through the tags.
+ $repeated_tag_index = array();//Multiple tags with same name will be turned into an array
+ foreach($xml_values as $data) {
+ unset($attributes,$value);//Remove existing values, or there will be trouble
+
+ //This command will extract these variables into the foreach scope
+ // tag(string), type(string), level(int), attributes(array).
+ extract($data);//We could use the array by itself, but this cooler.
+
+ $result = array();
+ $attributes_data = array();
+
+ if(isset($value)) {
+ if($priority == 'tag') $result = $value;
+ else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode
+ }
+
+ //Set the attributes too.
+ if(isset($attributes) and $get_attributes) {
+ foreach($attributes as $attr => $val) {
+ if($priority == 'tag') $attributes_data[$attr] = $val;
+ else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
+ }
+ }
+
+ //See tag status and do the needed.
+ if($type == "open") {//The starting of the tag '<tag>'
+ $parent[$level-1] = &$current;
+ if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
+ $current[$tag] = $result;
+ if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+
+ $current = &$current[$tag];
+
+ } else { //There was another element with the same tag name
+
+ if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+ $repeated_tag_index[$tag.'_'.$level]++;
+ } else {//This section will make the value an array if multiple tags with the same name appear together
+ $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
+ $repeated_tag_index[$tag.'_'.$level] = 2;
+
+ if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+ $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+ unset($current[$tag.'_attr']);
+ }
+
+ }
+ $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
+ $current = &$current[$tag][$last_item_index];
+ }
+
+ } elseif($type == "complete") { //Tags that ends in 1 line '<tag />'
+ //See if the key is already taken.
+ if(!isset($current[$tag])) { //New Key
+ $current[$tag] = $result;
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+ if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data;
+
+ } else { //If taken, put all things inside a list(array)
+ if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array...
+
+ // ...push the new element into that array.
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+
+ if($priority == 'tag' and $get_attributes and $attributes_data) {
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
+ }
+ $repeated_tag_index[$tag.'_'.$level]++;
+
+ } else { //If it is not an array...
+ $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+ if($priority == 'tag' and $get_attributes) {
+ if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+
+ $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+ unset($current[$tag.'_attr']);
+ }
+
+ if($attributes_data) {
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
+ }
+ }
+ $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
+ }
+ }
+
+ } elseif($type == 'close') { //End of tag '</tag>'
+ $current = &$parent[$level-1];
+ }
+ }
+
+ return($xml_array);
+}
+
+?>
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+
+ /**
+ * Modal Dialog
+ */
+ .modalBg {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ filter: Alpha(Opacity=50);
+ -moz-opacity: 0.5;
+ background-color: #ddd;
+ visibility: hidden;
+ width: expression(document.body.clientWidth);
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight);
+ z-index: 100;
+ }
+
+ .modalDialog {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ visibility: hidden;
+ z-index: 101;
+ background-color: white;
+ top: expression(document.body.clientHeight / 2 - this.offsetHeight / 2);
+ left: expression(document.body.clientWidth / 2 - this.offsetWidth / 2);
+ border: 1px solid #777;
+ border-top: 0;
+ padding: 20px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ }
+
+ .modalDialog .modalDialogHeader {
+ margin:0;
+ padding: 0px;
+ color: #333;
+ font-weight: bold;
+ background-color: #ccc;
+ border: 1px solid #989898;
+ position: absolute;
+ top: 0px;
+ left: -1px;
+ height: 7px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-bottomright: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-bottom-right-radius: 0;
+ }
+
+ .modalShadow {
+ position: absolute;
+ background-color: black;
+ top: 0px;
+ left: 0px;
+ z-index: 99;
+ top: expression(document.body.clientHeight / 2 - this.offsetHeight / 2);
+ left: expression(document.body.clientWidth / 2 - this.offsetWidth / 2);
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ opacity: 0.5;
+ }
+
+ /**
+ * This is not part of the core Modal Dialog styles, instead it's just so that the dialog looks
+ * respectable.
+ */
+ h4 {
+ font-family: Verdana, Arial;
+ padding-top: 10px;
+ }
\ No newline at end of file
--- /dev/null
+@font-face {
+ font-family: Delicious;
+ src: url('/Delicious-Roman.otf')
+}
+
+/**
+* Various
+*/
+body {
+ margin: 0px;
+}
+
+a {
+ text-decoration: none;
+}
+
+code {
+ background-color: #dedede;
+ border: 1px dashed #aaaaaa;
+ padding: 3px;
+ display: block;
+ font-family: Monospace;
+}
+
+
+/**
+* Datagrid stuff
+*/
+table.datagrid {
+ border-collapse: collapse;
+ margin-left: 30px;
+}
+
+table.datagrid th {
+ background-color: #ccc;
+ border: 1px solid #aaa;
+ padding: 2px;
+}
+
+table.datagrid tr {
+ background-color: #ddd;
+}
+
+table.datagrid tr.oddrow {
+ background-color: #eee;
+}
+
+table.datagrid td {
+ border: 1px solid #aaa;
+ padding: 3px;
+}
+
+
+/**
+* Master div
+*/
+.master {
+ font-family: Georgia;
+}
+
+
+/**
+* Header section
+*/
+.header {
+ margin-right: 10px;
+ letter-spacing: 2px;
+ background-image: url(/images/hdrbg.jpg);
+ margin-left: 10px;
+}
+
+.header h1 {
+ margin-top: 0px;
+}
+
+.tagline {
+ font-size: 8pt;
+ position: relative;
+ top: -15px;
+ left: 15px;
+ letter-spacing: 0px;
+}
+
+
+/**
+* Top nav
+*/
+.topnav {
+ color: white;
+ background-color: #314657; /* Old */
+ background-color: #2D4B33;
+ padding: 1px;
+ padding-left: 10px;
+}
+
+.topnav a {
+ color: white;
+}
+
+
+/**
+* Left nav
+*/
+.leftnav,
+.searchbox {
+ width: 180px;
+ color: black;
+ background-color: #FF5A18;
+ margin-left: 5px;
+ margin-top: 10px;
+ padding: 10px;
+ padding-top: 0;
+ padding-bottom: 0;
+ padding: expression('10px');
+ border: 1px solid #B33E11;
+}
+
+.leftnav {
+ box-shadow: 3px 3px 3px #aaa;
+ border-radius: 5px;
+ -moz-box-shadow: 3px 3px 3px #aaa;
+ -webkit-box-shadow: 3px 3px 3px #aaa;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ width: 180px;
+ float: left;
+ hmargin: 5px;
+}
+
+.leftnav h4 {
+ border-bottom: 1px solid black;
+}
+.leftnav a {
+ color: black;
+}
+
+.leftnav ul {
+ margin-left: -20px;
+ margin-left: expression('20px');
+ list-style-type: square;
+}
+
+
+/**
+* Main body section
+*/
+.mainbody {
+ margin-left: 220px;
+}
+
+.borderedTable table {
+ border-collapse: collapse;
+}
+
+.borderedTable th {
+ background-color: #dddddd;
+ border: 1px solid #aaaaaa;
+ font-size: 70%;
+ padding-left: 3px;
+ padding-right: 3px;
+}
+
+.borderedTable td {
+ vertical-align: top;
+ font-size: 70%;
+ border: 1px solid #dddddd;
+}
+
+.newsitem {
+ margin-bottom: 25px;
+}
+
+.newsitem h2,
+.newsitem h1 {
+ display: inline;
+}
+
+.newsitem .date {
+ font-size: 70%;
+}
+
+p.firstLetter:first-letter {
+ font-size: 200%;
+ font-style: italic;
+ font-weight: bold;
+ float: left;
+ padding-right: 3px;
+}
+
+.newsitem p.update {
+ background-color: #efefef;
+ border: 1px dashed black;
+ padding: 5px;
+}
+
+
+/**
+* Comments
+*/
+.comment {
+ padding: 5px;
+ margin-bottom: 20px;
+ font-size: 80%;
+ background-color: #efefef;
+ border: 1px dashed #cccccc;
+}
+
+.comment .body {
+ margin-top: 5px;
+ padding-left: 7px;
+}
+
+.comment .quoteLink {
+ text-align: right;
+ font-size: 90%;
+}
+
+
+/**
+* Errors
+*/
+.error {
+ color: red;
+ font-style: italic;
+}
+
+
+/**
+* Copyright text
+*/
+.copyright {
+ text-align: right;
+ font-size: 75%;
+}
+
+
+/**
+* Admin page
+*/
+.adminPage table {
+ font-family: Verdana;
+ font-size: 10pt;
+}
+
+.adminPage th {
+ background-color: #dddddd;
+}
+
+
+/**
+* Tools page
+*/
+#toolsPage th,
+#toolsPage td {
+}
+
+#toolsPage th {
+ font-weight: bold;
+ text-align: right;
+ white-space: nowrap;
+ vertical-align: top;
+ background-color: #ffffcc;
+}
+
+#toolsPage textarea {
+ height: 200px;
+ width: 800px;
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#ffffff, endColorstr=#ffffcc);
+}
+
+#shortcuts th {
+
+}
+
+#shortcuts th {
+ text-align: left;
+ background-color: #ededed;
+ padding: 2px;
+}
+
+/**
+* Download header/footer
+*/
+div#download pre,
+div#download pre a {
+
+}
+
+/**
+* Code
+*/
+div.boxout,
+pre.code {
+ border: 2px dashed gray;
+ padding: 3px;
+ background-color: #eee;
+}
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+
+body {
+ padding-top: 10px;
+ font-family: Georgia, Arial, Sans-Serif;
+}
+
+pre#code,
+code {
+ display: block;
+ border: 1px solid #aaa;
+ padding: 5px;
+ background-color: #ddd;
+}
+
+#breadcrumb,
+#logo {
+ border: 2px black solid;
+ background-color: #eee;
+ padding: 3px;
+ top: 0;
+ right: 0;
+ position: absolute;
+ margin: 2px;
+ opacity: 0.8;
+}
+#breadcrumb a,
+#logo a {
+ text-decoration: none;
+}
+
+th {
+ text-align: left;
+ border: 1px solid gray;
+ background-color: #ddd;
+ padding: 3px;
+ vertical-align: top;
+}
+
+td {
+ vertical-align: top;
+}
+
+ol li {
+ margin-top: 20px;
+}
+
+ol#implementation li code {
+ margin-top: 5px;
+}
+
+td.description {
+ background-color: #eee;
+ padding: 3px;
+ border: 1px solid #ddd;
+}
+
+td.chart {
+ text-align: center;
+}
+
+.example_boxout {
+ background-color: #eee;
+ padding: 3px;
+ border: 1px solid #aaa;
+}
+
+.code {
+ padding: 5px;
+ background-color: #eee;
+ border: 2px dashed gray
+}
+
+/**
+* This is semi-transparent box in the top left corner
+*/
+div#devtag {
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ -webkit-box-shadow: #999 3px 3px 3px;
+ -moz-box-shadow: #999 3px 3px 3px;
+ box-shadow: #999 3px 3px 3px;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135);
+ position: fixed;
+ top: 2px;
+ right: 2px;
+ width: 145px;
+ border: 2px solid black;
+ text-align: center;
+ font-weight: bold;
+ font-family: Arial;
+ background-color: #fdd;
+}
+
+div#devtag a {
+ font-size: 10px;
+ text-decoration: none;
+ color: blue;
+ opacity: 1;
+}
+
+/**
+* This overrides something defined earlier
+*/
+ol#colors li {
+ margin: 0;
+}
+
+/**
+* styles lists
+*/
+div.list-item {
+ width: 220px;
+ display: inline-block;
+}
+
+div.list-item.label {
+ width: 170px;
+}
+
+legend {
+ background-color: #efefef;
+ border: 1px solid #75736e;
+}
+
+body#licensing span {
+ font-size: 120%;
+}
+
+/**
+* The yellow warning box on the front page
+*/
+div.warning {
+ border: 1px solid black;
+ text-align: center;
+ background-color: #ffa;
+ padding: 5px;
+ margin-top: 5px;
+ border-radius: 15px;
+ -moz-border-radius: 15px;
+ -webkit-border-radius: 15px;
+ -webkit-box-shadow: #aaa 1px 1px 15px;
+ -moz-box-shadow: #aaa 1px 1px 15px;
+ box-shadow: #aaa 1px 1px 15px;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135);
+ z-index: 98;
+}
+
+div.canvasfallback {
+ border: 2px dashed red;
+ background-color: #fee;
+ width: 475px;
+ height: 150px;
+ text-align: center;
+ padding-top: 50px;
+}
+
+/**
+* The title "bar"
+*/
+div#title {
+}
+
+div#title div#image {
+ float: left;
+ margin-right: 15px;
+}
+
+div#title div#text {
+ padding-top: 5px;
+ margin-left: 70px;
+}
+
+
+div.warning p {
+ text-align: center;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ font-weight: bold;
+}
+
+
+div.description {
+ border: 1px dashed gray;
+ background-color: #eee;
+ font-size: 75%;
+ padding: 3px;
+}
+
+div#social {
+ display: inline;
+ display: inline-block;
+}
+
+
+/***************************************************************************************
+* *
+* RGraph CSS classes. *
+* *
+* These allow you to customise how tooltips and context menus will appear. To override *
+* the CSS defined in the graph scripts, you may need to use " ! important" like so: *
+* *
+* font-weight: bold ! important *
+* *
+* You don't always need to use this, only if you're trying to override something which *
+* the script sets. *
+* *
+***************************************************************************************/
+
+.RGraph_png {
+}
+
+.RGraph_tooltip {
+}
+
+.RGraph_contextmenu {
+}
+
+.RGraph_contextmenu_background {
+}
+
+.RGraph_contextmenu_item {
+}
+
+.RGraph_zoom_window {
+}
+
+.RGraph_zoomed_canvas {
+}
+
+.ModalDialog_background {
+}
+
+.ModalDialog_dialog {
+}
+
+.ModalDialog_topbar {
+}
\ No newline at end of file
--- /dev/null
+ Versions
+ ========
+ The excanvas.original.js is the original unminified and uncompressed library. The excanvas.compressed.js has been minified by hand and
+ Gzip compressed.
+
+ License for excanvas.js
+ =======================
+
+ This license is applicable to excanvas.original.js and excanvas.compressed.js ONLY.
+
+ License
+ =======
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
--- /dev/null
+##
+## This is an example Apache .htaccess file that can be used to add the required
+## Content-Encoding: header to the compressed version of the ExCanvas library.
+## This .htaccess file is ONLY required for the compressed version.
+##
+## If you are not using the compressed version, or are doing the compression
+## yourself (it could for example, be built into your web server), then you
+## do not need this file.
+##
+
+AddEncoding gzip .js
\ No newline at end of file
--- /dev/null
+// Copyright 2006 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+// Known Issues:
+//
+// * Patterns only support repeat.
+// * Radial gradient are not implemented. The VML version of these look very
+// different from the canvas one.
+// * Clipping paths are not implemented.
+// * Coordsize. The width and height attribute have higher priority than the
+// width and height style values which isn't correct.
+// * Painting mode isn't implemented.
+// * Canvas width/height should is using content-box by default. IE in
+// Quirks mode will draw the canvas using border-box. Either change your
+// doctype to HTML5
+// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
+// or use Box Sizing Behavior from WebFX
+// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
+// * Non uniform scaling does not correctly scale strokes.
+// * Optimize. There is always room for speed improvements.
+
+// Only add this code if we do not already have a canvas implementation
+if (!document.createElement('canvas').getContext) {
+
+(function() {
+
+ // alias some functions to make (compiled) code shorter
+ var m = Math;
+ var mr = m.round;
+ var ms = m.sin;
+ var mc = m.cos;
+ var abs = m.abs;
+ var sqrt = m.sqrt;
+
+ // this is used for sub pixel precision
+ var Z = 10;
+ var Z2 = Z / 2;
+
+ var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];
+
+ /**
+ * This funtion is assigned to the <canvas> elements as element.getContext().
+ * @this {HTMLElement}
+ * @return {CanvasRenderingContext2D_}
+ */
+ function getContext() {
+ return this.context_ ||
+ (this.context_ = new CanvasRenderingContext2D_(this));
+ }
+
+ var slice = Array.prototype.slice;
+
+ /**
+ * Binds a function to an object. The returned function will always use the
+ * passed in {@code obj} as {@code this}.
+ *
+ * Example:
+ *
+ * g = bind(f, obj, a, b)
+ * g(c, d) // will do f.call(obj, a, b, c, d)
+ *
+ * @param {Function} f The function to bind the object to
+ * @param {Object} obj The object that should act as this when the function
+ * is called
+ * @param {*} var_args Rest arguments that will be used as the initial
+ * arguments when the function is called
+ * @return {Function} A new function that has bound this
+ */
+ function bind(f, obj, var_args) {
+ var a = slice.call(arguments, 2);
+ return function() {
+ return f.apply(obj, a.concat(slice.call(arguments)));
+ };
+ }
+
+ function encodeHtmlAttribute(s) {
+ return String(s).replace(/&/g, '&').replace(/"/g, '"');
+ }
+
+ function addNamespace(doc, prefix, urn) {
+ if (!doc.namespaces[prefix]) {
+ if (IE_VERSION >= 7) {
+ doc.namespaces.add(prefix, urn).doImport('#default#VML');
+ } else {
+ // IE6 cannot handle the third argument.
+ doc.namespaces.add(prefix, urn);
+ }
+ }
+ }
+
+ function addNamespacesAndStylesheet(doc) {
+ addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml');
+ addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office');
+
+ // Setup default CSS. Only add one style sheet per document
+ if (!doc.styleSheets['ex_canvas_']) {
+ var ss = doc.createStyleSheet();
+ ss.owningElement.id = 'ex_canvas_';
+ ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +
+ // default size is 300x150 in Gecko and Opera
+ 'text-align:left;width:300px;height:150px}';
+ }
+ }
+
+ // Add namespaces and stylesheet at startup.
+ addNamespacesAndStylesheet(document);
+
+ var G_vmlCanvasManager_ = {
+ init: function(opt_doc) {
+ var doc = opt_doc || document;
+ // Create a dummy element so that IE will allow canvas elements to be
+ // recognized.
+ doc.createElement('canvas');
+ doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
+ },
+
+ init_: function(doc) {
+ // find all canvas elements
+ var els = doc.getElementsByTagName('canvas');
+ for (var i = 0; i < els.length; i++) {
+ this.initElement(els[i]);
+ }
+ },
+
+ /**
+ * Public initializes a canvas element so that it can be used as canvas
+ * element from now on. This is called automatically before the page is
+ * loaded but if you are creating elements using createElement you need to
+ * make sure this is called on the element.
+ * @param {HTMLElement} el The canvas element to initialize.
+ * @return {HTMLElement} the element that was created.
+ */
+ initElement: function(el) {
+ if (!el.getContext) {
+ el.getContext = getContext;
+
+ // Add namespaces and stylesheet to document of the element.
+ addNamespacesAndStylesheet(el.ownerDocument);
+
+ // Remove fallback content. There is no way to hide text nodes so we
+ // just remove all childNodes. We could hide all elements and remove
+ // text nodes but who really cares about the fallback content.
+ el.innerHTML = '';
+
+ // do not use inline function because that will leak memory
+ el.attachEvent('onpropertychange', onPropertyChange);
+ el.attachEvent('onresize', onResize);
+
+ var attrs = el.attributes;
+ if (attrs.width && attrs.width.specified) {
+ // TODO: use runtimeStyle and coordsize
+ // el.getContext().setWidth_(attrs.width.nodeValue);
+ el.style.width = attrs.width.nodeValue + 'px';
+ } else {
+ el.width = el.clientWidth;
+ }
+ if (attrs.height && attrs.height.specified) {
+ // TODO: use runtimeStyle and coordsize
+ // el.getContext().setHeight_(attrs.height.nodeValue);
+ el.style.height = attrs.height.nodeValue + 'px';
+ } else {
+ el.height = el.clientHeight;
+ }
+ //el.getContext().setCoordsize_()
+ }
+ return el;
+ }
+ };
+
+ function onPropertyChange(e) {
+ var el = e.srcElement;
+
+ switch (e.propertyName) {
+ case 'width':
+ el.getContext().clearRect();
+ el.style.width = el.attributes.width.nodeValue + 'px';
+ // In IE8 this does not trigger onresize.
+ el.firstChild.style.width = el.clientWidth + 'px';
+ break;
+ case 'height':
+ el.getContext().clearRect();
+ el.style.height = el.attributes.height.nodeValue + 'px';
+ el.firstChild.style.height = el.clientHeight + 'px';
+ break;
+ }
+ }
+
+ function onResize(e) {
+ var el = e.srcElement;
+ if (el.firstChild) {
+ el.firstChild.style.width = el.clientWidth + 'px';
+ el.firstChild.style.height = el.clientHeight + 'px';
+ }
+ }
+
+ G_vmlCanvasManager_.init();
+
+ // precompute "00" to "FF"
+ var decToHex = [];
+ for (var i = 0; i < 16; i++) {
+ for (var j = 0; j < 16; j++) {
+ decToHex[i * 16 + j] = i.toString(16) + j.toString(16);
+ }
+ }
+
+ function createMatrixIdentity() {
+ return [
+ [1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1]
+ ];
+ }
+
+ function matrixMultiply(m1, m2) {
+ var result = createMatrixIdentity();
+
+ for (var x = 0; x < 3; x++) {
+ for (var y = 0; y < 3; y++) {
+ var sum = 0;
+
+ for (var z = 0; z < 3; z++) {
+ sum += m1[x][z] * m2[z][y];
+ }
+
+ result[x][y] = sum;
+ }
+ }
+ return result;
+ }
+
+ function copyState(o1, o2) {
+ o2.fillStyle = o1.fillStyle;
+ o2.lineCap = o1.lineCap;
+ o2.lineJoin = o1.lineJoin;
+ o2.lineWidth = o1.lineWidth;
+ o2.miterLimit = o1.miterLimit;
+ o2.shadowBlur = o1.shadowBlur;
+ o2.shadowColor = o1.shadowColor;
+ o2.shadowOffsetX = o1.shadowOffsetX;
+ o2.shadowOffsetY = o1.shadowOffsetY;
+ o2.strokeStyle = o1.strokeStyle;
+ o2.globalAlpha = o1.globalAlpha;
+ o2.font = o1.font;
+ o2.textAlign = o1.textAlign;
+ o2.textBaseline = o1.textBaseline;
+ o2.arcScaleX_ = o1.arcScaleX_;
+ o2.arcScaleY_ = o1.arcScaleY_;
+ o2.lineScale_ = o1.lineScale_;
+ }
+
+ var colorData = {
+ aliceblue: '#F0F8FF',
+ antiquewhite: '#FAEBD7',
+ aquamarine: '#7FFFD4',
+ azure: '#F0FFFF',
+ beige: '#F5F5DC',
+ bisque: '#FFE4C4',
+ black: '#000000',
+ blanchedalmond: '#FFEBCD',
+ blueviolet: '#8A2BE2',
+ brown: '#A52A2A',
+ burlywood: '#DEB887',
+ cadetblue: '#5F9EA0',
+ chartreuse: '#7FFF00',
+ chocolate: '#D2691E',
+ coral: '#FF7F50',
+ cornflowerblue: '#6495ED',
+ cornsilk: '#FFF8DC',
+ crimson: '#DC143C',
+ cyan: '#00FFFF',
+ darkblue: '#00008B',
+ darkcyan: '#008B8B',
+ darkgoldenrod: '#B8860B',
+ darkgray: '#A9A9A9',
+ darkgreen: '#006400',
+ darkgrey: '#A9A9A9',
+ darkkhaki: '#BDB76B',
+ darkmagenta: '#8B008B',
+ darkolivegreen: '#556B2F',
+ darkorange: '#FF8C00',
+ darkorchid: '#9932CC',
+ darkred: '#8B0000',
+ darksalmon: '#E9967A',
+ darkseagreen: '#8FBC8F',
+ darkslateblue: '#483D8B',
+ darkslategray: '#2F4F4F',
+ darkslategrey: '#2F4F4F',
+ darkturquoise: '#00CED1',
+ darkviolet: '#9400D3',
+ deeppink: '#FF1493',
+ deepskyblue: '#00BFFF',
+ dimgray: '#696969',
+ dimgrey: '#696969',
+ dodgerblue: '#1E90FF',
+ firebrick: '#B22222',
+ floralwhite: '#FFFAF0',
+ forestgreen: '#228B22',
+ gainsboro: '#DCDCDC',
+ ghostwhite: '#F8F8FF',
+ gold: '#FFD700',
+ goldenrod: '#DAA520',
+ grey: '#808080',
+ greenyellow: '#ADFF2F',
+ honeydew: '#F0FFF0',
+ hotpink: '#FF69B4',
+ indianred: '#CD5C5C',
+ indigo: '#4B0082',
+ ivory: '#FFFFF0',
+ khaki: '#F0E68C',
+ lavender: '#E6E6FA',
+ lavenderblush: '#FFF0F5',
+ lawngreen: '#7CFC00',
+ lemonchiffon: '#FFFACD',
+ lightblue: '#ADD8E6',
+ lightcoral: '#F08080',
+ lightcyan: '#E0FFFF',
+ lightgoldenrodyellow: '#FAFAD2',
+ lightgreen: '#90EE90',
+ lightgrey: '#D3D3D3',
+ lightpink: '#FFB6C1',
+ lightsalmon: '#FFA07A',
+ lightseagreen: '#20B2AA',
+ lightskyblue: '#87CEFA',
+ lightslategray: '#778899',
+ lightslategrey: '#778899',
+ lightsteelblue: '#B0C4DE',
+ lightyellow: '#FFFFE0',
+ limegreen: '#32CD32',
+ linen: '#FAF0E6',
+ magenta: '#FF00FF',
+ mediumaquamarine: '#66CDAA',
+ mediumblue: '#0000CD',
+ mediumorchid: '#BA55D3',
+ mediumpurple: '#9370DB',
+ mediumseagreen: '#3CB371',
+ mediumslateblue: '#7B68EE',
+ mediumspringgreen: '#00FA9A',
+ mediumturquoise: '#48D1CC',
+ mediumvioletred: '#C71585',
+ midnightblue: '#191970',
+ mintcream: '#F5FFFA',
+ mistyrose: '#FFE4E1',
+ moccasin: '#FFE4B5',
+ navajowhite: '#FFDEAD',
+ oldlace: '#FDF5E6',
+ olivedrab: '#6B8E23',
+ orange: '#FFA500',
+ orangered: '#FF4500',
+ orchid: '#DA70D6',
+ palegoldenrod: '#EEE8AA',
+ palegreen: '#98FB98',
+ paleturquoise: '#AFEEEE',
+ palevioletred: '#DB7093',
+ papayawhip: '#FFEFD5',
+ peachpuff: '#FFDAB9',
+ peru: '#CD853F',
+ pink: '#FFC0CB',
+ plum: '#DDA0DD',
+ powderblue: '#B0E0E6',
+ rosybrown: '#BC8F8F',
+ royalblue: '#4169E1',
+ saddlebrown: '#8B4513',
+ salmon: '#FA8072',
+ sandybrown: '#F4A460',
+ seagreen: '#2E8B57',
+ seashell: '#FFF5EE',
+ sienna: '#A0522D',
+ skyblue: '#87CEEB',
+ slateblue: '#6A5ACD',
+ slategray: '#708090',
+ slategrey: '#708090',
+ snow: '#FFFAFA',
+ springgreen: '#00FF7F',
+ steelblue: '#4682B4',
+ tan: '#D2B48C',
+ thistle: '#D8BFD8',
+ tomato: '#FF6347',
+ turquoise: '#40E0D0',
+ violet: '#EE82EE',
+ wheat: '#F5DEB3',
+ whitesmoke: '#F5F5F5',
+ yellowgreen: '#9ACD32'
+ };
+
+
+ function getRgbHslContent(styleString) {
+ var start = styleString.indexOf('(', 3);
+ var end = styleString.indexOf(')', start + 1);
+ var parts = styleString.substring(start + 1, end).split(',');
+ // add alpha if needed
+ if (parts.length != 4 || styleString.charAt(3) != 'a') {
+ parts[3] = 1;
+ }
+ return parts;
+ }
+
+ function percent(s) {
+ return parseFloat(s) / 100;
+ }
+
+ function clamp(v, min, max) {
+ return Math.min(max, Math.max(min, v));
+ }
+
+ function hslToRgb(parts){
+ var r, g, b, h, s, l;
+ h = parseFloat(parts[0]) / 360 % 360;
+ if (h < 0)
+ h++;
+ s = clamp(percent(parts[1]), 0, 1);
+ l = clamp(percent(parts[2]), 0, 1);
+ if (s == 0) {
+ r = g = b = l; // achromatic
+ } else {
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ var p = 2 * l - q;
+ r = hueToRgb(p, q, h + 1 / 3);
+ g = hueToRgb(p, q, h);
+ b = hueToRgb(p, q, h - 1 / 3);
+ }
+
+ return '#' + decToHex[Math.floor(r * 255)] +
+ decToHex[Math.floor(g * 255)] +
+ decToHex[Math.floor(b * 255)];
+ }
+
+ function hueToRgb(m1, m2, h) {
+ if (h < 0)
+ h++;
+ if (h > 1)
+ h--;
+
+ if (6 * h < 1)
+ return m1 + (m2 - m1) * 6 * h;
+ else if (2 * h < 1)
+ return m2;
+ else if (3 * h < 2)
+ return m1 + (m2 - m1) * (2 / 3 - h) * 6;
+ else
+ return m1;
+ }
+
+ function processStyle(styleString) {
+ var str, alpha = 1;
+
+ styleString = String(styleString);
+ if (styleString.charAt(0) == '#') {
+ str = styleString;
+ } else if (/^rgb/.test(styleString)) {
+ var parts = getRgbHslContent(styleString);
+ var str = '#', n;
+ for (var i = 0; i < 3; i++) {
+ if (parts[i].indexOf('%') != -1) {
+ n = Math.floor(percent(parts[i]) * 255);
+ } else {
+ n = +parts[i];
+ }
+ str += decToHex[clamp(n, 0, 255)];
+ }
+ alpha = +parts[3];
+ } else if (/^hsl/.test(styleString)) {
+ var parts = getRgbHslContent(styleString);
+ str = hslToRgb(parts);
+ alpha = parts[3];
+ } else {
+ str = colorData[styleString] || styleString;
+ }
+ return {color: str, alpha: alpha};
+ }
+
+ var DEFAULT_STYLE = {
+ style: 'normal',
+ variant: 'normal',
+ weight: 'normal',
+ size: 10,
+ family: 'sans-serif'
+ };
+
+ // Internal text style cache
+ var fontStyleCache = {};
+
+ function processFontStyle(styleString) {
+ if (fontStyleCache[styleString]) {
+ return fontStyleCache[styleString];
+ }
+
+ var el = document.createElement('div');
+ var style = el.style;
+ try {
+ style.font = styleString;
+ } catch (ex) {
+ // Ignore failures to set to invalid font.
+ }
+
+ return fontStyleCache[styleString] = {
+ style: style.fontStyle || DEFAULT_STYLE.style,
+ variant: style.fontVariant || DEFAULT_STYLE.variant,
+ weight: style.fontWeight || DEFAULT_STYLE.weight,
+ size: style.fontSize || DEFAULT_STYLE.size,
+ family: style.fontFamily || DEFAULT_STYLE.family
+ };
+ }
+
+ function getComputedStyle(style, element) {
+ var computedStyle = {};
+
+ for (var p in style) {
+ computedStyle[p] = style[p];
+ }
+
+ // Compute the size
+ var canvasFontSize = parseFloat(element.currentStyle.fontSize),
+ fontSize = parseFloat(style.size);
+
+ if (typeof style.size == 'number') {
+ computedStyle.size = style.size;
+ } else if (style.size.indexOf('px') != -1) {
+ computedStyle.size = fontSize;
+ } else if (style.size.indexOf('em') != -1) {
+ computedStyle.size = canvasFontSize * fontSize;
+ } else if(style.size.indexOf('%') != -1) {
+ computedStyle.size = (canvasFontSize / 100) * fontSize;
+ } else if (style.size.indexOf('pt') != -1) {
+ computedStyle.size = fontSize / .75;
+ } else {
+ computedStyle.size = canvasFontSize;
+ }
+
+ // Different scaling between normal text and VML text. This was found using
+ // trial and error to get the same size as non VML text.
+ computedStyle.size *= 0.981;
+
+ return computedStyle;
+ }
+
+ function buildStyle(style) {
+ return style.style + ' ' + style.variant + ' ' + style.weight + ' ' +
+ style.size + 'px ' + style.family;
+ }
+
+ function processLineCap(lineCap) {
+ switch (lineCap) {
+ case 'butt':
+ return 'flat';
+ case 'round':
+ return 'round';
+ case 'square':
+ default:
+ return 'square';
+ }
+ }
+
+ /**
+ * This class implements CanvasRenderingContext2D interface as described by
+ * the WHATWG.
+ * @param {HTMLElement} canvasElement The element that the 2D context should
+ * be associated with
+ */
+ function CanvasRenderingContext2D_(canvasElement) {
+ this.m_ = createMatrixIdentity();
+
+ this.mStack_ = [];
+ this.aStack_ = [];
+ this.currentPath_ = [];
+
+ // Canvas context properties
+ this.strokeStyle = '#000';
+ this.fillStyle = '#000';
+
+ this.lineWidth = 1;
+ this.lineJoin = 'miter';
+ this.lineCap = 'butt';
+ this.miterLimit = Z * 1;
+ this.globalAlpha = 1;
+ this.font = '10px sans-serif';
+ this.textAlign = 'left';
+ this.textBaseline = 'alphabetic';
+ this.canvas = canvasElement;
+
+ var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' +
+ canvasElement.clientHeight + 'px;overflow:hidden;position:absolute';
+ var el = canvasElement.ownerDocument.createElement('div');
+ el.style.cssText = cssText;
+ canvasElement.appendChild(el);
+
+ var overlayEl = el.cloneNode(false);
+ // Use a non transparent background.
+ overlayEl.style.backgroundColor = 'red';
+ overlayEl.style.filter = 'alpha(opacity=0)';
+ canvasElement.appendChild(overlayEl);
+
+ this.element_ = el;
+ this.arcScaleX_ = 1;
+ this.arcScaleY_ = 1;
+ this.lineScale_ = 1;
+ }
+
+ var contextPrototype = CanvasRenderingContext2D_.prototype;
+ contextPrototype.clearRect = function() {
+ if (this.textMeasureEl_) {
+ this.textMeasureEl_.removeNode(true);
+ this.textMeasureEl_ = null;
+ }
+ this.element_.innerHTML = '';
+ };
+
+ contextPrototype.beginPath = function() {
+ // TODO: Branch current matrix so that save/restore has no effect
+ // as per safari docs.
+ this.currentPath_ = [];
+ };
+
+ contextPrototype.moveTo = function(aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
+ this.currentX_ = p.x;
+ this.currentY_ = p.y;
+ };
+
+ contextPrototype.lineTo = function(aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
+
+ this.currentX_ = p.x;
+ this.currentY_ = p.y;
+ };
+
+ contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
+ aCP2x, aCP2y,
+ aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ var cp1 = this.getCoords_(aCP1x, aCP1y);
+ var cp2 = this.getCoords_(aCP2x, aCP2y);
+ bezierCurveTo(this, cp1, cp2, p);
+ };
+
+ // Helper function that takes the already fixed cordinates.
+ function bezierCurveTo(self, cp1, cp2, p) {
+ self.currentPath_.push({
+ type: 'bezierCurveTo',
+ cp1x: cp1.x,
+ cp1y: cp1.y,
+ cp2x: cp2.x,
+ cp2y: cp2.y,
+ x: p.x,
+ y: p.y
+ });
+ self.currentX_ = p.x;
+ self.currentY_ = p.y;
+ }
+
+ contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
+ // the following is lifted almost directly from
+ // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
+
+ var cp = this.getCoords_(aCPx, aCPy);
+ var p = this.getCoords_(aX, aY);
+
+ var cp1 = {
+ x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),
+ y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)
+ };
+ var cp2 = {
+ x: cp1.x + (p.x - this.currentX_) / 3.0,
+ y: cp1.y + (p.y - this.currentY_) / 3.0
+ };
+
+ bezierCurveTo(this, cp1, cp2, p);
+ };
+
+ contextPrototype.arc = function(aX, aY, aRadius,
+ aStartAngle, aEndAngle, aClockwise) {
+ aRadius *= Z;
+ var arcType = aClockwise ? 'at' : 'wa';
+
+ var xStart = aX + mc(aStartAngle) * aRadius - Z2;
+ var yStart = aY + ms(aStartAngle) * aRadius - Z2;
+
+ var xEnd = aX + mc(aEndAngle) * aRadius - Z2;
+ var yEnd = aY + ms(aEndAngle) * aRadius - Z2;
+
+ // IE won't render arches drawn counter clockwise if xStart == xEnd.
+ if (xStart == xEnd && !aClockwise) {
+ xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
+ // that can be represented in binary
+ }
+
+ var p = this.getCoords_(aX, aY);
+ var pStart = this.getCoords_(xStart, yStart);
+ var pEnd = this.getCoords_(xEnd, yEnd);
+
+ this.currentPath_.push({type: arcType,
+ x: p.x,
+ y: p.y,
+ radius: aRadius,
+ xStart: pStart.x,
+ yStart: pStart.y,
+ xEnd: pEnd.x,
+ yEnd: pEnd.y});
+
+ };
+
+ contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ };
+
+ contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
+ var oldPath = this.currentPath_;
+ this.beginPath();
+
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ this.stroke();
+
+ this.currentPath_ = oldPath;
+ };
+
+ contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
+ var oldPath = this.currentPath_;
+ this.beginPath();
+
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ this.fill();
+
+ this.currentPath_ = oldPath;
+ };
+
+ contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
+ var gradient = new CanvasGradient_('gradient');
+ gradient.x0_ = aX0;
+ gradient.y0_ = aY0;
+ gradient.x1_ = aX1;
+ gradient.y1_ = aY1;
+ return gradient;
+ };
+
+ contextPrototype.createRadialGradient = function(aX0, aY0, aR0,
+ aX1, aY1, aR1) {
+ var gradient = new CanvasGradient_('gradientradial');
+ gradient.x0_ = aX0;
+ gradient.y0_ = aY0;
+ gradient.r0_ = aR0;
+ gradient.x1_ = aX1;
+ gradient.y1_ = aY1;
+ gradient.r1_ = aR1;
+ return gradient;
+ };
+
+ contextPrototype.drawImage = function(image, var_args) {
+ var dx, dy, dw, dh, sx, sy, sw, sh;
+
+ // to find the original width we overide the width and height
+ var oldRuntimeWidth = image.runtimeStyle.width;
+ var oldRuntimeHeight = image.runtimeStyle.height;
+ image.runtimeStyle.width = 'auto';
+ image.runtimeStyle.height = 'auto';
+
+ // get the original size
+ var w = image.width;
+ var h = image.height;
+
+ // and remove overides
+ image.runtimeStyle.width = oldRuntimeWidth;
+ image.runtimeStyle.height = oldRuntimeHeight;
+
+ if (arguments.length == 3) {
+ dx = arguments[1];
+ dy = arguments[2];
+ sx = sy = 0;
+ sw = dw = w;
+ sh = dh = h;
+ } else if (arguments.length == 5) {
+ dx = arguments[1];
+ dy = arguments[2];
+ dw = arguments[3];
+ dh = arguments[4];
+ sx = sy = 0;
+ sw = w;
+ sh = h;
+ } else if (arguments.length == 9) {
+ sx = arguments[1];
+ sy = arguments[2];
+ sw = arguments[3];
+ sh = arguments[4];
+ dx = arguments[5];
+ dy = arguments[6];
+ dw = arguments[7];
+ dh = arguments[8];
+ } else {
+ throw Error('Invalid number of arguments');
+ }
+
+ var d = this.getCoords_(dx, dy);
+
+ var w2 = sw / 2;
+ var h2 = sh / 2;
+
+ var vmlStr = [];
+
+ var W = 10;
+ var H = 10;
+
+ // For some reason that I've now forgotten, using divs didn't work
+ vmlStr.push(' <g_vml_:group',
+ ' coordsize="', Z * W, ',', Z * H, '"',
+ ' coordorigin="0,0"' ,
+ ' style="width:', W, 'px;height:', H, 'px;position:absolute;');
+
+ // If filters are necessary (rotation exists), create them
+ // filters are bog-slow, so only create them if abbsolutely necessary
+ // The following check doesn't account for skews (which don't exist
+ // in the canvas spec (yet) anyway.
+
+ if (this.m_[0][0] != 1 || this.m_[0][1] ||
+ this.m_[1][1] != 1 || this.m_[1][0]) {
+ var filter = [];
+
+ // Note the 12/21 reversal
+ filter.push('M11=', this.m_[0][0], ',',
+ 'M12=', this.m_[1][0], ',',
+ 'M21=', this.m_[0][1], ',',
+ 'M22=', this.m_[1][1], ',',
+ 'Dx=', mr(d.x / Z), ',',
+ 'Dy=', mr(d.y / Z), '');
+
+ // Bounding box calculation (need to minimize displayed area so that
+ // filters don't waste time on unused pixels.
+ var max = d;
+ var c2 = this.getCoords_(dx + dw, dy);
+ var c3 = this.getCoords_(dx, dy + dh);
+ var c4 = this.getCoords_(dx + dw, dy + dh);
+
+ max.x = m.max(max.x, c2.x, c3.x, c4.x);
+ max.y = m.max(max.y, c2.y, c3.y, c4.y);
+
+ vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z),
+ 'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',
+ filter.join(''), ", sizingmethod='clip');");
+
+ } else {
+ vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;');
+ }
+
+ vmlStr.push(' ">' ,
+ '<g_vml_:image src="', image.src, '"',
+ ' style="width:', Z * dw, 'px;',
+ ' height:', Z * dh, 'px"',
+ ' cropleft="', sx / w, '"',
+ ' croptop="', sy / h, '"',
+ ' cropright="', (w - sx - sw) / w, '"',
+ ' cropbottom="', (h - sy - sh) / h, '"',
+ ' />',
+ '</g_vml_:group>');
+
+ this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));
+ };
+
+ contextPrototype.stroke = function(aFill) {
+ var lineStr = [];
+ var lineOpen = false;
+
+ var W = 10;
+ var H = 10;
+
+ lineStr.push('<g_vml_:shape',
+ ' filled="', !!aFill, '"',
+ ' style="position:absolute;width:', W, 'px;height:', H, 'px;"',
+ ' coordorigin="0,0"',
+ ' coordsize="', Z * W, ',', Z * H, '"',
+ ' stroked="', !aFill, '"',
+ ' path="');
+
+ var newSeq = false;
+ var min = {x: null, y: null};
+ var max = {x: null, y: null};
+
+ for (var i = 0; i < this.currentPath_.length; i++) {
+ var p = this.currentPath_[i];
+ var c;
+
+ switch (p.type) {
+ case 'moveTo':
+ c = p;
+ lineStr.push(' m ', mr(p.x), ',', mr(p.y));
+ break;
+ case 'lineTo':
+ lineStr.push(' l ', mr(p.x), ',', mr(p.y));
+ break;
+ case 'close':
+ lineStr.push(' x ');
+ p = null;
+ break;
+ case 'bezierCurveTo':
+ lineStr.push(' c ',
+ mr(p.cp1x), ',', mr(p.cp1y), ',',
+ mr(p.cp2x), ',', mr(p.cp2y), ',',
+ mr(p.x), ',', mr(p.y));
+ break;
+ case 'at':
+ case 'wa':
+ lineStr.push(' ', p.type, ' ',
+ mr(p.x - this.arcScaleX_ * p.radius), ',',
+ mr(p.y - this.arcScaleY_ * p.radius), ' ',
+ mr(p.x + this.arcScaleX_ * p.radius), ',',
+ mr(p.y + this.arcScaleY_ * p.radius), ' ',
+ mr(p.xStart), ',', mr(p.yStart), ' ',
+ mr(p.xEnd), ',', mr(p.yEnd));
+ break;
+ }
+
+
+ // TODO: Following is broken for curves due to
+ // move to proper paths.
+
+ // Figure out dimensions so we can do gradient fills
+ // properly
+ if (p) {
+ if (min.x == null || p.x < min.x) {
+ min.x = p.x;
+ }
+ if (max.x == null || p.x > max.x) {
+ max.x = p.x;
+ }
+ if (min.y == null || p.y < min.y) {
+ min.y = p.y;
+ }
+ if (max.y == null || p.y > max.y) {
+ max.y = p.y;
+ }
+ }
+ }
+ lineStr.push(' ">');
+
+ if (!aFill) {
+ appendStroke(this, lineStr);
+ } else {
+ appendFill(this, lineStr, min, max);
+ }
+
+ lineStr.push('</g_vml_:shape>');
+
+ this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
+ };
+
+ function appendStroke(ctx, lineStr) {
+ var a = processStyle(ctx.strokeStyle);
+ var color = a.color;
+ var opacity = a.alpha * ctx.globalAlpha;
+ var lineWidth = ctx.lineScale_ * ctx.lineWidth;
+
+ // VML cannot correctly render a line if the width is less than 1px.
+ // In that case, we dilute the color to make the line look thinner.
+ if (lineWidth < 1) {
+ opacity *= lineWidth;
+ }
+
+ lineStr.push(
+ '<g_vml_:stroke',
+ ' opacity="', opacity, '"',
+ ' joinstyle="', ctx.lineJoin, '"',
+ ' miterlimit="', ctx.miterLimit, '"',
+ ' endcap="', processLineCap(ctx.lineCap), '"',
+ ' weight="', lineWidth, 'px"',
+ ' color="', color, '" />'
+ );
+ }
+
+ function appendFill(ctx, lineStr, min, max) {
+ var fillStyle = ctx.fillStyle;
+ var arcScaleX = ctx.arcScaleX_;
+ var arcScaleY = ctx.arcScaleY_;
+ var width = max.x - min.x;
+ var height = max.y - min.y;
+ if (fillStyle instanceof CanvasGradient_) {
+ // TODO: Gradients transformed with the transformation matrix.
+ var angle = 0;
+ var focus = {x: 0, y: 0};
+
+ // additional offset
+ var shift = 0;
+ // scale factor for offset
+ var expansion = 1;
+
+ if (fillStyle.type_ == 'gradient') {
+ var x0 = fillStyle.x0_ / arcScaleX;
+ var y0 = fillStyle.y0_ / arcScaleY;
+ var x1 = fillStyle.x1_ / arcScaleX;
+ var y1 = fillStyle.y1_ / arcScaleY;
+ var p0 = ctx.getCoords_(x0, y0);
+ var p1 = ctx.getCoords_(x1, y1);
+ var dx = p1.x - p0.x;
+ var dy = p1.y - p0.y;
+ angle = Math.atan2(dx, dy) * 180 / Math.PI;
+
+ // The angle should be a non-negative number.
+ if (angle < 0) {
+ angle += 360;
+ }
+
+ // Very small angles produce an unexpected result because they are
+ // converted to a scientific notation string.
+ if (angle < 1e-6) {
+ angle = 0;
+ }
+ } else {
+ var p0 = ctx.getCoords_(fillStyle.x0_, fillStyle.y0_);
+ focus = {
+ x: (p0.x - min.x) / width,
+ y: (p0.y - min.y) / height
+ };
+
+ width /= arcScaleX * Z;
+ height /= arcScaleY * Z;
+ var dimension = m.max(width, height);
+ shift = 2 * fillStyle.r0_ / dimension;
+ expansion = 2 * fillStyle.r1_ / dimension - shift;
+ }
+
+ // We need to sort the color stops in ascending order by offset,
+ // otherwise IE won't interpret it correctly.
+ var stops = fillStyle.colors_;
+ stops.sort(function(cs1, cs2) {
+ return cs1.offset - cs2.offset;
+ });
+
+ var length = stops.length;
+ var color1 = stops[0].color;
+ var color2 = stops[length - 1].color;
+ var opacity1 = stops[0].alpha * ctx.globalAlpha;
+ var opacity2 = stops[length - 1].alpha * ctx.globalAlpha;
+
+ var colors = [];
+ for (var i = 0; i < length; i++) {
+ var stop = stops[i];
+ colors.push(stop.offset * expansion + shift + ' ' + stop.color);
+ }
+
+ // When colors attribute is used, the meanings of opacity and o:opacity2
+ // are reversed.
+ lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"',
+ ' method="none" focus="100%"',
+ ' color="', color1, '"',
+ ' color2="', color2, '"',
+ ' colors="', colors.join(','), '"',
+ ' opacity="', opacity2, '"',
+ ' g_o_:opacity2="', opacity1, '"',
+ ' angle="', angle, '"',
+ ' focusposition="', focus.x, ',', focus.y, '" />');
+ } else if (fillStyle instanceof CanvasPattern_) {
+ if (width && height) {
+ var deltaLeft = -min.x;
+ var deltaTop = -min.y;
+ lineStr.push('<g_vml_:fill',
+ ' position="',
+ deltaLeft / width * arcScaleX * arcScaleX, ',',
+ deltaTop / height * arcScaleY * arcScaleY, '"',
+ ' type="tile"',
+ // TODO: Figure out the correct size to fit the scale.
+ //' size="', w, 'px ', h, 'px"',
+ ' src="', fillStyle.src_, '" />');
+ }
+ } else {
+ var a = processStyle(ctx.fillStyle);
+ var color = a.color;
+ var opacity = a.alpha * ctx.globalAlpha;
+ lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,
+ '" />');
+ }
+ }
+
+ contextPrototype.fill = function() {
+ this.stroke(true);
+ };
+
+ contextPrototype.closePath = function() {
+ this.currentPath_.push({type: 'close'});
+ };
+
+ /**
+ * @private
+ */
+ contextPrototype.getCoords_ = function(aX, aY) {
+ var m = this.m_;
+ return {
+ x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
+ y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
+ };
+ };
+
+ contextPrototype.save = function() {
+ var o = {};
+ copyState(this, o);
+ this.aStack_.push(o);
+ this.mStack_.push(this.m_);
+ this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
+ };
+
+ contextPrototype.restore = function() {
+ if (this.aStack_.length) {
+ copyState(this.aStack_.pop(), this);
+ this.m_ = this.mStack_.pop();
+ }
+ };
+
+ function matrixIsFinite(m) {
+ return isFinite(m[0][0]) && isFinite(m[0][1]) &&
+ isFinite(m[1][0]) && isFinite(m[1][1]) &&
+ isFinite(m[2][0]) && isFinite(m[2][1]);
+ }
+
+ function setM(ctx, m, updateLineScale) {
+ if (!matrixIsFinite(m)) {
+ return;
+ }
+ ctx.m_ = m;
+
+ if (updateLineScale) {
+ // Get the line scale.
+ // Determinant of this.m_ means how much the area is enlarged by the
+ // transformation. So its square root can be used as a scale factor
+ // for width.
+ var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
+ ctx.lineScale_ = sqrt(abs(det));
+ }
+ }
+
+ contextPrototype.translate = function(aX, aY) {
+ var m1 = [
+ [1, 0, 0],
+ [0, 1, 0],
+ [aX, aY, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), false);
+ };
+
+ contextPrototype.rotate = function(aRot) {
+ var c = mc(aRot);
+ var s = ms(aRot);
+
+ var m1 = [
+ [c, s, 0],
+ [-s, c, 0],
+ [0, 0, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), false);
+ };
+
+ contextPrototype.scale = function(aX, aY) {
+ this.arcScaleX_ *= aX;
+ this.arcScaleY_ *= aY;
+ var m1 = [
+ [aX, 0, 0],
+ [0, aY, 0],
+ [0, 0, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), true);
+ };
+
+ contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
+ var m1 = [
+ [m11, m12, 0],
+ [m21, m22, 0],
+ [dx, dy, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), true);
+ };
+
+ contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
+ var m = [
+ [m11, m12, 0],
+ [m21, m22, 0],
+ [dx, dy, 1]
+ ];
+
+ setM(this, m, true);
+ };
+
+ /**
+ * The text drawing function.
+ * The maxWidth argument isn't taken in account, since no browser supports
+ * it yet.
+ */
+ contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
+ var m = this.m_,
+ delta = 1000,
+ left = 0,
+ right = delta,
+ offset = {x: 0, y: 0},
+ lineStr = [];
+
+ var fontStyle = getComputedStyle(processFontStyle(this.font),
+ this.element_);
+
+ var fontStyleString = buildStyle(fontStyle);
+
+ var elementStyle = this.element_.currentStyle;
+ var textAlign = this.textAlign.toLowerCase();
+ switch (textAlign) {
+ case 'left':
+ case 'center':
+ case 'right':
+ break;
+ case 'end':
+ textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left';
+ break;
+ case 'start':
+ textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left';
+ break;
+ default:
+ textAlign = 'left';
+ }
+
+ // 1.75 is an arbitrary number, as there is no info about the text baseline
+ switch (this.textBaseline) {
+ case 'hanging':
+ case 'top':
+ offset.y = fontStyle.size / 1.75;
+ break;
+ case 'middle':
+ break;
+ default:
+ case null:
+ case 'alphabetic':
+ case 'ideographic':
+ case 'bottom':
+ offset.y = -fontStyle.size / 2.25;
+ break;
+ }
+
+ switch(textAlign) {
+ case 'right':
+ left = delta;
+ right = 0.05;
+ break;
+ case 'center':
+ left = right = delta / 2;
+ break;
+ }
+
+ var d = this.getCoords_(x + offset.x, y + offset.y);
+
+ lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ',
+ ' coordsize="100 100" coordorigin="0 0"',
+ ' filled="', !stroke, '" stroked="', !!stroke,
+ '" style="position:absolute;width:1px;height:1px;">');
+
+ if (stroke) {
+ appendStroke(this, lineStr);
+ } else {
+ // TODO: Fix the min and max params.
+ appendFill(this, lineStr, {x: -left, y: 0},
+ {x: right, y: fontStyle.size});
+ }
+
+ var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' +
+ m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0';
+
+ var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z);
+
+ lineStr.push('<g_vml_:skew on="t" matrix="', skewM ,'" ',
+ ' offset="', skewOffset, '" origin="', left ,' 0" />',
+ '<g_vml_:path textpathok="true" />',
+ '<g_vml_:textpath on="true" string="',
+ encodeHtmlAttribute(text),
+ '" style="v-text-align:', textAlign,
+ ';font:', encodeHtmlAttribute(fontStyleString),
+ '" /></g_vml_:line>');
+
+ this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
+ };
+
+ contextPrototype.fillText = function(text, x, y, maxWidth) {
+ this.drawText_(text, x, y, maxWidth, false);
+ };
+
+ contextPrototype.strokeText = function(text, x, y, maxWidth) {
+ this.drawText_(text, x, y, maxWidth, true);
+ };
+
+ contextPrototype.measureText = function(text) {
+ if (!this.textMeasureEl_) {
+ var s = '<span style="position:absolute;' +
+ 'top:-20000px;left:0;padding:0;margin:0;border:none;' +
+ 'white-space:pre;"></span>';
+ this.element_.insertAdjacentHTML('beforeEnd', s);
+ this.textMeasureEl_ = this.element_.lastChild;
+ }
+ var doc = this.element_.ownerDocument;
+ this.textMeasureEl_.innerHTML = '';
+ this.textMeasureEl_.style.font = this.font;
+ // Don't use innerHTML or innerText because they allow markup/whitespace.
+ this.textMeasureEl_.appendChild(doc.createTextNode(text));
+ return {width: this.textMeasureEl_.offsetWidth};
+ };
+
+ /******** STUBS ********/
+ contextPrototype.clip = function() {
+ // TODO: Implement
+ };
+
+ contextPrototype.arcTo = function() {
+ // TODO: Implement
+ };
+
+ contextPrototype.createPattern = function(image, repetition) {
+ return new CanvasPattern_(image, repetition);
+ };
+
+ // Gradient / Pattern Stubs
+ function CanvasGradient_(aType) {
+ this.type_ = aType;
+ this.x0_ = 0;
+ this.y0_ = 0;
+ this.r0_ = 0;
+ this.x1_ = 0;
+ this.y1_ = 0;
+ this.r1_ = 0;
+ this.colors_ = [];
+ }
+
+ CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
+ aColor = processStyle(aColor);
+ this.colors_.push({offset: aOffset,
+ color: aColor.color,
+ alpha: aColor.alpha});
+ };
+
+ function CanvasPattern_(image, repetition) {
+ assertImageIsValid(image);
+ switch (repetition) {
+ case 'repeat':
+ case null:
+ case '':
+ this.repetition_ = 'repeat';
+ break
+ case 'repeat-x':
+ case 'repeat-y':
+ case 'no-repeat':
+ this.repetition_ = repetition;
+ break;
+ default:
+ throwException('SYNTAX_ERR');
+ }
+
+ this.src_ = image.src;
+ this.width_ = image.width;
+ this.height_ = image.height;
+ }
+
+ function throwException(s) {
+ throw new DOMException_(s);
+ }
+
+ function assertImageIsValid(img) {
+ if (!img || img.nodeType != 1 || img.tagName != 'IMG') {
+ throwException('TYPE_MISMATCH_ERR');
+ }
+ if (img.readyState != 'complete') {
+ throwException('INVALID_STATE_ERR');
+ }
+ }
+
+ function DOMException_(s) {
+ this.code = this[s];
+ this.message = s +': DOM Exception ' + this.code;
+ }
+ var p = DOMException_.prototype = new Error;
+ p.INDEX_SIZE_ERR = 1;
+ p.DOMSTRING_SIZE_ERR = 2;
+ p.HIERARCHY_REQUEST_ERR = 3;
+ p.WRONG_DOCUMENT_ERR = 4;
+ p.INVALID_CHARACTER_ERR = 5;
+ p.NO_DATA_ALLOWED_ERR = 6;
+ p.NO_MODIFICATION_ALLOWED_ERR = 7;
+ p.NOT_FOUND_ERR = 8;
+ p.NOT_SUPPORTED_ERR = 9;
+ p.INUSE_ATTRIBUTE_ERR = 10;
+ p.INVALID_STATE_ERR = 11;
+ p.SYNTAX_ERR = 12;
+ p.INVALID_MODIFICATION_ERR = 13;
+ p.NAMESPACE_ERR = 14;
+ p.INVALID_ACCESS_ERR = 15;
+ p.VALIDATION_ERR = 16;
+ p.TYPE_MISMATCH_ERR = 17;
+
+ // set up externs
+ G_vmlCanvasManager = G_vmlCanvasManager_;
+ CanvasRenderingContext2D = CanvasRenderingContext2D_;
+ CanvasGradient = CanvasGradient_;
+ CanvasPattern = CanvasPattern_;
+ DOMException = DOMException_;
+})();
+
+} // if
--- /dev/null
+<table border=0>
+</table>
--- /dev/null
+<?
+function get_data($item) {
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+ echo $itemRSS[$item];
+}
+
+function summon($person,$status) {
+ if ($person == "russ") {
+ $myFile = "russ.txt";
+ $fh = fopen($myFile, 'w') or die("can't open file");
+ fwrite($fh, $status);
+ fclose($fh);
+ }
+ if ($person == "beth") {
+ $myFile = "beth.txt";
+ $fh = fopen($myFile, 'w') or die("can't open file");
+ fwrite($fh, $status);
+ fclose($fh);
+ }
+}
+
+function summon_status($person) {
+ if ($person == "russ") {
+ $myFile = "russ.txt";
+ $fh = fopen($myFile, 'r') or die("can't open file");
+ $status = fread($fh, 5);
+ fclose($fh);
+ }
+ if ($person == "beth") {
+ $myFile = "beth.txt";
+ $fh = fopen($myFile, 'r') or die("can't open file");
+ $status = fread($fh, 5);
+ fclose($fh);
+ }
+ return($status);
+}
+?>
--- /dev/null
+<? include("includes.php");
+ include("xml2array.php");
+?>
+<html>
+<head>
+
+<script type="text/javascript" src="/include/java/prototype.js"></script>
+<script type="text/javascript" src="/include/java/scriptaculous.js?load=effects"></script>
+<script type="text/javascript" src="/include/java/lightbox.js"></script>
+
+<link rel="stylesheet" href="/include/css/lightbox.css" type="text/css" media="screen" />
+
+<script type="text/javascript">
+
+/***********************************************
+* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
+* This notice MUST stay intact for legal use
+* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
+***********************************************/
+
+var bustcachevar=0 //bust potential caching of external pages after initial request? (1=yes, 0=no)
+var loadedobjects=""
+var rootdomain="http://"+window.location.hostname
+var bustcacheparameter=""
+
+function ajaxpage(url, containerid){
+ //alert("updating page");
+ var page_request = false
+ if (window.XMLHttpRequest) // if Mozilla, Safari etc
+ page_request = new XMLHttpRequest()
+ else if (window.ActiveXObject){ // if IE
+ try {
+ page_request = new ActiveXObject("Msxml2.XMLHTTP")
+ }
+ catch (e){
+ try{
+ page_request = new ActiveXObject("Microsoft.XMLHTTP")
+ }
+ catch (e){}
+ }
+ }
+ else
+ return false
+ page_request.onreadystatechange=function(){
+ loadpage(page_request, containerid)
+ }
+ if (bustcachevar) //if bust caching of external page
+ bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
+ page_request.open('GET', url+bustcacheparameter, true)
+ page_request.send(null)
+}
+
+function resize(which, max) {
+ var elem = document.getElementById(which);
+ if (elem == undefined || elem == null) return false;
+ if (max == undefined) max = 100;
+ if (elem.width > elem.height) {
+ if (elem.width > max) elem.width = max;
+ } else {
+ if (elem.height > max) elem.height = max;
+ }
+}
+
+
+function getPixelsFromTop(obj){
+ objFromTop = obj.offsetTop;
+ while(obj.offsetParent!=null) {
+ objParent = obj.offsetParent;
+ objFromTop += objParent.offsetTop;
+ obj = objParent;
+ }
+ return objFromTop;
+}
+
+
+function resizeheight(height,width) {
+ screen_title=parseInt(title.offsetHeight);
+ screen_menubar=150;
+ full_height=parseInt(fullheight.offsetHeight);
+ screen_height=screen_title+screen_menubar+parseInt(height);
+ if (screen_height>full_height) {
+ //newheight=(full_height-(screen_title+screen_menubar));
+ contentTopDiv = document.getElementById("contenttop")
+ contentBotDiv = document.getElementById("contentbottom")
+ contentTop = getPixelsFromTop(contentTopDiv);
+ contentBottom = getPixelsFromTop(contentBotDiv);
+ contentHeight = contentBottom - contentTop;
+
+ //alert("The cell height is " + contentHeight);
+
+ newheight=contentHeight;
+
+ percentage=newheight/height;
+ newwidth=parseInt(width*percentage);
+ var security = document.getElementById('security');
+ security.style.width=newheight+"px";
+ security.style.height=newwidth+"px";
+ //security.style.width=newheight;
+ //security.style.height=newwidth;
+ //alert(newwidth+" "+newheight);
+ } else {
+ //alert("not resizing height");
+ // return(height);
+ }
+}
+
+
+function insteon(url) {
+ var page_request = false
+ if (window.XMLHttpRequest) // if Mozilla, Safari etc
+ page_request = new XMLHttpRequest()
+ else if (window.ActiveXObject){ // if IE
+ try {
+ page_request = new ActiveXObject("Msxml2.XMLHTTP")
+ }
+ catch (e){
+ try{
+ page_request = new ActiveXObject("Microsoft.XMLHTTP")
+ }
+ catch (e){}
+ }
+ }
+ else
+ return false
+ if (bustcachevar) //if bust caching of external page
+ bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
+ page_request.open('GET', url+bustcacheparameter, true)
+ page_request.send(null)
+
+}
+
+function sillytimeout() {
+ ajaxpage('check_isy99i_status.php', 'contentarea');
+}
+
+function update_isy99() {
+ var t=setTimeout("sillytimeout()", 10000);
+}
+
+function loadpage(page_request, containerid){
+ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
+ document.getElementById(containerid).innerHTML=page_request.responseText;
+}
+
+function loadobjs(){
+ if (!document.getElementById)
+ return
+ for (i=0; i<arguments.length; i++){
+ var file=arguments[i]
+ var fileref=""
+ if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
+ if (file.indexOf(".js")!=-1){ //If object is a js file
+ fileref=document.createElement('script')
+ fileref.setAttribute("type","text/javascript");
+ fileref.setAttribute("src", file);
+ }
+ else if (file.indexOf(".css")!=-1){ //If object is a css file
+ fileref=document.createElement("link")
+ fileref.setAttribute("rel", "stylesheet");
+ fileref.setAttribute("type", "text/css");
+ fileref.setAttribute("href", file);
+ }
+ }
+ if (fileref!=""){
+ document.getElementsByTagName("head").item(0).appendChild(fileref)
+ loadedobjects+=file+" " //Remember this object as being already added to page
+ }
+ }
+}
+
+function chkObject(theVal) {
+ if (document.getElementById(theVal) != null) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function title_status() {
+ ajaxpage("title_status.php","title_status");
+ setTimeout("title_status()", 60000);
+}
+
+function alert_status() {
+ ajaxpage("alert_status.php","alert_status");
+ setTimeout("alert_status()", 1000);
+}
+
+function securityStatus() {
+ ajaxpage('check_isy99i_occupancy_status.php','contentarea');
+ t=setTimeout('securityStatus()', 10000);
+}
+
+function lightingStatus() {
+ ajaxpage('check_isy99i_status.php', 'contentarea');
+ t=setTimeout('lightingStatus()', 10000);
+}
+
+var weatherpages=new Array();
+ weatherpages[0]="weather1.php";
+ weatherpages[1]="weather2.php";
+ weatherpages[2]="weather3.php";
+ weatherpages[3]="weather4.php";
+ weatherpages[4]="weather5.php";
+ weatherpages[5]="weather6.php";
+
+var i=0;
+var t;
+
+function weatherpageChange() {
+ ajaxpage(weatherpages[i],'contentarea');
+ i++;
+ if (i==weatherpages.length) {
+ i=0;
+ }
+ t=setTimeout("weatherpageChange()",10000);
+}
+
+function imageHeaderChange(imgUrl) {
+ var div1 = document.getElementById('imgHeader');
+ div1.innerHTML='<img src=" '+imgUrl + ' ">'
+}
+
+function stopchanges(t) {
+ clearTimeout(t);
+ i=0;
+}
+
+function changeIcon(icon) {
+ var icons=new Array();
+ icons[0]="home";
+ icons[1]="weather";
+ icons[2]="lighting";
+ icons[3]="music";
+ icons[4]="cameras";
+ icons[5]="security";
+ icons[6]="climate";
+ icons[7]="news";
+ icons[8]="receipes";
+ icons[9]="groceries";
+ icons[10]="traffic";
+ icons[11]="power";
+ for ( var i=icons.length-1; i>=0; --i ){
+ if (icons[i] == icon) {
+ document.getElementById(icon).src = "images/"+icon+"-on.png";
+ } else {
+ document.getElementById(icons[i]).src = "images/"+icons[i]+"-off.png";
+ }
+ }
+}
+
+var securitypages=new Array();
+ securitypages[0]="security1.html";
+ securitypages[1]="security2.html";
+ securitypages[2]="security3.html";
+ securitypages[3]="security4.html";
+ securitypages[4]="security5.html";
+ securitypages[5]="security6.html";
+
+function securitypageChange() {
+ ajaxpage(securitypages[i],'contentarea');
+ i++;
+ if (i==securitypages.length) {
+ i=0;
+ }
+ t=setTimeout("securitypageChange()",10000);
+}
+
+function mediacenterSelect(ip) {
+ ajaxpage("jukebox.php?ip="+ip, 'contentarea');
+}
+
+function thermostatMode(modeId) {
+ alert(modeId);
+}
+
+function thermostatFan(fanId) {
+ alert(fanId);
+}
+
+</script>
+
+<style>
+body {overflow-y:hidden;
+ height:100%;
+ background-color: #000000;
+ background-image: url('images/bg.jpg');
+ background-repeat:repeat-x;
+ color: white;}
+
+#menubar {font-family:arial, helvetica; font-size:12px; font-weight:bold;}
+
+#fullheight{height: 100%;}
+
+#fullimage{
+ width: 100%;
+ height: 100%;
+}
+
+#imgHeader {
+ float: center;
+ vertical-align:text-top;
+}
+
+</style>
+</head>
+<body>
+<table border="0" width=100% id="fullheight">
+<tr><td>
+
+<table border=0 align=center cellspacing=0 cellpadding=0 width=100%>
+<tr style="background-image: url('images/header-repeater.png'); background-repeat: repeat-x;">
+<td width="40%">
+<canvas id="canvas3" height="62" width="420"> </canvas>
+<script language="JavaScript">
+function testDrawText3(canvas)
+{
+ var context=canvas.getContext('2d');
+ context.lineWidth=1;
+ context.strokeStyle="#3c3c3c";
+ context.shadowOffsetX=2;
+ context.shadowOffsetY=-2;
+ context.shadowColor="#3c3c3c";
+
+ context.font="22pt ariel";
+ context.fillStyle="#aaaaaa";
+ context.shadowOffsetX=5;
+ context.shadowOffsetY=5;
+ context.shadowBlur=10;
+ context.fillText("HANDORF HOUSE", 10, 35);
+ context.strokeText("HANDORF HOUSE", 10, 35);
+}
+testDrawText3(document.getElementById('canvas3'));
+</script>
+<!-- <img align="left" src="images/header.png"> -->
+</td><td><div id="alert_status" style="font-family: Arial;position: relative; top: -6px;">
+<script language="javascript">
+alert_status();
+</script></td><td align="right">
+<div id="title_status" style="font-family: Arial;position: relative; top: -6px;">
+<script language="javascript">
+title_status();
+</script>
+</td>
+<td width=20% align="right" valign="middle">
+<div id="js_clock" style="font-size:x-large;font-family: Arial;position: relative; top: -6px;">
+<script language="javascript">function js_clock(){var clock_time = new Date();var clock_hours = clock_time.getHours();var clock_minutes = clock_time.getMinutes();var clock_seconds = clock_time.getSeconds();var clock_suffix = "AM ";if (clock_hours > 11){clock_suffix = "PM ";clock_hours = clock_hours - 12;}if (clock_hours == 0){clock_hours = 12;}if (clock_hours < 10){clock_hours = "0" + clock_hours;}if (clock_minutes < 10){clock_minutes = "0" + clock_minutes;}if (clock_seconds < 10){clock_seconds = "0" + clock_seconds;}var clock_div = document.getElementById('js_clock');clock_div.innerHTML = clock_hours + ":" + clock_minutes + ":" + clock_seconds + " " + clock_suffix;setTimeout("js_clock()", 1000);}js_clock();</script>
+</div>
+</td>
+</tr>
+</table>
+
+
+
+</td></tr>
+<tr height="100%" valign="top"><td>
+<div id="contenttop"></div>
+<table align=center>
+<tr><td>
+<div id="imgHeader" align="center"></div>
+</td></tr>
+<tr><td>
+<div id="contentarea" align="center">
+
+Middle
+
+</div>
+</td></tr>
+</table>
+<div id="contentbottom"></div>
+</td></tr>
+<tr><td>
+
+<div name="menubar">
+<table border=0 ALIGN=center cellpadding=0 cellspacing =0 width=100%>
+<tr style="background-image: url('images/bottom-controls-repeatablebar.jpg'); background-repeat: repeat-x;">
+<td ALIGN=center>
+<table border=0 align=center cellpadding=0 cellspacing=0>
+<tr style="background-image: url('images/bottom-controls-repeatablebar.jpg'); background-repeat: repeat-x;">
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);weatherpageChange();imageHeaderChange('images/header-weather.png');changeIcon('weather');"><img src="./images/weather-off.png" onMouseover="" border=0 id="weather"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);lightingStatus();imageHeaderChange('images/header-lighting.png');changeIcon('lighting');"><img src="./images/lighting-off.png" onMouseover="" border=0 id="lighting"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);ajaxpage('jukebox.php', 'contentarea');imageHeaderChange('images/header-thejukebox.png');changeIcon('music');"><img src="./images/music-off.png" onMouseover="" border=0 id="music"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);securitypageChange();imageHeaderChange('images/header-camera.png');changeIcon('cameras');"><img src="./images/cameras-off.png" onMouseover="" border=0 id="cameras"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);securityStatus();imageHeaderChange('images/header-security.png');changeIcon('security');"><img src="./images/security-off.png" onMouseover="" border=0 id="security"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);ajaxpage('check_climate_status.php', 'contentarea');imageHeaderChange('images/header-climate.png');changeIcon('climate');"><img src="./images/climate-off.png" onMouseover="" border=0 id="climate"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);ajaxpage('news.php', 'contentarea');imageHeaderChange('images/header-news.png');changeIcon('news');"><img src="./images/news-off.png" onMouseover="" border=0 id="news"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);weatherpageChange();imageHeaderChange('images/header-recipes.png');changeIcon('receipes');"><img src="./images/receipes-off.png" onMouseover="" border=0 id="receipes"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);ajaxpage('groceries.html', 'contentarea');imageHeaderChange('images/header-groceries.png');changeIcon('groceries');"><img src="./images/groceries-off.png" onMouseover="" border=0 id="groceries"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);;ajaxpage('traffic.html', 'contentarea');imageHeaderChange('images/header-traffic.png');changeIcon('traffic');"><img src="./images/traffic-off.png" onMouseover="" border=0 id="traffic"></a>
+</td>
+<td ALIGN=center>
+<a href="javascript:stopchanges(t);ajaxpage('check_power_status.php', 'contentarea');imageHeaderChange('images/header-power.png');changeIcon('power');"><img src="./images/power-off.png" onMouseover="" border=0 id="power"></a>
+</td>
+</tr>
+<!--
+<tr>
+<td ALIGN=center>
+Weather
+</td>
+<td ALIGN=center>
+Lighting
+</td>
+<td ALIGN=center>
+Music
+</td>
+<td ALIGN=center>
+Cameras
+</td>
+<td ALIGN=center>
+Security
+</td>
+<td ALIGN=center>
+Climate
+</td>
+<td ALIGN=center>
+News
+</td>
+<td ALIGN=center>
+Receipes
+</td>
+<td ALIGN=center>
+Groceries
+</td>
+<td ALIGN=center>
+Traffic
+</td>
+<td ALIGN=center>
+Power
+</td>
+
+</tr>
+-->
+
+</td></tr></table>
+</table>
+
+</div>
+
+</td></tr>
+</table>
+
+
+
+
+
+</body>
+</html>
--- /dev/null
+<?
+
+include("xml2array.php");
+
+$mediacenters=array("Livingroom","Bedroom");
+
+foreach ($mediacenters as $mediacenter) {
+ list($ip,$name)=split("-",$mediacenter);
+ echo "<input type='radio' name='mediacenter' value='$ip' onClick=\"mediacenterSelect('$ip')\">$name ";
+}
+
+
+if ($_GET['ip']) {
+ $ip=$_GET['ip'];
+ $ch = curl_init();
+
+ curl_setopt($ch, CURLOPT_URL,"http://$ip:8800/xbmcCmds/xbmcHttp?command=querymusicdatabase(select%20strArtist%20from%20artist%20order%20by%20strArtist)");
+
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ #curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ #curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+ $output = curl_exec($ch);
+
+ echo "<pre>";
+ print_r($output);
+ $array=xml2array($output);
+ print_r($array);
+}
+
+exit;
+$ch = curl_init();
+
+curl_setopt($ch, CURLOPT_URL,"http://isy99/rest/nodes/11%20BE%2054%201");
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+$output = curl_exec($ch);
+
+#echo "<pre>";
+$array=xml2array($output);
+#print_r($array);
+
+echo "<table>";
+ echo "<tr><td>Set Temperature:</td><td>".$array['nodeInfo']['node']['property']['0_attr']['formatted']."</td></tr>";
+ echo "<tr><td>Current Temperature:</td><td>".($array['nodeInfo']['node']['property']['3_attr']['formatted'])."</td></tr>";
+ echo "<tr><td>Temperature Mode:</td><td>".($array['nodeInfo']['node']['property']['1_attr']['formatted'])."</td></tr>";
+ echo "<tr><td>Humidity:</td><td>".($array['nodeInfo']['properties']['property']['2_attr']['formatted'])."</td></tr>";
+echo "</table>";
+?>
--- /dev/null
+<HEAD>
+<Style>
+body {background-color: #4d4c48;}
+</style>
+
+<SCRIPT LANGUAGE="JavaScript">
+<!-- Beginning of JavaScript -
+
+var timeout;
+var x = 0;
+var step = 2;
+
+function start1(){
+ x=window.parent.menu.pageXOffset;
+ if (x < 0){
+ x=0;
+ }
+ x=x - step;
+ window.parent.menu.scroll(x,0);
+ timeout=setTimeout("start1()",50);
+}
+
+function start2(){
+ if (x >=0 ){
+ window.parent.menu.scroll(x,0);
+ x = x - step;
+ }
+
+ timeout=setTimeout("start2()",50);
+}
+
+function stop1(){
+ clearTimeout(timeout);
+}
+
+function top1(){
+ window.parent.menu.scroll(0,0);
+ x=0;
+}
+
+
+// - End of JavaScript - -->
+</SCRIPT>
+</HEAD>
+
+
+<img src="./icons/left-arrow.png" onMouseDown="stop1();start1();" onMouseup="stop1()" align="right"><br>
+
+
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The bar chart constructor
+ *
+ * @param object canvas The canvas object
+ * @param array data The chart data
+ */
+ RGraph.Bar = function (id, data)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.type = 'bar';
+ this.max = 0;
+ this.stackedOrGrouped = false;
+ this.isRGraph = true;
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Various config type stuff
+ this.properties = {
+ 'chart.background.barcolor1': 'rgba(0,0,0,0)',
+ 'chart.background.barcolor2': 'rgba(0,0,0,0)',
+ 'chart.background.grid': true,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.hsize': 20,
+ 'chart.background.grid.vsize': 20,
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 7,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.ytickgap': 20,
+ 'chart.smallyticks': 3,
+ 'chart.largeyticks': 5,
+ 'chart.numyticks': 10,
+ 'chart.hmargin': 5,
+ 'chart.strokecolor': '#666',
+ 'chart.axis.color': 'black',
+ 'chart.gutter': 25,
+ 'chart.labels': null,
+ 'chart.labels.ingraph': null,
+ 'chart.labels.above': false,
+ 'chart.labels.above.decimals': 0,
+ 'chart.labels.above.size': null,
+ 'chart.ylabels': true,
+ 'chart.ylabels.count': 5,
+ 'chart.ylabels.inside': false,
+ 'chart.xlabels.offset': 0,
+ 'chart.xaxispos': 'bottom',
+ 'chart.yaxispos': 'left',
+ 'chart.text.color': 'black',
+ 'chart.text.size': 10,
+ 'chart.text.angle': 0,
+ 'chart.text.font': 'Verdana',
+ 'chart.ymax': null,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.xaxis': '',
+ 'chart.title.yaxis': '',
+ 'chart.title.xaxis.pos': 0.25,
+ 'chart.title.yaxis.pos': 0.25,
+ 'chart.colors': ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0'],
+ 'chart.grouping': 'grouped',
+ 'chart.variant': 'bar',
+ 'chart.shadow': false,
+ 'chart.shadow.color': '#666',
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.shadow.blur': 3,
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.event': 'onclick',
+ 'chart.tooltips.coords.adjust': [0,0],
+ 'chart.tooltips.highlight': true,
+ 'chart.background.hbars': null,
+
+ 'chart.key': [],
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.key.text.size': 10,
+
+ 'chart.contextmenu': null,
+ 'chart.line': null,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.scale.decimals': 0,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.crosshairs': false,
+ 'chart.crosshairs.color': '#333',
+ 'chart.linewidth': 1,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.resizable': false,
+ 'chart.adjustable': false
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[BAR] No canvas support');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[BAR] Fatal error: The common library does not appear to have been included');
+ }
+
+ /**
+ * Determine whether the chart will contain stacked or grouped bars
+ */
+ for (i=0; i<data.length; ++i) {
+ if (typeof(data[i]) == 'object') {
+ this.stackedOrGrouped = true;
+ }
+ }
+
+ // Store the data
+ this.data = data;
+
+ // Used to store the coords of the bars
+ this.coords = [];
+ }
+
+
+ /**
+ * A setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Bar.prototype.Set = function (name, value)
+ {
+ name = name.toLowerCase();
+
+ if (name == 'chart.labels.abovebar') {
+ name = 'chart.labels.above';
+ }
+
+ if (name == 'chart.strokestyle') {
+ name = 'chart.strokecolor';
+ }
+
+ this.properties[name] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Bar.prototype.Get = function (name)
+ {
+ if (name == 'chart.labels.abovebar') {
+ name = 'chart.labels.above';
+ }
+
+ return this.properties[name];
+ }
+
+
+ /**
+ * The function you call to draw the bar chart
+ */
+ RGraph.Bar.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ /**
+ * Convert any null values to 0. Won't make any difference to the bar (as opposed to the line chart)
+ */
+ for (var i=0; i<this.data.length; ++i) {
+ if (this.data[i] == null) {
+ this.data[i] = 0;
+ }
+ }
+
+
+ // Cache this in a class variable as it's used rather a lot
+ this.gutter = this.Get('chart.gutter');
+
+ /**
+ * Check for tooltips and alert the user that they're not supported with pyramid charts
+ */
+ if ( (this.Get('chart.variant') == 'pyramid' || this.Get('chart.variant') == 'dot')
+ && typeof(this.Get('chart.tooltips')) == 'object'
+ && this.Get('chart.tooltips')
+ && this.Get('chart.tooltips').length > 0) {
+
+ alert('[BAR] (' + this.id + ') Sorry, tooltips are not supported with dot or pyramid charts');
+ }
+
+ /**
+ * Stop the coords array from growing uncontrollably
+ */
+ this.coords = [];
+
+ /**
+ * Work out a few things. They need to be here because they depend on things you can change before you
+ * call Draw() but after you instantiate the object
+ */
+ this.max = 0;
+ this.grapharea = this.canvas.height - ( (2 * this.gutter));
+ this.halfgrapharea = this.grapharea / 2;
+ this.halfTextHeight = this.Get('chart.text.size') / 2;
+
+ // Progressively Draw the chart
+ RGraph.background.Draw(this);
+
+
+ //If it's a sketch chart variant, draw the axes first
+ if (this.Get('chart.variant') == 'sketch') {
+ this.DrawAxes();
+ this.Drawbars();
+ } else {
+ this.Drawbars();
+ this.DrawAxes();
+ }
+
+ this.DrawLabels();
+
+
+ // Draw the key if necessary
+ if (this.Get('chart.key').length) {
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.colors'));
+ }
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+
+ /**
+ * Is a line is defined, draw it
+ */
+ var line = this.Get('chart.line');
+
+ if (line) {
+
+ // Check the length of the data(s)
+ if (line.original_data[0].length != this.data.length) {
+ alert("[BAR] You're adding a line with a differing amount of data points to the bar chart - this is not permitted");
+ }
+
+ // Check the X axis positions
+ if (this.Get('chart.xaxispos') != line.Get('chart.xaxispos')) {
+ alert("[BAR] Using different X axis positions when combining the Bar and Line is not advised");
+ }
+
+ line.Set('chart.gutter', this.Get('chart.gutter'));
+ line.Set('chart.noaxes', true);
+ line.Set('chart.background.barcolor1', 'rgba(0,0,0,0)');
+ line.Set('chart.background.barcolor2', 'rgba(0,0,0,0)');
+ line.Set('chart.background.grid', false);
+ line.Set('chart.ylabels', false);
+ line.Set('chart.hmargin', (this.canvas.width - (2 * this.gutter)) / (line.original_data[0].length * 2));
+
+ // If a custom yMax is set, use that
+ if (this.Get('chart.ymax')) {
+ line.Set('chart.ymax', this.Get('chart.ymax'));
+ }
+
+ line.Draw();
+ }
+
+
+ /**
+ * Draw "in graph" labels
+ */
+ if (this.Get('chart.labels.ingraph')) {
+ RGraph.DrawInGraphLabels(this);
+ }
+
+ /**
+ * Draw crosschairs
+ */
+ if (this.Get('chart.crosshairs')) {
+ RGraph.DrawCrosshairs(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+
+ /**
+ * This function enables adjusting
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the charts axes
+ */
+ RGraph.Bar.prototype.DrawAxes = function ()
+ {
+ var gutter = this.gutter;
+ var xaxispos = this.Get('chart.xaxispos');
+ var yaxispos = this.Get('chart.yaxispos');
+
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.axis.color');
+ this.context.lineWidth = 1;
+
+ // Draw the Y axis
+ if (yaxispos == 'right') {
+ this.context.moveTo(this.canvas.width - gutter, gutter);
+ this.context.lineTo(this.canvas.width - gutter, this.canvas.height - gutter);
+ } else {
+ this.context.moveTo(gutter, gutter);
+ this.context.lineTo(gutter, this.canvas.height - gutter);
+ }
+
+ // Draw the X axis
+ this.context.moveTo(gutter, (xaxispos == 'center' ? this.canvas.height / 2 : this.canvas.height - gutter));
+ this.context.lineTo(this.canvas.width - gutter, xaxispos == 'center' ? this.canvas.height / 2 : this.canvas.height - gutter);
+
+ var numYTicks = this.Get('chart.numyticks');
+
+ // Draw the Y tickmarks
+ var yTickGap = (this.canvas.height - (2 * gutter)) / numYTicks;
+ var xpos = yaxispos == 'left' ? gutter : this.canvas.width - gutter;
+
+ for (y=gutter;
+ xaxispos == 'center' ? y <= (this.canvas.height - gutter) : y < (this.canvas.height - gutter);
+ y += yTickGap) {
+
+ if (xaxispos == 'center' && y == (this.canvas.height / 2)) continue;
+
+ this.context.moveTo(xpos, y);
+ this.context.lineTo(xpos + (yaxispos == 'left' ? -3 : 3), y);
+ }
+
+ // Draw the X tickmarks
+ xTickGap = (this.canvas.width - (2 * gutter) ) / this.data.length;
+ yStart = this.canvas.height - gutter;
+ yEnd = (this.canvas.height - gutter) + 3;
+
+ //////////////// X TICKS ////////////////
+
+ // Now move the Y start end positions down if the axis is set to center
+ if (xaxispos == 'center') {
+ yStart = (this.canvas.height / 2) + 3;
+ yEnd = (this.canvas.height / 2) - 3;
+ }
+
+ for (x=gutter + (yaxispos == 'left' ? xTickGap : 0); x<this.canvas.width - gutter + (yaxispos == 'left' ? 5 : 0); x+=xTickGap) {
+ this.context.moveTo(x, yStart);
+ this.context.lineTo(x, yEnd);
+ }
+
+ //////////////// X TICKS ////////////////
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draws the bars
+ */
+ RGraph.Bar.prototype.Drawbars = function ()
+ {
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.strokeStyle = this.Get('chart.strokecolor');
+ this.context.fillStyle = this.Get('chart.colors')[0];
+ var prevX = 0;
+ var prevY = 0;
+ var gutter = this.gutter;
+ var decimals = this.Get('chart.scale.decimals');
+
+ /**
+ * Work out the max value
+ */
+ if (this.Get('chart.ymax')) {
+ this.max = this.Get('chart.ymax');
+
+ this.scale = [
+ (this.max * (1/5)).toFixed(decimals),
+ (this.max * (2/5)).toFixed(decimals),
+ (this.max * (3/5)).toFixed(decimals),
+ (this.max * (4/5)).toFixed(decimals),
+ this.max.toFixed(decimals)
+ ];
+ } else {
+ for (i=0; i<this.data.length; ++i) {
+ if (typeof(this.data[i]) == 'object') {
+ var value = this.Get('chart.grouping') == 'grouped' ? Number(RGraph.array_max(this.data[i], true)) : Number(RGraph.array_sum(this.data[i])) ;
+
+ } else {
+ var value = Number(this.data[i]);
+ }
+
+ this.max = Math.max(Math.abs(this.max), Math.abs(value));
+ }
+
+ this.scale = RGraph.getScale(this.max, this);
+ this.max = this.scale[4];
+
+ if (this.Get('chart.scale.decimals')) {
+ var decimals = this.Get('chart.scale.decimals');
+
+ this.scale[0] = Number(this.scale[0]).toFixed(decimals);
+ this.scale[1] = Number(this.scale[1]).toFixed(decimals);
+ this.scale[2] = Number(this.scale[2]).toFixed(decimals);
+ this.scale[3] = Number(this.scale[3]).toFixed(decimals);
+ this.scale[4] = Number(this.scale[4]).toFixed(decimals);
+ }
+ }
+
+ /**
+ * Draw horizontal bars here
+ */
+ if (this.Get('chart.background.hbars') && this.Get('chart.background.hbars').length > 0) {
+ RGraph.DrawBars(this);
+ }
+
+ var variant = this.Get('chart.variant');
+
+ /**
+ * Draw the 3D axes is necessary
+ */
+ if (variant == '3d') {
+ RGraph.Draw3DAxes(this);
+ }
+
+ /**
+ * Get the variant once, and draw the bars, be they regular, stacked or grouped
+ */
+
+ // Get these variables outside of the loop
+ var xaxispos = this.Get('chart.xaxispos');
+ var width = (this.canvas.width - (2 * gutter) ) / this.data.length;
+ var orig_height = height;
+ var hmargin = this.Get('chart.hmargin');
+ var shadow = this.Get('chart.shadow');
+ var shadowColor = this.Get('chart.shadow.color');
+ var shadowBlur = this.Get('chart.shadow.blur');
+ var shadowOffsetX = this.Get('chart.shadow.offsetx');
+ var shadowOffsetY = this.Get('chart.shadow.offsety');
+ var strokeStyle = this.Get('chart.strokecolor');
+ var colors = this.Get('chart.colors');
+
+ for (i=0; i<this.data.length; ++i) {
+
+ // Work out the height
+ //The width is up outside the loop
+ var height = (RGraph.array_sum(this.data[i]) / this.max) * (this.canvas.height - (2 * gutter) );
+
+ // Half the height if the Y axis is at the center
+ if (xaxispos == 'center') {
+ height /= 2;
+ }
+
+ var x = (i * width) + gutter;
+ var y = xaxispos == 'center' ? (this.canvas.height / 2) - height : this.canvas.height - height - gutter;
+
+
+ // Account for negative lengths - Some browsers (eg Chrome) don't like a negative value
+ if (height < 0) {
+ y += height;
+ height = Math.abs(height);
+ }
+
+ /**
+ * Turn on the shadow if need be
+ */
+ if (shadow) {
+ this.context.shadowColor = shadowColor;
+ this.context.shadowBlur = shadowBlur;
+ this.context.shadowOffsetX = shadowOffsetX;
+ this.context.shadowOffsetY = shadowOffsetY;
+ }
+
+ /**
+ * Draw the bar
+ */
+ this.context.beginPath();
+ if (typeof(this.data[i]) == 'number') {
+
+ var barWidth = width - (2 * hmargin);
+
+ // Set the fill color
+ this.context.strokeStyle = strokeStyle;
+ this.context.fillStyle = colors[0];
+
+ if (variant == 'sketch') {
+
+ this.context.lineCap = 'round';
+
+ var sketchOffset = 3;
+
+ this.context.beginPath();
+
+ this.context.strokeStyle = colors[0];
+
+ // Left side
+ this.context.moveTo(x + hmargin + 2, y + height - 2);
+ this.context.lineTo(x + hmargin , y - 2);
+
+ // The top
+ this.context.moveTo(x + hmargin - 3, y + -2 + (this.data[i] < 0 ? height : 0));
+ this.context.bezierCurveTo(x + ((hmargin + width) * 0.33),y + 5 + (this.data[i] < 0 ? height - 10: 0),x + ((hmargin + width) * 0.66),y + 5 + (this.data[i] < 0 ? height - 10 : 0),x + hmargin + width + -1, y + 0 + (this.data[i] < 0 ? height : 0));
+
+
+ // The right side
+ this.context.moveTo(x + hmargin + width - 2, y + -2);
+ this.context.lineTo(x + hmargin + width - 3, y + height - 3);
+
+ for (var r=0.2; r<=0.8; r+=0.2) {
+ this.context.moveTo(x + hmargin + width + (r > 0.4 ? -1 : 3) - (r * width),y - 1);
+ this.context.lineTo(x + hmargin + width - (r > 0.4 ? 1 : -1) - (r * width), y + height + (r == 0.2 ? 1 : -2));
+ }
+
+ this.context.stroke();
+
+ // Regular bar
+ } else if (variant == 'bar' || variant == '3d' || variant == 'glass') {
+
+ if (document.all && shadow) {
+ this.DrawIEShadow([x + hmargin, y, barWidth, height]);
+ }
+
+ if (variant == 'glass') {
+ RGraph.filledCurvyRect(this.context, x + hmargin, y, barWidth, height, 3, this.data[i] > 0, this.data[i] > 0, this.data[i] < 0, this.data[i] < 0);
+ RGraph.strokedCurvyRect(this.context, x + hmargin, y, barWidth, height, 3, this.data[i] > 0, this.data[i] > 0, this.data[i] < 0, this.data[i] < 0);
+ } else {
+ this.context.strokeRect(x + hmargin, y, barWidth, height);
+ this.context.fillRect(x + hmargin, y, barWidth, height);
+ }
+
+
+ // This bit draws the text labels that appear above the bars if requested
+ if (this.Get('chart.labels.above')) {
+
+ // Turn off any shadow
+ if (shadow) {
+ RGraph.NoShadow(this);
+ }
+
+ var yPos = y - 3;
+
+ // Account for negative bars
+ if (this.data[i] < 0) {
+ yPos += height + 6 + (this.Get('chart.text.size') - 4);
+ }
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ RGraph.Text(this.context, this.Get('chart.text.font'), typeof(this.Get('chart.labels.above.size')) == 'number' ? this.Get('chart.labels.above.size') : this.Get('chart.text.size') - 3, x + hmargin + (barWidth / 2), yPos, RGraph.number_format(this, Number(this.data[i]).toFixed(this.Get('chart.labels.above.decimals')),this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ }
+
+ // 3D effect
+ if (variant == '3d') {
+
+ var prevStrokeStyle = this.context.strokeStyle;
+ var prevFillStyle = this.context.fillStyle;
+
+ // Draw the top
+ this.context.beginPath();
+ this.context.moveTo(x + hmargin, y);
+ this.context.lineTo(x + hmargin + 10, y - 5);
+ this.context.lineTo(x + hmargin + 10 + barWidth, y - 5);
+ this.context.lineTo(x + hmargin + barWidth, y);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the right hand side
+ this.context.beginPath();
+ this.context.moveTo(x + hmargin + barWidth, y);
+ this.context.lineTo(x + hmargin + barWidth + 10, y - 5);
+ this.context.lineTo(x + hmargin + barWidth + 10, y + height - 5);
+ this.context.lineTo(x + hmargin + barWidth, y + height);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the darker top section
+ this.context.beginPath();
+ this.context.fillStyle = 'rgba(255,255,255,0.3)';
+ this.context.moveTo(x + hmargin, y);
+ this.context.lineTo(x + hmargin + 10, y - 5);
+ this.context.lineTo(x + hmargin + 10 + barWidth, y - 5);
+ this.context.lineTo(x + hmargin + barWidth, y);
+ this.context.lineTo(x + hmargin, y);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the darker right side section
+ this.context.beginPath();
+ this.context.fillStyle = 'rgba(0,0,0,0.4)';
+ this.context.moveTo(x + hmargin + barWidth, y);
+ this.context.lineTo(x + hmargin + barWidth + 10, y - 5);
+ this.context.lineTo(x + hmargin + barWidth + 10, y - 5 + height);
+ this.context.lineTo(x + hmargin + barWidth, y + height);
+ this.context.lineTo(x + hmargin + barWidth, y);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ this.context.strokeStyle = prevStrokeStyle;
+ this.context.fillStyle = prevFillStyle;
+
+ // Glass variant
+ } else if (variant == 'glass') {
+
+ var grad = this.context.createLinearGradient(
+ x + hmargin,
+ y,
+ x + hmargin + (barWidth / 2),
+ y
+ );
+ grad.addColorStop(0, 'rgba(255,255,255,0.9)');
+ grad.addColorStop(1, 'rgba(255,255,255,0.5)');
+
+ this.context.beginPath();
+ this.context.fillStyle = grad;
+ this.context.fillRect(x + hmargin + 2,y + (this.data[i] > 0 ? 2 : 0),(barWidth / 2) - 2,height - 2);
+ this.context.fill();
+ }
+
+ // Dot chart
+ } else if (variant == 'dot') {
+
+ this.context.beginPath();
+ this.context.moveTo(x + (width / 2), y);
+ this.context.lineTo(x + (width / 2), y + height);
+ this.context.stroke();
+
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.colors')[i];
+ this.context.arc(x + (width / 2), y + (this.data[i] > 0 ? 0 : height), 2, 0, 6.28, 0);
+
+ // Set the colour for the dots
+ this.context.fillStyle = this.Get('chart.colors')[0];
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Pyramid chart
+ } else if (variant == 'pyramid') {
+
+ this.context.beginPath();
+ var startY = (this.Get('chart.xaxispos') == 'center' ? (this.canvas.height / 2) : (this.canvas.height - this.Get('chart.gutter')));
+
+ this.context.moveTo(x + hmargin, startY);
+ this.context.lineTo(
+ x + hmargin + (barWidth / 2),
+ y + (this.Get('chart.xaxispos') == 'center' && (this.data[i] < 0) ? height : 0)
+ );
+ this.context.lineTo(x + hmargin + barWidth, startY);
+
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Arrow chart
+ } else if (variant == 'arrow') {
+ var startY = (this.Get('chart.xaxispos') == 'center' ? (this.canvas.height / 2) : (this.canvas.height - this.gutter));
+
+ this.context.lineWidth = this.Get('chart.linewidth') ? this.Get('chart.linewidth') : 1;
+ this.context.lineCap = 'round';
+
+ this.context.beginPath();
+
+ this.context.moveTo(x + hmargin + (barWidth / 2), startY);
+ this.context.lineTo(x + hmargin + (barWidth / 2), y + (this.Get('chart.xaxispos') == 'center' && (this.data[i] < 0) ? height : 0));
+ this.context.arc(x + hmargin + (barWidth / 2),
+ y + (this.Get('chart.xaxispos') == 'center' && (this.data[i] < 0) ? height : 0),
+ 5,
+ this.data[i] > 0 ? 0.78 : 5.6,
+ this.data[i] > 0 ? 0.79 : 5.48,
+ this.data[i] < 0);
+
+ this.context.moveTo(x + hmargin + (barWidth / 2), y + (this.Get('chart.xaxispos') == 'center' && (this.data[i] < 0) ? height : 0));
+ this.context.arc(x + hmargin + (barWidth / 2),
+ y + (this.Get('chart.xaxispos') == 'center' && (this.data[i] < 0) ? height : 0),
+ 5,
+ this.data[i] > 0 ? 2.355 : 4,
+ this.data[i] > 0 ? 2.4 : 3.925,
+ this.data[i] < 0);
+
+ this.context.stroke();
+
+ this.context.lineWidth = 1;
+
+ // Unknown variant type
+ } else {
+ alert('[BAR] Warning! Unknown chart.variant: ' + variant);
+ }
+
+ this.coords.push([x + hmargin, y, width - (2 * hmargin), height]);
+
+
+ /**
+ * Stacked bar
+ */
+ } else if (typeof(this.data[i]) == 'object' && this.Get('chart.grouping') == 'stacked') {
+
+ var barWidth = width - (2 * hmargin);
+ var redrawCoords = [];// Necessary to draw if the shadow is enabled
+ var startY = 0;
+
+ for (j=0; j<this.data[i].length; ++j) {
+
+ // Stacked bar chart and X axis pos in the middle - poitless since negative values are not permitted
+ if (xaxispos == 'center') {
+ alert("[BAR] It's fruitless having the X axis position at the center on a stacked bar chart.");
+ return;
+ }
+
+ // Negative values not permitted for the stacked chart
+ if (this.data[i][j] < 0) {
+ alert('[BAR] Negative values are not permitted with a stacked bar chart. Try a grouped one instead.');
+ return;
+ }
+
+ // Set the fill and stroke colors
+ this.context.strokeStyle = strokeStyle
+ this.context.fillStyle = colors[j];
+
+ var height = (this.data[i][j] / this.max) * (this.canvas.height - (2 * this.gutter) );
+
+ // If the X axis pos is in the center, we need to half the height
+ if (xaxispos == 'center') {
+ height /= 2;
+ }
+
+ var totalHeight = (RGraph.array_sum(this.data[i]) / this.max) * (this.canvas.height - hmargin - (2 * this.gutter));
+
+ /**
+ * Store the coords for tooltips
+ */
+ this.coords.push([x + hmargin, y, width - (2 * hmargin), height]);
+
+ // MSIE shadow
+ if (document.all && shadow) {
+ this.DrawIEShadow([x + hmargin, y, width - (2 * hmargin), height + 1]);
+ }
+
+ this.context.strokeRect(x + hmargin, y, width - (2 * hmargin), height);
+ this.context.fillRect(x + hmargin, y, width - (2 * hmargin), height);
+
+
+ if (j == 0) {
+ var startY = y;
+ var startX = x;
+ }
+
+ /**
+ * Store the redraw coords if the shadow is enabled
+ */
+ if (shadow) {
+ redrawCoords.push([x + hmargin, y, width - (2 * hmargin), height, colors[j]]);
+ }
+
+ /**
+ * Stacked 3D effect
+ */
+ if (variant == '3d') {
+
+ var prevFillStyle = this.context.fillStyle;
+ var prevStrokeStyle = this.context.strokeStyle;
+
+
+ // Draw the top side
+ if (j == 0) {
+ this.context.beginPath();
+ this.context.moveTo(startX + hmargin, y);
+ this.context.lineTo(startX + 10 + hmargin, y - 5);
+ this.context.lineTo(startX + 10 + barWidth + hmargin, y - 5);
+ this.context.lineTo(startX + barWidth + hmargin, y);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+ }
+
+ // Draw the side section
+ this.context.beginPath();
+ this.context.moveTo(startX + barWidth + hmargin, y);
+ this.context.lineTo(startX + barWidth + hmargin + 10, y - 5);
+ this.context.lineTo(startX + barWidth + + hmargin + 10, y - 5 + height);
+ this.context.lineTo(startX + barWidth + hmargin , y + height);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ // Draw the darker top side
+ if (j == 0) {
+ this.context.fillStyle = 'rgba(255,255,255,0.3)';
+ this.context.beginPath();
+ this.context.moveTo(startX + hmargin, y);
+ this.context.lineTo(startX + 10 + hmargin, y - 5);
+ this.context.lineTo(startX + 10 + barWidth + hmargin, y - 5);
+ this.context.lineTo(startX + barWidth + hmargin, y);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+ }
+
+ // Draw the darker side section
+ this.context.fillStyle = 'rgba(0,0,0,0.4)';
+ this.context.beginPath();
+ this.context.moveTo(startX + barWidth + hmargin, y);
+ this.context.lineTo(startX + barWidth + hmargin + 10, y - 5);
+ this.context.lineTo(startX + barWidth + + hmargin + 10, y - 5 + height);
+ this.context.lineTo(startX + barWidth + hmargin , y + height);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ this.context.strokeStyle = prevStrokeStyle;
+ this.context.fillStyle = prevFillStyle;
+ }
+
+ y += height;
+ }
+
+ // This bit draws the text labels that appear above the bars if requested
+ if (this.Get('chart.labels.above')) {
+
+ // Turn off any shadow
+ RGraph.NoShadow(this);
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ RGraph.Text(this.context,this.Get('chart.text.font'),typeof(this.Get('chart.labels.above.size')) == 'number' ? this.Get('chart.labels.above.size') : this.Get('chart.text.size') - 3,startX + (barWidth / 2) + this.Get('chart.hmargin'),startY - (this.Get('chart.shadow') && this.Get('chart.shadow.offsety') < 0 ? 7 : 4),String(this.Get('chart.units.pre') + RGraph.array_sum(this.data[i]).toFixed(this.Get('chart.labels.above.decimals')) + this.Get('chart.units.post')),null,'center');
+
+ // Turn any shadow back on
+ if (shadow) {
+ this.context.shadowColor = shadowColor;
+ this.context.shadowBlur = shadowBlur;
+ this.context.shadowOffsetX = shadowOffsetX;
+ this.context.shadowOffsetY = shadowOffsetY;
+ }
+ }
+
+
+ /**
+ * Redraw the bars if the shadow is enabled due to hem being drawn from the bottom up, and the
+ * shadow spilling over to higher up bars
+ */
+ if (shadow) {
+
+ RGraph.NoShadow(this);
+
+ for (k=0; k<redrawCoords.length; ++k) {
+ this.context.strokeStyle = strokeStyle;
+ this.context.fillStyle = redrawCoords[k][4];
+ this.context.strokeRect(redrawCoords[k][0], redrawCoords[k][1], redrawCoords[k][2], redrawCoords[k][3]);
+ this.context.fillRect(redrawCoords[k][0], redrawCoords[k][1], redrawCoords[k][2], redrawCoords[k][3]);
+
+ this.context.stroke();
+ this.context.fill();
+ }
+
+ // Reset the redraw coords to be empty
+ redrawCoords = [];
+ }
+ /**
+ * Grouped bar
+ */
+ } else if (typeof(this.data[i]) == 'object' && this.Get('chart.grouping') == 'grouped') {
+
+ var redrawCoords = [];
+ this.context.lineWidth = this.Get('chart.linewidth');
+
+ for (j=0; j<this.data[i].length; ++j) {
+ // Set the fill and stroke colors
+ this.context.strokeStyle = strokeStyle;
+ this.context.fillStyle = colors[j];
+
+ var individualBarWidth = (width - (2 * hmargin)) / this.data[i].length;
+ var height = (this.data[i][j] / this.max) * (this.canvas.height - (2 * this.gutter) );
+
+ // If the X axis pos is in the center, we need to half the height
+ if (xaxispos == 'center') {
+ height /= 2;
+ }
+
+ var startX = x + hmargin + (j * individualBarWidth);
+ var startY = (xaxispos == 'bottom' ? this.canvas.height : (this.canvas.height / 2) + this.gutter) - this.gutter - height;
+
+ // Account for a bug in chrome that doesn't allow negative heights
+ if (height < 0) {
+ startY += height;
+ height = Math.abs(height);
+ }
+
+ /**
+ * Draw MSIE shadow
+ */
+ if (document.all && shadow) {
+ this.DrawIEShadow([startX, startY, individualBarWidth, height]);
+ }
+
+ this.context.strokeRect(startX, startY, individualBarWidth, height);
+ this.context.fillRect(startX, startY, individualBarWidth, height);
+ y += height;
+
+ // This bit draws the text labels that appear above the bars if requested
+ if (this.Get('chart.labels.above')) {
+
+ this.context.strokeStyle = 'rgba(0,0,0,0)';
+
+ // Turn off any shadow
+ if (shadow) {
+ RGraph.NoShadow(this);
+ }
+
+ var yPos = y - 3;
+
+ // Account for negative bars
+ if (this.data[i][j] < 0) {
+ yPos += height + 6 + (this.Get('chart.text.size') - 4);
+ }
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ RGraph.Text(this.context,this.Get('chart.text.font'),typeof(this.Get('chart.labels.above.size')) == 'number' ? this.Get('chart.labels.above.size') : this.Get('chart.text.size') - 3,startX + (individualBarWidth / 2),startY - 2,RGraph.number_format(this, this.data[i][j].toFixed(this.Get('chart.labels.above.decimals'))),null,'center');
+
+ // Turn any shadow back on
+ if (shadow) {
+ this.context.shadowColor = shadowColor;
+ this.context.shadowBlur = shadowBlur;
+ this.context.shadowOffsetX = shadowOffsetX;
+ this.context.shadowOffsetY = shadowOffsetY;
+ }
+ }
+
+ /**
+ * Grouped 3D effect
+ */
+ if (variant == '3d') {
+ var prevFillStyle = this.context.fillStyle;
+ var prevStrokeStyle = this.context.strokeStyle;
+
+ // Draw the top side
+ this.context.beginPath();
+ this.context.moveTo(startX, startY);
+ this.context.lineTo(startX + 10, startY - 5);
+ this.context.lineTo(startX + 10 + individualBarWidth, startY - 5);
+ this.context.lineTo(startX + individualBarWidth, startY);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ // Draw the side section
+ this.context.beginPath();
+ this.context.moveTo(startX + individualBarWidth, startY);
+ this.context.lineTo(startX + individualBarWidth + 10, startY - 5);
+ this.context.lineTo(startX + individualBarWidth + 10, startY - 5 + height);
+ this.context.lineTo(startX + individualBarWidth , startY + height);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+
+ // Draw the darker top side
+ this.context.fillStyle = 'rgba(255,255,255,0.3)';
+ this.context.beginPath();
+ this.context.moveTo(startX, startY);
+ this.context.lineTo(startX + 10, startY - 5);
+ this.context.lineTo(startX + 10 + individualBarWidth, startY - 5);
+ this.context.lineTo(startX + individualBarWidth, startY);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ // Draw the darker side section
+ this.context.fillStyle = 'rgba(0,0,0,0.4)';
+ this.context.beginPath();
+ this.context.moveTo(startX + individualBarWidth, startY);
+ this.context.lineTo(startX + individualBarWidth + 10, startY - 5);
+ this.context.lineTo(startX + individualBarWidth + 10, startY - 5 + height);
+ this.context.lineTo(startX + individualBarWidth , startY + height);
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ this.context.strokeStyle = prevStrokeStyle;
+ this.context.fillStyle = prevFillStyle;
+ }
+
+ this.coords.push([startX, startY, individualBarWidth, height]);
+
+ // Facilitate shadows going to the left
+ if (this.Get('chart.shadow')) {
+ redrawCoords.push([startX, startY, individualBarWidth, height]);
+ }
+ }
+
+ /**
+ * Redraw the bar if shadows are going to the left
+ */
+ if (redrawCoords.length) {
+
+ RGraph.NoShadow(this);
+
+ this.context.lineWidth = this.Get('chart.linewidth');
+
+ this.context.beginPath();
+ for (var j=0; j<redrawCoords.length; ++j) {
+
+ this.context.fillStyle = this.Get('chart.colors')[j];
+ this.context.strokeStyle = this.Get('chart.strokecolor');
+
+ this.context.fillRect(redrawCoords[j][0], redrawCoords[j][1], redrawCoords[j][2], redrawCoords[j][3]);
+ this.context.strokeRect(redrawCoords[j][0], redrawCoords[j][1], redrawCoords[j][2], redrawCoords[j][3]);
+ }
+ this.context.fill();
+ this.context.stroke();
+
+ redrawCoords = [];
+ }
+ }
+
+ this.context.closePath();
+ }
+
+ /**
+ * Turn off any shadow
+ */
+ RGraph.NoShadow(this);
+
+
+ /**
+ * Install the onclick event handler
+ */
+ if (this.Get('chart.tooltips')) {
+
+ // Need to register this object for redrawing
+ RGraph.Register(this);
+
+ /**
+ * Install the window onclick handler
+ */
+ var window_onclick_func = function (){RGraph.Redraw();};
+ window.addEventListener('click', window_onclick_func, false);
+ RGraph.AddEventListener('window_' + this.id, 'click', window_onclick_func);
+
+
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand. Bar chart tooltips can now
+ * be based around the onmousemove event
+ */
+ canvas_onmousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(e.target.id);
+ var obj = canvas.__object__;
+ var barCoords = obj.getBar(e);
+
+ /**
+ * If there are bar coords AND the bar has height
+ */
+ if (barCoords && barCoords[4] > 0) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = String(obj.Get('chart.tooltips')(barCoords[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[barCoords[5]]) == 'function') {
+ var text = String(obj.Get('chart.tooltips')[barCoords[5]](barCoords[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && (typeof(obj.Get('chart.tooltips')[barCoords[5]]) == 'string' || typeof(obj.Get('chart.tooltips')[barCoords[5]]) == 'number')) {
+ var text = String(obj.Get('chart.tooltips')[barCoords[5]]);
+
+ } else {
+ var text = null;
+ }
+
+ if (text) {
+ canvas.style.cursor = 'pointer';
+ } else {
+ canvas.style.cursor = 'default';
+ }
+
+ /**
+ * Hide the currently displayed tooltip if the index is the same
+ */
+ if ( RGraph.Registry.Get('chart.tooltip')
+ && RGraph.Registry.Get('chart.tooltip').__canvas__.id != obj.id
+ && obj.Get('chart.tooltips.event') == 'onmousemove') {
+
+ RGraph.Redraw();
+ RGraph.HideTooltip();
+ }
+
+ /**
+ * This facilitates the tooltips using the onmousemove event
+ */
+
+ if ( obj.Get('chart.tooltips.event') == 'onmousemove'
+ && (
+ (RGraph.Registry.Get('chart.tooltip') && RGraph.Registry.Get('chart.tooltip').__index__ != barCoords[5])
+ || !RGraph.Registry.Get('chart.tooltip')
+ )
+ && text) {
+ /**
+ * Show a tooltip if it's defined
+ */
+ RGraph.Redraw(obj);
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(barCoords[1], barCoords[2], barCoords[3], barCoords[4]);
+ obj.context.fillRect(barCoords[1], barCoords[2], barCoords[3], barCoords[4]);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, barCoords[5]);
+ }
+ } else {
+ canvas.style.cursor = 'default';
+ }
+ }
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove);
+ this.canvas.addEventListener('mousemove', canvas_onmousemove, false);
+
+
+ /**
+ * Install the onclick event handler for the tooltips
+ */
+ if (this.Get('chart.tooltips.event') == 'onclick') {
+
+ canvas_onclick = function (e)
+ {
+ var e = RGraph.FixEventObject(e);
+
+ // If the button pressed isn't the left, we're not interested
+ if (e.button != 0) return;
+
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+ var barCoords = obj.getBar(e);
+
+ /**
+ * Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
+ * This "deselects" any already selected bar
+ */
+ RGraph.Redraw();
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ if (barCoords) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = String(obj.Get('chart.tooltips')(barCoords[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[barCoords[5]]) == 'function') {
+ var text = String(obj.Get('chart.tooltips')[barCoords[5]](barCoords[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = String(obj.Get('chart.tooltips')[barCoords[5]]);
+
+ } else {
+ var text = null;
+ }
+
+ /**
+ * Show a tooltip if it's defined
+ */
+ if (text && text != 'undefined') {
+
+ // [TODO] Allow customisation of the highlight colors
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(barCoords[1], barCoords[2], barCoords[3], barCoords[4]);
+ obj.context.fillRect(barCoords[1], barCoords[2], barCoords[3], barCoords[4]);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, barCoords[5]);
+ }
+ }
+
+ /**
+ * Stop the event bubbling
+ */
+ e.stopPropagation();
+ }
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick);
+ this.canvas.addEventListener('click', canvas_onclick, false);
+ }
+
+
+ // This resets the bar graph
+ // 8th August 2010 : Is this redundant
+ //if (typeof(obj) != 'undefined' && obj == RGraph.Registry.Get('chart.tooltip')) {
+ // obj.style.display = 'none';
+ // RGraph.Registry.Set('chart.tooltip', null)
+ //}
+ }
+ }
+
+ /**
+ * Draws the labels for the graph
+ */
+ RGraph.Bar.prototype.DrawLabels = function ()
+ {
+ var context = this.context;
+ var gutter = this.gutter;
+ var text_angle = this.Get('chart.text.angle');
+ var text_size = this.Get('chart.text.size');
+ var labels = this.Get('chart.labels');
+
+
+ // Draw the Y axis labels:
+ if (this.Get('chart.ylabels')) {
+ this.Drawlabels_center();
+ this.Drawlabels_bottom();
+ }
+
+ /**
+ * The X axis labels
+ */
+ if (typeof(labels) == 'object' && labels) {
+
+ var yOffset = 13 + Number(this.Get('chart.xlabels.offset'));
+
+ /**
+ * Text angle
+ */
+ var angle = 0;
+ var halign = 'center';
+
+ if (text_angle > 0) {
+ angle = -1 * text_angle;
+ halign = 'right';
+ yOffset -= 5;
+ }
+
+ // Draw the X axis labels
+ context.fillStyle = this.Get('chart.text.color');
+
+ // How wide is each bar
+ var barWidth = (this.canvas.width - (2 * gutter) ) / labels.length;
+
+ // Reset the xTickGap
+ xTickGap = (this.canvas.width - (2 * gutter)) / labels.length
+
+ // Draw the X tickmarks
+ var i=0;
+ var font = this.Get('chart.text.font');
+
+ for (x=gutter + (xTickGap / 2); x<=this.canvas.width - gutter; x+=xTickGap) {
+ RGraph.Text(context, font,
+ text_size,
+ x + (this.Get('chart.text.angle') == 90 ? 0: 0),
+ (this.canvas.height - gutter) + yOffset,
+ String(labels[i++]),
+ (this.Get('chart.text.angle') == 90 ? 'center' : null),
+ halign,
+ null,
+ angle);
+ }
+ }
+ }
+
+ /**
+ * Draws the X axis in the middle
+ */
+ RGraph.Bar.prototype.Drawlabels_center = function ()
+ {
+ var font = this.Get('chart.text.font');
+ var numYLabels = this.Get('chart.ylabels.count');
+
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ if (this.Get('chart.xaxispos') == 'center') {
+
+ /**
+ * Draw the top labels
+ */
+ var interval = (this.grapharea * (1/10) );
+ var text_size = this.Get('chart.text.size');
+ var gutter = this.gutter;
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var context = this.context;
+ var align = '';
+ var xpos = 0;
+ var boxed = false;
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ this.context.strokeStyle = 'black';
+
+ if (this.Get('chart.ylabels.inside') == true) {
+ var xpos = this.Get('chart.yaxispos') == 'left' ? gutter + 5 : this.canvas.width - gutter - 5;
+ var align = this.Get('chart.yaxispos') == 'left' ? 'left' : 'right';
+ var boxed = true;
+ } else {
+ var xpos = this.Get('chart.yaxispos') == 'left' ? gutter - 5 : this.canvas.width - gutter + 5;
+ var align = this.Get('chart.yaxispos') == 'left' ? 'right' : 'left';
+ var boxed = false;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
+ * Draw specific Y labels here so that the local variables can be reused
+ */
+ if (typeof(this.Get('chart.ylabels.specific')) == 'object') {
+
+ var labels = this.Get('chart.ylabels.specific');
+ var grapharea = this.canvas.height - (2 * gutter);
+
+ // Draw the top halves labels
+ for (var i=0; i<labels.length; ++i) {
+ var y = gutter + (grapharea * (i / (labels.length * 2) ));
+
+ RGraph.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed);
+ }
+
+ // Draw the bottom halves labels
+ for (var i=labels.length-1; i>=0; --i) {
+ var y = gutter + (grapharea * ( (i+1) / (labels.length * 2) )) + (grapharea / 2);
+
+ RGraph.Text(context, font, text_size, xpos, y, labels[labels.length - i - 1], 'center', align, boxed);
+ }
+
+ return;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ if (numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (1*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (3*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
+ }
+
+ if (numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (4*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (2*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
+ }
+ } else if (numYLabels == 10) {
+ // 10Y labels
+ interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context, font, text_size, xpos,gutter + ((this.grapharea / (numYLabels * 2)) * i),RGraph.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this.Get('chart.scale.decimals'))), units_pre, units_post), 'center', align, boxed);
+ }
+ }
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Draw the bottom (X axis) labels
+ */
+ var interval = (this.grapharea) / 10;
+
+ if (numYLabels == 3 || numYLabels == 5) {
+ if (numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (this.grapharea + gutter + this.halfTextHeight) - (4 * interval), '-' + RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (this.grapharea + gutter + this.halfTextHeight) - (2 * interval), '-' + RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
+ }
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (this.grapharea + gutter + this.halfTextHeight) - (3 * interval), '-' + RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (this.grapharea + gutter + this.halfTextHeight) - interval, '-' + RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
+ }
+
+ RGraph.Text(context, font, text_size, xpos, this.grapharea + gutter + this.halfTextHeight, '-' + RGraph.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
+
+ } else if (numYLabels == 10) {
+
+ // Arbitrary number of Y labels
+ interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context, font, text_size, xpos,this.Get('chart.gutter') + (this.grapharea / 2) + ((this.grapharea / (numYLabels * 2)) * i) + (this.grapharea / (numYLabels * 2)),RGraph.number_format(this, ((this.scale[4] / numYLabels) * (i+1)).toFixed((this.Get('chart.scale.decimals'))), '-' + units_pre, units_post),'center', align, boxed);
+ }
+ }
+
+
+
+ }
+ }
+
+ /**
+ * Draws the X axdis at the bottom (the default)
+ */
+ RGraph.Bar.prototype.Drawlabels_bottom = function ()
+ {
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.text.color');
+ this.context.strokeStyle = 'black';
+
+ if (this.Get('chart.xaxispos') != 'center') {
+
+ var interval = (this.grapharea * (1/5) );
+ var text_size = this.Get('chart.text.size');
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var gutter = this.gutter;
+ var context = this.context;
+ var align = this.Get('chart.yaxispos') == 'left' ? 'right' : 'left';
+ var font = this.Get('chart.text.font');
+ var numYLabels = this.Get('chart.ylabels.count');
+
+ if (this.Get('chart.ylabels.inside') == true) {
+ var xpos = this.Get('chart.yaxispos') == 'left' ? gutter + 5 : this.canvas.width - gutter - 5;
+ var align = this.Get('chart.yaxispos') == 'left' ? 'left' : 'right';
+ var boxed = true;
+ } else {
+ var xpos = this.Get('chart.yaxispos') == 'left' ? gutter - 5 : this.canvas.width - gutter + 5;
+ var boxed = false;
+ }
+
+ /**
+ * Draw specific Y labels here so that the local variables can be reused
+ */
+ if (typeof(this.Get('chart.ylabels.specific')) == 'object') {
+
+ var labels = this.Get('chart.ylabels.specific');
+ var grapharea = this.canvas.height - (2 * gutter);
+
+ for (var i=0; i<labels.length; ++i) {
+ var y = gutter + (grapharea * (i / labels.length));
+
+ RGraph.Text(context, font, text_size, xpos, y, labels[i], 'center', align, boxed);
+ }
+
+ return;
+ }
+
+ // 1 label
+ if (numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[4], units_pre, units_post), null, align, boxed);
+
+ // 5 labels
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (1*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (3*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, boxed);
+
+ }
+
+ // 3 labels
+ if (numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, (2*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, boxed);
+ RGraph.Text(context, font, text_size, xpos, (4*interval) + gutter + this.halfTextHeight, RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, boxed);
+ }
+ }
+
+ // 10 Y labels
+ if (numYLabels == 10) {
+
+ interval = (this.grapharea / numYLabels );
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context, font, text_size, xpos, this.Get('chart.gutter') + ((this.grapharea / numYLabels) * i), RGraph.number_format(this,((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this.Get('chart.scale.decimals'))), units_pre, units_post), 'center', align, boxed);
+ }
+ }
+ }
+
+ this.context.fill();
+ this.context.stroke();
+ }
+
+
+ /**
+ * This function is used by MSIE only to manually draw the shadow
+ *
+ * @param array coords The coords for the bar
+ */
+ RGraph.Bar.prototype.DrawIEShadow = function (coords)
+ {
+ var prevFillStyle = this.context.fillStyle;
+ var offsetx = this.Get('chart.shadow.offsetx');
+ var offsety = this.Get('chart.shadow.offsety');
+
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.fillStyle = this.Get('chart.shadow.color');
+ this.context.beginPath();
+
+ // Draw shadow here
+ this.context.fillRect(coords[0] + offsetx, coords[1] + offsety, coords[2], coords[3]);
+
+ this.context.fill();
+
+ // Change the fillstyle back to what it was
+ this.context.fillStyle = prevFillStyle;
+ }
+
+
+ /**
+ * Not used by the class during creating the graph, but is used by event handlers
+ * to get the coordinates (if any) of the selected bar
+ */
+ RGraph.Bar.prototype.getBar = function (e)
+ {
+ var canvas = e.target;
+ var obj = e.target.__object__;
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0];
+ var mouseY = mouseCoords[1];
+
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if ( mouseX >= (left + obj.Get('chart.tooltips.coords.adjust')[0])
+ && mouseX <= (left + width+ obj.Get('chart.tooltips.coords.adjust')[0])
+ && mouseY >= (top + obj.Get('chart.tooltips.coords.adjust')[1])
+ && mouseY <= (top + height + obj.Get('chart.tooltips.coords.adjust')[1]) ) {
+
+ return [obj, left, top, width, height, i];
+ }
+ }
+
+ return null;
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The bi-polar/age frequency constructor.
+ *
+ * @param string id The id of the canvas
+ * @param array left The left set of data points
+ * @param array right The right set of data points
+ */
+ RGraph.Bipolar = function (id, left, right)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.canvas.__object__ = this;
+ this.type = 'bipolar';
+ this.coords = [];
+ this.max = 0;
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // The left and right data respectively
+ this.left = left;
+ this.right = right;
+ this.data = [left, right];
+
+ this.properties = {
+ 'chart.margin': 2,
+ 'chart.xtickinterval': null,
+ 'chart.labels': [],
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.title.left': '',
+ 'chart.title.right': '',
+ 'chart.gutter': 25,
+ 'chart.gutter.center': 60,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.colors': ['#0f0'],
+ 'chart.contextmenu': null,
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.shadow': false,
+ 'chart.shadow.color': '#666',
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.shadow.blur': 3,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.xmax': null,
+ 'chart.scale.decimals': null,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.axis.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.strokestyle': '#333'
+ }
+
+ // Pad the arrays so they're the same size
+ while (this.left.length < this.right.length) this.left.push(0);
+ while (this.left.length > this.right.length) this.right.push(0);
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[BIPOLAR] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * The setter
+ *
+ * @param name string The name of the parameter to set
+ * @param value mixed The value of the paraneter
+ */
+ RGraph.Bipolar.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * The getter
+ *
+ * @param name string The name of the parameter to get
+ */
+ RGraph.Bipolar.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * Draws the graph
+ */
+ RGraph.Bipolar.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+
+ // Reset the data to what was initially supplied
+ this.left = this.data[0];
+ this.right = this.data[1];
+
+ /**
+ * Reset the coords array
+ */
+ this.coords = [];
+
+ this.GetMax();
+ this.DrawAxes();
+ this.DrawTicks();
+ this.DrawLeftBars();
+ this.DrawRightBars();
+
+ if (this.Get('chart.axis.color') != 'black') {
+ this.DrawAxes(); // Draw the axes again (if the axes color is not black)
+ }
+
+ this.DrawLabels();
+ this.DrawTitles();
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+
+ /**
+ * Install the on* event handlers
+ */
+ if (this.Get('chart.tooltips')) {
+
+
+ // Register the object so that it gets redrawn
+ RGraph.Register(this);
+
+
+ /**
+ * Install the window onclick handler
+ */
+
+ /**
+ * Install the window event handler
+ */
+ var eventHandler_window_click = function ()
+ {
+ RGraph.Redraw();
+ }
+ window.addEventListener('click', eventHandler_window_click, false);
+ RGraph.AddEventListener('window_' + this.id, 'click', eventHandler_window_click);
+
+
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand
+ */
+ var eventHandler_canvas_mousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if (mouseX >= left && mouseX <= (left + width ) && mouseY >= top && mouseY <= (top + height) ) {
+ canvas.style.cursor = 'pointer';
+ return;
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ this.canvas.addEventListener('mousemove', eventHandler_canvas_mousemove, false);
+ RGraph.AddEventListener(this.id, 'mouseover', eventHandler_canvas_mousemove);
+
+
+ /**
+ * Install the onclick event handler for the tooltips
+ */
+ var eventHandler_canvas_click = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id)
+ var obj = canvas.__object__;
+
+ /**
+ * Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
+ * This "deselects" any already selected bar
+ */
+ RGraph.Clear(canvas);
+ obj.Draw();
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+
+
+ /**
+ * Show a tooltip if it's defined
+ * FIXME pageX and pageY not supported in MSIE
+ */
+ if (obj.Get('chart.tooltips')) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(i);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[i]) == 'function') {
+ var text = obj.Get('chart.tooltips')[i](i);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[i];
+
+ } else {
+ var text = '';
+ }
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(left, top, width, height);
+ obj.context.fillRect(left, top, width, height);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+ }
+ }
+ }
+
+ /**
+ * Stop the event bubbling
+ */
+ e.stopPropagation();
+
+ return false;
+ }
+ this.canvas.addEventListener('click', eventHandler_canvas_click, false);
+ RGraph.AddEventListener(this.id, 'click', eventHandler_canvas_click);
+
+ // This resets the bipolar graph
+ if (RGraph.Registry.Get('chart.tooltip')) {
+ RGraph.Registry.Get('chart.tooltip').style.display = 'none';
+ RGraph.Registry.Set('chart.tooltip', null)
+ }
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the axes
+ */
+ RGraph.Bipolar.prototype.DrawAxes = function ()
+ {
+ // Draw the left set of axes
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.axis.color');
+
+ this.axisWidth = (this.canvas.width - this.Get('chart.gutter.center') ) / 2;
+ this.axisHeight = this.canvas.height - (2 * this.Get('chart.gutter'));
+
+ this.context.moveTo(this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.axisWidth, this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.axisWidth, this.Get('chart.gutter'));
+
+ this.context.stroke();
+
+ // Draw the right set of axes
+ this.context.beginPath();
+
+ this.axisWidth = ((this.canvas.width - this.Get('chart.gutter.center')) / 2) + this.Get('chart.gutter.center');
+
+ this.context.moveTo(this.axisWidth, this.Get('chart.gutter'));
+ this.context.lineTo(this.axisWidth, this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draws the tick marks on the axes
+ */
+ RGraph.Bipolar.prototype.DrawTicks = function ()
+ {
+ var numDataPoints = this.left.length;
+ var barHeight = ( (this.canvas.height - (2 * this.Get('chart.gutter')))- (this.left.length * (this.Get('chart.margin') * 2) )) / numDataPoints;
+
+ // Draw the left Y tick marks
+ for (var i = this.canvas.height - this.Get('chart.gutter'); i >= this.Get('chart.gutter'); i -= (barHeight + ( this.Get('chart.margin') * 2)) ) {
+ if (i < (this.canvas.height - this.Get('chart.gutter')) ) {
+ this.context.beginPath();
+ this.context.moveTo(this.axisWidth - this.Get('chart.gutter.center'), i);
+ this.context.lineTo(this.axisWidth - this.Get('chart.gutter.center') + 3, i);
+ this.context.stroke();
+ }
+ }
+
+ //Draw the right axis Y tick marks
+ for (var i = this.canvas.height - this.Get('chart.gutter'); i >= this.Get('chart.gutter'); i -= (barHeight + ( this.Get('chart.margin') * 2)) ) {
+ if (i < (this.canvas.height - this.Get('chart.gutter')) ) {
+ this.context.beginPath();
+ this.context.moveTo(this.axisWidth, i);
+ this.context.lineTo(this.axisWidth - 3, i);
+ this.context.stroke();
+ }
+ }
+
+ // Draw the left sides X tick marks
+ var xInterval = (this.canvas.width - (2 * this.Get('chart.gutter')) - this.Get('chart.gutter.center')) / 10;
+
+ // Is chart.xtickinterval specified ? If so, use that.
+ if (typeof(this.Get('chart.xtickinterval')) == 'number') {
+ xInterval = this.Get('chart.xtickinterval');
+ }
+
+ for (i=this.Get('chart.gutter'); i<(this.canvas.width - this.Get('chart.gutter.center') ) / 2; i += xInterval) {
+ this.context.beginPath();
+ this.context.moveTo(i, this.canvas.height - this.Get('chart.gutter')); // 4 is the tick height
+ this.context.lineTo(i, (this.canvas.height - this.Get('chart.gutter')) + 4);
+ this.context.closePath();
+
+ this.context.stroke();
+ }
+
+ // Draw the right sides X tick marks
+ var stoppingPoint = (this.canvas.width - (2 * this.Get('chart.gutter')) - this.Get('chart.gutter.center')) / 2;
+ var stoppingPoint = stoppingPoint + this.Get('chart.gutter.center') + this.Get('chart.gutter')
+
+ for (i=this.canvas.width - this.Get('chart.gutter'); i > stoppingPoint; i-=xInterval) {
+ this.context.beginPath();
+ this.context.moveTo(i, this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(i, (this.canvas.height - this.Get('chart.gutter')) + 4);
+ this.context.closePath();
+
+ this.context.stroke();
+ }
+
+ // Store this for later
+ this.barHeight = barHeight;
+ }
+
+
+ /**
+ * Figures out the maximum value, or if defined, uses xmax
+ */
+ RGraph.Bipolar.prototype.GetMax = function()
+ {
+ var max = 0;
+ var dec = this.Get('chart.scale.decimals');
+
+ // chart.xmax defined
+ if (this.Get('chart.xmax')) {
+
+ max = this.Get('chart.xmax');
+
+ this.scale = [];
+ this.scale[0] = Number((max / 5) * 1).toFixed(dec);
+ this.scale[1] = Number((max / 5) * 2).toFixed(dec);
+ this.scale[2] = Number((max / 5) * 3).toFixed(dec);
+ this.scale[3] = Number((max / 5) * 4).toFixed(dec);
+ this.scale[4] = Number(max).toFixed(dec);
+
+ this.max = max;
+
+
+ // Generate the scale ourselves
+ } else {
+ this.leftmax = RGraph.array_max(this.left);
+ this.rightmax = RGraph.array_max(this.right);
+ max = Math.max(this.leftmax, this.rightmax);
+
+ this.scale = RGraph.getScale(max, this);
+ this.scale[0] = Number(this.scale[0]).toFixed(dec);
+ this.scale[1] = Number(this.scale[1]).toFixed(dec);
+ this.scale[2] = Number(this.scale[2]).toFixed(dec);
+ this.scale[3] = Number(this.scale[3]).toFixed(dec);
+ this.scale[4] = Number(this.scale[4]).toFixed(dec);
+
+ this.max = this.scale[4];
+ }
+
+ // Don't need to return it as it is stored in this.max
+ }
+
+
+ /**
+ * Function to draw the left hand bars
+ */
+ RGraph.Bipolar.prototype.DrawLeftBars = function ()
+ {
+ // Set the stroke colour
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+
+ for (i=0; i<this.left.length; ++i) {
+
+ /**
+ * Turn on a shadow if requested
+ */
+ if (this.Get('chart.shadow')) {
+ this.context.shadowColor = this.Get('chart.shadow.color');
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+ }
+
+ this.context.beginPath();
+
+ // Set the colour
+ if (this.Get('chart.colors')[i]) {
+ this.context.fillStyle = this.Get('chart.colors')[i];
+ }
+
+ /**
+ * Work out the coordinates
+ */
+ var width = ( (this.left[i] / this.max) * ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter')) ) / 2) );
+ var coords = [
+ this.axisWidth - this.Get('chart.gutter.center') - width,
+ this.Get('chart.margin') + (i * ( (this.canvas.height - (2 * this.Get('chart.gutter')) ) / this.left.length)) + this.Get('chart.gutter'),
+ width,
+ this.barHeight
+ ];
+
+ // Draw the IE shadow if necessary
+ if (document.all && this.Get('chart.shadow')) {
+ this.DrawIEShadow(coords);
+ }
+
+
+ this.context.strokeRect(coords[0], coords[1], coords[2], coords[3]);
+ this.context.fillRect(coords[0], coords[1], coords[2], coords[3]);
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * Add the coordinates to the coords array
+ */
+ this.coords.push([
+ coords[0],
+ coords[1],
+ coords[2],
+ coords[3]
+ ]);
+ }
+
+ /**
+ * Turn off any shadow
+ */
+ RGraph.NoShadow(this);
+ }
+
+
+ /**
+ * Function to draw the right hand bars
+ */
+ RGraph.Bipolar.prototype.DrawRightBars = function ()
+ {
+ // Set the stroke colour
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+
+ /**
+ * Turn on a shadow if requested
+ */
+ if (this.Get('chart.shadow')) {
+ this.context.shadowColor = this.Get('chart.shadow.color');
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+ }
+
+ for (var i=0; i<this.right.length; ++i) {
+ this.context.beginPath();
+
+ // Set the colour
+ if (this.Get('chart.colors')[i]) {
+ this.context.fillStyle = this.Get('chart.colors')[i];
+ }
+
+
+ var width = ( (this.right[i] / this.max) * ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter')) ) / 2) );
+ var coords = [
+ this.axisWidth,
+ this.Get('chart.margin') + (i * ((this.canvas.height - (2 * this.Get('chart.gutter'))) / this.right.length)) + this.Get('chart.gutter'),
+ width,
+ this.barHeight
+ ];
+
+ // Draw the IE shadow if necessary
+ if (document.all && this.Get('chart.shadow')) {
+ this.DrawIEShadow(coords);
+ }
+ this.context.strokeRect(coords[0], coords[1], coords[2], coords[3]);
+ this.context.fillRect(coords[0], coords[1], coords[2], coords[3]);
+
+ this.context.closePath();
+
+ /**
+ * Add the coordinates to the coords array
+ */
+ this.coords.push([
+ coords[0],
+ coords[1],
+ coords[2],
+ coords[3]
+ ]);
+ }
+
+ this.context.stroke();
+
+ /**
+ * Turn off any shadow
+ */
+ RGraph.NoShadow(this);
+ }
+
+
+ /**
+ * Draws the titles
+ */
+ RGraph.Bipolar.prototype.DrawLabels = function ()
+ {
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ var labelPoints = new Array();
+ var font = this.Get('chart.text.font');
+ var size = this.Get('chart.text.size');
+
+ var max = Math.max(this.left.length, this.right.length);
+
+ for (i=0; i<max; ++i) {
+ var barAreaHeight = this.canvas.height - (2 * this.Get('chart.gutter'));
+ var barHeight = barAreaHeight / this.left.length;
+ var yPos = (i * barAreaHeight) + this.Get('chart.gutter');
+
+ labelPoints.push(this.Get('chart.gutter') + (i * barHeight) + (barHeight / 2) + 5);
+ }
+
+ for (i=0; i<labelPoints.length; ++i) {
+ RGraph.Text(this.context, this.Get('chart.text.font'),
+ this.Get('chart.text.size'),
+ this.canvas.width / 2,
+ labelPoints[i],
+ String(this.Get('chart.labels')[i] ? this.Get('chart.labels')[i] : ''), null, 'center');
+ }
+
+ // Now draw the X labels for the left hand side
+ RGraph.Text(this.context, font, size, this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[4], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (1/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[3], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (2/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[2], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (3/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[1], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (4/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[0], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+
+ // Now draw the X labels for the right hand side
+ RGraph.Text(this.context, font, size, this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this, this.scale[4], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (1/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this, this.scale[3], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (2/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this, this.scale[2], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (3/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this, this.scale[1], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - this.Get('chart.gutter.center') - (2 * this.Get('chart.gutter'))) / 2) * (4/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this, this.scale[0], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');
+ }
+
+ /**
+ * Draws the titles
+ */
+ RGraph.Bipolar.prototype.DrawTitles = function ()
+ {
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size'), 30, (this.Get('chart.gutter') / 2) + 5, String(this.Get('chart.title.left')), 'center');
+ RGraph.Text(this.context,this.Get('chart.text.font'), this.Get('chart.text.size'), this.canvas.width - 30, (this.Get('chart.gutter') / 2) + 5, String(this.Get('chart.title.right')), 'center', 'right');
+
+ // Draw the main title for the whole chart
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'));
+ }
+
+
+ /**
+ * This function is used by MSIE only to manually draw the shadow
+ *
+ * @param array coords The coords for the bar
+ */
+ RGraph.Bipolar.prototype.DrawIEShadow = function (coords)
+ {
+ var prevFillStyle = this.context.fillStyle;
+ var offsetx = this.Get('chart.shadow.offsetx');
+ var offsety = this.Get('chart.shadow.offsety');
+
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.fillStyle = this.Get('chart.shadow.color');
+ this.context.beginPath();
+
+ // Draw shadow here
+ this.context.fillRect(coords[0] + offsetx, coords[1] + offsety, coords[2],coords[3]);
+
+ this.context.fill();
+
+ // Change the fillstyle back to what it was
+ this.context.fillStyle = prevFillStyle;
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+ RGraph.AllowAdjusting = function (obj)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ RGraph.Register(obj);
+
+ if (obj.type == 'line') {
+ canvas.onmousedown = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var coords = obj.coords;
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ RGraph.Redraw();
+
+ for (var i=0; i<coords.length; ++i) {
+
+ if ( mouseCoords[0] > coords[i][0] - 5
+ && mouseCoords[1] > coords[i][1] - 5
+ && mouseCoords[0] < coords[i][0] + 5
+ && mouseCoords[1] < coords[i][1] + 5
+ ) {
+
+ var numDataSeries = obj.original_data.length;
+ var numDataPoints = obj.original_data[0].length;
+ var data_series = i / numDataPoints;
+ data_series = Math.floor(data_series);
+
+
+
+ canvas.style.cursor = 'ns-resize';
+ RGraph.Registry.Set('chart.adjusting.line.' + id, [obj, i, [coords[i][0], coords[i][1]], data_series]);
+
+ return;
+ }
+ }
+ }
+
+
+ canvas.onmousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+ var id = e.target.__object__.id;
+
+ var state = RGraph.Registry.Get('chart.adjusting.line.' + id);
+
+ if (state) {
+ var obj = state[0];
+ var idx = state[1];
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var data_series = state[3];
+ var points = obj.original_data[data_series];
+ var mouseCoords = RGraph.getMouseXY(e);
+ var x = mouseCoords[0];
+ var y = mouseCoords[1];
+
+ if (y >= (obj.canvas.height - obj.Get('chart.gutter'))) {
+ y = obj.canvas.height - obj.Get('chart.gutter');
+ } else if (y <= obj.Get('chart.gutter')) {
+ y = obj.Get('chart.gutter');
+ }
+
+ var pos = obj.canvas.height - (2 * obj.Get('chart.gutter'));
+ pos = pos - (y - obj.Get('chart.gutter'));
+ var value = (obj.max / (obj.canvas.height - (2 * obj.Get('chart.gutter')))) * pos;
+
+ // Adjust the index so that it's applicable to the correct data series
+ for (var i=0; i<data_series; ++i) {
+ idx -= obj.original_data[0].length;
+ }
+
+ obj.original_data[data_series][idx] = value;
+
+ obj.Set('chart.ymax', obj.max);
+ canvas.style.cursor = 'ns-resize';
+ RGraph.Redraw();
+
+ /**
+ * Fire the onadjust event
+ */
+ RGraph.FireCustomEvent(obj, 'onadjust');
+
+ return;
+
+ } else {
+
+ var canvas = e.target;
+ var context = canvas.__object__.context;
+ var obj = canvas.__object__;
+ var mouseCoords = RGraph.getMouseXY(e);
+ var x = mouseCoords[0];
+ var y = mouseCoords[1];
+
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ if ( x > obj.coords[i][0] - 5
+ && y > obj.coords[i][1] - 5
+ && x < obj.coords[i][0] + 5
+ && y < obj.coords[i][1] + 5
+ ) {
+
+ canvas.style.cursor = 'ns-resize';
+ return;
+ }
+ }
+ }
+
+ e.target.style.cursor = null;
+ }
+
+
+ canvas.onmouseup = function (e)
+ {
+ var id = e.target.__object__.id;
+
+ RGraph.Registry.Set('chart.adjusting.line.' + id, null);
+ e.target.style.cursor = null;
+ }
+
+
+ canvas.onmouseout = function (e)
+ {
+ canvas.onmouseup(e);
+ }
+
+ /**
+ * Progress bar
+ */
+ } else if (obj.type == 'hprogress') {
+
+
+ canvas.onmousedown = function (e)
+ {
+ var id = e.target.__object__.id;
+
+ RGraph.Registry.Set('chart.adjusting.progress.' + id, [true]);
+
+ canvas.onmousemove(e);
+ }
+
+
+ canvas.onmousemove = function (e)
+ {
+ var id = e.target.__object__.id;
+ var state = RGraph.Registry.Get('chart.adjusting.progress.' + id);
+
+ if (state && state.length) {
+ var obj = e.target.__object__;
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ if (obj.type == 'hprogress') {
+
+ var coords = RGraph.getMouseXY(e);
+ coords[0] = Math.max(0, coords[0] - obj.Get('chart.gutter'));
+ var barWidth = canvas.width - (2 * obj.Get('chart.gutter'));
+
+ // Work out the new value
+ var value = (coords[0] / barWidth) * (obj.max - obj.Get('chart.min'));
+ value += obj.Get('chart.min');
+
+ obj.value = Math.max(0, value.toFixed());
+ RGraph.Clear(obj.canvas);
+ obj.Draw();
+
+ } else if (obj.type == 'vprogress') {
+
+ var coords = RGraph.getMouseXY(e);
+ coords[1] = Math.max(0, coords[1] - obj.Get('chart.gutter'));
+ var barHeight = canvas.height - (2 * obj.Get('chart.gutter'));
+
+ // Work out the new value
+ var value = ( (barHeight - coords[1]) / barHeight) * obj.max;
+
+ obj.value = Math.max(0, value.toFixed());
+ RGraph.Clear(obj.canvas);
+ obj.Draw();
+ }
+
+ /**
+ * Fire the onadjust event
+ */
+ RGraph.FireCustomEvent(obj, 'onadjust');
+ }
+ }
+
+
+ canvas.onmouseup = function (e)
+ {
+ var id = e.target.__object__.id;
+ RGraph.Registry.Set('chart.adjusting.progress.' + id, null);
+ }
+
+
+ canvas.onmouseout = function (e)
+ {
+ canvas.onmouseup(e);
+ }
+
+ /**
+ * Rose chart
+ */
+ } else if (obj.type == 'rose') {
+
+
+ obj.Set('chart.ymax', obj.max);
+
+
+ canvas.onmousemove = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var coords = RGraph.getMouseXY(e);
+ var segment = RGraph.Registry.Get('chart.adjusting.rose.' + id);
+ var x = Math.abs(coords[0] - obj.centerx);
+ var y = Math.abs(coords[1] - obj.centery);
+ var theta = Math.atan(y / x) * (180 / Math.PI); // theta is now in DEGREES
+
+
+ // Account for the correct quadrant
+ if (coords[0] >= obj.centerx && coords[1] < obj.centery) {
+ theta = 90 - theta;
+ } else if (coords[0] >= obj.centerx && coords[1] >= obj.centery) {
+ theta += 90;
+ } else if (coords[0] < obj.centerx && coords[1] >= obj.centery) {
+ theta = 90 - theta;
+ theta = 180 + theta;
+
+ } else if (coords[0] < obj.centerx && coords[1] < obj.centery) {
+ theta = theta + 270;
+ }
+
+ var Opp = y;
+ var Adj = x;
+ var Hyp = Math.abs(Adj / Math.sin(theta / (180 / Math.PI)));
+
+ for (var i=0; i<obj.angles.length; ++i) {
+ if (
+ theta > obj.angles[i][0]
+ && theta < obj.angles[i][1] ) {
+
+ if (RGraph.Registry.Get('chart.adjusting.rose.' + id) && i == segment[5]) {
+ var newvalue = (Hyp / (obj.radius - 25) ) * obj.max;
+ obj.data[i] = Math.min(newvalue, obj.max);
+
+ RGraph.Clear(obj.canvas);
+ obj.Draw();
+
+ /**
+ * Fire the onadjust event
+ */
+ RGraph.FireCustomEvent(obj, 'onadjust');
+ }
+
+ if (Hyp <= (obj.angles[i][2] + 5) && Hyp >= (obj.angles[i][2] - 5) ) {
+ canvas.style.cursor = 'move';
+ return;
+
+ } else if (obj.Get('chart.tooltips') && Hyp <= (obj.angles[i][2] - 5) ) {
+ canvas.style.cursor = 'pointer';
+ return;
+ }
+
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+
+
+ canvas.onmousedown = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var coords = RGraph.getMouseXY(e);
+ var segment = RGraph.getSegment(e, 5);
+
+ if (segment && segment.length && !RGraph.Registry.Get('chart.adjusting.rose.' + id)) {
+ var x = Math.abs(coords[0] - obj.centerx);
+ var y = Math.abs(coords[1] - obj.centery);
+
+ var a = Math.atan(y / x) * (180 / Math.PI); // a is now in DEGREES
+
+ // Account for the correct quadrant
+ if (coords[0] >= obj.centerx && coords[1] < obj.centery) {
+ a = 90 - a;
+ a += 270;
+ } else if (coords[0] >= obj.centerx && coords[1] >= obj.centery) {
+ // Nada
+ } else if (coords[0] < obj.centerx && coords[1] >= obj.centery) {
+ a = 90 - a;
+ a += 90;
+ } else if (coords[0] < obj.centerx && coords[1] < obj.centery) {
+ a += 180;
+ }
+
+ var hyp = Math.abs(y / Math.sin(a / 57.3));
+
+ if (hyp >= (segment[2] - 10) ) {
+
+ /**
+ * Hide any currently shown tooltip
+ */
+ if (RGraph.Registry.Get('chart.tooltip')) {
+ RGraph.Registry.Get('chart.tooltip').style.display = 'none';
+ RGraph.Registry.Set('chart.tooltip', null);
+ }
+
+ RGraph.Registry.Set('chart.adjusting.rose.' + id, segment);
+
+ e.stopPropagation();
+ }
+ }
+ }
+
+
+ canvas.onmouseup = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+
+ if (RGraph.Registry.Get('chart.adjusting.rose.' + id)) {
+
+ RGraph.Registry.Set('chart.adjusting.rose.' + id, null);
+ e.stopPropagation();
+
+ return false;
+ }
+ }
+
+
+ canvas.onmouseout = function (e)
+ {
+ canvas.onmouseup(e);
+ }
+
+ /**
+ * Bar chart
+ */
+ } else if (obj.type == 'bar') {
+
+ // Stacked bar charts not supported
+ if (obj.Get('chart.grouping') == 'stacked') {
+ alert('[BAR] Adjusting stacked bar charts is not supported');
+ return;
+ }
+
+
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+
+ canvas.onmousemove = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var mouse = RGraph.getMouseXY(e);
+ var mousex = mouse[0];
+ var mousey = mouse[1]; // mousey, mousey...
+
+ // Loop through the coords to see if the mouse position is at the top of a bar
+ for (var i=0; i<obj.coords.length; ++i) {
+ if (mousex > obj.coords[i][0] && mousex < (obj.coords[i][0] + obj.coords[i][2])) {
+
+ // Change the mouse pointer
+ if (mousey > (obj.coords[i][1] - 5) && mousey < (obj.coords[i][1] + 5)) {
+ canvas.style.cursor = 'ns-resize';
+ } else {
+ canvas.style.cursor = 'default';
+ }
+
+ var idx = RGraph.Registry.Get('chart.adjusting.bar.' + id)
+
+ if (typeof(idx) == 'number') {
+ var newheight = obj.grapharea - (mousey - obj.Get('chart.gutter'));
+ var newvalue = (newheight / obj.grapharea) * obj.max;
+
+ // Top and bottom boundaries
+ if (newvalue > obj.max) newvalue = obj.max;
+ if (newvalue < 0) newvalue = 0;
+
+ ///////////////// This was fun to work out... /////////////////
+ for (var j=0, index=0; j<obj.data.length; ++j,++index) {
+ if (typeof(obj.data[j]) == 'object') {
+ for (var k=0; k<obj.data[j].length && index <= idx; ++k, ++index) {
+ if (index == idx) {
+ obj.data[j][k] = newvalue;
+ var b = true;
+ break;
+ }
+ }
+
+ --index;
+ } else if (typeof(obj.data[j]) == 'number') {
+
+ if (index == idx) {
+ obj.data[j] = newvalue;
+ // No need to set b
+ break;
+ }
+ }
+
+ if (b) {
+ break;
+ }
+ }
+ ///////////////////////////////////////////////////////////////
+
+ RGraph.Clear(canvas);
+ obj.Draw();
+
+ /**
+ * Fire the onadjust event
+ */
+ RGraph.FireCustomEvent(obj, 'onadjust');
+ }
+
+ return;
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+
+
+
+ canvas.onmousedown = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var mouse = RGraph.getMouseXY(e);
+ var mousex = mouse[0];
+ var mousey = mouse[1]; // mousey, mousey...
+
+ // Loop through the coords to see if the mouse position is at the top of a bar
+ for (var i=0; i<obj.coords.length; ++i) {
+ if (
+ mousex > obj.coords[i][0] && mousex < (obj.coords[i][0] + obj.coords[i][2])
+
+ ) {
+
+ obj.Set('chart.ymax', obj.max);
+ RGraph.Registry.Set('chart.adjusting.bar.' + id, i);
+ canvas.onmousemove(e);
+ }
+ }
+ }
+
+
+
+ canvas.onmouseup = function (e)
+ {
+ var id = e.target.__object__.id;
+
+ RGraph.Registry.Set('chart.adjusting.bar.' + id, null);
+ }
+
+
+ canvas.onmouseout = function (e)
+ {
+ canvas.onmouseup(e);
+ }
+
+
+ /**
+ * The Tradar chart
+ */
+ } else if (obj.type == 'tradar') {
+
+
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+
+ canvas.onmousemove = function (e)
+ {
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var mouseDown = RGraph.Registry.Get('chart.adjusting.tradar.' + id);
+ var mouseCoords = RGraph.getMouseXY(e);
+
+
+ if (mouseDown) {
+
+ canvas.style.cursor = 'move';
+
+ var dx = mouseCoords[0] - obj.centerx;
+ var dy = mouseCoords[1] - obj.centery;
+ var hyp = Math.sqrt((dx * dx) + (dy * dy));
+
+ var newvalue = (hyp / (obj.size / 2)) * obj.max;
+
+ newvalue = Math.min(obj.max, newvalue);
+ newvalue = Math.max(0, newvalue);
+
+ /**
+ * Only redraw the graph if the mouse is in the same quadrant as the point
+ */
+ if ( (dx >= 0 ? true : false) == mouseDown[1] && (dy >= 0 ? true : false) == mouseDown[2]) {
+ obj.data[mouseDown[0]] = newvalue;
+ RGraph.Clear(canvas);
+ obj.Draw();
+
+ /**
+ * Fire the onadjust event
+ */
+ RGraph.FireCustomEvent(obj, 'onadjust');
+ }
+
+
+ } else {
+
+ // Determine if the mouse is near a point, and if so, change the pointer
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ var dx = Math.abs(mouseCoords[0] - obj.coords[i][0]);
+ var dy = Math.abs(mouseCoords[1] - obj.coords[i][1]);
+ var a = Math.atan(dy / dx);
+
+
+ var hyp = Math.sqrt((dx * dx) + (dy * dy));
+
+ if (hyp <= 5) {
+ canvas.style.cursor = 'move';
+ return;
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ }
+
+
+ canvas.onmousedown = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var obj = e.target.__object__;
+ var id = obj.id;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var mouseCoords = RGraph.getMouseXY(e);
+
+
+ // Determine if the mouse is near a point
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ var dx = Math.abs(mouseCoords[0] - obj.coords[i][0]);
+ var dy = Math.abs(mouseCoords[1] - obj.coords[i][1]);
+ var a = Math.atan(dy / dx);
+
+
+ var hyp = Math.sqrt((dx * dx) + (dy * dy));
+
+ if (hyp <= 5) {
+ canvas.style.cursor = 'pointer';
+ RGraph.Registry.Set('chart.adjusting.tradar.' + id, [i, obj.coords[i][0] > obj.centerx, obj.coords[i][1] > obj.centery]);
+ return;
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+
+
+ canvas.onmouseup = function (e)
+ {
+ RGraph.Registry.Set('chart.adjusting.tradar.' + e.target.id, null);
+ canvas.style.cursor = 'default';
+ }
+
+
+ canvas.onmouseout = function (e)
+ {
+ canvas.onmouseup(e);
+ }
+ }
+ }
+
+
+ /**
+ * Returns 1 or -1 depening on whether the given number is positive or negative.
+ * Zero is considered positive.
+ *
+ * @param int num The number
+ * @return int 1 if the number is positive or zero, -1 if it's negative
+ */
+ //RGraph.getSign = function (num)
+ //{
+ // return num >= 0 ? 1 : -1;
+ //}
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+
+ /**
+ * The function which controls the annotate feature
+ *
+ * @param object obj The graph object
+ */
+ RGraph.Annotate = function (obj)
+ {
+ /**
+ * This installs some event handlers
+ */
+ if (obj.Get('chart.annotatable')) {
+
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ /**
+ * Capture the mouse events so we can set whther the mouse is down or not
+ */
+ canvas.onmousedown = function (e)
+ {
+ if (e.button == 0) {
+
+ e.target.__object__.Set('chart.mousedown', true);
+
+ // Get the context
+ var obj = e.target.__object__;
+ var context = obj.canvas.getContext('2d');
+
+ // Don't want any "joining" lines or colour "bleeding"
+ context.beginPath();
+
+ // Accommodate Chrome
+ var coords = RGraph.getMouseXY(e);
+ var x = coords[0];
+ var y = coords[1];
+
+ // Clear the annotation recording
+ RGraph.Registry.Set('annotate.actions', [obj.Get('chart.annotate.color')]);
+
+ context.strokeStyle = obj.Get('chart.annotate.color');
+
+ context.moveTo(x, y);
+
+ // Set the lineWidth
+ context.lineWidth = 1;
+
+ RGraph.Registry.Set('started.annotating', false);
+
+ /**
+ * Fire the onannotatestart event
+ */
+ RGraph.FireCustomEvent(obj, 'onannotatestart');
+ }
+
+ return false;
+ }
+
+ /**
+ * This cancels annotating for ALL canvases
+ */
+ window.onmouseup = function (e)
+ {
+ var tags = document.getElementsByTagName('canvas');
+
+ for (var i=0; i<tags.length; ++i) {
+ if (tags[i].__object__) {
+ tags[i].__object__.Set('chart.mousedown', false);
+ }
+ }
+
+ // Store the annotations in browser storage if it's available
+ if (RGraph.Registry.Get('annotate.actions') && RGraph.Registry.Get('annotate.actions').length > 0 && window.localStorage) {
+
+ var id = '__rgraph_annotations_' + e.target.id + '__';
+ var annotations = window.localStorage[id] ? window.localStorage[id] + '|' : '';
+ annotations += RGraph.Registry.Get('annotate.actions');
+
+ // Store the annotations information in HTML5 browser storage here
+ window.localStorage[id] = annotations;
+ }
+
+ // Clear the recorded annotations
+ RGraph.Registry.Set('annotate.actions', []);
+
+ /**
+ * Fire the annotate event
+ */
+ RGraph.FireCustomEvent(e.target.__object__, 'onannotateend');
+ }
+
+ canvas.onmouseup = function (e)
+ {
+ //window.onmouseup(e);
+ }
+
+ //canvas.onmouseout = window.onmouseup;
+
+ /**
+ * The canvas onmousemove function
+ */
+ canvas.onmousemove = function (e)
+ {
+ var e = RGraph.FixEventObject(e);
+ var obj = e.target.__object__;
+ var coords = RGraph.getMouseXY(e);
+ var x = coords[0];
+ var y = coords[1];
+ var gutter = obj.Get('chart.gutter');
+ var width = canvas.width;
+ var height = canvas.height;
+
+ obj.context.lineWidth = 1;
+
+ // Don't allow annotating in the gutter
+ //
+ // CHANGED 20TH DECEMBER 2010 TO ALLOW ANNOTATING IN THE GUTTER
+ if (true) {
+
+ canvas.style.cursor = 'crosshair';
+
+ if (obj.Get('chart.mousedown')) {
+
+ // Special case for HBars and Gantts with their extra wide left gutter
+ if ( (obj.type != 'hbar' && obj.type != 'gantt') || x > (3 * gutter)) {
+
+ /**
+ * This is here to stop annotating in the gutter
+ */
+ if (RGraph.Registry.Get('started.annotating') == false) {
+ context.moveTo(x, y);
+ RGraph.Registry.Set('started.annotating', true)
+ }
+
+ context.lineTo(x, y);
+
+ RGraph.Registry.Set('annotate.actions', RGraph.Registry.Get('annotate.actions') + '|' + x + ',' + y);
+
+ context.stroke();
+
+ /**
+ * Fire the annotate event
+ */
+ RGraph.FireCustomEvent(obj, 'onannotate');
+ }
+ }
+
+ } else {
+ canvas.style.cursor = 'default';
+ }
+ }
+
+ RGraph.ReplayAnnotations(obj);
+ }
+ }
+
+
+ /**
+ * Shows the mini palette used for annotations
+ *
+ * @param object e The event object
+ */
+ RGraph.Showpalette = function (e)
+ {
+ var isSafari = navigator.userAgent.indexOf('Safari') ? true : false;
+
+ e = RGraph.FixEventObject(e);
+
+ var canvas = e.target.parentNode.__canvas__;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ var div = document.createElement('DIV');
+ var coords = RGraph.getMouseXY(e);
+
+ div.__object__ = obj; // The graph object
+ div.className = 'RGraph_palette';
+ div.style.position = 'absolute';
+ div.style.backgroundColor = 'white';
+ div.style.border = '1px solid black';
+ div.style.left = 0;
+ div.style.top = 0;
+ div.style.padding = '3px';
+ div.style.paddingBottom = 0;
+ div.style.paddingRight = 0;
+ div.style.opacity = 0;
+ div.style.boxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ div.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ div.style.MozBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ div.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135)';
+
+ var common_css = 'padding: 1px; display: inline; display: inline-block; width: 15px; height: 15px; margin-right: 3px; cursor: pointer;' + (isSafari ? 'margin-bottom: 3px' : '');
+ var common_mouseover = ' onmouseover="this.style.border = \'1px black solid\'; this.style.padding = 0"';
+ var common_mouseout = ' onmouseout="this.style.border = 0; this.style.padding = \'1px\'" ';
+
+ var str = '';
+
+ var colors = ['red', 'blue', 'green', 'black', 'yellow', 'magenta', 'pink', 'cyan', 'purple', '#ddf', 'gray', '#36905c'];
+
+ for (i=0; i<colors.length; ++i) {
+ str = str + '<span ' + common_mouseover + common_mouseout + ' style="background-color: ' + colors[i] + '; ' + common_css + '" onclick="this.parentNode.__object__.Set(\'chart.annotate.color\', this.style.backgroundColor); this.parentNode.style.display = \'none\'"> </span>';
+
+ // This makes the colours go across two levels
+ if (i == 5) {
+ str += '<br />';
+ }
+ }
+
+ div.innerHTML = str;
+ document.body.appendChild(div);
+
+ /**
+ * Now the div has been added to the document, move it up and left and set the width and height
+ */
+ div.style.width = (div.offsetWidth - (RGraph.isIE9up() ? 12 : 5)) + 'px';
+ div.style.height = (div.offsetHeight - (RGraph.isIE9up() ? 13 : 5)) + 'px';
+ div.style.left = Math.max(0, e.pageX - div.offsetWidth - 2) + 'px';
+ div.style.top = (e.pageY - div.offsetHeight - 2) + 'px';
+
+ /**
+ * Store the palette div in the registry
+ */
+ RGraph.Registry.Set('palette', div);
+
+ setTimeout("RGraph.Registry.Get('palette').style.opacity = 0.2", 50);
+ setTimeout("RGraph.Registry.Get('palette').style.opacity = 0.4", 100);
+ setTimeout("RGraph.Registry.Get('palette').style.opacity = 0.6", 150);
+ setTimeout("RGraph.Registry.Get('palette').style.opacity = 0.8", 200);
+ setTimeout("RGraph.Registry.Get('palette').style.opacity = 1", 250);
+
+ RGraph.HideContext();
+
+ window.onclick = function ()
+ {
+ RGraph.HidePalette();
+ }
+
+ // Should this be here? Yes. This function is being used as an event handler.
+ e.stopPropagation();
+ return false;
+ }
+
+
+ /**
+ * Clears any annotation data from global storage
+ *
+ * @param string id The ID of the canvas
+ */
+ RGraph.ClearAnnotations = function (id)
+ {
+ if (window.localStorage && window.localStorage['__rgraph_annotations_' + id + '__'] && window.localStorage['__rgraph_annotations_' + id + '__'].length) {
+ window.localStorage['__rgraph_annotations_' + id + '__'] = [];
+ }
+ }
+
+
+ /**
+ * Replays stored annotations
+ *
+ * @param object obj The graph object
+ */
+ RGraph.ReplayAnnotations = function (obj)
+ {
+ // Check for support
+ if (!window.localStorage) {
+ return;
+ }
+
+ var context = obj.context;
+ var annotations = window.localStorage['__rgraph_annotations_' + obj.id + '__'];
+ var i, len, move, coords;
+
+ context.beginPath();
+ context.lineWidth = 2;
+
+ if (annotations && annotations.length) {
+ annotations = annotations.split('|');
+ } else {
+ return;
+ }
+
+ for (i=0, len=annotations.length; i<len; ++i) {
+ if (!annotations[i].match(/^[0-9]+,[0-9]+$/)) {
+ context.stroke();
+ context.beginPath();
+ context.strokeStyle = annotations[i];
+ move = true;
+ continue;
+ }
+
+ coords = annotations[i].split(',');
+
+ if (move) {
+ context.moveTo(coords[0], coords[1]);
+ move = false;
+ } else {
+ context.lineTo(coords[0], coords[1]);
+ }
+ }
+
+ context.stroke();
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+
+ /**
+ * This gunction shows a context menu containing the parameters
+ * provided to it
+ *
+ * @param object canvas The canvas object
+ * @param array menuitems The context menu menuitems
+ * @param object e The event object
+ */
+ RGraph.Contextmenu = function (canvas, menuitems, e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ /**
+ * Hide any existing menu
+ */
+ if (RGraph.Registry.Get('chart.contextmenu')) {
+ RGraph.HideContext();
+ }
+
+ // Hide any zoomed canvas
+ RGraph.HideZoomedCanvas();
+
+ /**
+ * Hide the palette if necessary
+ */
+ RGraph.HidePalette();
+
+ /**
+ * This is here to ensure annotating is OFF
+ */
+ canvas.__object__.Set('chart.mousedown', false);
+
+ var x = e.pageX;
+ var y = e.pageY;
+ var div = document.createElement('div');
+ var bg = document.createElement('div');
+
+ div.className = 'RGraph_contextmenu';
+ div.__canvas__ = canvas; /* Store a reference to the canvas on the contextmenu object */
+ div.style.position = 'absolute';
+ div.style.left = 0;
+ div.style.top = 0;
+ div.style.border = '1px solid black';
+ div.style.backgroundColor = 'white';
+ div.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ div.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ div.style.WebkitBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ div.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';
+ div.style.opacity = 0;
+
+ bg.className = 'RGraph_contextmenu_background';
+ bg.style.position = 'absolute';
+ bg.style.backgroundColor = '#ccc';
+ bg.style.borderRight = '1px solid #aaa';
+ bg.style.top = 0;
+ bg.style.left = 0;
+ bg.style.width = '18px';
+ bg.style.height = '100%';
+ bg.style.opacity = 0;
+
+
+ div = document.body.appendChild(div);
+ bg = div.appendChild(bg);
+
+
+ /**
+ * Now add the context menu items
+ */
+ for (i=0; i<menuitems.length; ++i) {
+
+ var menuitem = document.createElement('div');
+
+ menuitem.__canvas__ = canvas;
+ menuitem.__contextmenu__ = div;
+ menuitem.className = 'RGraph_contextmenu_item';
+
+ if (menuitems[i]) {
+ menuitem.style.padding = '2px 5px 2px 23px';
+ menuitem.style.fontFamily = 'Arial';
+ menuitem.style.fontSize = '10pt';
+ menuitem.style.fontWeight = 'normal';
+ menuitem.innerHTML = menuitems[i][0];
+
+ if (RGraph.is_array(menuitems[i][1])) {
+ menuitem.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAQUlEQVQImY3NoQ2AMABE0ZewABMyGQ6mqWODzlAclBSFO8HZl8uf0FFxCHtwYkt4Y6ChYE44cGH9/fyae2p2LAleW9oVTQuVf6gAAAAASUVORK5CYII=)';
+ menuitem.style.backgroundRepeat = 'no-repeat';
+ menuitem.style.backgroundPosition = '97% center';
+ }
+
+ // Add the mouseover event
+ if (menuitems[i][1]) {
+ if (menuitem.addEventListener) {
+ menuitem.addEventListener("mouseover", function (e) {RGraph.HideContextSubmenu(); e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
+ } else {
+ menuitem.attachEvent("onmouseover", function () {RGraph.HideContextSubmenu();event.srcElement.style.backgroundColor = '#eee';event.srcElement.style.cursor = 'pointer';}
+ , false);
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
+ }
+ } else {
+ if (menuitem.addEventListener) {
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
+ } else {
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
+ }
+ }
+
+ } else {
+ menuitem.style.borderBottom = '1px solid #ddd';
+ menuitem.style.marginLeft = '25px';
+ }
+
+ div.appendChild(menuitem);
+
+ /**
+ * Install the event handler that calls the menuitem
+ */
+ if (menuitems[i] && menuitems[i][1] && typeof(menuitems[i][1]) == 'function') {
+ if (document.all) {
+ menuitem.attachEvent('onclick', menuitems[i][1]);
+ menuitem.attachEvent('onclick', function () {RGraph.HideContext();});
+ } else {
+ menuitem.addEventListener('click', menuitems[i][1], false);
+ }
+
+ // Submenu
+ } else if (menuitems[i] && menuitems[i][1] && RGraph.is_array(menuitems[i][1])) {
+ var tmp = menuitems[i][1]; // This is here because of "references vs primitives" and how they're passed around in Javascript
+ menuitem.addEventListener('mouseover', function (e) {RGraph.Contextmenu_submenu(canvas.__object__, tmp, e.target);}, false);
+ }
+ }
+
+ /**
+ * Now all the menu items have been added, set the shadow width
+ * Shadow now handled by CSS3?
+ */
+ div.style.width = (div.offsetWidth + 10) + 'px';
+ div.style.height = (div.offsetHeight - (RGraph.isIE9up() ? 10 : 2)) + 'px';
+
+ /**
+ * Set the background (the left bar) width if it's MSIE
+ */
+ if (document.all) {
+ bg.style.height = (div.offsetHeight - 10) + 'px';
+ }
+
+ // Show the menu to the left or the right (normal) of the cursor?
+ if (x + div.offsetWidth > document.body.offsetWidth) {
+ x -= div.offsetWidth;
+ }
+
+ // Reposition the menu (now we have the real offsetWidth)
+ div.style.left = x + 'px';
+ div.style.top = y + 'px';
+
+ /**
+ * Do a little fade in effect
+ */
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.2", 50);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.4", 100);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.6", 150);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.8", 200);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 1", 250);
+
+ // The fade in effect on the left gray bar
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.2", 50);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.4", 100);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.6", 150);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.8", 200);
+ setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 1", 250);
+
+ // Store the context menu in the registry
+ RGraph.Registry.Set('chart.contextmenu', div);
+ RGraph.Registry.Set('chart.contextmenu.bg', bg);
+ RGraph.Registry.Get('chart.contextmenu').oncontextmenu = function () {return false;};
+ RGraph.Registry.Get('chart.contextmenu.bg').oncontextmenu = function () {return false;};
+
+ /**
+ * Install the event handlers that hide the context menu
+ */
+ canvas.addEventListener('click', function () {RGraph.HideContext();}, false);
+
+ window.onclick = function (e)
+ {
+ RGraph.HideContext();
+
+ // Removed on 3/7/10 - stops a bug in conjunction with annotating which presents itself on the Rscatter
+ //RGraph.Redraw();
+
+ // Fire the onclick event again
+ if (e.target.onclick && e.button == 0) {
+ e.target.onclick(e);
+ }
+ }
+
+ window.onresize = function () {RGraph.HideContext();}
+
+ e.stopPropagation();
+
+ /**
+ * Fire the (RGraph) oncontextmenu event
+ */
+ RGraph.FireCustomEvent(canvas.__object__, 'oncontextmenu');
+
+ return false;
+ }
+
+
+ /**
+ * Hides the context menu if it's currently visible
+ */
+ RGraph.HideContext = function ()
+ {
+ var cm = RGraph.Registry.Get('chart.contextmenu');
+ var cmbg = RGraph.Registry.Get('chart.contextmenu.bg');
+
+ //Hide any submenu currently being displayed
+ RGraph.HideContextSubmenu();
+
+ if (cm) {
+ cm.parentNode.removeChild(cm);
+ cmbg.parentNode.removeChild(cmbg);
+
+ cm.style.visibility = 'hidden';
+ cm.style.display = 'none';
+ RGraph.Registry.Set('chart.contextmenu', null);
+
+ cmbg.style.visibility = 'hidden';
+ cmbg.style.display = 'none';
+ RGraph.Registry.Set('chart.contextmenu.bg', null);
+ }
+ }
+
+
+ /**
+ * Hides the context menus SUBMENU if it's currently visible
+ */
+ RGraph.HideContextSubmenu = function ()
+ {
+ var sub = RGraph.Registry.Get('chart.contextmenu.submenu');
+
+ if (sub) {
+ sub.style.visibility = 'none';
+ sub.style.display = 'none';
+ RGraph.Registry.Set('chart.contextmenu.submenu', null);
+ }
+ }
+
+
+ /**
+ * Shows the context menu after making a few checks - not opera (doesn't support oncontextmenu,
+ * not safari (tempermentality), not chrome (hmmm)
+ */
+ RGraph.ShowContext = function (obj)
+ {
+ RGraph.HidePalette();
+
+ if (obj.Get('chart.contextmenu') && obj.Get('chart.contextmenu').length) {
+
+ var isOpera = navigator.userAgent.indexOf('Opera') >= 0;
+ var isSafari = navigator.userAgent.indexOf('Safari') >= 0;
+ var isChrome = navigator.userAgent.indexOf('Chrome') >= 0;
+ var isMacFirefox = navigator.userAgent.indexOf('Firefox') > 0 && navigator.userAgent.indexOf('Mac') > 0;
+ var isIE9 = navigator.userAgent.indexOf('MSIE 9') >= 0;
+
+ if (((!isOpera && !isSafari) || isChrome) && !isMacFirefox && !isIE9) {
+
+ obj.canvas.oncontextmenu = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ if (e.ctrlKey) return true;
+
+ RGraph.Contextmenu(obj.canvas, obj.Get('chart.contextmenu'), e);
+
+ return false;
+ }
+
+ // Accomodate Opera, IE9 and Safari - use double click event
+ } else {
+
+ obj.canvas.addEventListener('dblclick', function (e)
+ {
+ if (e.ctrlKey) return true;
+
+ if (!RGraph.Registry.Get('chart.contextmenu')) {
+ RGraph.Contextmenu(obj.canvas, obj.Get('chart.contextmenu'), e);
+ }
+ }, false);
+ }
+ }
+ }
+
+
+ /**
+ * This draws a submenu should it be necessary
+ *
+ * @param object obj The graph object
+ * @param object menu The context menu
+ */
+ RGraph.Contextmenu_submenu = function (obj, menuitems, parentMenuItem)
+ {
+ RGraph.HideContextSubmenu();
+
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var menu = parentMenuItem.parentNode;
+
+ var subMenu = document.createElement('DIV');
+ subMenu.style.position = 'absolute';
+ subMenu.style.width = '100px';
+ subMenu.style.top = menu.offsetTop + parentMenuItem.offsetTop + 'px';
+ subMenu.style.left = (menu.offsetLeft + menu.offsetWidth - (document.all ? 9 : 0)) + 'px';
+ subMenu.style.backgroundColor = 'white';
+ subMenu.style.border = '1px solid black';
+ subMenu.className = 'RGraph_contextmenu';
+ subMenu.__contextmenu__ = menu;
+ subMenu.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ subMenu.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ subMenu.style.WebkitBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ subMenu.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';
+ document.body.appendChild(subMenu);
+
+ for (var i=0; i<menuitems.length; ++i) {
+
+ var menuitem = document.createElement('DIV');
+
+ menuitem.__canvas__ = canvas;
+ menuitem.__contextmenu__ = menu;
+ menuitem.className = 'RGraph_contextmenu_item';
+
+ if (menuitems[i]) {
+ menuitem.style.padding = '2px 5px 2px 23px';
+ menuitem.style.fontFamily = 'Arial';
+ menuitem.style.fontSize = '10pt';
+ menuitem.style.fontWeight = 'normal';
+ menuitem.innerHTML = menuitems[i][0];
+
+ if (menuitems[i][1]) {
+ if (menuitem.addEventListener) {
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
+ } else {
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.backgroundColor = 'rgba(0,0,0,0.2)'; event.srcElement.style.cursor = 'pointer'}, false);
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
+ }
+ } else {
+ if (menuitem.addEventListener) {
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
+ } else {
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
+ }
+ }
+ } else {
+ menuitem.style.borderBottom = '1px solid #ddd';
+ menuitem.style.marginLeft = '25px';
+ }
+
+ subMenu.appendChild(menuitem);
+
+ if (menuitems[i] && menuitems[i][1]) {
+ if (document.all) {
+ menuitem.attachEvent('onclick', menuitems[i][1]);
+ } else {
+ menuitem.addEventListener('click', menuitems[i][1], false);
+ }
+ }
+ }
+
+
+ var bg = document.createElement('DIV');
+ bg.className = 'RGraph_contextmenu_background';
+ bg.style.position = 'absolute';
+ bg.style.backgroundColor = '#ccc';
+ bg.style.borderRight = '1px solid #aaa';
+ bg.style.top = 0;
+ bg.style.left = 0;
+ bg.style.width = '18px';
+ bg.style.height = '100%';
+
+ bg = subMenu.appendChild(bg);
+
+ RGraph.Registry.Set('chart.contextmenu.submenu', subMenu);
+ }
+
+
+ /**
+ * A function designed to be used in conjunction with thed context menu
+ * to allow people to get image versions of canvases.
+ *
+ * @param canvas Optionally you can pass in the canvas, which will be used
+ */
+ RGraph.showPNG = function ()
+ {
+ if (RGraph.isIE8()) {
+ alert('[RGRAPH PNG] Sorry, showing a PNG is not supported on MSIE8.');
+ return;
+ }
+
+ if (arguments[0] && arguments[0].id) {
+ var canvas = arguments[0];
+ var event = arguments[1];
+
+ } else if (RGraph.Registry.Get('chart.contextmenu')) {
+ var canvas = RGraph.Registry.Get('chart.contextmenu').__canvas__;
+
+ } else {
+ alert('[RGRAPH SHOWPNG] Could not find canvas!');
+ }
+
+ var obj = canvas.__object__;
+
+ /**
+ * Create the gray background DIV to cover the page
+ */
+ var bg = document.createElement('DIV');
+ bg.id = '__rgraph_image_bg__';
+ bg.style.position = 'fixed';
+ bg.style.top = '-10px';
+ bg.style.left = '-10px';
+ bg.style.width = '5000px';
+ bg.style.height = '5000px';
+ bg.style.backgroundColor = 'rgb(204,204,204)';
+ bg.style.opacity = 0;
+ document.body.appendChild(bg);
+
+
+ /**
+ * Create the div that the graph sits in
+ */
+ var div = document.createElement('DIV');
+ div.style.backgroundColor = 'white';
+ div.style.opacity = 0;
+ div.style.border = '1px solid black';
+ div.style.position = 'fixed';
+ div.style.top = '20%';
+ div.style.width = canvas.width + 'px';
+ div.style.height = canvas.height + 35 + 'px';
+ div.style.left = (document.body.clientWidth / 2) - (canvas.width / 2) + 'px';
+ div.style.padding = '5px';
+
+ div.style.borderRadius = '10px';
+ div.style.MozBorderRadius = '10px';
+ div.style.WebkitBorderRadius = '10px';
+
+ div.style.boxShadow = '0 0 15px rgba(96,96,96,0.5)';
+ div.style.MozBoxShadow = '0 0 15px rgba(96,96,96,0.5)';
+ div.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
+
+ div.__canvas__ = canvas;
+ div.__object__ = obj;
+ div.id = '__rgraph_image_div__';
+ document.body.appendChild(div);
+
+
+ /**
+ * Add the HTML text inputs
+ */
+ div.innerHTML += '<div style="position: absolute; margin-left: 10px; top: ' + canvas.height + 'px; width: ' + (canvas.width - 50) + 'px; height: 25px"><span style="display: inline; display: inline-block; width: 65px; text-align: right">URL:</span><textarea style="float: right; overflow: hidden; height: 15px; width: ' + (canvas.width - (2 * obj.Get('chart.gutter')) - 80) + 'px" onclick="this.select()" readonly="readonly" id="__rgraph_dataurl__">' + canvas.toDataURL() + '</textarea></div>';
+ div.innerHTML += '<div style="position: absolute; top: ' + (canvas.height + 25) + 'px; left: ' + (obj.Get('chart.gutter') - 65 + (canvas.width / 2)) + 'px; width: ' + (canvas.width - obj.Get('chart.gutter')) + 'px; font-size: 65%">A link using the URL: <a href="' + canvas.toDataURL() + '">View</a></div>'
+
+
+
+ /**
+ * Create the image rendition of the graph
+ */
+ var img = document.createElement('IMG');
+ RGraph.Registry.Set('chart.png', img);
+ img.__canvas__ = canvas;
+ img.__object__ = obj;
+ img.id = '__rgraph_image_img__';
+ img.className = 'RGraph_png';
+
+ img.src = canvas.toDataURL();
+
+ div.appendChild(img);
+
+ setTimeout(function () {document.getElementById("__rgraph_dataurl__").select();}, 50);
+
+ window.addEventListener('resize', function (e){var img = RGraph.Registry.Get('chart.png');img.style.left = (document.body.clientWidth / 2) - (img.width / 2) + 'px';}, false);
+
+ bg.onclick = function (e)
+ {
+ var div = document.getElementById("__rgraph_image_div__");
+ var bg = document.getElementById("__rgraph_image_bg__");
+
+ if (div) {
+ div.style.opacity = 0;
+
+ div.parentNode.removeChild(div);
+
+ div.id = '';
+ div.style.display = 'none';
+ div = null;
+ }
+
+ if (bg) {
+ bg.style.opacity = 0;
+
+ bg.id = '';
+ bg.style.display = 'none';
+ bg = null;
+ }
+ }
+
+ window.addEventListener('resize', function (e) {bg.onclick(e);}, false)
+
+ /**
+ * This sets the image as a global variable, circumventing repeated calls to document.getElementById()
+ */
+ __rgraph_image_bg__ = bg;
+ __rgraph_image_div__ = div;
+
+
+ setTimeout('__rgraph_image_div__.style.opacity = 0.2', 50);
+ setTimeout('__rgraph_image_div__.style.opacity = 0.4', 100);
+ setTimeout('__rgraph_image_div__.style.opacity = 0.6', 150);
+ setTimeout('__rgraph_image_div__.style.opacity = 0.8', 200);
+ setTimeout('__rgraph_image_div__.style.opacity = 1', 250);
+
+ setTimeout('__rgraph_image_bg__.style.opacity = 0.1', 50);
+ setTimeout('__rgraph_image_bg__.style.opacity = 0.2', 100);
+ setTimeout('__rgraph_image_bg__.style.opacity = 0.3', 150);
+ setTimeout('__rgraph_image_bg__.style.opacity = 0.4', 200);
+ setTimeout('__rgraph_image_bg__.style.opacity = 0.5', 250);
+
+
+
+ img.onclick = function (e)
+ {
+ if (e.stopPropagation) e.stopPropagation();
+ else event.cancelBubble = true;
+ }
+
+ if (event && event.stopPropagation) {
+ event.stopPropagation();
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ /**
+ * Initialise the various objects
+ */
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+
+ RGraph.Registry = {};
+ RGraph.Registry.store = [];
+ RGraph.Registry.store['chart.event.handlers'] = [];
+ RGraph.background = {};
+ RGraph.objects = [];
+ RGraph.Resizing = {};
+ RGraph.events = [];
+
+
+
+ /**
+ * Returns five values which are used as a nice scale
+ *
+ * @param max int The maximum value of the graph
+ * @param obj object The graph object
+ * @return array An appropriate scale
+ */
+ RGraph.getScale = function (max, obj)
+ {
+ /**
+ * Special case for 0
+ */
+ if (max == 0) {
+ return ['0.2', '0.4', '0.6', '0.8', '1.0'];
+ }
+
+ var original_max = max;
+
+ /**
+ * Manually do decimals
+ */
+ if (max <= 1) {
+ if (max > 0.5) {
+ return [0.2,0.4,0.6,0.8, Number(1).toFixed(1)];
+
+ } else if (max >= 0.1) {
+ return obj.Get('chart.scale.round') ? [0.2,0.4,0.6,0.8,1] : [0.1,0.2,0.3,0.4,0.5];
+
+ } else {
+
+ var tmp = max;
+ var exp = 0;
+
+ while (tmp < 1.01) {
+ exp += 1;
+ tmp *= 10;
+ }
+
+ var ret = ['2e-' + exp, '4e-' + exp, '6e-' + exp, '8e-' + exp, '10e-' + exp];
+
+
+ if (max <= ('5e-' + exp)) {
+ ret = ['1e-' + exp, '2e-' + exp, '3e-' + exp, '4e-' + exp, '5e-' + exp];
+ }
+
+ return ret;
+ }
+ }
+
+ // Take off any decimals
+ if (String(max).indexOf('.') > 0) {
+ max = String(max).replace(/\.\d+$/, '');
+ }
+
+ var interval = Math.pow(10, Number(String(Number(max)).length - 1));
+ var topValue = interval;
+
+ while (topValue < max) {
+ topValue += (interval / 2);
+ }
+
+ // Handles cases where the max is (for example) 50.5
+ if (Number(original_max) > Number(topValue)) {
+ topValue += (interval / 2);
+ }
+
+ // Custom if the max is greater than 5 and less than 10
+ if (max < 10) {
+ topValue = (Number(original_max) <= 5 ? 5 : 10);
+ }
+
+ /**
+ * Added 02/11/2010 to create "nicer" scales
+ */
+ if (obj && typeof(obj.Get('chart.scale.round')) == 'boolean' && obj.Get('chart.scale.round')) {
+ topValue = 10 * interval;
+ }
+
+ return [topValue * 0.2, topValue * 0.4, topValue * 0.6, topValue * 0.8, topValue];
+ }
+
+
+ /**
+ * Returns the maximum value which is in an array
+ *
+ * @param array arr The array
+ * @param int Whether to ignore signs (ie negative/positive)
+ * @return int The maximum value in the array
+ */
+ RGraph.array_max = function (arr)
+ {
+ var max = null;
+
+ for (var i=0; i<arr.length; ++i) {
+ if (typeof(arr[i]) == 'number') {
+ max = (max ? Math.max(max, arguments[1] ? Math.abs(arr[i]) : arr[i]) : arr[i]);
+ }
+ }
+
+ return max;
+ }
+
+
+ /**
+ * Returns the maximum value which is in an array
+ *
+ * @param array arr The array
+ * @param int len The length to pad the array to
+ * @param mixed The value to use to pad the array (optional)
+ */
+ RGraph.array_pad = function (arr, len)
+ {
+ if (arr.length < len) {
+ var val = arguments[2] ? arguments[2] : null;
+
+ for (var i=arr.length; i<len; ++i) {
+ arr[i] = val;
+ }
+ }
+
+ return arr;
+ }
+
+
+ /**
+ * An array sum function
+ *
+ * @param array arr The array to calculate the total of
+ * @return int The summed total of the arrays elements
+ */
+ RGraph.array_sum = function (arr)
+ {
+ // Allow integers
+ if (typeof(arr) == 'number') {
+ return arr;
+ }
+
+ var i, sum;
+ var len = arr.length;
+
+ for(i=0,sum=0;i<len;sum+=arr[i++]);
+ return sum;
+ }
+
+
+
+ /**
+ * A simple is_array() function
+ *
+ * @param mixed obj The object you want to check
+ * @return bool Whether the object is an array or not
+ */
+ RGraph.is_array = function (obj)
+ {
+ return obj != null && obj.constructor.toString().indexOf('Array') != -1;
+ }
+
+
+ /**
+ * Converts degrees to radians
+ *
+ * @param int degrees The number of degrees
+ * @return float The number of radians
+ */
+ RGraph.degrees2Radians = function (degrees)
+ {
+ return degrees * (Math.PI / 180);
+ }
+
+
+ /**
+ * This function draws an angled line. The angle is cosidered to be clockwise
+ *
+ * @param obj ctxt The context object
+ * @param int x The X position
+ * @param int y The Y position
+ * @param int angle The angle in RADIANS
+ * @param int length The length of the line
+ */
+ RGraph.lineByAngle = function (context, x, y, angle, length)
+ {
+ context.arc(x, y, length, angle, angle, false);
+ context.lineTo(x, y);
+ context.arc(x, y, length, angle, angle, false);
+ }
+
+
+ /**
+ * This is a useful function which is basically a shortcut for drawing left, right, top and bottom alligned text.
+ *
+ * @param object context The context
+ * @param string font The font
+ * @param int size The size of the text
+ * @param int x The X coordinate
+ * @param int y The Y coordinate
+ * @param string text The text to draw
+ * @parm string The vertical alignment. Can be null. "center" gives center aligned text, "top" gives top aligned text.
+ * Anything else produces bottom aligned text. Default is bottom.
+ * @param string The horizontal alignment. Can be null. "center" gives center aligned text, "right" gives right aligned text.
+ * Anything else produces left aligned text. Default is left.
+ * @param bool Whether to show a bounding box around the text. Defaults not to
+ * @param int The angle that the text should be rotate at (IN DEGREES)
+ * @param string Background color for the text
+ * @param bool Whether the text is bold or not
+ * @param bool Whether the bounding box has a placement indicator
+ */
+ RGraph.Text = function (context, font, size, x, y, text)
+ {
+ /**
+ * This calls the text function recursively to accommodate multi-line text
+ */
+ if (typeof(text) == 'string' && text.match(/\r?\n/)) {
+
+ var nextline = text.replace(/^.*\r?\n/, '');
+
+ RGraph.Text(context, font, size, arguments[9] == -90 ? (x + (size * 1.5)) : x, y + (size * 1.5), nextline, arguments[6] ? arguments[6] : null, 'center', arguments[8], arguments[9], arguments[10], arguments[11], arguments[12]);
+
+ text = text.replace(/\r?\n.*$/, '');
+
+ }
+
+
+ // Accommodate MSIE
+ if (RGraph.isIE8()) {
+ y += 2;
+ }
+
+
+ context.font = (arguments[11] ? 'Bold ': '') + size + 'pt ' + font;
+
+ var i;
+ var origX = x;
+ var origY = y;
+ var originalFillStyle = context.fillStyle;
+ var originalLineWidth = context.lineWidth;
+
+ // Need these now the angle can be specified, ie defaults for the former two args
+ if (typeof(arguments[6]) == null) arguments[6] = 'bottom'; // Vertical alignment. Default to bottom/baseline
+ if (typeof(arguments[7]) == null) arguments[7] = 'left'; // Horizontal alignment. Default to left
+ if (typeof(arguments[8]) == null) arguments[8] = null; // Show a bounding box. Useful for positioning during development. Defaults to false
+ if (typeof(arguments[9]) == null) arguments[9] = 0; // Angle (IN DEGREES) that the text should be drawn at. 0 is middle right, and it goes clockwise
+ if (typeof(arguments[12]) == null) arguments[12] = true; // Whether the bounding box has the placement indicator
+
+ // The alignment is recorded here for purposes of Opera compatibility
+ if (navigator.userAgent.indexOf('Opera') != -1) {
+ context.canvas.__rgraph_valign__ = arguments[6];
+ context.canvas.__rgraph_halign__ = arguments[7];
+ }
+
+ // First, translate to x/y coords
+ context.save();
+
+ context.canvas.__rgraph_originalx__ = x;
+ context.canvas.__rgraph_originaly__ = y;
+
+ context.translate(x, y);
+ x = 0;
+ y = 0;
+
+ // Rotate the canvas if need be
+ if (arguments[9]) {
+ context.rotate(arguments[9] / 57.3);
+ }
+
+ // Vertical alignment - defaults to bottom
+ if (arguments[6]) {
+ var vAlign = arguments[6];
+
+ if (vAlign == 'center') {
+ context.translate(0, size / 2);
+ } else if (vAlign == 'top') {
+ context.translate(0, size);
+ }
+ }
+
+
+ // Hoeizontal alignment - defaults to left
+ if (arguments[7]) {
+ var hAlign = arguments[7];
+ var width = context.measureText(text).width;
+
+ if (hAlign) {
+ if (hAlign == 'center') {
+ context.translate(-1 * (width / 2), 0)
+ } else if (hAlign == 'right') {
+ context.translate(-1 * width, 0)
+ }
+ }
+ }
+
+
+ context.fillStyle = originalFillStyle;
+
+ /**
+ * Draw a bounding box if requested
+ */
+ context.save();
+ context.fillText(text,0,0);
+ context.lineWidth = 0.5;
+
+ if (arguments[8]) {
+
+ var width = context.measureText(text).width;
+ var ieOffset = RGraph.isIE8() ? 2 : 0;
+
+ context.translate(x, y);
+ context.strokeRect(0 - 3, 0 - 3 - size - ieOffset, width + 6, 0 + size + 6);
+
+ /**
+ * If requested, draw a background for the text
+ */
+ if (arguments[10]) {
+
+ var offset = 3;
+ var ieOffset = RGraph.isIE8() ? 2 : 0;
+ var width = context.measureText(text).width
+
+ //context.strokeStyle = 'gray';
+ context.fillStyle = arguments[10];
+ context.fillRect(x - offset, y - size - offset - ieOffset, width + (2 * offset), size + (2 * offset));
+ //context.strokeRect(x - offset, y - size - offset - ieOffset, width + (2 * offset), size + (2 * offset));
+ }
+
+ /**
+ * Do the actual drawing of the text
+ */
+ context.fillStyle = originalFillStyle;
+ context.fillText(text,0,0);
+
+ if (arguments[12]) {
+ context.fillRect(
+ arguments[7] == 'left' ? 0 : (arguments[7] == 'center' ? width / 2 : width ) - 2,
+ arguments[6] == 'bottom' ? 0 : (arguments[6] == 'center' ? (0 - size) / 2 : 0 - size) - 2,
+ 4,
+ 4
+ );
+ }
+ }
+ context.restore();
+
+ // Reset the lineWidth
+ context.lineWidth = originalLineWidth;
+
+ context.restore();
+ }
+
+
+ /**
+ * Clears the canvas by setting the width. You can specify a colour if you wish.
+ *
+ * @param object canvas The canvas to clear
+ */
+ RGraph.Clear = function (canvas)
+ {
+ var context = canvas.getContext('2d');
+
+ context.fillStyle = arguments[1] ? String(arguments[1]) : 'white';
+
+ context = canvas.getContext('2d');
+ context.beginPath();
+ context.fillRect(-5,-5,canvas.width + 5,canvas.height + 5);
+ context.fill();
+
+ if (RGraph.ClearAnnotations) {
+ RGraph.ClearAnnotations(canvas.id);
+ }
+ }
+
+
+ /**
+ * Draws the title of the graph
+ *
+ * @param object canvas The canvas object
+ * @param string text The title to write
+ * @param integer gutter The size of the gutter
+ * @param integer The center X point (optional - if not given it will be generated from the canvas width)
+ * @param integer Size of the text. If not given it will be 14
+ */
+ RGraph.DrawTitle = function (canvas, text, gutter)
+ {
+ var obj = canvas.__object__;
+ var context = canvas.getContext('2d');
+ var size = arguments[4] ? arguments[4] : 12;
+ var centerx = (arguments[3] ? arguments[3] : canvas.width / 2);
+ var keypos = obj.Get('chart.key.position');
+ var vpos = gutter / 2;
+ var hpos = obj.Get('chart.title.hpos');
+ var bgcolor = obj.Get('chart.title.background');
+
+ // Account for 3D effect by faking the key position
+ if (obj.type == 'bar' && obj.Get('chart.variant') == '3d') {
+ keypos = 'gutter';
+ }
+
+ context.beginPath();
+ context.fillStyle = obj.Get('chart.text.color') ? obj.Get('chart.text.color') : 'black';
+
+ /**
+ * Vertically center the text if the key is not present
+ */
+ if (keypos && keypos != 'gutter') {
+ var vCenter = 'center';
+
+ } else if (!keypos) {
+ var vCenter = 'center';
+
+ } else {
+ var vCenter = 'bottom';
+ }
+
+ // if chart.title.vpos does not equal 0.5, use that
+ if (typeof(obj.Get('chart.title.vpos')) == 'number') {
+ vpos = obj.Get('chart.title.vpos') * gutter;
+ }
+
+ // if chart.title.hpos is a number, use that. It's multiplied with the (entire) canvas width
+ if (typeof(hpos) == 'number') {
+ centerx = hpos * canvas.width;
+ }
+
+ // Set the colour
+ if (typeof(obj.Get('chart.title.color') != null)) {
+ var oldColor = context.fillStyle
+ var newColor = obj.Get('chart.title.color')
+ context.fillStyle = newColor ? newColor : 'black';
+ }
+
+ /**
+ * Default font is Verdana
+ */
+ var font = obj.Get('chart.text.font');
+
+ /**
+ * Draw the title itself
+ */
+ RGraph.Text(context, font, size, centerx, vpos, text, vCenter, 'center', bgcolor != null, null, bgcolor, true);
+
+ // Reset the fill colour
+ context.fillStyle = oldColor;
+ }
+
+
+ /**
+ * This function returns the mouse position in relation to the canvas
+ *
+ * @param object e The event object.
+ */
+ RGraph.getMouseXY = function (e)
+ {
+ var obj = (RGraph.isIE8() ? event.srcElement : e.target);
+ var x;
+ var y;
+
+ if (RGraph.isIE8()) e = event;
+
+ // Browser with offsetX and offsetY
+ if (typeof(e.offsetX) == 'number' && typeof(e.offsetY) == 'number') {
+ x = e.offsetX;
+ y = e.offsetY;
+
+ // FF and other
+ } else {
+ x = 0;
+ y = 0;
+
+ while (obj != document.body && obj) {
+ x += obj.offsetLeft;
+ y += obj.offsetTop;
+
+ obj = obj.offsetParent;
+ }
+
+ x = e.pageX - x;
+ y = e.pageY - y;
+ }
+
+ return [x, y];
+ }
+
+
+ /**
+ * This function returns a two element array of the canvas x/y position in
+ * relation to the page
+ *
+ * @param object canvas
+ */
+ RGraph.getCanvasXY = function (canvas)
+ {
+ var x = 0;
+ var y = 0;
+ var obj = canvas;
+
+ do {
+
+ x += obj.offsetLeft;
+ y += obj.offsetTop;
+
+ obj = obj.offsetParent;
+
+ } while (obj && obj.tagName.toLowerCase() != 'body');
+
+ return [x, y];
+ }
+
+
+ /**
+ * Registers a graph object (used when the canvas is redrawn)
+ *
+ * @param object obj The object to be registered
+ */
+ RGraph.Register = function (obj)
+ {
+ var key = obj.id + '_' + obj.type;
+
+ RGraph.objects[key] = obj;
+ }
+
+
+ /**
+ * Causes all registered objects to be redrawn
+ *
+ * @param string An optional string indicating which canvas is not to be redrawn
+ * @param string An optional color to use to clear the canvas
+ */
+ RGraph.Redraw = function ()
+ {
+ for (i in RGraph.objects) {
+ // TODO FIXME Maybe include more intense checking for whether the object is an RGraph object, eg obj.isRGraph == true ...?
+ if (
+ typeof(i) == 'string'
+ && typeof(RGraph.objects[i]) == 'object'
+ && typeof(RGraph.objects[i].type) == 'string'
+ && RGraph.objects[i].isRGraph) {
+
+ if (!arguments[0] || arguments[0] != RGraph.objects[i].id) {
+ RGraph.Clear(RGraph.objects[i].canvas, arguments[1] ? arguments[1] : null);
+ RGraph.objects[i].Draw();
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Loosly mimicks the PHP function print_r();
+ */
+ RGraph.pr = function (obj)
+ {
+ var str = '';
+ var indent = (arguments[2] ? arguments[2] : '');
+
+ switch (typeof(obj)) {
+ case 'number':
+ if (indent == '') {
+ str+= 'Number: '
+ }
+ str += String(obj);
+ break;
+
+ case 'string':
+ if (indent == '') {
+ str+= 'String (' + obj.length + '):'
+ }
+ str += '"' + String(obj) + '"';
+ break;
+
+ case 'object':
+ // In case of null
+ if (obj == null) {
+ str += 'null';
+ break;
+ }
+
+ str += 'Object\n' + indent + '(\n';
+
+ for (var i=0; i<obj.length; ++i) {
+ str += indent + ' ' + i + ' => ' + RGraph.pr(obj[i], true, indent + ' ') + '\n';
+ }
+
+ var str = str + indent + ')';
+ break;
+
+ case 'function':
+ str += obj;
+ break;
+
+ case 'boolean':
+ str += 'Boolean: ' + (obj ? 'true' : 'false');
+ break;
+ }
+
+ /**
+ * Finished, now either return if we're in a recursed call, or alert()
+ * if we're not.
+ */
+ if (arguments[1]) {
+ return str;
+ } else {
+ alert(str);
+ }
+ }
+
+
+ /**
+ * The RGraph registry Set() function
+ *
+ * @param string name The name of the key
+ * @param mixed value The value to set
+ * @return mixed Returns the same value as you pass it
+ */
+ RGraph.Registry.Set = function (name, value)
+ {
+ // Store the setting
+ RGraph.Registry.store[name] = value;
+
+ // Don't really need to do this, but ho-hum
+ return value;
+ }
+
+
+ /**
+ * The RGraph registry Get() function
+ *
+ * @param string name The name of the particular setting to fetch
+ * @return mixed The value if exists, null otherwise
+ */
+ RGraph.Registry.Get = function (name)
+ {
+ //return RGraph.Registry.store[name] == null ? null : RGraph.Registry.store[name];
+ return RGraph.Registry.store[name];
+ }
+
+
+ /**
+ * This function draws the background for the bar chart, line chart and scatter chart.
+ *
+ * @param object obj The graph object
+ */
+ RGraph.background.Draw = function (obj)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var height = 0;
+ var gutter = obj.Get('chart.gutter');
+ var variant = obj.Get('chart.variant');
+
+ context.fillStyle = obj.Get('chart.text.color');
+
+ // If it's a bar and 3D variant, translate
+ if (variant == '3d') {
+ context.save();
+ context.translate(10, -5);
+ }
+
+ // X axis title
+ if (typeof(obj.Get('chart.title.xaxis')) == 'string' && obj.Get('chart.title.xaxis').length) {
+
+ var size = obj.Get('chart.text.size');
+ var font = obj.Get('chart.text.font');
+
+ context.beginPath();
+ RGraph.Text(context, font, size + 2, obj.canvas.width / 2, canvas.height - (gutter * obj.Get('chart.title.xaxis.pos')), obj.Get('chart.title.xaxis'), 'center', 'center', false, false, false, true);
+ context.fill();
+ }
+
+ // Y axis title
+ if (typeof(obj.Get('chart.title.yaxis')) == 'string' && obj.Get('chart.title.yaxis').length) {
+
+ var size = obj.Get('chart.text.size');
+ var font = obj.Get('chart.text.font');
+
+ context.beginPath();
+ RGraph.Text(context, font, size + 2, gutter * obj.Get('chart.title.yaxis.pos'), canvas.height / 2, obj.Get('chart.title.yaxis'), 'center', 'center', false, 270, false, true);
+ context.fill();
+ }
+
+ obj.context.beginPath();
+
+ // Draw the horizontal bars
+ context.fillStyle = obj.Get('chart.background.barcolor1');
+ height = (obj.canvas.height - obj.Get('chart.gutter'));
+
+ for (var i=gutter; i < height ; i+=80) {
+ obj.context.fillRect(gutter, i, obj.canvas.width - (gutter * 2), Math.min(40, obj.canvas.height - gutter - i) );
+ }
+
+ context.fillStyle = obj.Get('chart.background.barcolor2');
+ height = (obj.canvas.height - gutter);
+
+ for (var i= (40 + gutter); i < height; i+=80) {
+ obj.context.fillRect(gutter, i, obj.canvas.width - (gutter * 2), i + 40 > (obj.canvas.height - gutter) ? obj.canvas.height - (gutter + i) : 40);
+ }
+
+ context.stroke();
+
+
+ // Draw the background grid
+ if (obj.Get('chart.background.grid')) {
+
+ // If autofit is specified, use the .numhlines and .numvlines along with the width to work
+ // out the hsize and vsize
+ if (obj.Get('chart.background.grid.autofit')) {
+ var vsize = (canvas.width - (2 * obj.Get('chart.gutter')) - (obj.type == 'gantt' ? 2 * obj.Get('chart.gutter') : 0)) / obj.Get('chart.background.grid.autofit.numvlines');
+ var hsize = (canvas.height - (2 * obj.Get('chart.gutter'))) / obj.Get('chart.background.grid.autofit.numhlines');
+
+ obj.Set('chart.background.grid.vsize', vsize);
+ obj.Set('chart.background.grid.hsize', hsize);
+ }
+
+ context.beginPath();
+ context.lineWidth = obj.Get('chart.background.grid.width') ? obj.Get('chart.background.grid.width') : 1;
+ context.strokeStyle = obj.Get('chart.background.grid.color');
+
+ // Draw the horizontal lines
+ if (obj.Get('chart.background.grid.hlines')) {
+ height = (canvas.height - gutter)
+ for (y=gutter; y < height; y+=obj.Get('chart.background.grid.hsize')) {
+ context.moveTo(gutter, y);
+ context.lineTo(canvas.width - gutter, y);
+ }
+ }
+
+ if (obj.Get('chart.background.grid.vlines')) {
+ // Draw the vertical lines
+ var width = (canvas.width - gutter)
+ for (x=gutter + (obj.type == 'gantt' ? (2 * gutter) : 0); x<=width; x+=obj.Get('chart.background.grid.vsize')) {
+ context.moveTo(x, gutter);
+ context.lineTo(x, obj.canvas.height - gutter);
+ }
+ }
+
+ if (obj.Get('chart.background.grid.border')) {
+ // Make sure a rectangle, the same colour as the grid goes around the graph
+ context.strokeStyle = obj.Get('chart.background.grid.color');
+ context.strokeRect(gutter, gutter, canvas.width - (2 * gutter), canvas.height - (2 * gutter));
+ }
+ }
+
+ context.stroke();
+
+ // If it's a bar and 3D variant, translate
+ if (variant == '3d') {
+ context.restore();
+ }
+
+ // Draw the title if one is set
+ if ( typeof(obj.Get('chart.title')) == 'string') {
+
+ if (obj.type == 'gantt') {
+ gutter /= 2;
+ }
+
+ RGraph.DrawTitle(canvas, obj.Get('chart.title'), gutter, null, obj.Get('chart.text.size') + 2);
+ }
+
+ context.stroke();
+ }
+
+
+ /**
+ * Returns the day number for a particular date. Eg 1st February would be 32
+ *
+ * @param object obj A date object
+ * @return int The day number of the given date
+ */
+ RGraph.GetDays = function (obj)
+ {
+ var year = obj.getFullYear();
+ var days = obj.getDate();
+ var month = obj.getMonth();
+
+ if (month == 0) return days;
+ if (month >= 1) days += 31;
+ if (month >= 2) days += 28;
+
+ // Leap years. Crude, but if this code is still being used
+ // when it stops working, then you have my permission to shoot
+ // me. Oh, you won't be able to - I'll be dead...
+ if (year >= 2008 && year % 4 == 0) days += 1;
+
+ if (month >= 3) days += 31;
+ if (month >= 4) days += 30;
+ if (month >= 5) days += 31;
+ if (month >= 6) days += 30;
+ if (month >= 7) days += 31;
+ if (month >= 8) days += 31;
+ if (month >= 9) days += 30;
+ if (month >= 10) days += 31;
+ if (month >= 11) days += 30;
+
+ return days;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
+ * Draws the graph key (used by various graphs)
+ *
+ * @param object obj The graph object
+ * @param array key An array of the texts to be listed in the key
+ * @param colors An array of the colors to be used
+ */
+ RGraph.DrawKey = function (obj, key, colors)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ context.lineWidth = 1;
+
+ context.beginPath();
+
+ /**
+ * Key positioned in the gutter
+ */
+ var keypos = obj.Get('chart.key.position');
+ var textsize = obj.Get('chart.text.size');
+ var gutter = obj.Get('chart.gutter');
+
+ /**
+ * Change the older chart.key.vpos to chart.key.position.y
+ */
+ if (typeof(obj.Get('chart.key.vpos')) == 'number') {
+ obj.Set('chart.key.position.y', obj.Get('chart.key.vpos') * gutter);
+ }
+
+ if (keypos && keypos == 'gutter') {
+
+ RGraph.DrawKey_gutter(obj, key, colors);
+
+
+ /**
+ * In-graph style key
+ */
+ } else if (keypos && keypos == 'graph') {
+
+ RGraph.DrawKey_graph(obj, key, colors);
+
+ } else {
+ alert('[COMMON] (' + obj.id + ') Unknown key position: ' + keypos);
+ }
+ }
+
+
+
+
+
+ /**
+ * This does the actual drawing of the key when it's in the graph
+ *
+ * @param object obj The graph object
+ * @param array key The key items to draw
+ * @param array colors An aray of colors that the key will use
+ */
+ RGraph.DrawKey_graph = function (obj, key, colors)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var text_size = typeof(obj.Get('chart.key.text.size')) == 'number' ? obj.Get('chart.key.text.size') : obj.Get('chart.text.size');
+ var text_font = obj.Get('chart.text.font');
+ var gutter = obj.Get('chart.gutter');
+ var hpos = obj.Get('chart.yaxispos') == 'right' ? gutter + 10 : canvas.width - gutter - 10;
+ var vpos = gutter + 10;
+ var title = obj.Get('chart.title');
+ var blob_size = text_size; // The blob of color
+ var hmargin = 8; // This is the size of the gaps between the blob of color and the text
+ var vmargin = 4; // This is the vertical margin of the key
+ var fillstyle = obj.Get('chart.key.background');
+ var strokestyle = 'black';
+ var height = 0;
+ var width = 0;
+
+
+ // Need to set this so that measuring the text works out OK
+ context.font = text_size + 'pt ' + obj.Get('chart.text.font');
+
+ // Work out the longest bit of text
+ for (i=0; i<key.length; ++i) {
+ width = Math.max(width, context.measureText(key[i]).width);
+ }
+
+ width += 5;
+ width += blob_size;
+ width += 5;
+ width += 5;
+ width += 5;
+
+ /**
+ * Now we know the width, we can move the key left more accurately
+ */
+ if ( obj.Get('chart.yaxispos') == 'left'
+ || (obj.type == 'pie' && !obj.Get('chart.yaxispos'))
+ || (obj.type == 'hbar' && !obj.Get('chart.yaxispos'))
+ || (obj.type == 'rscatter' && !obj.Get('chart.yaxispos'))
+ || (obj.type == 'tradar' && !obj.Get('chart.yaxispos'))
+ || (obj.type == 'rose' && !obj.Get('chart.yaxispos'))
+ || (obj.type == 'funnel' && !obj.Get('chart.yaxispos'))
+ ) {
+
+ hpos -= width;
+ }
+
+ /**
+ * Specific location coordinates
+ */
+ if (typeof(obj.Get('chart.key.position.x')) == 'number') {
+ hpos = obj.Get('chart.key.position.x');
+ }
+
+ if (typeof(obj.Get('chart.key.position.y')) == 'number') {
+ vpos = obj.Get('chart.key.position.y');
+ }
+
+
+ // Stipulate the shadow for the key box
+ if (obj.Get('chart.key.shadow')) {
+ context.shadowColor = obj.Get('chart.key.shadow.color');
+ context.shadowBlur = obj.Get('chart.key.shadow.blur');
+ context.shadowOffsetX = obj.Get('chart.key.shadow.offsetx');
+ context.shadowOffsetY = obj.Get('chart.key.shadow.offsety');
+ }
+
+
+
+
+ // Draw the box that the key resides in
+ context.beginPath();
+ context.fillStyle = obj.Get('chart.key.background');
+ context.strokeStyle = 'black';
+
+
+ if (arguments[3] != false) {
+ /*
+ // Manually draw the MSIE shadow
+ if (RGraph.isIE8() && obj.Get('chart.key.shadow')) {
+ context.beginPath();
+ context.fillStyle = '#666';
+
+ if (obj.Get('chart.key.rounded')) {
+ RGraph.NoShadow(obj);
+ context.beginPath();
+ RGraph.filledCurvyRect(context,
+ xpos + obj.Get('chart.key.shadow.offsetx'),
+ gutter + 5 + obj.Get('chart.key.shadow.offsety'),
+ width - 5,
+ 5 + ( (textsize + 5) * key.length),
+ 5);
+ context.closePath();
+ context.fill();
+
+ } else {
+ context.fillRect(xpos + 2, gutter + 5 + 2, width - 5, 5 + ( (textsize + 5) * key.length));
+ }
+ context.fill();
+ context.fillStyle = obj.Get('chart.key.background');
+ }
+ */
+
+ // The older square rectangled key
+ if (obj.Get('chart.key.rounded') == true) {
+ context.beginPath();
+ context.strokeStyle = strokestyle;
+ RGraph.strokedCurvyRect(context, hpos, vpos, width - 5, 5 + ( (text_size + 5) * key.length),4);
+
+ context.stroke();
+ context.fill();
+
+ RGraph.NoShadow(obj);
+
+ } else {
+ context.strokeRect(hpos, vpos, width - 5, 5 + ( (text_size + 5) * key.length));
+ context.fillRect(hpos, vpos, width - 5, 5 + ( (text_size + 5) * key.length));
+ }
+ }
+
+ RGraph.NoShadow(obj);
+
+ context.beginPath();
+ // Draw the labels given
+ for (var i=key.length - 1; i>=0; i--) {
+ var j = Number(i) + 1;
+
+ // Draw the blob of color
+ if (obj.Get('chart.key.color.shape') == 'circle') {
+ context.beginPath();
+ context.strokeStyle = 'rgba(0,0,0,0)';
+ context.fillStyle = colors[i];
+ context.arc(hpos + 5 + (blob_size / 2), vpos + (5 * j) + (text_size * j) - text_size + (blob_size / 2), blob_size / 2, 0, 6.26, 0);
+ context.fill();
+
+ } else if (obj.Get('chart.key.color.shape') == 'line') {
+ context.beginPath();
+ context.strokeStyle = colors[i];
+ context.moveTo(hpos + 5, vpos + (5 * j) + (text_size * j) - text_size + (blob_size / 2));
+ context.lineTo(hpos + blob_size + 5, vpos + (5 * j) + (text_size * j) - text_size + (blob_size / 2));
+ context.stroke();
+
+ } else {
+ context.fillStyle = colors[i];
+ context.fillRect(hpos + 5, vpos + (5 * j) + (text_size * j) - text_size, text_size, text_size + 1);
+ }
+
+ context.beginPath();
+
+ context.fillStyle = 'black';
+
+ RGraph.Text(context,
+ text_font,
+ text_size,
+ hpos + blob_size + 5 + 5,
+ vpos + (5 * j) + (text_size * j),
+ key[i]);
+ }
+ context.fill();
+ }
+
+
+
+
+
+
+ /**
+ * This does the actual drawing of the key when it's in the gutter
+ *
+ * @param object obj The graph object
+ * @param array key The key items to draw
+ * @param array colors An aray of colors that the key will use
+ */
+ RGraph.DrawKey_gutter = function (obj, key, colors)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var text_size = typeof(obj.Get('chart.key.text.size')) == 'number' ? obj.Get('chart.key.text.size') : obj.Get('chart.text.size');
+ var text_font = obj.Get('chart.text.font');
+ var gutter = obj.Get('chart.gutter');
+ var hpos = canvas.width / 2;
+ var vpos = (gutter / 2) - 5;
+ var title = obj.Get('chart.title');
+ var blob_size = text_size; // The blob of color
+ var hmargin = 8; // This is the size of the gaps between the blob of color and the text
+ var vmargin = 4; // This is the vertical margin of the key
+ var fillstyle = obj.Get('chart.key.background');
+ var strokestyle = 'black';
+ var length = 0;
+
+
+
+ // Need to work out the length of the key first
+ context.font = text_size + 'pt ' + text_font;
+ for (i=0; i<key.length; ++i) {
+ length += hmargin;
+ length += blob_size;
+ length += hmargin;
+ length += context.measureText(key[i]).width;
+ }
+ length += hmargin;
+
+
+
+
+ /**
+ * Work out hpos since in the Pie it isn't necessarily dead center
+ */
+ if (obj.type == 'pie') {
+ if (obj.Get('chart.align') == 'left') {
+ var hpos = obj.radius + obj.Get('chart.gutter');
+
+ } else if (obj.Get('chart.align') == 'right') {
+ var hpos = obj.canvas.width - obj.radius - obj.Get('chart.gutter');
+
+ } else {
+ hpos = canvas.width / 2;
+ }
+ }
+
+
+
+
+
+ /**
+ * This makes the key centered
+ */
+ hpos -= (length / 2);
+
+
+ /**
+ * Override the horizontal/vertical positioning
+ */
+ if (typeof(obj.Get('chart.key.position.x')) == 'number') {
+ hpos = obj.Get('chart.key.position.x');
+ }
+ if (typeof(obj.Get('chart.key.position.y')) == 'number') {
+ vpos = obj.Get('chart.key.position.y');
+ }
+
+
+
+ /**
+ * Draw the box that the key sits in
+ */
+ if (obj.Get('chart.key.position.gutter.boxed')) {
+
+ if (obj.Get('chart.key.shadow')) {
+ context.shadowColor = obj.Get('chart.key.shadow.color');
+ context.shadowBlur = obj.Get('chart.key.shadow.blur');
+ context.shadowOffsetX = obj.Get('chart.key.shadow.offsetx');
+ context.shadowOffsetY = obj.Get('chart.key.shadow.offsety');
+ }
+
+
+ context.beginPath();
+ context.fillStyle = fillstyle;
+ context.strokeStyle = strokestyle;
+
+ if (obj.Get('chart.key.rounded')) {
+ RGraph.strokedCurvyRect(context, hpos, vpos - vmargin, length, text_size + vmargin + vmargin)
+ // Odd... RGraph.filledCurvyRect(context, hpos, vpos - vmargin, length, text_size + vmargin + vmargin);
+ } else {
+ context.strokeRect(hpos, vpos - vmargin, length, text_size + vmargin + vmargin);
+ context.fillRect(hpos, vpos - vmargin, length, text_size + vmargin + vmargin);
+ }
+
+ context.stroke();
+ context.fill();
+
+
+ RGraph.NoShadow(obj);
+ }
+
+
+ /**
+ * Draw the blobs of color and the text
+ */
+ for (var i=0, pos=hpos; i<key.length; ++i) {
+ pos += hmargin;
+
+ // Draw the blob of color - line
+ if (obj.Get('chart.key.color.shape') =='line') {
+
+ context.beginPath();
+ context.strokeStyle = colors[i];
+ context.moveTo(pos, vpos + (blob_size / 2));
+ context.lineTo(pos + blob_size, vpos + (blob_size / 2));
+ context.stroke();
+
+ // Circle
+ } else if (obj.Get('chart.key.color.shape') == 'circle') {
+
+ context.beginPath();
+ context.fillStyle = colors[i];
+ context.moveTo(pos, vpos + (blob_size / 2));
+ context.arc(pos + (blob_size / 2), vpos + (blob_size / 2), (blob_size / 2), 0, 6.28, 0);
+ context.fill();
+
+
+ } else {
+
+ context.beginPath();
+ context.fillStyle = colors[i];
+ context.fillRect(pos, vpos, blob_size, blob_size);
+ context.fill();
+ }
+
+ pos += blob_size;
+
+ pos += hmargin;
+
+ context.beginPath();
+ context.fillStyle = 'black';
+ RGraph.Text(context, text_font, text_size, pos, vpos + text_size - 1, key[i]);
+ context.fill();
+ pos += context.measureText(key[i]).width;
+ }
+ }
+
+
+
+
+
+
+ /**
+ * A shortcut for RGraph.pr()
+ */
+ function pd(variable)
+ {
+ RGraph.pr(variable);
+ }
+
+ function p(variable)
+ {
+ RGraph.pr(variable);
+ }
+
+ /**
+ * A shortcut for console.log - as used by Firebug and Chromes console
+ */
+ function cl (variable)
+ {
+ return console.log(variable);
+ }
+
+
+ /**
+ * Makes a clone of an object
+ *
+ * @param obj val The object to clone
+ */
+ RGraph.array_clone = function (obj)
+ {
+ if(obj == null || typeof(obj) != 'object') {
+ return obj;
+ }
+
+ var temp = [];
+ //var temp = new obj.constructor();
+
+ for(var i=0;i<obj.length; ++i) {
+ temp[i] = RGraph.array_clone(obj[i]);
+ }
+
+ return temp;
+ }
+
+
+ /**
+ * This function reverses an array
+ */
+ RGraph.array_reverse = function (arr)
+ {
+ var newarr = [];
+
+ for (var i=arr.length - 1; i>=0; i--) {
+ newarr.push(arr[i]);
+ }
+
+ return newarr;
+ }
+
+
+ /**
+ * Formats a number with thousand seperators so it's easier to read
+ *
+ * @param integer num The number to format
+ * @param string The (optional) string to prepend to the string
+ * @param string The (optional) string to ap
+ * pend to the string
+ * @return string The formatted number
+ */
+ RGraph.number_format = function (obj, num)
+ {
+ var i;
+ var prepend = arguments[2] ? String(arguments[2]) : '';
+ var append = arguments[3] ? String(arguments[3]) : '';
+ var output = '';
+ var decimal = '';
+ var decimal_seperator = obj.Get('chart.scale.point') ? obj.Get('chart.scale.point') : '.';
+ var thousand_seperator = obj.Get('chart.scale.thousand') ? obj.Get('chart.scale.thousand') : ',';
+ RegExp.$1 = '';
+ var i,j;
+
+ // Ignore the preformatted version of "1e-2"
+ if (String(num).indexOf('e') > 0) {
+ return String(prepend + String(num) + append);
+ }
+
+ // We need then number as a string
+ num = String(num);
+
+ // Take off the decimal part - we re-append it later
+ if (num.indexOf('.') > 0) {
+ num = num.replace(/\.(.*)/, '');
+ decimal = RegExp.$1;
+ }
+
+ // Thousand seperator
+ //var seperator = arguments[1] ? String(arguments[1]) : ',';
+ var seperator = thousand_seperator;
+
+ /**
+ * Work backwards adding the thousand seperators
+ */
+ var foundPoint;
+ for (i=(num.length - 1),j=0; i>=0; j++,i--) {
+ var character = num.charAt(i);
+
+ if ( j % 3 == 0 && j != 0) {
+ output += seperator;
+ }
+
+ /**
+ * Build the output
+ */
+ output += character;
+ }
+
+ /**
+ * Now need to reverse the string
+ */
+ var rev = output;
+ output = '';
+ for (i=(rev.length - 1); i>=0; i--) {
+ output += rev.charAt(i);
+ }
+
+ // Tidy up
+ output = output.replace(/^-,/, '-');
+
+ // Reappend the decimal
+ if (decimal.length) {
+ output = output + decimal_seperator + decimal;
+ decimal = '';
+ RegExp.$1 = '';
+ }
+
+ // Minor bugette
+ if (output.charAt(0) == '-') {
+ output *= -1;
+ prepend = '-' + prepend;
+ }
+
+ return prepend + output + append;
+ }
+
+
+ /**
+ * Draws horizontal coloured bars on something like the bar, line or scatter
+ */
+ RGraph.DrawBars = function (obj)
+ {
+ var hbars = obj.Get('chart.background.hbars');
+
+ /**
+ * Draws a horizontal bar
+ */
+ obj.context.beginPath();
+
+ for (i=0; i<hbars.length; ++i) {
+
+ // If null is specified as the "height", set it to the upper max value
+ if (hbars[i][1] == null) {
+ hbars[i][1] = obj.max;
+
+ // If the first index plus the second index is greater than the max value, adjust accordingly
+ } else if (hbars[i][0] + hbars[i][1] > obj.max) {
+ hbars[i][1] = obj.max - hbars[i][0];
+ }
+
+
+ // If height is negative, and the abs() value is greater than .max, use a negative max instead
+ if (Math.abs(hbars[i][1]) > obj.max) {
+ hbars[i][1] = -1 * obj.max;
+ }
+
+
+ // If start point is greater than max, change it to max
+ if (Math.abs(hbars[i][0]) > obj.max) {
+ hbars[i][0] = obj.max;
+ }
+
+ // If start point plus height is less than negative max, use the negative max plus the start point
+ if (hbars[i][0] + hbars[i][1] < (-1 * obj.max) ) {
+ hbars[i][1] = -1 * (obj.max + hbars[i][0]);
+ }
+
+ // If the X axis is at the bottom, and a negative max is given, warn the user
+ if (obj.Get('chart.xaxispos') == 'bottom' && (hbars[i][0] < 0 || (hbars[i][1] + hbars[i][1] < 0)) ) {
+ alert('[' + obj.type.toUpperCase() + ' (ID: ' + obj.id + ') BACKGROUND HBARS] You have a negative value in one of your background hbars values, whilst the X axis is in the center');
+ }
+
+ var ystart = (obj.grapharea - ((hbars[i][0] / obj.max) * obj.grapharea));
+ var height = (Math.min(hbars[i][1], obj.max - hbars[i][0]) / obj.max) * obj.grapharea;
+
+ // Account for the X axis being in the center
+ if (obj.Get('chart.xaxispos') == 'center') {
+ ystart /= 2;
+ height /= 2;
+ }
+
+ ystart += obj.Get('chart.gutter')
+
+ var x = obj.Get('chart.gutter');
+ var y = ystart - height;
+ var w = obj.canvas.width - (2 * obj.Get('chart.gutter'));
+ var h = height;
+
+ // Accommodate Opera :-/
+ if (navigator.userAgent.indexOf('Opera') != -1 && obj.Get('chart.xaxispos') == 'center' && h < 0) {
+ h *= -1;
+ y = y - h;
+ }
+
+ obj.context.fillStyle = hbars[i][2];
+ obj.context.fillRect(x, y, w, h);
+ }
+
+ obj.context.fill();
+ }
+
+
+ /**
+ * Draws in-graph labels.
+ *
+ * @param object obj The graph object
+ */
+ RGraph.DrawInGraphLabels = function (obj)
+ {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var labels = obj.Get('chart.labels.ingraph');
+ var labels_processed = [];
+
+ // Defaults
+ var fgcolor = 'black';
+ var bgcolor = 'white';
+ var direction = 1;
+
+ if (!labels) {
+ return;
+ }
+
+ /**
+ * Preprocess the labels array. Numbers are expanded
+ */
+ for (var i=0; i<labels.length; ++i) {
+ if (typeof(labels[i]) == 'number') {
+ for (var j=0; j<labels[i]; ++j) {
+ labels_processed.push(null);
+ }
+ } else if (typeof(labels[i]) == 'string' || typeof(labels[i]) == 'object') {
+ labels_processed.push(labels[i]);
+
+ } else {
+ labels_processed.push('');
+ }
+ }
+
+ /**
+ * Turn off any shadow
+ */
+ RGraph.NoShadow(obj);
+
+ if (labels_processed && labels_processed.length > 0) {
+
+ for (var i=0; i<labels_processed.length; ++i) {
+ if (labels_processed[i]) {
+ var coords = obj.coords[i];
+
+ if (coords && coords.length > 0) {
+ var x = (obj.type == 'bar' ? coords[0] + (coords[2] / 2) : coords[0]);
+ var y = (obj.type == 'bar' ? coords[1] + (coords[3] / 2) : coords[1]);
+ var length = typeof(labels_processed[i][4]) == 'number' ? labels_processed[i][4] : 25;
+
+ context.beginPath();
+ context.fillStyle = 'black';
+ context.strokeStyle = 'black';
+
+
+ if (obj.type == 'bar') {
+
+ if (obj.Get('chart.variant') == 'dot') {
+ context.moveTo(x, obj.coords[i][1] - 5);
+ context.lineTo(x, obj.coords[i][1] - 5 - length);
+
+ var text_x = x;
+ var text_y = obj.coords[i][1] - 5 - length;
+
+ } else if (obj.Get('chart.variant') == 'arrow') {
+ context.moveTo(x, obj.coords[i][1] - 5);
+ context.lineTo(x, obj.coords[i][1] - 5 - length);
+
+ var text_x = x;
+ var text_y = obj.coords[i][1] - 5 - length;
+
+ } else {
+
+ context.arc(x, y, 2.5, 0, 6.28, 0);
+ context.moveTo(x, y);
+ context.lineTo(x, y - length);
+
+ var text_x = x;
+ var text_y = y - length;
+ }
+
+ context.stroke();
+ context.fill();
+
+
+ } else if (obj.type == 'line') {
+
+ if (
+ typeof(labels_processed[i]) == 'object' &&
+ typeof(labels_processed[i][3]) == 'number' &&
+ labels_processed[i][3] == -1
+ ) {
+
+ context.moveTo(x, y + 5);
+ context.lineTo(x, y + 5 + length);
+
+ context.stroke();
+ context.beginPath();
+
+ // This draws the arrow
+ context.moveTo(x, y + 5);
+ context.lineTo(x - 3, y + 10);
+ context.lineTo(x + 3, y + 10);
+ context.closePath();
+
+ var text_x = x;
+ var text_y = y + 5 + length;
+
+ } else {
+
+ var text_x = x;
+ var text_y = y - 5 - length;
+
+ context.moveTo(x, y - 5);
+ context.lineTo(x, y - 5 - length);
+
+ context.stroke();
+ context.beginPath();
+
+ // This draws the arrow
+ context.moveTo(x, y - 5);
+ context.lineTo(x - 3, y - 10);
+ context.lineTo(x + 3, y - 10);
+ context.closePath();
+ }
+
+ context.fill();
+ }
+
+
+ // Taken out on the 10th Nov 2010 - unnecessary
+ //var width = context.measureText(labels[i]).width;
+
+ context.beginPath();
+
+ // Fore ground color
+ context.fillStyle = (typeof(labels_processed[i]) == 'object' && typeof(labels_processed[i][1]) == 'string') ? labels_processed[i][1] : 'black';
+
+ RGraph.Text(context,
+ obj.Get('chart.text.font'),
+ obj.Get('chart.text.size'),
+ text_x,
+ text_y,
+ (typeof(labels_processed[i]) == 'object' && typeof(labels_processed[i][0]) == 'string') ? labels_processed[i][0] : labels_processed[i],
+ 'bottom',
+ 'center',
+ true,
+ null,
+ (typeof(labels_processed[i]) == 'object' && typeof(labels_processed[i][2]) == 'string') ? labels_processed[i][2] : 'white');
+ context.fill();
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * This function "fills in" key missing properties that various implementations lack
+ *
+ * @param object e The event object
+ */
+ RGraph.FixEventObject = function (e)
+ {
+ if (RGraph.isIE8()) {
+
+ var e = event;
+
+ e.pageX = (event.clientX + document.body.scrollLeft);
+ e.pageY = (event.clientY + document.body.scrollTop);
+ e.target = event.srcElement;
+
+ if (!document.body.scrollTop && document.documentElement.scrollTop) {
+ e.pageX += parseInt(document.documentElement.scrollLeft);
+ e.pageY += parseInt(document.documentElement.scrollTop);
+ }
+ }
+
+ // This is mainly for FF which doesn't provide offsetX
+ if (typeof(e.offsetX) == 'undefined' && typeof(e.offsetY) == 'undefined') {
+ var coords = RGraph.getMouseXY(e);
+ e.offsetX = coords[0];
+ e.offsetY = coords[1];
+ }
+
+ // Any browser that doesn't implement stopPropagation() (MSIE)
+ if (!e.stopPropagation) {
+ e.stopPropagation = function () {window.event.cancelBubble = true;}
+ }
+
+ return e;
+ }
+
+
+ /**
+ * Draw crosshairs if enabled
+ *
+ * @param object obj The graph object (from which we can get the context and canvas as required)
+ */
+ RGraph.DrawCrosshairs = function (obj)
+ {
+ if (obj.Get('chart.crosshairs')) {
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ // 5th November 2010 - removed now that tooltips are DOM2 based.
+ //if (obj.Get('chart.tooltips') && obj.Get('chart.tooltips').length > 0) {
+ //alert('[' + obj.type.toUpperCase() + '] Sorry - you cannot have crosshairs enabled with tooltips! Turning off crosshairs...');
+ //obj.Set('chart.crosshairs', false);
+ //return;
+ //}
+
+ canvas.onmousemove = function (e)
+ {
+ var e = RGraph.FixEventObject(e);
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var gutter = obj.Get('chart.gutter');
+ var width = canvas.width;
+ var height = canvas.height;
+ var adjustments = obj.Get('chart.tooltips.coords.adjust');
+
+ var mouseCoords = RGraph.getMouseXY(e);
+ var x = mouseCoords[0];
+ var y = mouseCoords[1];
+
+ if (typeof(adjustments) == 'object' && adjustments[0] && adjustments[1]) {
+ x = x - adjustments[0];
+ y = y - adjustments[1];
+ }
+
+ RGraph.Clear(canvas);
+ obj.Draw();
+
+ if ( x >= gutter
+ && y >= gutter
+ && x <= (width - gutter)
+ && y <= (height - gutter)
+ ) {
+
+ var linewidth = obj.Get('chart.crosshairs.linewidth');
+ context.lineWidth = linewidth ? linewidth : 1;
+
+ context.beginPath();
+ context.strokeStyle = obj.Get('chart.crosshairs.color');
+
+ // Draw a top vertical line
+ context.moveTo(x, gutter);
+ context.lineTo(x, height - gutter);
+
+ // Draw a horizontal line
+ context.moveTo(gutter, y);
+ context.lineTo(width - gutter, y);
+
+ context.stroke();
+
+ /**
+ * Need to show the coords?
+ */
+ if (obj.Get('chart.crosshairs.coords')) {
+ if (obj.type == 'scatter') {
+
+ var xCoord = (((x - obj.Get('chart.gutter')) / (obj.canvas.width - (2 * obj.Get('chart.gutter')))) * (obj.Get('chart.xmax') - obj.Get('chart.xmin'))) + obj.Get('chart.xmin');
+ xCoord = xCoord.toFixed(obj.Get('chart.scale.decimals'));
+ var yCoord = obj.max - (((y - obj.Get('chart.gutter')) / (obj.canvas.height - (2 * obj.Get('chart.gutter')))) * obj.max);
+
+ if (obj.type == 'scatter' && obj.Get('chart.xaxispos') == 'center') {
+ yCoord = (yCoord - (obj.max / 2)) * 2;
+ }
+
+ yCoord = yCoord.toFixed(obj.Get('chart.scale.decimals'));
+ var div = RGraph.Registry.Get('chart.coordinates.coords.div');
+ var mouseCoords = RGraph.getMouseXY(e);
+ var canvasXY = RGraph.getCanvasXY(canvas);
+
+ if (!div) {
+
+ div = document.createElement('DIV');
+ div.__object__ = obj;
+ div.style.position = 'absolute';
+ div.style.backgroundColor = 'white';
+ div.style.border = '1px solid black';
+ div.style.fontFamily = 'Arial, Verdana, sans-serif';
+ div.style.fontSize = '10pt'
+ div.style.padding = '2px';
+ div.style.opacity = 1;
+ div.style.WebkitBorderRadius = '3px';
+ div.style.borderRadius = '3px';
+ div.style.MozBorderRadius = '3px';
+ document.body.appendChild(div);
+
+ RGraph.Registry.Set('chart.coordinates.coords.div', div);
+ }
+
+ // Convert the X/Y pixel coords to correspond to the scale
+
+ div.style.opacity = 1;
+ div.style.display = 'inline';
+
+ if (!obj.Get('chart.crosshairs.coords.fixed')) {
+ div.style.left = Math.max(2, (e.pageX - div.offsetWidth - 3)) + 'px';
+ div.style.top = Math.max(2, (e.pageY - div.offsetHeight - 3)) + 'px';
+ } else {
+ div.style.left = canvasXY[0] + obj.Get('chart.gutter') + 3 + 'px';
+ div.style.top = canvasXY[1] + obj.Get('chart.gutter') + 3 + 'px';
+ }
+
+ div.innerHTML = '<span style="color: #666">' + obj.Get('chart.crosshairs.coords.labels.x') + ':</span> ' + xCoord + '<br><span style="color: #666">' + obj.Get('chart.crosshairs.coords.labels.y') + ':</span> ' + yCoord;
+
+ canvas.addEventListener('mouseout', RGraph.HideCrosshairCoords, false);
+
+ } else {
+ alert('[RGRAPH] Showing crosshair coordinates is only supported on the Scatter chart');
+ }
+ }
+ } else {
+ RGraph.HideCrosshairCoords();
+ }
+ }
+ }
+ }
+
+ /**
+ * Thisz function hides the crosshairs coordinates
+ */
+ RGraph.HideCrosshairCoords = function ()
+ {
+ var div = RGraph.Registry.Get('chart.coordinates.coords.div');
+
+ if ( div
+ && div.style.opacity == 1
+ && div.__object__.Get('chart.crosshairs.coords.fadeout')
+ ) {
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.9;}, 50);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.8;}, 100);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.7;}, 150);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.6;}, 200);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.5;}, 250);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.4;}, 300);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.3;}, 350);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.2;}, 400);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0.1;}, 450);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.opacity = 0;}, 500);
+ setTimeout(function() {RGraph.Registry.Get('chart.coordinates.coords.div').style.display = 'none';}, 550);
+ }
+ }
+
+
+ /**
+ * Trims the right hand side of a string. Removes SPACE, TAB
+ * CR and LF.
+ *
+ * @param string str The string to trim
+ */
+ RGraph.rtrim = function (str)
+ {
+ return str.replace(/( |\n|\r|\t)+$/, '');
+ }
+
+
+ /**
+ * Draws the3D axes/background
+ */
+ RGraph.Draw3DAxes = function (obj)
+ {
+ var gutter = obj.Get('chart.gutter');
+ var context = obj.context;
+ var canvas = obj.canvas;
+
+ context.strokeStyle = '#aaa';
+ context.fillStyle = '#ddd';
+
+ // Draw the vertical left side
+ context.beginPath();
+ context.moveTo(gutter, gutter);
+ context.lineTo(gutter + 10, gutter - 5);
+ context.lineTo(gutter + 10, canvas.height - gutter - 5);
+ context.lineTo(gutter, canvas.height - gutter);
+ context.closePath();
+
+ context.stroke();
+ context.fill();
+
+ // Draw the bottom floor
+ context.beginPath();
+ context.moveTo(gutter, canvas.height - gutter);
+ context.lineTo(gutter + 10, canvas.height - gutter - 5);
+ context.lineTo(canvas.width - gutter + 10, canvas.height - gutter - 5);
+ context.lineTo(canvas.width - gutter, canvas.height - gutter);
+ context.closePath();
+
+ context.stroke();
+ context.fill();
+ }
+
+ /**
+ * Turns off any shadow
+ *
+ * @param object obj The graph object
+ */
+ RGraph.NoShadow = function (obj)
+ {
+ obj.context.shadowColor = 'rgba(0,0,0,0)';
+ obj.context.shadowBlur = 0;
+ obj.context.shadowOffsetX = 0;
+ obj.context.shadowOffsetY = 0;
+ }
+
+
+ /**
+ * Sets the four shadow properties - a shortcut function
+ *
+ * @param object obj Your graph object
+ * @param string color The shadow color
+ * @param number offsetx The shadows X offset
+ * @param number offsety The shadows Y offset
+ * @param number blur The blurring effect applied to the shadow
+ */
+ RGraph.SetShadow = function (obj, color, offsetx, offsety, blur)
+ {
+ obj.context.shadowColor = color;
+ obj.context.shadowOffsetX = offsetx;
+ obj.context.shadowOffsetY = offsety;
+ obj.context.shadowBlur = blur;
+ }
+
+
+ /**
+ * This function attempts to "fill in" missing functions from the canvas
+ * context object. Only two at the moment - measureText() nd fillText().
+ *
+ * @param object context The canvas 2D context
+ */
+ RGraph.OldBrowserCompat = function (context)
+ {
+ if (!context.measureText) {
+
+ // This emulates the measureText() function
+ context.measureText = function (text)
+ {
+ var textObj = document.createElement('DIV');
+ textObj.innerHTML = text;
+ textObj.style.backgroundColor = 'white';
+ textObj.style.position = 'absolute';
+ textObj.style.top = -100
+ textObj.style.left = 0;
+ document.body.appendChild(textObj);
+
+ var width = {width: textObj.offsetWidth};
+
+ textObj.style.display = 'none';
+
+ return width;
+ }
+ }
+
+ if (!context.fillText) {
+ // This emulates the fillText() method
+ context.fillText = function (text, targetX, targetY)
+ {
+ return false;
+ }
+ }
+
+ // If IE8, add addEventListener()
+ if (!context.canvas.addEventListener) {
+ window.addEventListener = function (ev, func, bubble)
+ {
+ return this.attachEvent('on' + ev, func);
+ }
+
+ context.canvas.addEventListener = function (ev, func, bubble)
+ {
+ return this.attachEvent('on' + ev, func);
+ }
+ }
+ }
+
+
+ /**
+ * This function is for use with circular graph types, eg the Pie or Radar. Pass it your event object
+ * and it will pass you back the corresponding segment details as an array:
+ *
+ * [x, y, r, startAngle, endAngle]
+ *
+ * Angles are measured in degrees, and are measured from the "east" axis (just like the canvas).
+ *
+ * @param object e Your event object
+ */
+ RGraph.getSegment = function (e)
+ {
+ RGraph.FixEventObject(e);
+
+ // The optional arg provides a way of allowing some accuracy (pixels)
+ var accuracy = arguments[1] ? arguments[1] : 0;
+
+ var obj = e.target.__object__;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var mouseCoords = RGraph.getMouseXY(e);
+ var x = mouseCoords[0] - obj.centerx;
+ var y = mouseCoords[1] - obj.centery;
+ var r = obj.radius;
+ var theta = Math.atan(y / x); // RADIANS
+ var hyp = y / Math.sin(theta);
+ var angles = obj.angles;
+ var ret = [];
+ var hyp = (hyp < 0) ? hyp + accuracy : hyp - accuracy;
+
+
+ // Put theta in DEGREES
+ theta *= 57.3
+
+ // hyp should not be greater than radius if it's a Rose chart
+ if (obj.type == 'rose') {
+ if ( (isNaN(hyp) && Math.abs(mouseCoords[0]) < (obj.centerx - r) )
+ || (isNaN(hyp) && Math.abs(mouseCoords[0]) > (obj.centerx + r))
+ || (!isNaN(hyp) && Math.abs(hyp) > r)) {
+ return;
+ }
+ }
+
+ /**
+ * Account for the correct quadrant
+ */
+ if (x < 0 && y >= 0) {
+ theta += 180;
+ } else if (x < 0 && y < 0) {
+ theta += 180;
+ } else if (x > 0 && y < 0) {
+ theta += 360;
+ }
+
+ /**
+ * Account for the rose chart
+ */
+ if (obj.type == 'rose') {
+ theta += 90;
+ }
+
+ if (theta > 360) {
+ theta -= 360;
+ }
+
+ for (var i=0; i<angles.length; ++i) {
+ if (theta >= angles[i][0] && theta < angles[i][1]) {
+
+ hyp = Math.abs(hyp);
+
+ if (obj.type == 'rose' && hyp > angles[i][2]) {
+ return null;
+ }
+
+ if (!hyp || (obj.type == 'pie' && obj.radius && hyp > obj.radius) ) {
+ return null;
+ }
+
+ if (obj.type == 'pie' && obj.Get('chart.variant') == 'donut' && (hyp > obj.radius || hyp < (obj.radius / 2) ) ) {
+ return null;
+ }
+
+ ret[0] = obj.centerx;
+ ret[1] = obj.centery;
+ ret[2] = (obj.type == 'rose') ? angles[i][2] : obj.radius;
+ ret[3] = angles[i][0];
+ ret[4] = angles[i][1];
+ ret[5] = i;
+
+ if (obj.type == 'rose') {
+
+ ret[3] -= 90;
+ ret[4] -= 90;
+
+ if (x > 0 && y < 0) {
+ ret[3] += 360;
+ ret[4] += 360;
+ }
+ }
+
+ if (ret[3] < 0) ret[3] += 360;
+ if (ret[4] > 360) ret[4] -= 360;
+
+ return ret;
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * This is a function that can be used to run code asynchronously, which can
+ * be used to speed up the loading of you pages.
+ *
+ * @param string func This is the code to run. It can also be a function pointer.
+ * The front page graphs show this function in action. Basically
+ * each graphs code is made in a function, and that function is
+ * passed to this function to run asychronously.
+ */
+ RGraph.Async = function (func)
+ {
+ return setTimeout(func, arguments[1] ? arguments[1] : 1);
+ }
+
+
+ /**
+ * A custom random number function
+ *
+ * @param number min The minimum that the number should be
+ * @param number max The maximum that the number should be
+ * @param number How many decimal places there should be. Default for this is 0
+ */
+ RGraph.random = function (min, max)
+ {
+ var dp = arguments[2] ? arguments[2] : 0;
+ var r = Math.random();
+
+ return Number((((max - min) * r) + min).toFixed(dp));
+ }
+
+
+ /**
+ * Draws a rectangle with curvy corners
+ *
+ * @param context object The context
+ * @param x number The X coordinate (top left of the square)
+ * @param y number The Y coordinate (top left of the square)
+ * @param w number The width of the rectangle
+ * @param h number The height of the rectangle
+ * @param number The radius of the curved corners
+ * @param boolean Whether the top left corner is curvy
+ * @param boolean Whether the top right corner is curvy
+ * @param boolean Whether the bottom right corner is curvy
+ * @param boolean Whether the bottom left corner is curvy
+ */
+ RGraph.strokedCurvyRect = function (context, x, y, w, h)
+ {
+ // The corner radius
+ var r = arguments[5] ? arguments[5] : 3;
+
+ // The corners
+ var corner_tl = (arguments[6] || arguments[6] == null) ? true : false;
+ var corner_tr = (arguments[7] || arguments[7] == null) ? true : false;
+ var corner_br = (arguments[8] || arguments[8] == null) ? true : false;
+ var corner_bl = (arguments[9] || arguments[9] == null) ? true : false;
+
+ context.beginPath();
+
+ // Top left side
+ context.moveTo(x + (corner_tl ? r : 0), y);
+ context.lineTo(x + w - (corner_tr ? r : 0), y);
+
+ // Top right corner
+ if (corner_tr) {
+ context.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2, false);
+ }
+
+ // Top right side
+ context.lineTo(x + w, y + h - (corner_br ? r : 0) );
+
+ // Bottom right corner
+ if (corner_br) {
+ context.arc(x + w - r, y - r + h, r, Math.PI * 2, Math.PI * 0.5, false);
+ }
+
+ // Bottom right side
+ context.lineTo(x + (corner_bl ? r : 0), y + h);
+
+ // Bottom left corner
+ if (corner_bl) {
+ context.arc(x + r, y - r + h, r, Math.PI * 0.5, Math.PI, false);
+ }
+
+ // Bottom left side
+ context.lineTo(x, y + (corner_tl ? r : 0) );
+
+ // Top left corner
+ if (corner_tl) {
+ context.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5, false);
+ }
+
+ context.stroke();
+ }
+
+
+ /**
+ * Draws a filled rectangle with curvy corners
+ *
+ * @param context object The context
+ * @param x number The X coordinate (top left of the square)
+ * @param y number The Y coordinate (top left of the square)
+ * @param w number The width of the rectangle
+ * @param h number The height of the rectangle
+ * @param number The radius of the curved corners
+ * @param boolean Whether the top left corner is curvy
+ * @param boolean Whether the top right corner is curvy
+ * @param boolean Whether the bottom right corner is curvy
+ * @param boolean Whether the bottom left corner is curvy
+ */
+ RGraph.filledCurvyRect = function (context, x, y, w, h)
+ {
+ // The corner radius
+ var r = arguments[5] ? arguments[5] : 3;
+
+ // The corners
+ var corner_tl = (arguments[6] || arguments[6] == null) ? true : false;
+ var corner_tr = (arguments[7] || arguments[7] == null) ? true : false;
+ var corner_br = (arguments[8] || arguments[8] == null) ? true : false;
+ var corner_bl = (arguments[9] || arguments[9] == null) ? true : false;
+
+ context.beginPath();
+
+ // First draw the corners
+
+ // Top left corner
+ if (corner_tl) {
+ context.moveTo(x + r, y + r);
+ context.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI, false);
+ } else {
+ context.fillRect(x, y, r, r);
+ }
+
+ // Top right corner
+ if (corner_tr) {
+ context.moveTo(x + w - r, y + r);
+ context.arc(x + w - r, y + r, r, 1.5 * Math.PI, 0, false);
+ } else {
+ context.moveTo(x + w - r, y);
+ context.fillRect(x + w - r, y, r, r);
+ }
+
+
+ // Bottom right corner
+ if (corner_br) {
+ context.moveTo(x + w - r, y + h - r);
+ context.arc(x + w - r, y - r + h, r, 0, Math.PI / 2, false);
+ } else {
+ context.moveTo(x + w - r, y + h - r);
+ context.fillRect(x + w - r, y + h - r, r, r);
+ }
+
+ // Bottom left corner
+ if (corner_bl) {
+ context.moveTo(x + r, y + h - r);
+ context.arc(x + r, y - r + h, r, Math.PI / 2, Math.PI, false);
+ } else {
+ context.moveTo(x, y + h - r);
+ context.fillRect(x, y + h - r, r, r);
+ }
+
+ // Now fill it in
+ context.fillRect(x + r, y, w - r - r, h);
+ context.fillRect(x, y + r, r + 1, h - r - r);
+ context.fillRect(x + w - r - 1, y + r, r + 1, h - r - r);
+
+ context.fill();
+ }
+
+
+ /**
+ * A crude timing function
+ *
+ * @param string label The label to use for the time
+ */
+ RGraph.Timer = function (label)
+ {
+ var d = new Date();
+
+ // This uses the Firebug console
+ console.log(label + ': ' + d.getSeconds() + '.' + d.getMilliseconds());
+ }
+
+
+ /**
+ * Hides the palette if it's visible
+ */
+ RGraph.HidePalette = function ()
+ {
+ var div = RGraph.Registry.Get('palette');
+
+ if (typeof(div) == 'object' && div) {
+ div.style.visibility = 'hidden';
+ div.style.display = 'none';
+ RGraph.Registry.Set('palette', null);
+ }
+ }
+
+
+ /**
+ * Hides the zoomed canvas
+ */
+ RGraph.HideZoomedCanvas = function ()
+ {
+ if (typeof(__zoomedimage__) == 'object') {
+ obj = __zoomedimage__.obj;
+ } else {
+ return;
+ }
+
+ if (obj.Get('chart.zoom.fade.out')) {
+ for (var i=10,j=1; i>=0; --i, ++j) {
+ if (typeof(__zoomedimage__) == 'object') {
+ setTimeout("__zoomedimage__.style.opacity = " + String(i / 10), j * 30);
+ }
+ }
+
+ if (typeof(__zoomedbackground__) == 'object') {
+ setTimeout("__zoomedbackground__.style.opacity = " + String(i / 10), j * 30);
+ }
+ }
+
+ if (typeof(__zoomedimage__) == 'object') {
+ setTimeout("__zoomedimage__.style.display = 'none'", obj.Get('chart.zoom.fade.out') ? 310 : 0);
+ }
+
+ if (typeof(__zoomedbackground__) == 'object') {
+ setTimeout("__zoomedbackground__.style.display = 'none'", obj.Get('chart.zoom.fade.out') ? 310 : 0);
+ }
+ }
+
+
+ /**
+ * Adds an event handler
+ *
+ * @param object obj The graph object
+ * @param string event The name of the event, eg ontooltip
+ * @param object func The callback function
+ */
+ RGraph.AddCustomEventListener = function (obj, name, func)
+ {
+ if (typeof(RGraph.events[obj.id]) == 'undefined') {
+ RGraph.events[obj.id] = [];
+ }
+
+ RGraph.events[obj.id].push([obj, name, func]);
+ }
+
+
+ /**
+ * Used to fire one of the RGraph custom events
+ *
+ * @param object obj The graph object that fires the event
+ * @param string event The name of the event to fire
+ */
+ RGraph.FireCustomEvent = function (obj, name)
+ {
+ for (i in RGraph.events) {
+ if (typeof(i) == 'string' && i == obj.id && RGraph.events[i].length > 0) {
+ for(var j=0; j<RGraph.events[i].length; ++j) {
+ if (RGraph.events[i][j][1] == name) {
+ RGraph.events[i][j][2](obj);
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Checks the browser for traces of MSIE8
+ */
+ RGraph.isIE8 = function ()
+ {
+ return navigator.userAgent.indexOf('MSIE 8') > 0;
+ }
+
+
+ /**
+ * Checks the browser for traces of MSIE9
+ */
+ RGraph.isIE9 = function ()
+ {
+ return navigator.userAgent.indexOf('MSIE 9') > 0;
+ }
+
+
+ /**
+ * Checks the browser for traces of MSIE9
+ */
+ RGraph.isIE9up = function ()
+ {
+ navigator.userAgent.match(/MSIE (\d+)/);
+
+ return Number(RegExp.$1) >= 9;
+ }
+
+
+ /**
+ * This clears a canvases event handlers.
+ *
+ * @param string id The ID of the canvas whose event handlers will be cleared
+ */
+ RGraph.ClearEventListeners = function (id)
+ {
+ for (var i=0; i<RGraph.Registry.Get('chart.event.handlers').length; ++i) {
+
+ var el = RGraph.Registry.Get('chart.event.handlers')[i];
+
+ if (el && (el[0] == id || el[0] == ('window_' + id)) ) {
+ if (el[0].substring(0, 7) == 'window_') {
+ window.removeEventListener(el[1], el[2], false);
+ } else {
+ document.getElementById(id).removeEventListener(el[1], el[2], false);
+ }
+
+ RGraph.Registry.Get('chart.event.handlers')[i] = null;
+ }
+ }
+ }
+
+
+ /**
+ *
+ */
+ RGraph.AddEventListener = function (id, e, func)
+ {
+ RGraph.Registry.Get('chart.event.handlers').push([id, e, func]);
+ }
+
+
+ /**
+ * This function suggests a gutter size based on the widest left label. Given that the bottom
+ * labels may be longer, this may be a little out.
+ *
+ * @param object obj The graph object
+ * @param array data An array of graph data
+ * @return int A suggested gutter setting
+ */
+ RGraph.getGutterSuggest = function (obj, data)
+ {
+ var str = RGraph.number_format(obj, RGraph.array_max(RGraph.getScale(RGraph.array_max(data), obj)), obj.Get('chart.units.pre'), obj.Get('chart.units.post'));
+
+ // Take into account the HBar
+ if (obj.type == 'hbar') {
+
+ var str = '';
+ var len = 0;
+
+ for (var i=0; i<obj.Get('chart.labels').length; ++i) {
+ str = (obj.Get('chart.labels').length > str.length ? obj.Get('chart.labels')[i] : str);
+ }
+ }
+
+ obj.context.font = obj.Get('chart.text.size') + 'pt ' + obj.Get('chart.text.font');
+
+ len = obj.context.measureText(str).width + 5;
+
+ return (obj.type == 'hbar' ? len / 3 : len);
+ }
+
+
+ /**
+ * A basic Array shift gunction
+ *
+ * @param object The numerical array to work on
+ * @return The new array
+ */
+ RGraph.array_shift = function (arr)
+ {
+ var ret = [];
+
+ for (var i=1; i<arr.length; ++i) ret.push(arr[i]);
+
+ return ret;
+ }
+
+
+ /**
+ * If you prefer, you can use the SetConfig() method to set the configuration information
+ * for your chart. You may find that setting the configuration this way eases reuse.
+ *
+ * @param object obj The graph object
+ * @param object config The graph configuration information
+ */
+ RGraph.SetConfig = function (obj, config)
+ {
+ for (i in config) {
+ if (typeof(i) == 'string') {
+ obj.Set(i, config[i]);
+ }
+ }
+
+ return obj;
+ }
+
+
+ /**
+ * This function gets the canvas height. Defaults to the actual
+ * height but this can be changed by setting chart.height.
+ *
+ * @param object obj The graph object
+ */
+ RGraph.GetHeight = function (obj)
+ {
+ var height = obj.Get('chart.height');
+
+ return height ? height : obj.canvas.height;
+ }
+
+
+ /**
+ * This function gets the canvas width. Defaults to the actual
+ * width but this can be changed by setting chart.width.
+ *
+ * @param object obj The graph object
+ */
+ RGraph.GetWidth = function (obj)
+ {
+ var width = obj.Get('chart.width');
+
+ return width ? width : obj.canvas.width;
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+
+ /**
+ * This function can be used to allow resizing
+ *
+ * @param object obj Your graph object
+ */
+ RGraph.AllowResizing = function (obj)
+ {
+ if (obj.Get('chart.resizable')) {
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var resizeHandle = 15;
+ RGraph.Resizing.canvas = canvas;
+
+ /**
+ * Add the original width and height to the canvas
+ */
+ if (!canvas.__original_width__ && !canvas.__original_height__) {
+ canvas.__original_width__ = canvas.width;
+ canvas.__original_height__ = canvas.height;
+ }
+
+ /**
+ * Draw the resize handle
+ */
+ var textWidth = context.measureText('Reset').width + 2;
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'gray';
+ obj.context.fillStyle = 'rgba(0,0,0,0)';
+ obj.context.lineWidth = 1;
+ obj.context.fillRect(obj.canvas.width - resizeHandle, obj.canvas.height - resizeHandle - 2, resizeHandle, resizeHandle + 2);
+ obj.context.fillRect(obj.canvas.width - resizeHandle - textWidth, obj.canvas.height - resizeHandle, resizeHandle + textWidth, resizeHandle + 2);
+
+
+ // Draw the arrows
+
+ // Vertical line
+ obj.context.moveTo(obj.canvas.width - (resizeHandle / 2), obj.canvas.height - resizeHandle);
+ obj.context.lineTo(obj.canvas.width - (resizeHandle / 2), obj.canvas.height);
+
+
+ obj.context.moveTo(obj.canvas.width, obj.canvas.height - (resizeHandle / 2));
+ obj.context.lineTo(obj.canvas.width - resizeHandle, obj.canvas.height - (resizeHandle / 2));
+
+ context.fill();
+ context.stroke();
+
+ // Top arrow head
+ context.fillStyle = 'gray';
+ context.beginPath();
+ context.moveTo(canvas.width - (resizeHandle / 2), canvas.height - resizeHandle);
+ context.lineTo(canvas.width - (resizeHandle / 2) + 3, canvas.height - resizeHandle + 3);
+ context.lineTo(canvas.width - (resizeHandle / 2) - 3, canvas.height - resizeHandle + 3);
+ context.closePath();
+ context.fill();
+
+ // Bottom arrow head
+ context.beginPath();
+ context.moveTo(canvas.width - (resizeHandle / 2), canvas.height);
+ context.lineTo(canvas.width - (resizeHandle / 2) + 3, canvas.height - 3);
+ context.lineTo(canvas.width - (resizeHandle / 2) - 3, canvas.height - 3);
+ context.closePath();
+ context.fill();
+
+ // Left arrow head
+ context.beginPath();
+ context.moveTo(canvas.width - resizeHandle, canvas.height - (resizeHandle / 2));
+ context.lineTo(canvas.width - resizeHandle + 3, canvas.height - (resizeHandle / 2) + 3);
+ context.lineTo(canvas.width - resizeHandle + 3, canvas.height - (resizeHandle / 2) - 3);
+ context.closePath();
+ context.fill();
+
+ // Right arrow head
+ context.beginPath();
+ context.moveTo(canvas.width, canvas.height - (resizeHandle / 2));
+ context.lineTo(canvas.width - 3, canvas.height - (resizeHandle / 2) + 3);
+ context.lineTo(canvas.width - 3, canvas.height - (resizeHandle / 2) - 3);
+ context.closePath();
+ context.fill();
+
+ // Square at the centre of the arrows
+ context.beginPath();
+ context.fillStyle = 'white';
+ context.moveTo(canvas.width, canvas.height - (resizeHandle / 2));
+ context.strokeRect(canvas.width - (resizeHandle / 2) - 2, canvas.height - (resizeHandle / 2) - 2, 4, 4);
+ context.fillRect(canvas.width - (resizeHandle / 2) - 2, canvas.height - (resizeHandle / 2) - 2, 4, 4);
+ context.fill();
+ context.stroke();
+
+
+ // Draw the "Reset" button
+ context.beginPath();
+ context.fillStyle = 'gray';
+ context.moveTo(canvas.width - resizeHandle - 3, canvas.height - resizeHandle / 2);
+ context.lineTo(canvas.width - resizeHandle - resizeHandle, canvas.height - (resizeHandle / 2));
+ context.lineTo(canvas.width - resizeHandle - resizeHandle + 2, canvas.height - (resizeHandle / 2) - 2);
+ context.lineTo(canvas.width - resizeHandle - resizeHandle + 2, canvas.height - (resizeHandle / 2) + 2);
+ context.lineTo(canvas.width - resizeHandle - resizeHandle, canvas.height - (resizeHandle / 2));
+ context.stroke();
+ context.fill();
+
+ context.beginPath();
+ context.moveTo(canvas.width - resizeHandle - resizeHandle - 1, canvas.height - (resizeHandle / 2) - 3);
+ context.lineTo(canvas.width - resizeHandle - resizeHandle - 1, canvas.height - (resizeHandle / 2) + 3);
+ context.stroke();
+ context.fill();
+
+
+ window.onmousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = RGraph.Resizing.canvas;
+ var newWidth = RGraph.Resizing.originalw - (RGraph.Resizing.originalx - e.pageX);// - 5
+ var newHeight = RGraph.Resizing.originalh - (RGraph.Resizing.originaly - e.pageY);// - 5
+
+ if (RGraph.Resizing.mousedown) {
+ if (newWidth > (canvas.__original_width__ / 2)) RGraph.Resizing.div.style.width = newWidth + 'px';
+ if (newHeight > (canvas.__original_height__ / 2)) RGraph.Resizing.div.style.height = newHeight + 'px';
+ }
+ }
+
+ /**
+ * The window onmouseup function
+ */
+ var MouseupFunc = function (e)
+ {
+ if (!RGraph.Resizing || !RGraph.Resizing.div || !RGraph.Resizing.mousedown) {
+ return;
+ }
+
+ if (RGraph.Resizing.div) {
+
+ var div = RGraph.Resizing.div;
+ var canvas = div.__canvas__;
+ var coords = RGraph.getCanvasXY(div.__canvas__);
+
+ var parentNode = canvas.parentNode;
+
+ if (canvas.style.position != 'absolute') {
+ // Create a DIV to go in the canvases place
+ var placeHolderDIV = document.createElement('DIV');
+ placeHolderDIV.style.width = RGraph.Resizing.originalw + 'px';
+ placeHolderDIV.style.height = RGraph.Resizing.originalh + 'px';
+ //placeHolderDIV.style.backgroundColor = 'red';
+ placeHolderDIV.style.display = 'inline-block'; // Added 5th Nov 2010
+ placeHolderDIV.style.position = canvas.style.position;
+ placeHolderDIV.style.left = canvas.style.left;
+ placeHolderDIV.style.top = canvas.style.top;
+ placeHolderDIV.style.cssFloat = canvas.style.cssFloat;
+ parentNode.insertBefore(placeHolderDIV, canvas);
+ }
+
+
+ // Now set the canvas to be positioned absolutely
+ canvas.style.backgroundColor = 'white';
+ canvas.style.position = 'absolute';
+ canvas.style.border = '1px dashed gray';
+ canvas.style.left = (RGraph.Resizing.originalCanvasX - 1) + 'px';
+ canvas.style.top = (RGraph.Resizing.originalCanvasY - 1) + 'px';
+
+ canvas.width = parseInt(div.style.width);
+ canvas.height = parseInt(div.style.height);
+ canvas.__object__.Draw();
+
+ // Get rid of transparent semi-opaque DIV
+ RGraph.Resizing.mousedown = false;
+ div.style.left = '-1000px';
+ div.style.top = '-1000px';
+ }
+
+ /**
+ * Fire the onresize event
+ */
+ RGraph.FireCustomEvent(canvas.__object__, 'onresize');
+ }
+
+
+ window.onmouseup = MouseupFunc;
+
+
+ canvas.onmousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var coords = RGraph.getMouseXY(e);
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+
+ RGraph.Resizing.title = canvas.title;
+
+ if ( (coords[0] > (canvas.width - resizeHandle)
+ && coords[0] < canvas.width
+ && coords[1] > (canvas.height - resizeHandle)
+ && coords[1] < canvas.height)) {
+
+ canvas.title = 'Resize the graph';
+ canvas.style.cursor = 'move';
+
+ } else if ( coords[0] > (canvas.width - resizeHandle - resizeHandle)
+ && coords[0] < canvas.width - resizeHandle
+ && coords[1] > (canvas.height - resizeHandle)
+ && coords[1] < canvas.height) {
+
+ canvas.style.cursor = 'pointer';
+ canvas.title = 'Reset graph to original size';
+
+ } else {
+
+ canvas.style.cursor = 'default';
+ canvas.title = '';
+ }
+ }
+
+
+ canvas.onmousedown = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var coords = RGraph.getMouseXY(e);
+ var canvasCoords = RGraph.getCanvasXY(e.target);
+
+ if ( coords[0] > (obj.canvas.width - resizeHandle)
+ && coords[0] < obj.canvas.width
+ && coords[1] > (obj.canvas.height - resizeHandle)
+ && coords[1] < obj.canvas.height) {
+
+ RGraph.Resizing.mousedown = true;
+
+
+ /**
+ * Create the semi-opaque DIV
+ */
+ var div = document.createElement('DIV');
+ div.style.position = 'absolute';
+ div.style.left = canvasCoords[0] + 'px';
+ div.style.top = canvasCoords[1] + 'px';
+ div.style.width = canvas.width + 'px';
+ div.style.height = canvas.height + 'px';
+ div.style.border = '1px dotted black';
+ div.style.backgroundColor = 'gray';
+ div.style.opacity = 0.5;
+ div.__canvas__ = e.target;
+
+ document.body.appendChild(div);
+ RGraph.Resizing.div = div;
+
+ // This is a repetition of the window.onmouseup function
+ div.onmouseup = function (e)
+ {
+ MouseupFunc(e);
+ }
+
+
+ RGraph.Resizing.div.onmouseover = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+ e.stopPropagation();
+ }
+
+ // The mouse
+ RGraph.Resizing.originalx = e.pageX;
+ RGraph.Resizing.originaly = e.pageY;
+
+ //The canvas
+ RGraph.Resizing.originalw = obj.canvas.width;
+ RGraph.Resizing.originalh = obj.canvas.height;
+
+ RGraph.Resizing.originalCanvasX = RGraph.getCanvasXY(obj.canvas)[0];
+ RGraph.Resizing.originalCanvasY = RGraph.getCanvasXY(obj.canvas)[1];
+ }
+ }
+
+
+ /**
+ * This function facilitates the reset button
+ */
+ canvas.onclick = function (e)
+ {
+ var coords = RGraph.getMouseXY(e);
+ var canvas = e.target;
+
+ if ( coords[0] > (canvas.width - resizeHandle - resizeHandle)
+ && coords[0] < canvas.width - resizeHandle
+ && coords[1] > (canvas.height - resizeHandle)
+ && coords[1] < canvas.height) {
+
+ // Restore the original width and height
+ canvas.width = canvas.__original_width__;
+ canvas.height = canvas.__original_height__;
+
+ // Lose the border
+ canvas.style.border = '';
+
+ // Add 1 pixel to the top/left because the border is going
+ canvas.style.left = (parseInt(canvas.style.left) + 1) + 'px';
+ canvas.style.top = (parseInt(canvas.style.top) + 1) + 'px';
+
+ // Redraw the canvas
+ canvas.__object__.Draw();
+
+ // Set the width and height on the DIV
+ RGraph.Resizing.div.style.width = canvas.__original_width__ + 'px';
+ RGraph.Resizing.div.style.height = canvas.__original_height__ + 'px';
+
+ /**
+ * Fire the resize event
+ */
+ RGraph.FireCustomEvent(canvas.__object__, 'onresize');
+ }
+ }
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+ /**
+ * This is used in two functions, hence it's here
+ */
+ RGraph.tooltips = {};
+ RGraph.tooltips.padding = '3px';
+ RGraph.tooltips.font_face = 'Tahoma';
+ RGraph.tooltips.font_size = '10pt';
+
+
+ /**
+ * Shows a tooltip next to the mouse pointer
+ *
+ * @param canvas object The canvas element object
+ * @param text string The tooltip text
+ * @param int x The X position that the tooltip should appear at. Combined with the canvases offsetLeft
+ * gives the absolute X position
+ * @param int y The Y position the tooltip should appear at. Combined with the canvases offsetTop
+ * gives the absolute Y position
+ * @param int idx The index of the tooltip in the graph objects tooltip array
+ */
+ RGraph.Tooltip = function (canvas, text, x, y, idx)
+ {
+ /**
+ * chart.tooltip.override allows you to totally take control of rendering the tooltip yourself
+ */
+ if (typeof(canvas.__object__.Get('chart.tooltips.override')) == 'function') {
+ return canvas.__object__.Get('chart.tooltips.override')(canvas, text, x, y, idx);
+ }
+
+ /**
+ * This facilitates the "id:xxx" format
+ */
+ text = RGraph.getTooltipText(text);
+
+ /**
+ * First clear any exising timers
+ */
+ var timers = RGraph.Registry.Get('chart.tooltip.timers');
+
+ if (timers && timers.length) {
+ for (i=0; i<timers.length; ++i) {
+ clearTimeout(timers[i]);
+ }
+ }
+ RGraph.Registry.Set('chart.tooltip.timers', []);
+
+ /**
+ * Hide the context menu if it's currently shown
+ */
+ if (canvas.__object__.Get('chart.contextmenu')) {
+ RGraph.HideContext();
+ }
+
+ // Redraw the canvas?
+ if (canvas.__object__.Get('chart.tooltips.highlight')) {
+ RGraph.Redraw(canvas.id);
+ }
+
+ var effect = canvas.__object__.Get('chart.tooltips.effect').toLowerCase();
+
+ if (effect == 'snap' && RGraph.Registry.Get('chart.tooltip')) {
+
+ if ( canvas.__object__.type == 'line'
+ || canvas.__object__.type == 'tradar'
+ || canvas.__object__.type == 'scatter'
+ || canvas.__object__.type == 'rscatter'
+ ) {
+
+ var tooltipObj = RGraph.Registry.Get('chart.tooltip');
+
+ tooltipObj.style.width = null;
+ tooltipObj.style.height = null;
+
+ tooltipObj.innerHTML = text;
+ tooltipObj.__text__ = text;
+
+ /**
+ * Now that the new content has been set, re-set the width & height
+ */
+ RGraph.Registry.Get('chart.tooltip').style.width = RGraph.getTooltipWidth(text, canvas.__object__) + 'px';
+ RGraph.Registry.Get('chart.tooltip').style.height = RGraph.Registry.Get('chart.tooltip').offsetHeight - (RGraph.isIE9up() ? 7 : 0) + 'px';
+
+
+ var currentx = parseInt(RGraph.Registry.Get('chart.tooltip').style.left);
+ var currenty = parseInt(RGraph.Registry.Get('chart.tooltip').style.top);
+
+ var diffx = x - currentx - ((x + RGraph.Registry.Get('chart.tooltip').offsetWidth) > document.body.offsetWidth ? RGraph.Registry.Get('chart.tooltip').offsetWidth : 0);
+ var diffy = y - currenty - RGraph.Registry.Get('chart.tooltip').offsetHeight;
+
+ // Position the tooltip
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.2)) + 'px"', 25);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.4)) + 'px"', 50);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.6)) + 'px"', 75);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 0.8)) + 'px"', 100);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.left = "' + (currentx + (diffx * 1.0)) + 'px"', 125);
+
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.2)) + 'px"', 25);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.4)) + 'px"', 50);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.6)) + 'px"', 75);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 0.8)) + 'px"', 100);
+ setTimeout('RGraph.Registry.Get("chart.tooltip").style.top = "' + (currenty + (diffy * 1.0)) + 'px"', 125);
+
+ } else {
+
+ alert('[TOOLTIPS] The "snap" effect is only supported on the Line, Rscatter, Scatter and Tradar charts');
+ }
+
+ /**
+ * Fire the tooltip event
+ */
+ RGraph.FireCustomEvent(canvas.__object__, 'ontooltip');
+
+ return;
+ }
+
+ /**
+ * Hide any currently shown tooltip
+ */
+ RGraph.HideTooltip();
+
+
+ /**
+ * Show a tool tip
+ */
+ var tooltipObj = document.createElement('DIV');
+ tooltipObj.className = canvas.__object__.Get('chart.tooltips.css.class');
+ tooltipObj.style.display = 'none';
+ tooltipObj.style.position = 'absolute';
+ tooltipObj.style.left = 0;
+ tooltipObj.style.top = 0;
+ tooltipObj.style.backgroundColor = '#ffe';
+ tooltipObj.style.color = 'black';
+ if (!document.all) tooltipObj.style.border = '1px solid rgba(0,0,0,0)';
+ tooltipObj.style.visibility = 'visible';
+ tooltipObj.style.paddingLeft = RGraph.tooltips.padding;
+ tooltipObj.style.paddingRight = RGraph.tooltips.padding;
+ tooltipObj.style.fontFamily = RGraph.tooltips.font_face;
+ tooltipObj.style.fontSize = RGraph.tooltips.font_size;
+ tooltipObj.style.zIndex = 3;
+ tooltipObj.style.borderRadius = '5px';
+ tooltipObj.style.MozBorderRadius = '5px';
+ tooltipObj.style.WebkitBorderRadius = '5px';
+ tooltipObj.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ tooltipObj.style.MozBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ tooltipObj.style.boxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+ tooltipObj.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135)';
+ tooltipObj.style.opacity = 0;
+ tooltipObj.style.overflow = 'hidden';
+ tooltipObj.innerHTML = text;
+ tooltipObj.__text__ = text; // This is set because the innerHTML can change when it's set
+ tooltipObj.__canvas__ = canvas;
+ tooltipObj.style.display = 'inline';
+
+ if (typeof(idx) == 'number') {
+ tooltipObj.__index__ = idx;
+ }
+
+ document.body.appendChild(tooltipObj);
+
+ var width = tooltipObj.offsetWidth;
+ var height = tooltipObj.offsetHeight - (RGraph.isIE9up() ? 7 : 0);
+
+ if ((y - height - 2) > 0) {
+ y = y - height - 2;
+ } else {
+ y = y + 2;
+ }
+
+ /**
+ * Set the width on the tooltip so it doesn't resize if the window is resized
+ */
+ tooltipObj.style.width = width + 'px';
+ //tooltipObj.style.height = 0; // Initially set the tooltip height to nothing
+
+ /**
+ * If the mouse is towards the right of the browser window and the tooltip would go outside of the window,
+ * move it left
+ */
+ if ( (x + width) > document.body.offsetWidth ) {
+ x = x - width - 7;
+ var placementLeft = true;
+
+ if (canvas.__object__.Get('chart.tooltips.effect') == 'none') {
+ x = x - 3;
+ }
+
+ tooltipObj.style.left = x + 'px';
+ tooltipObj.style.top = y + 'px';
+
+ } else {
+ x += 5;
+
+ tooltipObj.style.left = x + 'px';
+ tooltipObj.style.top = y + 'px';
+ }
+
+
+ if (effect == 'expand') {
+
+ tooltipObj.style.left = (x + (width / 2)) + 'px';
+ tooltipObj.style.top = (y + (height / 2)) + 'px';
+ leftDelta = (width / 2) / 10;
+ topDelta = (height / 2) / 10;
+
+ tooltipObj.style.width = 0;
+ tooltipObj.style.height = 0;
+ tooltipObj.style.boxShadow = '';
+ tooltipObj.style.MozBoxShadow = '';
+ tooltipObj.style.WebkitBoxShadow = '';
+ tooltipObj.style.borderRadius = 0;
+ tooltipObj.style.MozBorderRadius = 0;
+ tooltipObj.style.WebkitBorderRadius = 0;
+ tooltipObj.style.opacity = 1;
+
+ // Progressively move the tooltip to where it should be (the x position)
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) - leftDelta) + 'px' }", 250));
+
+ // Progressively move the tooltip to where it should be (the Y position)
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) - topDelta) + 'px' }", 250));
+
+ // Progressively grow the tooltip width
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.1) + "px'; }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.2) + "px'; }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.3) + "px'; }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.4) + "px'; }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.5) + "px'; }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.6) + "px'; }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.7) + "px'; }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.8) + "px'; }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 0.9) + "px'; }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + width + "px'; }", 250));
+
+ // Progressively grow the tooltip height
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.1) + "px'; }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.2) + "px'; }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.3) + "px'; }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.4) + "px'; }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.5) + "px'; }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.6) + "px'; }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.7) + "px'; }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.8) + "px'; }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 0.9) + "px'; }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + height + "px'; }", 250));
+
+ // When the animation is finished, set the tooltip HTML
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').innerHTML = RGraph.Registry.Get('chart.tooltip').__text__; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.boxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.MozBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.borderRadius = '5px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.MozBorderRadius = '5px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.WebkitBorderRadius = '5px'; }", 250));
+
+ } else if (effect == 'contract') {
+
+ tooltipObj.style.left = (x - width) + 'px';
+ tooltipObj.style.top = (y - (height * 2)) + 'px';
+ tooltipObj.style.cursor = 'pointer';
+
+ leftDelta = width / 10;
+ topDelta = height / 10;
+
+ tooltipObj.style.width = (width * 5) + 'px';
+ tooltipObj.style.height = (height * 5) + 'px';
+
+ tooltipObj.style.opacity = 0.2;
+
+ // Progressively move the tooltip to where it should be (the x position)
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.left = (parseInt(RGraph.Registry.Get('chart.tooltip').style.left) + leftDelta) + 'px' }", 250));
+
+ // Progressively move the tooltip to where it should be (the Y position)
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.top = (parseInt(RGraph.Registry.Get('chart.tooltip').style.top) + (topDelta*2)) + 'px' }", 250));
+
+ // Progressively shrink the tooltip width
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 5.5) + "px'; }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 5.0) + "px'; }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 4.5) + "px'; }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 4.0) + "px'; }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 3.5) + "px'; }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 3.0) + "px'; }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 2.5) + "px'; }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 2.0) + "px'; }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + (width * 1.5) + "px'; }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.width = '" + width + "px'; }", 250));
+
+ // Progressively shrink the tooltip height
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 5.5) + "px'; }", 25));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 5.0) + "px'; }", 50));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 4.5) + "px'; }", 75));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 4.0) + "px'; }", 100));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 3.5) + "px'; }", 125));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 3.0) + "px'; }", 150));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 2.5) + "px'; }", 175));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 2.0) + "px'; }", 200));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + (height * 1.5) + "px'; }", 225));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.height = '" + height + "px'; }", 250));
+
+ // When the animation is finished, set the tooltip HTML
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').innerHTML = RGraph.Registry.Get('chart.tooltip').__text__; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.boxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.MozBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.borderRadius = '5px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.MozBorderRadius = '5px'; }", 250));
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.WebkitBorderRadius = '5px'; }", 250));
+
+ /**
+ * This resets the pointer
+ */
+ RGraph.Registry.Get('chart.tooltip.timers').push(setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.cursor = 'default'; }", 275));
+
+
+
+ } else if (effect != 'fade' && effect != 'expand' && effect != 'none' && effect != 'snap' && effect != 'contract') {
+ alert('[COMMON] Unknown tooltip effect: ' + effect);
+ }
+
+ if (effect != 'none') {
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.1; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 25);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.2; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 50);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.3; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 75);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.4; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 100);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.5; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 125);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.6; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.2)'; }", 150);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.7; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.4)'; }", 175);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.8; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.6)'; }", 200);
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 0.9; RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgba(96,96,96,0.8)'; }", 225);
+ }
+
+ setTimeout("if (RGraph.Registry.Get('chart.tooltip')) { RGraph.Registry.Get('chart.tooltip').style.opacity = 1;RGraph.Registry.Get('chart.tooltip').style.border = '1px solid rgb(96,96,96)';}", effect == 'none' ? 50 : 250);
+
+ /**
+ * If the tooltip it self is clicked, cancel it
+ */
+ tooltipObj.onmousedown = function (e)
+ {
+ e = RGraph.FixEventObject(e)
+ e.stopPropagation();
+ }
+
+ tooltipObj.onclick = function (e)
+ {
+ if (e.button == 0) {
+ e = RGraph.FixEventObject(e);
+ e.stopPropagation();
+ }
+ }
+
+ /**
+ * Install the function for hiding the tooltip.
+ */
+ document.body.onmousedown = function (event)
+ {
+ var tooltip = RGraph.Registry.Get('chart.tooltip');
+
+ if (tooltip) {
+ RGraph.HideTooltip();
+
+ // Redraw if highlighting is enabled
+ if (tooltip.__canvas__.__object__.Get('chart.tooltips.highlight')) {
+ RGraph.Redraw();
+ }
+ }
+ }
+
+ /**
+ * If the window is resized, hide the tooltip
+ */
+ window.onresize = function ()
+ {
+ var tooltip = RGraph.Registry.Get('chart.tooltip');
+
+ if (tooltip) {
+ tooltip.parentNode.removeChild(tooltip);
+ tooltip.style.display = 'none';
+ tooltip.style.visibility = 'hidden';
+ RGraph.Registry.Set('chart.tooltip', null);
+
+ // Redraw the graph if necessary
+ if (canvas.__object__.Get('chart.tooltips.highlight')) {
+ RGraph.Clear(canvas);
+ canvas.__object__.Draw();
+ }
+ }
+ }
+
+ /**
+ * Keep a reference to the tooltip
+ */
+ RGraph.Registry.Set('chart.tooltip', tooltipObj);
+
+ /**
+ * Fire the tooltip event
+ */
+ RGraph.FireCustomEvent(canvas.__object__, 'ontooltip');
+ }
+
+
+ /**
+ *
+ */
+ RGraph.getTooltipText = function (text)
+ {
+ var result = /^id:(.*)/.exec(text);
+
+ if (result) {
+ text = document.getElementById(result[1]).innerHTML;
+ }
+
+ return text;
+ }
+
+
+ /**
+ *
+ */
+ RGraph.getTooltipWidth = function (text, obj)
+ {
+ var div = document.createElement('DIV');
+ div.className = obj.Get('chart.tooltips.css.class');
+ div.style.paddingLeft = RGraph.tooltips.padding;
+ div.style.paddingRight = RGraph.tooltips.padding;
+ div.style.fontFamily = RGraph.tooltips.font_face;
+ div.style.fontSize = RGraph.tooltips.font_size;
+ div.style.visibility = 'hidden';
+ div.style.position = 'absolute';
+ div.style.top = '300px';
+ div.style.left = 0;
+ div.style.display = 'inline';
+ div.innerHTML = RGraph.getTooltipText(text);
+ document.body.appendChild(div);
+
+ return div.offsetWidth;
+ }
+
+
+ /**
+ * Hides the currently shown tooltip
+ */
+ RGraph.HideTooltip = function ()
+ {
+ var tooltip = RGraph.Registry.Get('chart.tooltip');
+
+ if (tooltip) {
+ tooltip.parentNode.removeChild(tooltip);
+ tooltip.style.display = 'none';
+ tooltip.style.visibility = 'hidden';
+ RGraph.Registry.Set('chart.tooltip', null);
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {isRGraph:true,type:'common'};
+
+
+ /**
+ * Installs the event handlers for zooming an area of the graph
+ *
+ * @param object obj Your graph object
+ */
+ RGraph.ZoomArea = function (obj)
+ {
+ if (obj.Get('chart.zoom.mode') == 'area') {
+
+ var canvas = obj.canvas;
+ var context = obj.context;
+
+ obj.canvas.style.cursor = 'crosshair';
+
+ RGraph.Register(obj);
+
+
+ canvas.onmousedown = function(e)
+ {
+ var canvas = e.target;
+ var coords = RGraph.getMouseXY(e);
+ var obj = canvas.__object__;
+
+ if (RGraph.Registry.Get('chart.zoomed.area.div')) {
+ RGraph.Registry.Get('chart.zoomed.area.div').style.display = 'none';
+ }
+
+ if (typeof(RGraph.Registry.Get('chart.zoomed.area.divs')) == null) {
+ RGraph.Registry.Set('chart.zoomed.area.divs', []);
+
+ } else {
+
+ var divs = RGraph.Registry.Get('chart.zoomed.area.divs');
+
+ if (divs && divs.length) {
+ for (var i=0; i<divs.length; ++i) {
+ if (divs[i]) {
+ divs[i].style.display = 'none';
+ divs[i] = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Create the indicator DIV
+ */
+ var canvasXY = RGraph.getCanvasXY(canvas);
+ var areaDiv = document.createElement('DIV');
+ areaDiv.__canvas__ = canvas;
+ areaDiv.style.position = 'absolute';
+ areaDiv.style.left = canvasXY[0] + coords[0] + 'px'
+ areaDiv.style.top = canvasXY[1] + coords[1] + 'px'
+ areaDiv.style.width = 0;
+ areaDiv.style.height = 0;
+ areaDiv.style.border = '1px solid black';
+ areaDiv.style.backgroundColor = 'rgba(220,220,220,0.3)';
+ areaDiv.style.display = 'none';
+
+ areaDiv.onmouseover = function (e)
+ {
+ setTimeout(function () {e.target.style.opacity = 0.8;}, 50);
+ setTimeout(function () {e.target.style.opacity = 0.6;}, 100);
+ setTimeout(function () {e.target.style.opacity = 0.4;}, 150);
+ setTimeout(function () {e.target.style.opacity = 0.2;}, 200);
+ setTimeout(function () {e.target.style.opacity = 0;}, 250);
+ setTimeout(function () {e.target.style.display = 'none';}, 300);
+ setTimeout(function () {e.target = null;}, 350);
+ }
+
+ document.body.appendChild(areaDiv);
+
+
+ RGraph.Registry.Set('chart.zoomed.area.div', null);
+ RGraph.Registry.Set('chart.zoomed.area.mousedown', coords);
+ RGraph.Registry.Set('chart.zoomed.area.areadiv', areaDiv);
+ }
+
+
+ canvas.onmousemove = function (e)
+ {
+ var startCoords = RGraph.Registry.Get('chart.zoomed.area.mousedown');
+
+ if (startCoords && startCoords.length) {
+
+ var coords = RGraph.getMouseXY(e);
+ var canvasXY = RGraph.getCanvasXY(e.target);
+ var obj = e.target.__object__;
+ var context = obj.context;
+ var canvas = obj.canvas;
+ var startx = startCoords[0];
+ var starty = startCoords[1];
+ var endx = coords[0];
+ var endy = coords[1];
+ var width = endx - startx;
+ var height = endy - starty;
+ var areaDiv = RGraph.Registry.Get('chart.zoomed.area.areadiv');
+
+ if (width >= 0 && height >= 0) {
+
+ if (width > 5 && height > 5) {
+ areaDiv.style.width = (width - 15) + 'px';
+ areaDiv.style.height = (height - 15) + 'px';
+ areaDiv.style.display = 'inline';
+ } else {
+ areaDiv.style.display = 'none';
+ }
+
+ } else if (width < -5 || height < -5) {
+
+ var canvasCoords = RGraph.getCanvasXY(canvas);
+ var noticeDiv = document.createElement('DIV');
+
+ noticeDiv.style.position = 'absolute';
+ noticeDiv.style.top = 0;
+ noticeDiv.style.left = 0;
+ noticeDiv.style.zIndex = 99;
+ noticeDiv.style.border = '1px dashed black';
+ noticeDiv.style.backgroundColor = '#ffc1c1';
+ noticeDiv.style.MozBoxShadow = '0 0 5px #999';
+ noticeDiv.style.WebkitBoxShadow = '0 0 5px #999';
+ noticeDiv.style.boxShadow = '0 0 5px #999';
+ noticeDiv.style.padding = '2px';
+ noticeDiv.innerHTML = 'Zoom goes right and down';
+ document.body.appendChild(noticeDiv);
+
+ // Reposition the warning
+ noticeDiv.style.top = canvasCoords[1] + startCoords[1] - noticeDiv.offsetHeight + 'px';
+ noticeDiv.style.left = canvasCoords[0] + startCoords[0] - (noticeDiv.offsetWidth / 2) + 'px';
+ noticeDiv.style.width = noticeDiv.offsetWidth + 'px';
+
+ setTimeout(function () {noticeDiv.style.opacity = 0.8;}, 2100);
+ setTimeout(function () {noticeDiv.style.opacity = 0.6;}, 2200);
+ setTimeout(function () {noticeDiv.style.opacity = 0.4;}, 2300);
+ setTimeout(function () {noticeDiv.style.opacity = 0.2;}, 2400);
+ setTimeout(function () {noticeDiv.style.display = 'none';}, 2500);
+ setTimeout(function () {noticeDiv = null;}, 2600);
+ }
+ }
+ }
+
+
+ canvas.onmouseup = function (e)
+ {
+ RGraph.FixEventObject(e);
+
+ var startCoords = RGraph.Registry.Get('chart.zoomed.area.mousedown');
+ var coords = RGraph.getMouseXY(e);
+
+ // Do the zooming here
+ if (RGraph.Registry.Get('chart.zoomed.area.mousedown')) {
+
+ //RGraph.Redraw();
+
+ RGraph.Registry.Get('chart.zoomed.area.areadiv').style.display = 'none';
+ RGraph.Registry.Get('chart.zoomed.area.areadiv').style.left = '-1000px';
+ RGraph.Registry.Get('chart.zoomed.area.areadiv').style.top = '-1000px';
+ RGraph.Registry.Set('chart.zoomed.area.areadiv', null);
+
+ if (coords[0] < startCoords[0] || coords[1] < startCoords[1]) {
+ RGraph.Registry.Set('chart.zoomed.area.mousedown', false);
+ return;
+ }
+
+ var canvas = e.target;
+ var obj = canvas.__object__;
+ var context = obj.context;
+ var canvasCoords = RGraph.getCanvasXY(e.target);
+ var coords = RGraph.getMouseXY(e);
+ var startCoords = RGraph.Registry.Get('chart.zoomed.area.mousedown');
+ var startx = startCoords[0];
+ var starty = startCoords[1];
+ var endx = coords[0] - 15;
+ var endy = coords[1] - 15;
+ var width = Math.abs(endx - startx);
+ var height = Math.abs(endy - starty);
+ var factor = obj.Get('chart.zoom.factor') - 1;
+
+ var img = document.createElement('IMG');
+ img.src = canvas.toDataURL();
+ img.style.position = 'relative';
+ img.style.left = (factor + 1) * -1 * startx + 'px';
+ img.style.top = (factor + 1) * -1 * starty + 'px';
+ img.width = (factor + 1) * canvas.width;
+ img.height = (factor + 1) * canvas.height;
+
+ var div = document.createElement('DIV');
+ div.__object__ = obj;
+ div.className = 'RGraph_zoomed_area';
+ div.style.position = 'absolute';
+ div.style.backgroundColor = 'white';
+ div.style.cursor = 'move';
+
+ div.style.top = e.pageY + 'px';
+ div.style.left = e.pageX + 'px';
+ div.origWidth = width;
+ div.origHeight = height;
+ div.style.width = width + 'px';
+ div.style.height = height + 'px';
+ div.style.border = '1px solid black';
+ div.style.boxShadow = '0 0 15px black';
+ div.style.MozBoxShadow = '0 0 15px black';
+ div.style.WebkitBoxShadow = '0 0 15px black';
+ div.style.overflow = 'hidden';
+ div.style.opacity = 0;
+ div.style.zIndex = 99;
+
+ document.body.appendChild(div);
+ div.appendChild(img);
+
+
+ /**
+ * This facilitates expanding the zoomed area once visible (the double click)
+ */
+ div.ondblclick = function (event)
+ {
+ var event = RGraph.FixEventObject(event);
+ var img = event.target;
+ var div = event.target.parentNode;
+
+ var current_width = div.offsetWidth
+ var current_height = div.offsetHeight
+ var target_width = img.offsetWidth;
+ var target_height = img.offsetHeight;
+ var diff_width = target_width - current_width;
+ var diff_height = target_height - current_height;
+
+ var img_offset_left = parseInt(img.offsetLeft);
+ var img_offset_top = parseInt(img.offsetTop);
+
+ // Global vars on purpose so the timers can access them
+ __zoomed_div_style__ = div.style;
+ __zoomed_img_style__ = img.style;
+
+ setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 50);
+ setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 100);
+ setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 150);
+ setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 200);
+ setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 250);
+
+ setTimeout("__zoomed_div_style__.top = parseInt(__zoomed_div_style__.top) - " + (diff_height * 0.1) + " + 'px'", 50);
+ setTimeout("__zoomed_div_style__.top = parseInt(__zoomed_div_style__.top) - " + (diff_height * 0.1) + " + 'px'", 100);
+ setTimeout("__zoomed_div_style__.top = parseInt(__zoomed_div_style__.top) - " + (diff_height * 0.1) + " + 'px'", 150);
+ setTimeout("__zoomed_div_style__.top = parseInt(__zoomed_div_style__.top) - " + (diff_height * 0.1) + " + 'px'", 200);
+ setTimeout("__zoomed_div_style__.top = parseInt(__zoomed_div_style__.top) - " + (diff_height * 0.1) + " + 'px'", 250);
+
+ setTimeout("__zoomed_div_style__.width = parseInt(__zoomed_div_style__.width) + " + (diff_width * 0.2) + " + 'px'", 50);
+ setTimeout("__zoomed_div_style__.width = parseInt(__zoomed_div_style__.width) + " + (diff_width * 0.2) + " + 'px'", 100);
+ setTimeout("__zoomed_div_style__.width = parseInt(__zoomed_div_style__.width) + " + (diff_width * 0.2) + " + 'px'", 150);
+ setTimeout("__zoomed_div_style__.width = parseInt(__zoomed_div_style__.width) + " + (diff_width * 0.2) + " + 'px'", 200);
+ setTimeout("__zoomed_div_style__.width = parseInt(__zoomed_div_style__.width) + " + (diff_width * 0.2) + " + 'px'", 250);
+
+ setTimeout("__zoomed_div_style__.height = parseInt(__zoomed_div_style__.height) + " + (diff_height * 0.2) + " + 'px'", 50);
+ setTimeout("__zoomed_div_style__.height = parseInt(__zoomed_div_style__.height) + " + (diff_height * 0.2) + " + 'px'", 100);
+ setTimeout("__zoomed_div_style__.height = parseInt(__zoomed_div_style__.height) + " + (diff_height * 0.2) + " + 'px'", 150);
+ setTimeout("__zoomed_div_style__.height = parseInt(__zoomed_div_style__.height) + " + (diff_height * 0.2) + " + 'px'", 200);
+ setTimeout("__zoomed_div_style__.height = parseInt(__zoomed_div_style__.height) + " + (diff_height * 0.2) + " + 'px'", 250);
+
+ // Move the image within the div
+ setTimeout("__zoomed_img_style__.left = " + (img_offset_left * 0.8) + " + 'px'", 50);
+ setTimeout("__zoomed_img_style__.left = " + (img_offset_left * 0.6) + " + 'px'", 100);
+ setTimeout("__zoomed_img_style__.left = " + (img_offset_left * 0.4) + " + 'px'", 150);
+ setTimeout("__zoomed_img_style__.left = " + (img_offset_left * 0.2) + " + 'px'", 200);
+ setTimeout("__zoomed_img_style__.left = 0", 250);
+
+ setTimeout("__zoomed_img_style__.top = " + (img_offset_top * 0.8) + " + 'px'", 50);
+ setTimeout("__zoomed_img_style__.top = " + (img_offset_top * 0.6) + " + 'px'", 100);
+ setTimeout("__zoomed_img_style__.top = " + (img_offset_top * 0.4) + " + 'px'", 150);
+ setTimeout("__zoomed_img_style__.top = " + (img_offset_top * 0.2) + " + 'px'", 200);
+ setTimeout("__zoomed_img_style__.top = 0", 250);
+
+ div.ondblclick = null;
+ }
+ /**
+ * Make the zoomed bit draggable
+ */
+ div.onmousedown = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var div = e.target.parentNode;
+ var img = div.childNodes[0];
+
+ if (e.button == 0 || e.button == 1 ) {
+
+ div.__offsetx__ = e.offsetX + img.offsetLeft;
+ div.__offsety__ = e.offsetY + img.offsetTop;
+
+ RGraph.Registry.Set('chart.mousedown', div);
+ RGraph.Registry.Set('chart.button', 0);
+
+ } else {
+
+ img.__startx__ = e.pageX;
+ img.__starty__ = e.pageY;
+
+ img.__originalx__ = img.offsetLeft;
+ img.__originaly__ = img.offsetTop;
+
+ RGraph.Registry.Set('chart.mousedown', img);
+ RGraph.Registry.Set('chart.button', 2);
+
+ /**
+ * Don't show a context menu when the zoomed area is right-clicked on
+ */
+ window.oncontextmenu = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ e.stopPropagation();
+
+ // [18th July 2010] Is this reallly necessary?
+ window.oncontextmenu = function (e)
+ {
+ return true;
+ }
+
+
+ return false;
+ }
+ }
+
+ e.stopPropagation();
+
+ return false;
+ }
+
+ window.onmouseup = function (e)
+ {
+ RGraph.Registry.Set('chart.mousedown', false);
+ }
+
+ window.onmousemove = function (e)
+ {
+ if (RGraph.Registry.Get('chart.mousedown') && RGraph.Registry.Get('chart.button') == 0) {
+
+ var div = RGraph.Registry.Get('chart.mousedown');
+
+ var x = e.pageX - div.__offsetx__;
+ var y = e.pageY - div.__offsety__;
+
+ div.style.left = x + 'px';
+ div.style.top = y + 'px';
+
+ } else if (RGraph.Registry.Get('chart.mousedown') && RGraph.Registry.Get('chart.button') == 2) {
+
+ var img = RGraph.Registry.Get('chart.mousedown');
+
+ var x = img.__originalx__ + e.pageX - img.__startx__;
+ var y = img.__originaly__ + e.pageY - img.__starty__;
+
+ img.style.left = x + 'px';
+ img.style.top = y + 'px';
+ }
+ }
+ // End dragging code
+
+
+ var divs = RGraph.Registry.Get('chart.zoomed.area.divs');
+ if (typeof(divs) == 'object') {
+ divs.push(div);
+ } else {
+ RGraph.Registry.Set('chart.zoomed.area.divs', [div])
+ }
+
+ // Create the background
+ var bg = document.createElement('DIV');
+ bg.style.position = 'fixed'
+ bg.style.zIndex = 98;
+ bg.style.top = 0;
+ bg.style.left = 0;
+ bg.style.backgroundColor = '#999';
+ bg.style.opacity = 0;
+ bg.style.width = (screen.width + 100) + 'px';
+ bg.style.height = (screen.height + 100) + 'px';
+ document.body.appendChild(bg);
+
+ bg.onclick = function (e)
+ {
+ div.style.display = 'none';
+ bg.style.display = 'none';
+ div = null;
+ bg = null;
+ }
+
+
+ setTimeout(function (){div.style.opacity = 0.2;}, 50);
+ setTimeout(function (){div.style.opacity = 0.4;}, 100);
+ setTimeout(function (){div.style.opacity = 0.6;}, 150);
+ setTimeout(function (){div.style.opacity = 0.8;}, 200);
+ setTimeout(function (){div.style.opacity = 1.0;}, 250);
+
+ setTimeout(function () {div.style.left = canvasCoords[0] + startx - (width * factor * 0.1) + 'px'}, 50);
+ setTimeout(function () {div.style.left = canvasCoords[0] + startx - (width * factor * 0.2) + 'px'}, 100);
+ setTimeout(function () {div.style.left = canvasCoords[0] + startx - (width * factor * 0.3) + 'px'}, 150);
+ setTimeout(function () {div.style.left = canvasCoords[0] + startx - (width * factor * 0.4) + 'px'}, 200);
+ setTimeout(function () {div.style.left = canvasCoords[0] + startx - (width * factor * 0.5) + 'px'}, 250);
+
+ setTimeout(function () {div.style.top = canvasCoords[1] + starty - (height * factor * 0.1) + 'px'}, 50);
+ setTimeout(function () {div.style.top = canvasCoords[1] + starty - (height * factor * 0.2) + 'px'}, 100);
+ setTimeout(function () {div.style.top = canvasCoords[1] + starty - (height * factor * 0.3) + 'px'}, 150);
+ setTimeout(function () {div.style.top = canvasCoords[1] + starty - (height * factor * 0.4) + 'px'}, 200);
+ setTimeout(function () {div.style.top = canvasCoords[1] + starty - (height * factor * 0.5) + 'px'}, 250);
+
+ setTimeout(function () {div.style.width = width + (width * factor * 0.2) + 'px'}, 50);
+ setTimeout(function () {div.style.width = width + (width * factor * 0.4) + 'px'}, 100);
+ setTimeout(function () {div.style.width = width + (width * factor * 0.6) + 'px'}, 150);
+ setTimeout(function () {div.style.width = width + (width * factor * 0.8) + 'px'}, 200);
+ setTimeout(function () {div.style.width = width + (width * factor * 1.0) + 'px'}, 250);
+
+ setTimeout(function () {div.style.height = height + (height * factor * 0.2) + 'px'}, 50);
+ setTimeout(function () {div.style.height = height + (height * factor * 0.4) + 'px'}, 100);
+ setTimeout(function () {div.style.height = height + (height * factor * 0.6) + 'px'}, 150);
+ setTimeout(function () {div.style.height = height + (height * factor * 0.8) + 'px'}, 200);
+ setTimeout(function () {div.style.height = height + (height * factor * 1.0) + 'px'}, 250);
+
+ setTimeout(function (){bg.style.opacity = 0.1;}, 50);
+ setTimeout(function (){bg.style.opacity = 0.2;}, 100);
+ setTimeout(function (){bg.style.opacity = 0.3;}, 150);
+ setTimeout(function (){bg.style.opacity = 0.4;}, 200);
+ setTimeout(function (){bg.style.opacity = 0.5;}, 250);
+
+ RGraph.Registry.Set('chart.zoomed.area.bg', bg);
+ RGraph.Registry.Set('chart.zoomed.area.img', img);
+ RGraph.Registry.Set('chart.zoomed.area.div', div);
+ RGraph.Registry.Set('chart.zoomed.area.mousedown', null);
+ }
+
+ /**
+ * Fire the zoom event
+ */
+ RGraph.FireCustomEvent(obj, 'onzoom');
+ }
+
+ canvas.onmouseout = function (e)
+ {
+ RGraph.Registry.Set('chart.zoomed.area.areadiv', null);
+ RGraph.Registry.Set('chart.zoomed.area.mousedown', null);
+ RGraph.Registry.Set('chart.zoomed.area.div', null);
+ }
+ }
+ }
+
+
+ /**
+ * This function sets up the zoom window if requested
+ *
+ * @param obj object The graph object
+ */
+ RGraph.ShowZoomWindow = function (obj)
+ {
+ var gutter = obj.Get('chart.gutter');
+
+ if (obj.Get('chart.zoom.mode') == 'thumbnail') {
+ RGraph.ZoomWindow(obj.canvas);
+ }
+
+ if (obj.Get('chart.zoom.mode') == 'area') {
+ RGraph.ZoomArea(obj);
+ }
+ }
+
+
+ /**
+ * Installs the evnt handler for the zoom window/THUMBNAIL
+ */
+ RGraph.ZoomWindow = function (canvas)
+ {
+ canvas.onmousemove = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var obj = e.target.__object__;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var coords = RGraph.getMouseXY(e);
+
+ /**
+ * Create the DIV
+ */
+ if (!RGraph.Registry.Get('chart.zoomed.div')) {
+
+ var div = document.createElement('div');
+ div.className = 'RGraph_zoom_window';
+ div.style.width = obj.Get('chart.zoom.thumbnail.width') + 'px';
+ div.style.height = obj.Get('chart.zoom.thumbnail.height') + 'px';
+
+ // Added back in on the 17th December
+ div.style.border = '2px dashed gray';
+
+ div.style.position = 'absolute';
+ div.style.overflow = 'hidden';
+ div.style.backgroundColor = 'white';
+
+ // Initially the zoomed layer should be off-screen
+ div.style.left = '-1000px';
+ div.style.top = '-1000px';
+
+ // Should these be 0? No.
+ div.style.borderRadius = '5px';
+ div.style.MozBorderRadius = '5px';
+ div.style.WebkitBorderRadius = '5px';
+
+ if (obj.Get('chart.zoom.shadow')) {
+ div.style.boxShadow = 'rgba(0,0,0,0.5) 3px 3px 3px';
+ div.style.MozBoxShadow = 'rgba(0,0,0,0.5) 3px 3px 3px';
+ div.style.WebkitBoxShadow = 'rgba(0,0,0,0.5) 3px 3px 3px';
+ }
+
+ //div.style.opacity = 0.2;
+ div.__object__ = obj;
+ document.body.appendChild(div);
+
+ /**
+ * Get the canvas as an image
+ */
+ var img = document.createElement('img');
+ img.width = obj.canvas.width * obj.Get('chart.zoom.factor');
+ img.height = obj.canvas.height * obj.Get('chart.zoom.factor');
+ img.style.position = 'relative';
+ img.style.backgroundColor = 'white';
+ img.__object__ = obj;
+
+ div.appendChild(img);
+
+ RGraph.Registry.Set('chart.zoomed.div', div);
+ RGraph.Registry.Set('chart.zoomed.img', img);
+
+ // Fade the zoom in
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').__object__.canvas.onmouseover()", 5);
+
+ } else {
+
+ div = RGraph.Registry.Get('chart.zoomed.div');
+ img = RGraph.Registry.Get('chart.zoomed.img');
+ }
+
+ // Make sure the image is up-to-date
+ img.src = canvas.toDataURL();
+
+ /**
+ * Ensure the div is visible
+ */
+ if (div && div.style.opacity < 1) {
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 1", 400);
+ }
+
+ /**
+ * Get the canvas x/y coords
+ */
+ var c = RGraph.getCanvasXY(obj.canvas);
+ var x = c[0];
+ var y = c[1];
+
+ /**
+ * Position the div and img
+ */
+ var offset = 7;
+
+ div.style.left = (e.pageX - obj.Get('chart.zoom.thumbnail.width') - offset) + 'px';
+ div.style.top = (e.pageY - obj.Get('chart.zoom.thumbnail.height') - offset) + 'px';
+
+ var l = (obj.Get('chart.zoom.thumbnail.width') / 2) - (coords[0] * obj.Get('chart.zoom.factor'));
+ var t = (obj.Get('chart.zoom.thumbnail.height') / 2) - (coords[1] * obj.Get('chart.zoom.factor'));
+
+ // More positioning
+ img.style.left = (l + ((obj.Get('chart.zoom.thumbnail.width') / 2) * obj.Get('chart.zoom.factor'))) + 'px';
+ img.style.top = (t + ((obj.Get('chart.zoom.thumbnail.height') / 2) * obj.Get('chart.zoom.factor'))) + 'px';
+
+ /**
+ * Fire the onzoom event
+ */
+ RGraph.FireCustomEvent(obj, 'onzoom');
+ }
+
+ /**
+ * The onmouseover event. Evidently. Fades the zoom window in
+ */
+ canvas.onmouseover = function (e)
+ {
+ var div = RGraph.Registry.Get('chart.zoomed.div');
+
+ // ???
+ if (!div) return;
+
+ var obj = div.__object__;
+
+ // Used for the enlargement animation
+ var targetWidth = obj.Get('chart.zoom.thumbnail.width');
+ var targetHeight = obj.Get('chart.zoom.thumbnail.height');
+
+ div.style.width = 0;
+ div.style.height = 0;
+
+ if (obj.Get('chart.zoom.fade.in')) {
+
+ RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.2;
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.4", 100);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.6", 200);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.8", 300);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 1", 400);
+
+ } else {
+
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 1", 1);
+ }
+
+ // The enlargement animation frames
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.width = '" + (targetWidth * (1/5) ) + "px'", 75);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.width = '" + (targetWidth * (2/5) ) + "px'", 150);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.width = '" + (targetWidth * (3/5) ) + "px'", 225);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.width = '" + (targetWidth * (4/5) ) + "px'", 300);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.width = '" + (targetWidth * (5/5) ) + "px'", 325);
+
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.height = '" + (targetHeight * (1/5) ) + "px'", 75);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.height = '" + (targetHeight * (2/5) ) + "px'", 150);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.height = '" + (targetHeight * (3/5) ) + "px'", 225);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.height = '" + (targetHeight * (4/5) ) + "px'", 300);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.height = '" + (targetHeight * (5/5) ) + "px'", 375);
+ }
+
+ canvas.onmouseout = function (e)
+ {
+ if (RGraph.Registry.Get('chart.zoomed.div') && RGraph.Registry.Get('chart.zoomed.div').__object__.Get('chart.zoom.fade.out')) {
+
+ RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.8;
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.6", 100);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.4", 200);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.2", 300);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0", 400);
+
+ // Get rid of the zoom window
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.left = '-400px'", 400);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.top = '-400px'", 400);
+
+ } else {
+ // Get rid of the zoom window
+ if (RGraph.Registry.Get('chart.zoomed.div')) {
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.left = '-400px'", 1);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.top = '-400px'", 41);
+ } }
+ }
+ }
+
+
+ /**
+ * A zoom in function
+ *
+ * @param e object The event object
+ */
+ RGraph.Zoom = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ /**
+ * Show the zoom window
+ */
+ //if ((e.target.__canvas__ && e.target.__canvas__.__object__.Get('chart.zoom.mode') == 'thumbnail') || (e.target.parentNode.__canvas__ && e.target.parentNode.__canvas__.__object__.Get('chart.zoom.mode') == 'thumbnail') ) {
+ // return RGraph.ZoomWindow(e);
+ //}
+
+ var canvas = e.target.__canvas__;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ var dataurl = canvas.toDataURL();
+ var tmp = canvas;
+ var coords = RGraph.getCanvasXY(canvas);
+ var factor = obj.Get('chart.zoom.factor') - 1;
+
+ var x = coords[0];
+ var y = coords[1];
+
+ var img = document.createElement('img');
+ img.className = 'RGraph_zoomed_canvas';
+ img.style.border = '3px solid gray';
+ img.style.width = canvas.width + 'px';
+ img.style.height = canvas.height + 'px';
+ img.style.position = 'absolute';
+ img.style.left = x + 'px';
+ img.style.top = y + 'px';
+ img.style.backgroundColor = 'white';
+ img.style.opacity = obj.Get('chart.zoom.fade.in') ? 0 : 1;
+ img.style.zIndex = 99;
+ img.src = dataurl;
+ document.body.appendChild(img);
+
+ //RGraph.Registry.Set('chart.zoomedimage', img);
+ // Store the zoomed image in a global var - NOT the registry
+ __zoomedimage__ = img;
+ __zoomedimage__.obj = obj;
+
+ // Image onclick should not hide the image
+ img.onclick = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+ e.stopPropagation();
+ return false;
+ }
+
+ setTimeout(function () {window.onclick = RGraph.HideZoomedCanvas;}, 1);
+
+ var width = parseInt(canvas.width);
+ var height = parseInt(canvas.height);
+ var frames = obj.Get('chart.zoom.frames');
+ var delay = obj.Get('chart.zoom.delay');
+
+ // Increase the width over 10 frames - center
+ if (obj.Get('chart.zoom.hdir') == 'center') {
+
+ for (var i=1; i<=frames; ++i) {
+ var newWidth = width * factor * (i/frames) + width;
+ var rightHandEdge = x + canvas.width;
+ var newLeft = (x + (canvas.width / 2)) - (newWidth / 2);
+
+ setTimeout("__zoomedimage__.style.width = '" + String(newWidth) + "px'; __zoomedimage__.style.left = '" + newLeft + "px'", i * delay);
+ }
+
+ // Left
+ } else if (obj.Get('chart.zoom.hdir') == 'left') {
+ for (var i=1; i<=frames; ++i) {
+ var newWidth = width * factor * (i/frames) + width;
+ var rightHandEdge = x + canvas.width;
+ var newLeft = rightHandEdge - newWidth;
+
+ setTimeout("__zoomedimage__.style.width = '" + String(newWidth) + "px'; __zoomedimage__.style.left = '" + newLeft + "px'", i * delay);
+ }
+
+ // Right (default)
+ } else {
+ for (var i=1; i<=frames; ++i) {
+ var newWidth = width * factor * (i/frames) + width;
+ setTimeout("__zoomedimage__.style.width = '" + String(newWidth) + "px'", i * delay);
+ }
+ }
+
+ // Increase the height over 10 frames - up
+ if (obj.Get('chart.zoom.vdir') == 'up') {
+ for (var i=1; i<=frames; ++i) {
+ var newHeight = (height * factor * (i/frames)) + height;
+ var bottomEdge = y + canvas.height;
+ var newTop = bottomEdge - newHeight;
+
+ setTimeout("__zoomedimage__.style.height = '" + String(newHeight) + "px'; __zoomedimage__.style.top = '" + newTop + "px'", i * delay);
+ }
+
+ // center
+ } else if (obj.Get('chart.zoom.vdir') == 'center') {
+ for (var i=1; i<=frames; ++i) {
+ var newHeight = (height * factor * (i/frames)) + height;
+ var bottomEdge = (y + (canvas.height / 2)) + (newHeight / 2);
+ var newTop = bottomEdge - newHeight;
+
+ setTimeout("__zoomedimage__.style.height = '" + String(newHeight) + "px'; __zoomedimage__.style.top = '" + newTop + "px'", i * delay);
+ }
+
+ // Down (default
+ } else {
+ for (var i=1; i<=frames; ++i) {
+ setTimeout("__zoomedimage__.style.height = '" + String(height * factor * (i/frames) + height) + "px'", i * delay);
+ }
+ }
+
+ // If enabled, increase the opactity over 10 frames
+ if (obj.Get('chart.zoom.fade.in')) {
+ for (var i=1; i<=frames; ++i) {
+ setTimeout("__zoomedimage__.style.opacity = " + String(i / frames), i * delay);
+ }
+ }
+
+ // If stipulated, produce a shadow
+ if (obj.Get('chart.zoom.shadow')) {
+ for (var i=1; i<=frames; ++i) {
+ setTimeout("__zoomedimage__.style.boxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 15px'", i * delay);
+ setTimeout("__zoomedimage__.style.MozBoxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 15px'", i * delay);
+ setTimeout("__zoomedimage__.style.WebkitBoxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 15px'", i * delay);
+ }
+ }
+
+ /**
+ * The onmouseout event. Hides the zoom window. Fades the zoom out
+ */
+ canvas.onmouseout = function (e)
+ {
+ if (RGraph.Registry.Get('chart.zoomed.div') && RGraph.Registry.Get('chart.zoomed.div').__object__.Get('chart.zoom.fade.out')) {
+
+ RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.8;
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.6", 100);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.4", 200);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0.2", 300);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.opacity = 0", 400);
+
+ // Get rid of the zoom window
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.left = '-400px'", 400);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.top = '-400px'", 400);
+
+ } else {
+
+ // Get rid of the zoom window
+ if (RGraph.Registry.Get('chart.zoomed.div')) {
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.left = '-400px'", 1);
+ setTimeout("RGraph.Registry.Get('chart.zoomed.div').style.top = '-400px'", 1);
+ }
+ }
+ }
+
+ // The background
+ if (obj.Get('chart.zoom.background')) {
+ var div = document.createElement('DIV');
+ div.style.backgroundColor = '#999';
+ div.style.opacity = 0;
+ div.style.position = 'fixed';
+ div.style.top = 0;
+ div.style.left = 0;
+ div.style.width = (screen.width + 100) + 'px';
+ div.style.height = (screen.height + 100) + 'px';
+ div.style.zIndex = 98;
+
+ // Hides the zoomed caboodle
+ div.oncontextmenu = function (e)
+ {
+ return RGraph.HideZoomedCanvas(e);
+ }
+
+ // 30th July 2010 - Is this necessary?
+ //for (var i=1; i<=frames; ++i) {
+ // setTimeout('__zoomedbackground__.style.opacity = ' + Number(0.04 * i), i * delay);
+ //
+ // // MSIE doesn't support zoom
+ // //setTimeout('__zoomedbackground__.style.filter = "progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135); Alpha(opacity=10)"', 50);
+ //}
+
+ div.origHeight = div.style.height;
+
+ document.body.appendChild(div);
+
+ __zoomedbackground__ = div;
+
+ // If the window is resized, hide the zoom
+ //window.onresize = RGraph.HideZoomedCanvas;
+
+ for (var i=1; i<=frames; ++i) {
+ setTimeout("__zoomedbackground__.style.opacity = " + (Number(i / frames) * 0.5), i * delay);
+ }
+ }
+
+ /**
+ * Fire the onzoom event
+ */
+ RGraph.FireCustomEvent(obj, 'onzoom');
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The bar chart constructor
+ *
+ * @param object canvas The canvas object
+ * @param array data The chart data
+ */
+ RGraph.Funnel = function (id, data)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.type = 'funnel';
+ this.coords = [];
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[FUNNEL] No canvas support');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[FUNNEL] Fatal error: The common library does not appear to have been included');
+ }
+
+ /**
+ * The funnel charts properties
+ */
+ this.properties = {
+ 'chart.strokestyle': 'black',
+ 'chart.gutter': 25,
+ 'chart.labels': null,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.colors': ['red', 'green', 'gray', 'blue', 'black', 'gray'],
+ 'chart.text.size': 10,
+ 'chart.text.boxed': true,
+ 'chart.text.halign': 'left',
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.contextmenu': null,
+ 'chart.shadow': false,
+ 'chart.shadow.color': '#666',
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+
+
+ 'chart.key': [],
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false
+ }
+
+ // Store the data
+ this.data = data;
+ }
+
+
+ /**
+ * A setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Funnel.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Funnel.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * The function you call to draw the bar chart
+ */
+ RGraph.Funnel.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // This stops the coords array from growing
+ this.coords = [];
+
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), null, this.Get('chart.text.size') + 2);
+ this.DrawFunnel();
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * The tooltip handler
+ */
+ if (this.Get('chart.tooltips')) {
+
+ RGraph.Register(this);
+
+ var canvas_onclick_func = function (e)
+ {
+ RGraph.Redraw();
+
+ var e = RGraph.FixEventObject(e);
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+
+ var mouseCoords = RGraph.getMouseXY(e);
+ var coords = obj.coords;
+ var x = mouseCoords[0];
+ var y = mouseCoords[1];
+
+ for (i=0; i<coords.length; ++i) {
+ if (
+ x > coords[i][0]
+ && x < coords[i][2]
+ && y > coords[i][1]
+ && y < coords[i][5]
+ ) {
+
+ /**
+ * Handle the right corner
+ */
+ if (x > coords[i][4]) {
+ var w1 = coords[i][2] - coords[i][4];
+ var h1 = coords[i][5] - coords[i][3];;
+ var a1 = Math.atan(h1 / w1) * 57.3; // DEGREES
+
+ var w2 = coords[i][2] - mouseCoords[0];
+ var h2 = mouseCoords[1] - coords[i][1];
+ var a2 = Math.atan(h2 / w2) * 57.3; // DEGREES
+
+ if (a2 > a1) {
+ continue;
+ }
+
+ /**
+ * Handle the left corner
+ */
+ } else if (x < coords[i][6]) {
+ var w1 = coords[i][6] - coords[i][0];
+ var h1 = coords[i][7] - coords[i][1];;
+ var a1 = Math.atan(h1 / w1) * 57.3; // DEGREES
+
+ var w2 = mouseCoords[0] - coords[i][0];
+ var h2 = mouseCoords[1] - coords[i][1];
+ var a2 = Math.atan(h2 / w2) * 57.3; // DEGREES
+
+ if (a2 > a1) {
+ continue;
+ }
+ }
+
+ // Is there a tooltip defined?
+ if (!obj.Get('chart.tooltips')[i] && typeof(obj.Get('chart.tooltips')) != 'function') {
+ break;
+ }
+
+ context.beginPath();
+
+ RGraph.NoShadow(obj);
+
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.moveTo(coords[i][0], coords[i][1]);
+ context.lineTo(coords[i][2], coords[i][3]);
+ context.lineTo(coords[i][4], coords[i][5]);
+ context.lineTo(coords[i][6], coords[i][7]);
+ context.closePath();
+
+ context.stroke();
+ context.fill();
+
+ /**
+ * Draw the key again for in-graph keys so they don't appear "under" the highlight
+ */
+ if (obj.Get('chart.key').length && obj.Get('chart.key.position') == 'graph') {
+ RGraph.DrawKey(obj, obj.Get('chart.key'), obj.Get('chart.colors'));
+ }
+
+ /**
+ * Redraw the labels if necessary
+ */
+ if (obj.Get('chart.labels')) {
+ obj.DrawLabels();
+ }
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(i);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[i]) == 'function') {
+ var text = obj.Get('chart.tooltips')[i](i);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[i];
+
+ } else {
+ var text = '';
+ }
+
+ // Show the tooltip
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+
+ // Stop the event propagating
+ e.stopPropagation();
+
+ break;
+ }
+ }
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+
+ /**
+ * Onmousemove event handler
+ */
+ var canvas_onmousemove_func = function (e)
+ {
+ var e = RGraph.FixEventObject(e);
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ var overFunnel = false;
+ var coords = obj.coords;
+
+ var mouseCoords = RGraph.getMouseXY(e);
+ var x = mouseCoords[0];
+ var y = mouseCoords[1];
+
+ for (i=0; i<coords.length; ++i) {
+ if (
+ x > coords[i][0]
+ && x < coords[i][2]
+ && y > coords[i][1]
+ && y < coords[i][5]
+ ) {
+
+ /**
+ * Handle the right corner
+ */
+ if (x > coords[i][4]) {
+ var w1 = coords[i][2] - coords[i][4];
+ var h1 = coords[i][5] - coords[i][3];;
+ var a1 = Math.atan(h1 / w1) * 57.3; // DEGREES
+
+ var w2 = coords[i][2] - mouseCoords[0];
+ var h2 = mouseCoords[1] - coords[i][1];
+ var a2 = Math.atan(h2 / w2) * 57.3; // DEGREES
+
+ if (a2 > a1) {
+ continue;
+ }
+
+ /**
+ * Handle the left corner
+ */
+ } else if (x < coords[i][6]) {
+ var w1 = coords[i][6] - coords[i][0];
+ var h1 = coords[i][7] - coords[i][1];;
+ var a1 = Math.atan(h1 / w1) * 57.3; // DEGREES
+
+ var w2 = mouseCoords[0] - coords[i][0];
+ var h2 = mouseCoords[1] - coords[i][1];
+ var a2 = Math.atan(h2 / w2) * 57.3; // DEGREES
+
+ if (a2 > a1) {
+ continue;
+ }
+ }
+
+ // Is there a tooltip defined?
+ if (!obj.Get('chart.tooltips')[i] && typeof(obj.Get('chart.tooltips')) != 'function') {
+ break;
+ }
+
+ overFunnel = true;
+ canvas.style.cursor = 'pointer';
+
+ // Stop the event propagating
+ e.stopPropagation();
+
+ break;
+ }
+ }
+
+ if (!overFunnel) {
+ canvas.style.cursor = 'default';
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+
+ /**
+ * Draw the labels on the chart
+ */
+ this.DrawLabels();
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail'|| this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * This function actually draws the chart
+ */
+ RGraph.Funnel.prototype.DrawFunnel = function ()
+ {
+ var context = this.context;
+ var canvas = this.canvas;
+ var width = this.canvas.width - (2 * this.Get('chart.gutter'));
+ var height = this.canvas.height - (2 * this.Get('chart.gutter'));
+ var total = RGraph.array_max(this.data);
+ var accheight = this.Get('chart.gutter');
+
+
+ /**
+ * Loop through each segment to draw
+ */
+
+ // Set a shadow if it's been requested
+ if (this.Get('chart.shadow')) {
+ context.shadowColor = this.Get('chart.shadow.color');
+ context.shadowBlur = this.Get('chart.shadow.blur');
+ context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ context.shadowOffsetY = this.Get('chart.shadow.offsety');
+ }
+
+ for (i=0; i<this.data.length; ++i) {
+
+ i = Number(i);
+
+ var curvalue = this.data[i];
+ var curwidth = (curvalue / total) * width;
+ var curheight = height / this.data.length;
+ var halfCurWidth = (curwidth / 2);
+ var nextvalue = this.data[i + 1] ? this.data[i + 1] : 0;
+ var nextwidth = this.data[i + 1] ? (nextvalue / total) * width : 0;
+ var halfNextWidth = (nextwidth / 2);
+ var center = (canvas.width / 2);
+ var gutter = this.Get('chart.gutter');
+
+ /**
+ * First segment
+ */
+ if (i == 0) {
+ var x1 = center - halfCurWidth;
+ var y1 = gutter;
+ var x2 = center + halfCurWidth;
+ var y2 = gutter;
+ var x3 = center + halfNextWidth;
+ var y3 = accheight + curheight;
+ var x4 = center - halfNextWidth;
+ var y4 = accheight + curheight;
+
+ /**
+ * Subsequent segments
+ */
+ } else {
+ var x1 = center - halfCurWidth;
+ var y1 = accheight;
+ var x2 = center + halfCurWidth;
+ var y2 = accheight;
+ var x3 = center + halfNextWidth;
+ var y3 = accheight + curheight;
+ var x4 = center - halfNextWidth;
+ var y4 = accheight + curheight;
+ }
+
+ /**
+ * Set the fill colour. If i is over 0 then don't use an offset
+ */
+ if (document.all && this.Get('chart.shadow')) {
+ this.DrawIEShadow([x1, y1, x2, y2, x3, y3, x4, y4], i > 0 && this.Get('chart.shadow.offsety') < 0);
+ }
+
+ context.strokeStyle = this.Get('chart.strokestyle');
+ context.fillStyle = this.Get('chart.colors')[i];
+
+ context.beginPath();
+ context.moveTo(x1, y1);
+ context.lineTo(x2, y2);
+ context.lineTo(x3, y3);
+ context.lineTo(x4, y4);
+ context.closePath();
+
+ /**
+ * Store the coordinates
+ */
+ this.coords.push([x1, y1, x2, y2, x3, y3, x4, y4]);
+
+ // The redrawing if the shadow is on will do the stroke
+ if (!this.Get('chart.shadow')) {
+ context.stroke();
+ }
+
+ context.fill();
+
+ accheight += curheight;
+ }
+
+ /**
+ * If the shadow is enabled, redraw every segment, in order to allow for shadows going upwards
+ */
+ if (this.Get('chart.shadow')) {
+
+ RGraph.NoShadow(this);
+
+ for (i=0; i<this.coords.length; ++i) {
+
+ context.strokeStyle = this.Get('chart.strokestyle');
+ context.fillStyle = this.Get('chart.colors')[i];
+
+ context.beginPath();
+ context.moveTo(this.coords[i][0], this.coords[i][1]);
+ context.lineTo(this.coords[i][2], this.coords[i][3]);
+ context.lineTo(this.coords[i][4], this.coords[i][5]);
+ context.lineTo(this.coords[i][6], this.coords[i][7]);
+ context.closePath();
+
+ context.stroke();
+ context.fill();
+ }
+ }
+
+ /**
+ * Lastly, draw the key if necessary
+ */
+ if (this.Get('chart.key') && this.Get('chart.key').length) {
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.colors'));
+ }
+ }
+
+ /**
+ * Draws the labels
+ */
+ RGraph.Funnel.prototype.DrawLabels = function ()
+ {
+ /**
+ * Draws the labels
+ */
+ if (this.Get('chart.labels') && this.Get('chart.labels').length > 0) {
+
+ var context = this.context;
+
+ for (var j=0; j<this.coords.length; ++j) { // MUST be "j"
+ context.beginPath();
+
+ // Set the color back to black
+ context.strokeStyle = 'black';
+ context.fillStyle = this.Get('chart.text.color');
+
+ // Turn off any shadow
+ RGraph.NoShadow(this);
+
+ var label = this.Get('chart.labels')[j];
+
+ RGraph.Text(context, this.Get('chart.text.font'), this.Get('chart.text.size'), this.Get('chart.text.halign') == 'left' ? 15 : this.canvas.width / 2, this.coords[j][1], label, 'center', this.Get('chart.text.halign') == 'left' ? 'left' : 'center', true, null, this.Get('chart.text.boxed') ? 'white' : null);
+ }
+ }
+ }
+
+
+ /**
+ * This function is used by MSIE only to manually draw the shadow
+ *
+ * @param array coords The coords for the bar
+ */
+ RGraph.Funnel.prototype.DrawIEShadow = function (coords, noOffset)
+ {
+ var prevFillStyle = this.context.fillStyle;
+ var offsetx = this.Get('chart.shadow.offsetx');
+ var offsety = this.Get('chart.shadow.offsety');
+ var context = this.context;
+
+ context.lineWidth = 1;
+ context.fillStyle = this.Get('chart.shadow.color');
+
+ // Draw the shadow
+ context.beginPath();
+ context.moveTo(coords[0] + (noOffset ? 0 : offsetx), coords[1] + (noOffset ? 0 : offsety));
+ context.lineTo(coords[2] + (noOffset ? 0 : offsetx), coords[3] + (noOffset ? 0 : offsety));
+ context.lineTo(coords[4] + (noOffset ? 0 : offsetx), coords[5] + (noOffset ? 0 : offsety));
+ context.lineTo(coords[6] + (noOffset ? 0 : offsetx), coords[7] + (noOffset ? 0 : offsety));
+ context.closePath();
+
+ context.fill();
+
+
+
+ // Change the fillstyle back to what it was
+ this.context.fillStyle = prevFillStyle;
+ }
\ No newline at end of file
--- /dev/null
+7 /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The gantt chart constructor
+ *
+ * @param object canvas The cxanvas object
+ * @param array data The chart data
+ */
+ RGraph.Gantt = function (id)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext("2d");
+ this.canvas.__object__ = this;
+ this.type = 'gantt';
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Set some defaults
+ this.properties = {
+ 'chart.background.barcolor1': 'white',
+ 'chart.background.barcolor2': 'white',
+ 'chart.background.grid': true,
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.hsize': 20,
+ 'chart.background.grid.vsize': 20,
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 7,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.background.vbars': [],
+ 'chart.text.size': 10,
+ 'chart.text.font': 'Verdana',
+ 'chart.text.color': 'black',
+ 'chart.gutter': 25,
+ 'chart.labels': [],
+ 'chart.margin': 2,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.events': [],
+ 'chart.borders': true,
+ 'chart.defaultcolor': 'white',
+ 'chart.coords': [],
+ 'chart.tooltips': [],
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.xmin': 0,
+ 'chart.xmax': 0,
+ 'chart.contextmenu': null,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[GANTT] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A peudo setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Gantt.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A peudo getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Gantt.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * Draws the chart
+ */
+ RGraph.Gantt.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ var gutter = this.Get('chart.gutter');
+
+ /**
+ * Work out the graphArea
+ */
+ this.graphArea = this.canvas.width - (2 * gutter);
+ this.graphHeight = this.canvas.height - (2 * gutter);
+ this.numEvents = this.Get('chart.events').length
+ this.barHeight = this.graphHeight / this.numEvents;
+ this.halfBarHeight = this.barHeight / 2;
+
+ /**
+ * Draw the background
+ */
+ RGraph.background.Draw(this);
+
+ /**
+ * Draw a space for the left hand labels
+ */
+ this.context.beginPath();
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = this.Get('chart.background.grid.color');
+ this.context.fillStyle = 'white';
+ this.context.fillRect(0,gutter - 5,gutter * 3, this.canvas.height - (2 * gutter) + 10);
+ this.context.moveTo(gutter * 3, gutter);
+ this.context.lineTo(gutter * 3, this.canvas.height - gutter);
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * Draw the labels at the top
+ */
+ this.DrawLabels();
+
+ /**
+ * Draw the events
+ */
+ this.DrawEvents();
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the labels at the top and the left of the chart
+ */
+ RGraph.Gantt.prototype.DrawLabels = function ()
+ {
+ var gutter = this.Get('chart.gutter');
+
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ /**
+ * Draw the X labels at the top of the chart.
+ */
+ var labelSpace = (this.graphArea - (2 * gutter)) / this.Get('chart.labels').length;
+ var xPos = (3 * gutter) + (labelSpace / 2);
+ this.context.strokeStyle = 'black'
+
+ for (i=0; i<this.Get('chart.labels').length; ++i) {
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size'), xPos + (i * labelSpace), gutter * (3/4), String(this.Get('chart.labels')[i]), 'center', 'center');
+ }
+
+ // Draw the vertical labels
+ for (i=0; i<this.Get('chart.events').length; ++i) {
+ var ev = this.Get('chart.events')[i];
+ var x = (3 * gutter);
+ var y = gutter + this.halfBarHeight + (i * this.barHeight);
+
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size'), x - 5, y, String(ev[3]), 'center', 'right');
+ }
+ }
+
+ /**
+ * Draws the events to the canvas
+ */
+ RGraph.Gantt.prototype.DrawEvents = function ()
+ {
+ var canvas = this.canvas;
+ var context = this.context;
+ var gutter = this.Get('chart.gutter');
+ var events = this.Get('chart.events');
+
+ /**
+ * Reset the coords array to prevent it growing
+ */
+ this.coords = [];
+
+ /**
+ * First draw the vertical bars that have been added
+ */
+ if (this.Get('chart.vbars')) {
+ for (i=0; i<this.Get('chart.vbars').length; ++i) {
+ // Boundary checking
+ if (this.Get('chart.vbars')[i][0] + this.Get('chart.vbars')[i][1] > this.Get('chart.xmax')) {
+ this.Get('chart.vbars')[i][1] = 364 - this.Get('chart.vbars')[i][0];
+ }
+
+ var barX = (3 * gutter) + ( (this.Get('chart.vbars')[i][0] - this.Get('chart.xmin')) / (this.Get('chart.xmax') - this.Get('chart.xmin')) ) * (this.graphArea - (2 * gutter) );
+ var barY = gutter;
+ var width = ( (this.graphArea - (2 * gutter)) / (this.Get('chart.xmax') - this.Get('chart.xmin')) ) * this.Get('chart.vbars')[i][1];
+ var height = canvas.height - (2 * gutter);
+
+ // Right hand bounds checking
+ if ( (barX + width) > (this.canvas.width - gutter) ) {
+ width = this.canvas.width - gutter - barX;
+ }
+
+ context.fillStyle = this.Get('chart.vbars')[i][2];
+ context.fillRect(barX, barY, width, height);
+ }
+ }
+
+
+ /**
+ * Draw the events
+ */
+ for (i=0; i<events.length; ++i) {
+
+ var ev = events[i];
+ var min = this.Get('chart.xmin');
+
+ context.beginPath();
+ context.strokeStyle = 'black';
+ context.fillStyle = ev[4] ? ev[4] : this.Get('chart.defaultcolor');
+
+ var barStartX = (3 * gutter) + ( (ev[0] - min) / (this.Get('chart.xmax') - min)) * (this.graphArea - (2 * gutter) );
+ //barStartX += this.margin;
+ var barStartY = gutter + (i * this.barHeight);
+ var barWidth = (ev[1] / (this.Get('chart.xmax') - min) ) * (this.graphArea - (2 * gutter));
+
+ /**
+ * If the width is greater than the graph atrea, curtail it
+ */
+ if ( (barStartX + barWidth) > (canvas.width - gutter) ) {
+ barWidth = canvas.width - gutter - barStartX;
+ }
+
+ // draw the border around the bar
+ if (this.Get('chart.borders')) {
+ context.strokeStyle = 'black';
+ context.beginPath();
+ context.strokeRect(barStartX, barStartY + this.Get('chart.margin'), barWidth, this.barHeight - (2 * this.Get('chart.margin')) );
+ }
+
+ /**
+ * Draw the actual bar storing store the coordinates
+ */
+ this.coords.push([barStartX, barStartY + this.Get('chart.margin'), barWidth, this.barHeight - (2 * this.Get('chart.margin'))]);
+ context.fillRect(barStartX, barStartY + this.Get('chart.margin'), barWidth, this.barHeight - (2 * this.Get('chart.margin')) );
+
+ // Work out the completeage indicator
+ var complete = (ev[2] / 100) * barWidth;
+
+ // Draw the % complete indicator. If it's greater than 0
+ if (typeof(ev[2]) == 'number') {
+ context.beginPath();
+ context.fillStyle = ev[5] ? ev[5] : '#0c0';
+ context.fillRect(barStartX,
+ barStartY + this.Get('chart.margin'),
+ (ev[2] / 100) * barWidth,
+ this.barHeight - (2 * this.Get('chart.margin')) );
+
+ context.beginPath();
+ context.fillStyle = this.Get('chart.text.color');
+ RGraph.Text(context, this.Get('chart.text.font'), this.Get('chart.text.size'), barStartX + barWidth + 5, barStartY + this.halfBarHeight, String(ev[2]) + '%', 'center');
+ }
+ }
+
+
+ /**
+ * If tooltips are defined, handle them
+ */
+ if (this.Get('chart.tooltips')) {
+
+ // Register the object for redrawing
+ RGraph.Register(this);
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand
+ */
+ var canvas_onmousemove_func = function (eventObj)
+ {
+ eventObj = RGraph.FixEventObject(eventObj);
+ var canvas = eventObj.target;
+ var obj = canvas.__object__;
+ var len = obj.coords.length;
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(eventObj);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<len; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if ( mouseX >= left
+ && mouseX <= (left + width)
+ && mouseY >= top
+ && mouseY <= (top + height)
+ && (typeof(obj.Get('chart.tooltips')) == 'function' || obj.Get('chart.tooltips')[i]) ) {
+
+ canvas.style.cursor = 'pointer';
+ return;
+ }
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+
+
+ var canvas_onclick_func = function (eventObj)
+ {
+ eventObj = RGraph.FixEventObject(eventObj);
+
+ var canvas = eventObj.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+
+ var mouseCoords = RGraph.getMouseXY(eventObj);
+ var mouseX = mouseCoords[0];
+ var mouseY = mouseCoords[1];
+
+
+ for (i=0; i<obj.coords.length; ++i) {
+
+ var idx = i;
+ var xCoord = obj.coords[i][0];
+ var yCoord = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if (
+ mouseX >= xCoord
+ && (mouseX <= xCoord + width)
+ && mouseY >= yCoord
+ && (mouseY <= yCoord + height)
+ && obj.Get('chart.tooltips')
+ ) {
+
+ // Redraw the graph
+ RGraph.Redraw();
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[idx]) == 'function') {
+ var text = obj.Get('chart.tooltips')[idx](idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[idx];
+
+ } else {
+ var text = null;
+ }
+
+ if (String(text).length && text != null) {
+
+ // SHOW THE CORRECT TOOLTIP
+ RGraph.Tooltip(canvas, text, eventObj.pageX, eventObj.pageY, idx);
+
+ /**
+ * Draw a rectangle around the correct bar, in effect highlighting it
+ */
+ context.strokeStyle = 'black';
+ context.fillStyle = 'rgba(255,255,255,0.8)';
+ context.strokeRect(xCoord, yCoord, width, height);
+ context.fillRect(xCoord, yCoord, width, height);
+
+ eventObj.stopPropagation();
+ }
+ return;
+ }
+ }
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The horizontal bar chart constructor. The horizontal bar is a minor variant
+ * on the bar chart. If you have big labels, this may be useful as there is usually
+ * more space available for them.
+ *
+ * @param object canvas The canvas object
+ * @param array data The chart data
+ */
+ RGraph.HBar = function (id, data)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.data = data;
+ this.type = 'hbar';
+ this.coords = [];
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ this.max = 0;
+ this.stackedOrGrouped = false;
+
+ // Default properties
+ this.properties = {
+ 'chart.gutter': 25,
+ 'chart.background.grid': true,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.hsize': 25,
+ 'chart.background.grid.vsize': 25,
+ 'chart.background.barcolor1': 'white',
+ 'chart.background.barcolor2': 'white',
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 14,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.xaxis': '',
+ 'chart.title.yaxis': '',
+ 'chart.title.xaxis.pos': 0.25,
+ 'chart.title.yaxis.pos': 0.5,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.colors': ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0'],
+ 'chart.labels': [],
+ 'chart.labels.above': false,
+ 'chart.labels.above.decimals': 0,
+ 'chart.contextmenu': null,
+ 'chart.key': [],
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.units.ingraph': false,
+ 'chart.strokestyle': 'black',
+ 'chart.xmax': 0,
+ 'chart.axis.color': 'black',
+ 'chart.shadow': false,
+ 'chart.shadow.color': '#666',
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.vmargin': 3,
+ 'chart.grouping': 'grouped',
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.scale.decimals': null
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[HBAR] No canvas support');
+ return;
+ }
+
+ // Check the canvasText library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[HBAR] Fatal error: The common library does not appear to have been included');
+ }
+
+ for (i=0; i<this.data.length; ++i) {
+ if (typeof(this.data[i]) == 'object') {
+ this.stackedOrGrouped = true;
+ }
+ }
+ }
+
+
+ /**
+ * A setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.HBar.prototype.Set = function (name, value)
+ {
+ if (name == 'chart.labels.abovebar') {
+ name = 'chart.labels.above';
+ }
+
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.HBar.prototype.Get = function (name)
+ {
+ if (name == 'chart.labels.abovebar') {
+ name = 'chart.labels.above';
+ }
+
+ return this.properties[name];
+ }
+
+
+ /**
+ * The function you call to draw the bar chart
+ */
+ RGraph.HBar.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+
+ var gutter = this.Get('chart.gutter');
+
+ /**
+ * Stop the coords array from growing uncontrollably
+ */
+ this.coords = [];
+
+ /**
+ * Work out a few things. They need to be here because they depend on things you can change before you
+ * call Draw() but after you instantiate the object
+ */
+ this.graphwidth = this.canvas.width - ( (4 * gutter));
+ this.graphheight = this.canvas.height - (2 * gutter);
+ this.halfgrapharea = this.grapharea / 2;
+ this.halfTextHeight = this.Get('chart.text.size') / 2;
+ this.lgutter = 3 * gutter;
+
+ // Progressively Draw the chart
+ this.DrawBackground();
+
+ this.Drawbars();
+ this.DrawAxes();
+ this.DrawLabels();
+
+
+ // Draw the key if necessary
+ if (this.Get('chart.key').length) {
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.colors'));
+ }
+
+ /**
+ * Install the event handlers for tooltips
+ */
+ if (this.Get('chart.tooltips')) {
+
+ // Need to register this object for redrawing
+ RGraph.Register(this);
+
+ /**
+ * Install the window onclick handler
+ */
+ window.onclick = function ()
+ {
+ RGraph.Redraw();
+ }
+
+
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand
+ */
+ //this.canvas.onmousemove = function (e)
+ var canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0,len=obj.coords.length; i<len; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if ( mouseX >= (left)
+ && mouseX <= (left + width)
+ && mouseY >= top
+ && mouseY <= (top + height)
+ && ( typeof(obj.Get('chart.tooltips')) == 'function'
+ || obj.Get('chart.tooltips')[i]
+ ) ) {
+
+ canvas.style.cursor = 'pointer';
+ return;
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+
+
+ /**
+ * Install the onclick event handler for the tooltips
+ */
+ //this.canvas.onclick = function (e)
+ var canvas_onclick_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ //var canvas = document.getElementById(this.id);
+ var canvas = e.target;
+ var obj = canvas.__object__;
+
+ /**
+ * Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
+ * This "deselects" any already selected bar
+ */
+ RGraph.Redraw();
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0,len=obj.coords.length; i<len; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+ var idx = i;
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[idx]) == 'function') {
+ var text = obj.Get('chart.tooltips')[idx](idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[idx];
+
+ } else {
+ var text = null;
+ }
+
+ /**
+ * Show a tooltip if it's defined
+ */
+ if (String(text).length && text != null) {
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(left, top, width, height);
+ obj.context.fillRect(left, top, width, height);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+ }
+ }
+ }
+
+ /**
+ * Stop the event bubbling
+ */
+ e.stopPropagation();
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+
+ // This resets the bar graph
+ if (RGraph.Registry.Get('chart.tooltip')) {
+ RGraph.Registry.Get('chart.tooltip').style.display = 'none';
+ RGraph.Registry.Set('chart.tooltip', null)
+ }
+ }
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+
+ /**
+ * Draw "in graph" labels
+ */
+ RGraph.DrawInGraphLabels(this);
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+ /**
+ * This draws the axes
+ */
+ RGraph.HBar.prototype.DrawAxes = function ()
+ {
+ var gutter = this.Get('chart.gutter');
+ var halfway = ((this.canvas.width - (4 * gutter)) / 2) + (3 * gutter);
+
+ this.context.beginPath();
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = this.Get('chart.axis.color');
+
+ // Draw the Y axis
+ if (this.Get('chart.yaxispos') == 'center') {
+ this.context.moveTo(halfway, gutter);
+ this.context.lineTo(halfway, this.canvas.height - gutter);
+ } else {
+ this.context.moveTo(gutter * 3, gutter);
+ this.context.lineTo(gutter * 3, this.canvas.height - gutter);
+ }
+
+ // Draw the X axis
+ this.context.moveTo(gutter * 3, this.canvas.height - gutter);
+ this.context.lineTo(this.canvas.width - gutter, this.canvas.height - gutter);
+
+ // Draw the Y tickmarks
+ var yTickGap = (this.canvas.height - (2 * gutter)) / this.data.length;
+
+ for (y=gutter; y<(this.canvas.height - gutter); y+=yTickGap) {
+ if (this.Get('chart.yaxispos') == 'center') {
+ this.context.moveTo(halfway + 3, y);
+ this.context.lineTo(halfway - 3, y);
+ } else {
+ this.context.moveTo(gutter * 3, y);
+ this.context.lineTo( (gutter * 3) - 3, y);
+ }
+ }
+
+
+ // Draw the X tickmarks
+ xTickGap = (this.canvas.width - (4 * gutter) ) / 10;
+ yStart = this.canvas.height - gutter;
+ yEnd = (this.canvas.height - gutter) + 3;
+
+ for (x=(this.canvas.width - gutter), i=0; this.Get('chart.yaxispos') == 'center' ? x>=(3 * gutter) : x>(3*gutter); x-=xTickGap) {
+
+ if (this.Get('chart.yaxispos') != 'center' || i != 5) {
+ this.context.moveTo(x, yStart);
+ this.context.lineTo(x, yEnd);
+ }
+ i++;
+ }
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * This function draws the background. The common function isn't used because the left gutter is
+ * three times as big.
+ *
+ * @param object obj The graph object
+ */
+ RGraph.HBar.prototype.DrawBackground = function ()
+ {
+ var gutter = this.Get('chart.gutter');
+ var size = this.Get('chart.text.size');
+ var font = this.Get('chart.text.font');
+ var canvas = this.canvas;
+ var context = this.context;
+
+ this.context.beginPath();
+
+ // Draw the horizontal bars
+ this.context.fillStyle = this.Get('chart.background.barcolor1');
+ for (var i=gutter; i < (canvas.height - gutter); i+=80) {
+ context.fillRect (gutter * 3, i, canvas.width - (gutter * 4), Math.min(40, canvas.height - gutter - i) );
+ }
+
+ this.context.fillStyle = this.Get('chart.background.barcolor2');
+ for (var i= (40 + gutter); i < (canvas.height - gutter); i+=80) {
+ context.fillRect (gutter * 3, i, canvas.width - (gutter * 4), i + 40 > (canvas.height - gutter) ? canvas.height - (gutter + i) : 40);
+ }
+
+ this.context.stroke();
+
+ // Draw the background grid
+ if (this.Get('chart.background.grid')) {
+
+ // If autofit is specified, use the .numhlines and .numvlines along with the width to work
+ // out the hsize and vsize
+ if (this.Get('chart.background.grid.autofit')) {
+ var vsize = (canvas.width - (4 * gutter)) / this.Get('chart.background.grid.autofit.numvlines');
+ var hsize = (canvas.height - (4 * gutter)) / this.Get('chart.background.grid.autofit.numhlines');
+
+ this.Set('chart.background.grid.vsize', vsize);
+ this.Set('chart.background.grid.hsize', hsize);
+ }
+
+ context.beginPath();
+ context.lineWidth = this.Get('chart.background.grid.width');
+ context.strokeStyle = this.Get('chart.background.grid.color');
+
+ // Draw the horizontal lines
+ if (this.Get('chart.background.grid.hlines')) {
+ for (y=gutter; y < (canvas.height - gutter); y+=this.Get('chart.background.grid.hsize')) {
+ context.moveTo(gutter * 3, y);
+ context.lineTo(canvas.width - gutter, y);
+ }
+ }
+
+ // Draw the vertical lines
+ if (this.Get('chart.background.grid.vlines')) {
+ for (x=gutter * 3; x <= (canvas.width - gutter); x+=this.Get('chart.background.grid.vsize')) {
+ context.moveTo(x, gutter);
+ context.lineTo(x, canvas.height - gutter);
+ }
+ }
+
+ if (this.Get('chart.background.grid.border')) {
+ // Make sure a rectangle, the same colour as the grid goes around the graph
+ context.strokeStyle = this.Get('chart.background.grid.color');
+ context.strokeRect(gutter * 3, gutter, canvas.width - (4 * gutter), canvas.height - (2 * gutter));
+ }
+ }
+
+ context.stroke();
+
+
+ // Draw the title if one is set
+ if ( typeof(this.Get('chart.title')) == 'string') {
+
+ RGraph.DrawTitle(canvas,
+ this.Get('chart.title'),
+ gutter,
+ (3 * gutter) + ((canvas.width - (4 * gutter)) / 2),
+ size + 2);
+ }
+
+ context.stroke();
+
+
+ // X axis title
+ if (typeof(this.Get('chart.title.xaxis')) == 'string' && this.Get('chart.title.xaxis').length) {
+ context.beginPath();
+ RGraph.Text(context, font, size + 2, canvas.width / 2, canvas.height - (gutter * this.Get('chart.title.xaxis.pos')), this.Get('chart.title.xaxis'), 'center', 'center', false, false, false, true);
+ context.fill();
+ }
+
+
+ // Y axis title
+ if (typeof(this.Get('chart.title.yaxis')) == 'string' && this.Get('chart.title.yaxis').length) {
+ context.beginPath();
+ RGraph.Text(context, font, size + 2, gutter * this.Get('chart.title.yaxis.pos'), canvas.height / 2, this.Get('chart.title.yaxis'), 'center', 'center', false, 270, false, true);
+ context.fill();
+ }
+ }
+
+
+ /**
+ * This draws the labels for the graph
+ */
+ RGraph.HBar.prototype.DrawLabels = function ()
+ {
+ var gutter = this.Get('chart.gutter');
+ var context = this.context;
+ var canvas = this.canvas;
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var text_size = this.Get('chart.text.size');
+ var font = this.Get('chart.text.font');
+
+
+ /**
+ * Set the units to blank if they're to be used for ingraph labels only
+ */
+ if (this.Get('chart.units.ingraph')) {
+ units_pre = '';
+ units_post = '';
+ }
+
+
+ /**
+ * Draw the X axis labels
+ */
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ //var interval = (this.canvas.width - (4 * gutter)) / (t ? 10 : 5);
+
+ if (this.Get('chart.yaxispos') == 'center') {
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (10/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[4], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (9/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[3], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (8/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[2], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (7/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[1], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (6/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[0], units_pre, units_post), 'center', 'center');
+
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (4/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, -1 * this.scale[0], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (3/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, -1 * this.scale[1], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (2/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, -1 * this.scale[2], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (1/10)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, -1 * this.scale[3], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (0)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, -1 * this.scale[4], units_pre, units_post), 'center', 'center');
+
+ } else {
+
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (5/5)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[4], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (4/5)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[3], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (3/5)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[2], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (2/5)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[1], units_pre, units_post), 'center', 'center');
+ RGraph.Text(context, font, text_size, (gutter * 3) + (this.graphwidth * (1/5)), gutter + this.halfTextHeight + this.graphheight + 2, RGraph.number_format(this, this.scale[0], units_pre, units_post), 'center', 'center');
+ }
+
+ this.context.fill();
+ this.context.stroke();
+
+ /**
+ * The Y axis labels
+ */
+ if (typeof(this.Get('chart.labels')) == 'object') {
+
+ var xOffset = 5;
+ var font = this.Get('chart.text.font');
+
+ // Draw the X axis labels
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ // How wide is each bar
+ var barHeight = (this.canvas.height - (2 * gutter) ) / this.Get('chart.labels').length;
+
+ // Reset the xTickGap
+ yTickGap = (this.canvas.height - (2 * gutter)) / this.Get('chart.labels').length
+
+ // Draw the X tickmarks
+ var i=0;
+ for (y=gutter + (yTickGap / 2); y<=this.canvas.height - gutter; y+=yTickGap) {
+ RGraph.Text(this.context, font,
+ this.Get('chart.text.size'),
+ (gutter * 3) - xOffset,
+ y,
+ String(this.Get('chart.labels')[i++]),
+ 'center',
+ 'right');
+ }
+ }
+ }
+
+
+ /**
+ * This function draws the actual bars
+ */
+ RGraph.HBar.prototype.Drawbars = function ()
+ {
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = this.Get('chart.colors')[0];
+ var prevX = 0;
+ var prevY = 0;
+
+ /**
+ * Work out the max value
+ */
+ if (this.Get('chart.xmax')) {
+ this.scale = [
+ (this.Get('chart.xmax') * 0.2).toFixed(this.Get('chart.scale.decimals')),
+ (this.Get('chart.xmax') * 0.4).toFixed(this.Get('chart.scale.decimals')),
+ (this.Get('chart.xmax') * 0.6).toFixed(this.Get('chart.scale.decimals')),
+ (this.Get('chart.xmax') * 0.8).toFixed(this.Get('chart.scale.decimals')),
+ (this.Get('chart.xmax')).toFixed(this.Get('chart.scale.decimals'))
+ ];
+ this.max = this.scale[4];
+ } else {
+ var grouping = this.Get('chart.grouping');
+
+ for (i=0; i<this.data.length; ++i) {
+ if (typeof(this.data[i]) == 'object') {
+ var value = grouping == 'grouped' ? Number(RGraph.array_max(this.data[i], true)) : Number(RGraph.array_sum(this.data[i])) ;
+ } else {
+ var value = Number(this.data[i]);
+ }
+
+ this.max = Math.max(Math.abs(this.max), Math.abs(value));
+ }
+
+ this.scale = RGraph.getScale(this.max, this);
+ this.max = this.scale[4];
+ }
+
+
+ /**
+ * The bars are drawn HERE
+ */
+ var gutter = this.Get('chart.gutter');
+ var graphwidth = (this.canvas.width - (4 * gutter));
+ var halfwidth = graphwidth / 2;
+
+ for (i=0; i<this.data.length; ++i) {
+
+ // Work out the width and height
+ var width = (this.data[i] / this.max) * graphwidth;
+ var height = this.graphheight / this.data.length;
+
+ var orig_height = height;
+
+ var x = 3 * gutter;
+ var y = gutter + (i * height);
+ var vmargin = this.Get('chart.vmargin');
+ var gutter = gutter;
+
+ // Account for negative lengths - Some browsers (eg Chrome) don't like a negative value
+ if (width < 0) {
+ x -= width;
+ width = Math.abs(width);
+ }
+
+ /**
+ * Turn on the shadow if need be
+ */
+ if (this.Get('chart.shadow')) {
+ this.context.shadowColor = this.Get('chart.shadow.color');
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+ }
+
+ /**
+ * Draw the bar
+ */
+ this.context.beginPath();
+ if (typeof(this.data[i]) == 'number') {
+
+ var barHeight = height - (2 * vmargin);
+ var barWidth = (this.data[i] / this.max) * this.graphwidth;
+ var barX = 3 * gutter;
+
+ // Account for Y axis pos
+ if (this.Get('chart.yaxispos') == 'center') {
+ barWidth /= 2;
+ barX += halfwidth;
+ }
+
+ // Set the fill color
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = this.Get('chart.colors')[0];
+
+ this.context.strokeRect(barX, gutter + (i * height) + this.Get('chart.vmargin'), barWidth, barHeight);
+ this.context.fillRect(barX, gutter + (i * height) + this.Get('chart.vmargin'), barWidth, barHeight);
+
+ this.coords.push([x, y + vmargin, width, height - (2 * vmargin), this.Get('chart.colors')[0], this.data[i]]);
+
+ /**
+ * Stacked bar chart
+ */
+ } else if (typeof(this.data[i]) == 'object' && this.Get('chart.grouping') == 'stacked') {
+
+ var barHeight = height - (2 * vmargin);
+
+ for (j=0; j<this.data[i].length; ++j) {
+
+ // Set the fill/stroke colors
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = this.Get('chart.colors')[j];
+
+ var width = (this.data[i][j] / this.max) * this.graphwidth;
+ var totalWidth = (RGraph.array_sum(this.data[i]) / this.max) * this.graphwidth;
+
+ this.context.strokeRect(x, gutter + this.Get('chart.vmargin') + (this.graphheight / this.data.length) * i, width, height - (2 * vmargin) );
+ this.context.fillRect(x, gutter + this.Get('chart.vmargin') + (this.graphheight / this.data.length) * i, width, height - (2 * vmargin) );
+
+ /**
+ * Store the coords for tooltips
+ */
+
+ this.coords.push([x, y + vmargin, width, height - (2 * vmargin), this.Get('chart.colors')[j], RGraph.array_sum(this.data[i])]);
+
+ x += width;
+ }
+
+ /**
+ * A grouped bar chart
+ */
+ } else if (typeof(this.data[i]) == 'object' && this.Get('chart.grouping') == 'grouped') {
+
+ for (j=0; j<this.data[i].length; ++j) {
+
+ /**
+ * Turn on the shadow if need be
+ */
+ if (this.Get('chart.shadow')) {
+ RGraph.SetShadow(this, this.Get('chart.shadow.color'), this.Get('chart.shadow.offsetx'), this.Get('chart.shadow.offsety'), this.Get('chart.shadow.blur'));
+ }
+
+ // Set the fill/stroke colors
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = this.Get('chart.colors')[j];
+
+ var width = (this.data[i][j] / this.max) * (this.canvas.width - (4 * gutter) );
+ var individualBarHeight = (height - (2 * vmargin)) / this.data[i].length;
+
+ var startX = gutter * 3;
+ var startY = y + vmargin + (j * individualBarHeight);
+
+ // Account for the Y axis being in the middle
+ if (this.Get('chart.yaxispos') == 'center') {
+ width /= 2;
+ startX += halfwidth;
+ }
+
+ if (width < 0) {
+ startX += width;
+ width *= -1;
+ }
+
+ this.context.strokeRect(startX, startY, width, individualBarHeight);
+ this.context.fillRect(startX, startY, width, individualBarHeight);
+
+ this.coords.push([startX, startY, width, individualBarHeight, this.Get('chart.colors')[j], this.data[i][j]]);
+ }
+ }
+
+ this.context.closePath();
+ }
+
+ this.context.fill();
+ this.context.stroke();
+
+
+
+ /**
+ * Now the bars are stroke()ed, turn off the shadow
+ */
+ RGraph.NoShadow(this);
+
+ this.RedrawBars();
+ }
+
+
+ /**
+ * This function goes over the bars after they been drawn, so that upwards shadows are underneath the bars
+ */
+ RGraph.HBar.prototype.RedrawBars = function ()
+ {
+ var coords = this.coords;
+
+ RGraph.NoShadow(this);
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+
+ for (var i=0; i<coords.length; ++i) {
+
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = coords[i][4];
+ this.context.lineWidth = 1;
+ this.context.strokeRect(coords[i][0], coords[i][1], coords[i][2], coords[i][3]);
+ this.context.fillRect(coords[i][0], coords[i][1], coords[i][2], coords[i][3]);
+ this.context.fill();
+ this.context.stroke();
+
+ /**
+ * Draw labels "above" the bar
+ */
+ if (this.Get('chart.labels.above')) {
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ this.context.strokeStyle = 'black';
+ RGraph.NoShadow(this);
+
+ var border = (coords[i][0] + coords[i][2] + 7 + this.context.measureText(this.Get('chart.units.pre') + this.coords[i][5] + this.Get('chart.units.post')).width) > this.canvas.width ? true : false;
+
+ RGraph.Text(this.context,this.Get('chart.text.font'),this.Get('chart.text.size'),coords[i][0] + coords[i][2] + (border ? -5 : 5),coords[i][1] + (coords[i][3] / 2),RGraph.number_format(this, (this.coords[i][5]).toFixed(this.Get('chart.labels.above.decimals')), this.Get('chart.units.pre'), this.Get('chart.units.post')),'center',border ? 'right' : 'left',border,null,border ? 'rgba(255,255,255,0.9)' : null);
+
+ }
+ }
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The progress bar constructor
+ *
+ * @param int id The ID of the canvas tag
+ * @param int value The indicated value of the meter.
+ * @param int max The end value (the upper most) of the meter
+ */
+ RGraph.HProgress = function (id, value, max)
+ {
+ this.id = id;
+ this.max = max;
+ this.value = value;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.canvas.__object__ = this;
+ this.type = 'hprogress';
+ this.coords = [];
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+ this.properties = {
+ 'chart.min': 0,
+ 'chart.colors': ['#0c0'],
+ 'chart.tickmarks': true,
+ 'chart.tickmarks.color': 'black',
+ 'chart.tickmarks.inner': false,
+ 'chart.gutter': 25,
+ 'chart.numticks': 10,
+ 'chart.numticks.inner': 50,
+ 'chart.background.color': '#eee',
+ 'chart.shadow': false,
+ 'chart.shadow.color': 'rgba(0,0,0,0.5)',
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.width': 0,
+ 'chart.height': 0,
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.contextmenu': null,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.tooltips': [],
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.background': true,
+ 'chart.zoom.thumbnail.width': 100,
+ 'chart.zoom.thumbnail.height': 100,
+ 'chart.arrows': false,
+ 'chart.margin': 0,
+ 'chart.resizable': false,
+ 'chart.label.inner': false,
+ 'chart.adjustable': false,
+ 'chart.scale.decimals': 0
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[PROGRESS] No canvas support');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[PROGRESS] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A generic setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the poperty
+ */
+ RGraph.HProgress.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A generic getter
+ *
+ * @param string name The name of the property to get
+ */
+ RGraph.HProgress.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * Draws the progress bar
+ */
+ RGraph.HProgress.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // Figure out the width and height
+ this.width = this.canvas.width - (2 * this.Get('chart.gutter'));
+ this.height = this.canvas.height - (2 * this.Get('chart.gutter'));
+ this.coords = [];
+
+ this.Drawbar();
+ this.DrawTickMarks();
+ this.DrawLabels();
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Alternatively, show the tooltip if requested
+ */
+ if (typeof(this.Get('chart.tooltips')) == 'function' || this.Get('chart.tooltips').length) {
+
+ // Need to register this object for redrawing
+ RGraph.Register(this);
+
+ /**
+ * Install the window onclick handler
+ */
+ window.onclick = function ()
+ {
+ RGraph.Redraw();
+ }
+
+
+ /**
+ * Install the onclick event handler for the tooltips
+ */
+ var canvas_onclick_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
+ * This "deselects" any already selected bar
+ */
+ RGraph.Redraw();
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0];
+ var mouseY = mouseCoords[1];
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+ var idx = i;
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[idx]) == 'function') {
+ var text = obj.Get('chart.tooltips')[idx](idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[idx];
+
+ } else {
+ var text = null;
+ }
+
+ /**
+ * Show a tooltip if it's defined
+ */
+ if (text) {
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(left, top, width, height);
+ obj.context.fillRect(left, top, width, height);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+ }
+ }
+ }
+
+ /**
+ * Stop the event bubbling
+ */
+ e.stopPropagation();
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand
+ */
+ var canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+ canvas.style.cursor = 'pointer';
+ break;
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Instead of using RGraph.common.adjusting.js, handle them here
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+ /**
+ * Draws the bar
+ */
+ RGraph.HProgress.prototype.Drawbar = function ()
+ {
+ // Set a shadow if requested
+ if (this.Get('chart.shadow')) {
+ RGraph.SetShadow(this, this.Get('chart.shadow.color'), this.Get('chart.shadow.offsetx'), this.Get('chart.shadow.offsety'), this.Get('chart.shadow.blur'));
+ }
+
+ // Draw the shadow for MSIE
+ if (RGraph.isIE8() && this.Get('chart.shadow')) {
+ this.context.fillStyle = this.Get('chart.shadow.color');
+ this.context.fillRect(this.Get('chart.gutter') + this.Get('chart.shadow.offsetx'), this.Get('chart.gutter') + this.Get('chart.shadow.offsety'), this.width, this.height);
+ }
+
+ // Draw the outline
+ this.context.fillStyle = this.Get('chart.background.color');
+ this.context.strokeStyle = 'black';
+ this.context.strokeRect(this.Get('chart.gutter'), this.Get('chart.gutter'), this.width, this.height);
+ this.context.fillRect(this.Get('chart.gutter'), this.Get('chart.gutter'), this.width, this.height);
+
+ // Turn off any shadow
+ RGraph.NoShadow(this);
+
+ this.context.fillStyle = this.Get('chart.color');
+ this.context.strokeStyle = 'black';
+
+ var margin = this.Get('chart.margin');
+
+ // Draw the actual bar itself
+ var barWidth = Math.min(this.width, ((RGraph.array_sum(this.value) - this.Get('chart.min')) / (this.max - this.Get('chart.min')) ) * this.width);
+
+ if (this.Get('chart.tickmarks.inner')) {
+
+ var spacing = (this.canvas.width - this.Get('chart.gutter') - this.Get('chart.gutter')) / this.Get('chart.numticks.inner');
+
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = '#999';
+
+ this.context.beginPath();
+ for (var x = this.Get('chart.gutter'); x<this.canvas.width - this.Get('chart.gutter'); x+=spacing) {
+ this.context.moveTo(x, this.Get('chart.gutter'));
+ this.context.lineTo(x, this.Get('chart.gutter') + 2);
+
+ this.context.moveTo(x, this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(x, this.canvas.height - this.Get('chart.gutter') - 2);
+ }
+ this.context.stroke();
+ }
+
+ /**
+ * This bit draws the actual progress bar
+ */
+ if (typeof(this.value) == 'number') {
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+ this.context.fillStyle = this.Get('chart.colors')[0];
+ this.context.strokeRect(this.Get('chart.gutter'), this.Get('chart.gutter') + margin, barWidth, this.height - margin - margin);
+ this.context.fillRect(this.Get('chart.gutter'), this.Get('chart.gutter') + margin, barWidth, this.height - margin - margin);
+
+ // Store the coords
+ this.coords.push([this.Get('chart.gutter'),
+ this.Get('chart.gutter') + margin,
+ barWidth,
+ this.height - margin - margin]);
+
+ } else if (typeof(this.value) == 'object') {
+
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+
+ var startPoint = this.Get('chart.gutter');
+
+ for (var i=0; i<this.value.length; ++i) {
+
+ var segmentLength = (this.value[i] / RGraph.array_sum(this.value)) * barWidth;
+ this.context.fillStyle = this.Get('chart.colors')[i];
+
+ this.context.strokeRect(startPoint, this.Get('chart.gutter') + margin, segmentLength, this.height - margin - margin);
+ this.context.fillRect(startPoint, this.Get('chart.gutter') + margin, segmentLength, this.height - margin - margin);
+
+
+ // Store the coords
+ this.coords.push([startPoint,
+ this.Get('chart.gutter') + margin,
+ segmentLength,
+ this.height - margin - margin]);
+
+ startPoint += segmentLength;
+ }
+ }
+
+ /**
+ * Draw the arrows indicating the level if requested
+ */
+ if (this.Get('chart.arrows')) {
+ var x = this.Get('chart.gutter') + barWidth;
+ var y = this.Get('chart.gutter');
+
+ this.context.lineWidth = 1;
+ this.context.fillStyle = 'black';
+ this.context.strokeStyle = 'black';
+
+ this.context.beginPath();
+ this.context.moveTo(x, y - 3);
+ this.context.lineTo(x + 2, y - 7);
+ this.context.lineTo(x - 2, y - 7);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ this.context.beginPath();
+ this.context.moveTo(x, y + this.height + 4);
+ this.context.lineTo(x + 2, y + this.height + 9);
+ this.context.lineTo(x - 2, y + this.height + 9);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill()
+
+
+ /**
+ * Draw the "in-bar" label
+ */
+ if (this.Get('chart.label.inner')) {
+ this.context.beginPath();
+ this.context.fillStyle = 'black';
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size') + 2, this.Get('chart.gutter') + barWidth + 5, this.canvas.height / 2, String(this.Get('chart.units.pre') + this.value + this.Get('chart.units.post')), 'center', 'left');
+ this.context.fill();
+ }
+ }
+
+ }
+
+ /**
+ * The function that draws the tick marks. Apt name...
+ */
+ RGraph.HProgress.prototype.DrawTickMarks = function ()
+ {
+ var context = this.context;
+ var gutter = this.Get('chart.gutter');
+
+ context.strokeStyle = this.Get('chart.tickmarks.color');
+
+ if (this.Get('chart.tickmarks')) {
+
+ this.context.beginPath();
+
+ // This is used by the label function below
+ this.tickInterval = this.width / this.Get('chart.numticks');
+
+ if (this.Get('chart.labels.position') == 'top') {
+ for (var i=gutter + this.tickInterval; i<=(this.width + gutter); i+=this.tickInterval) {
+ context.moveTo(i, gutter);
+ context.lineTo(i, gutter - 4);
+ }
+
+ } else {
+
+ for (var i=gutter + this.tickInterval; i<=(this.width + gutter); i+=this.tickInterval) {
+ context.moveTo(i, gutter + this.height);
+ context.lineTo(i, gutter + this.height + 4);
+ }
+ }
+
+ this.context.stroke();
+ }
+ }
+
+
+ /**
+ * The function that draws the labels
+ */
+ RGraph.HProgress.prototype.DrawLabels = function ()
+ {
+ var context = this.context;
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ var xPoints = [];
+ var yPoints = [];
+
+ for (i=this.Get('chart.gutter') + this.tickInterval; i <= (this.Get('chart.gutter') + this.width); i+= this.tickInterval) {
+ xPoints.push(i);
+ yPoints.push(this.Get('chart.gutter') + this.height + 4);
+ }
+
+ var font = this.Get('chart.text.font');
+ var size = this.Get('chart.text.size');
+
+ this.context.beginPath();
+
+ if (this.Get('chart.labels.position') == 'top') {
+ for (i=0; i<xPoints.length; ++i) {
+ RGraph.Text(context,font,size,xPoints[i],yPoints[i] - this.height - 4 - 4 - 2,this.Get('chart.units.pre') + String((((this.max - this.Get('chart.min')) / xPoints.length) * (i + 1) + this.Get('chart.min')).toFixed(this.Get('chart.scale.decimals'))) + this.Get('chart.units.post'),'bottom','center');
+ }
+
+ } else {
+
+ for (i=0; i<xPoints.length; ++i) {
+ RGraph.Text(this.context,font,size,xPoints[i],yPoints[i],this.Get('chart.units.pre') + String((((this.max - this.Get('chart.min')) / xPoints.length) * (i + 1) + this.Get('chart.min')).toFixed(this.Get('chart.scale.decimals'))) + this.Get('chart.units.post'),'top','center');
+ }
+ }
+
+
+ // Draw the title text
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), 0, this.Get('chart.text.size') + 2);
+ }
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The LED lights constructor
+ *
+ * @param object canvas The canvas object
+ * @param array data The chart data
+ */
+ RGraph.LED = function (id, text)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.type = 'led';
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ /**
+ * Set the string that is to be displayed
+ */
+ this.text = text;
+
+ /**
+ * The letters and numbers
+ */
+ this.lights = {
+ 'a': [[0,1,1,0],[1,0,0,1],[1,0,0,1],[1,1,1,1],[1,0,0,1],[1,0,0,1],[1,0,0,1]],
+ 'b': [[1,1,1,0],[1,0,0,1],[1,0,0,1],[1,1,1,0],[1,0,0,1],[1,0,0,1],[1,1,1,0]],
+ 'c': [[0,1,1,0],[1,0,0,1],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,1],[0,1,1,0]],
+ 'd': [[1,1,1,0],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,1,1,0]],
+ 'e': [[1,1,1,1],[1,0,0,0],[1,0,0,0],[1,1,1,0],[1,0,0,0],[1,0,0,0],[1,1,1,1]],
+ 'f': [[1,1,1,1],[1,0,0,0],[1,0,0,0],[1,1,1,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]],
+ 'g': [[0,1,1,0],[1,0,0,1],[1,0,0,0],[1,0,1,1],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ 'h': [[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,1,1,1],[1,0,0,1],[1,0,0,1],[1,0,0,1]],
+ 'i': [[0,1,1,1],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,1,1,1]],
+ 'j': [[0,1,1,1],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,1,0,0]],
+ 'k': [[1,0,0,1],[1,0,0,1],[1,0,1,0],[1,1,0,0],[1,0,1,0],[1,0,0,1],[1,0,0,1]],
+ 'l': [[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,1,1,1]],
+ 'm': [[1,0,0,1],[1,1,1,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1]],
+ 'n': [[1,0,0,1],[1,1,0,1],[1,0,1,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1]],
+ 'o': [[0,1,1,0],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ 'p': [[1,1,1,0],[1,0,0,1],[1,0,0,1],[1,1,1,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]],
+ 'q': [[0,1,1,0],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,1,1],[0,1,1,1]],
+ 'r': [[1,1,1,0],[1,0,0,1],[1,0,0,1],[1,1,1,0],[1,0,1,0],[1,0,0,1],[1,0,0,1]],
+ 's': [[0,1,1,0],[1,0,0,1],[1,0,0,0],[0,1,1,0],[0,0,0,1],[1,0,0,1],[0,1,1,0]],
+ 't': [[1,1,1,0],[0,1,0,0],[0,1,0,0],[0,1,0,0],[0,1,0,0],[0,1,0,0],[0,1,0,0]],
+ 'u': [[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ 'v': [[1,0,1],[1,0,1],[1,0,1],[1,0,1],[1,0,1],[0,1,0],[0,1,0]],
+ 'w': [[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,1,1,1],[0,1,1,0]],
+ 'x': [[0,1,0,1],[0,1,0,1],[0,1,0,1],[0,0,1,0],[0,1,0,1],[0,1,0,1],[0,1,0,1]],
+ 'y': [[0,1,0,1],[0,1,0,1],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0]],
+ 'z': [[1,1,1,1],[0,0,0,1],[0,0,1,0],[0,0,1,0],[0,1,0,0],[1,0,0,0],[1,1,1,1]],
+ ' ': [[],[],[],[],[], [], []],
+ '0': [[0,1,1,0],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ '1': [[0,0,1,0],[0,1,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,0,1,0],[0,1,1,1]],
+ '2': [[0,1,1,0],[1,0,0,1],[0,0,0,1],[0,0,1,0],[0,1,,0],[1,0,0,0],[1,1,1,1]],
+ '3': [[0,1,1,0],[1,0,0,1],[0,0,0,1],[0,1,1,0],[0,0,0,1],[1,0,0,1],[0,1,1,0]],
+ '4': [[1,0,0,0],[1,0,0,0],[1,0,1,0],[1,0,1,0],[1,1,1,1],[0,0,1,0],[0,0,1,0]],
+ '5': [[1,1,1,1],[1,0,0,0],[1,0,0,0],[1,1,1,0],[0,0,0,1],[1,0,0,1],[0,1,1,0]],
+ '6': [[0,1,1,0],[1,0,0,1],[1,0,0,0],[1,1,1,0],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ '7': [[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,1,0],[0,1,0,0],[0,1,0,0],[0,1,0,0]],
+ '8': [[0,1,1,0],[1,0,0,1],[1,0,0,1],[0,1,1,0],[1,0,0,1],[1,0,0,1],[0,1,1,0]],
+ '9': [[0,1,1,1],[1,0,0,1],[1,0,0,1],[0,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]
+ }
+
+ // Various config type stuff
+ this.properties = {
+ 'chart.background': 'white',
+ 'chart.dark': '#eee',
+ 'chart.light': '#f66',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[LED] No canvas support');
+ return;
+ }
+
+ // Check the canvasText library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[LED] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.LED.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.LED.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * This draws the LEDs
+ */
+ RGraph.LED.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+
+ // First clear the canvas, using the background colour
+ RGraph.Clear(this.canvas, this.Get('chart.background'));
+
+ for (var l=0; l<this.text.length; l++) {
+ this.DrawLetter(this.text.charAt(l), l);
+ }
+
+ /**
+ * Set the title attribute on the canvas
+ */
+ this.canvas.title = RGraph.rtrim(this.text);
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws a single letter
+ *
+ * @param string lights The lights to draw to draw
+ * @param int index The position of the letter
+ */
+ RGraph.LED.prototype.DrawLetter = function (letter, index)
+ {
+ var light = this.Get('chart.light');
+ var dark = this.Get('chart.dark');
+ var lights = (this.lights[letter] ? this.lights[letter] : [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]);
+ var lwidth = this.canvas.width / this.text.length;
+ var diameter = lwidth / 5;
+ var radius = diameter / 2;
+
+ for (var i=0; i<7; i++) {
+ for (var j=0; j<5; j++) {
+
+ var x = (j * diameter) + (index * lwidth) + radius;
+ var y = (this.canvas.height / 2) + ((i * diameter) + 2) - (7 * radius);
+
+ // Draw a circle
+ this.context.fillStyle = (lights[i][j] ? light : dark);
+ this.context.strokeStyle = (lights[i][j] ? '#ccc' : 'rgba(0,0,0,0)');
+ this.context.beginPath();
+ this.context.arc(x, y, radius, 0, 6.28, 0);
+
+ this.context.stroke();
+ this.context.fill();
+ }
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The line chart constructor
+ *
+ * @param object canvas The cxanvas object
+ * @param array data The chart data
+ * @param array ... Other lines to plot
+ */
+ RGraph.Line = function (id)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.type = 'line';
+ this.max = 0;
+ this.coords = [];
+ this.hasnegativevalues = false;
+ this.isRGraph = true;
+
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Various config type stuff
+ this.properties = {
+ 'chart.background.barcolor1': 'rgba(0,0,0,0)',
+ 'chart.background.barcolor2': 'rgba(0,0,0,0)',
+ 'chart.background.grid': 1,
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.hsize': 25,
+ 'chart.background.grid.vsize': 25,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 7,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.background.hbars': null,
+ 'chart.labels': null,
+ 'chart.labels.ingraph': null,
+ 'chart.labels.above': false,
+ 'chart.labels.above.size': 8,
+ 'chart.xtickgap': 20,
+ 'chart.smallxticks': 3,
+ 'chart.largexticks': 5,
+ 'chart.ytickgap': 20,
+ 'chart.smallyticks': 3,
+ 'chart.largeyticks': 5,
+ 'chart.linewidth': 1,
+ 'chart.colors': ['red', '#0f0', '#00f', '#f0f', '#ff0', '#0ff'],
+ 'chart.hmargin': 0,
+ 'chart.tickmarks.dot.color': 'white',
+ 'chart.tickmarks': null,
+ 'chart.ticksize': 3,
+ 'chart.gutter': 25,
+ 'chart.tickdirection': -1,
+ 'chart.yaxispoints': 5,
+ 'chart.fillstyle': null,
+ 'chart.xaxispos': 'bottom',
+ 'chart.yaxispos': 'left',
+ 'chart.xticks': null,
+ 'chart.text.size': 10,
+ 'chart.text.angle': 0,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.ymin': null,
+ 'chart.ymax': null,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.xaxis': '',
+ 'chart.title.yaxis': '',
+ 'chart.title.xaxis.pos': 0.25,
+ 'chart.title.yaxis.pos': 0.25,
+ 'chart.shadow': false,
+ 'chart.shadow.offsetx': 2,
+ 'chart.shadow.offsety': 2,
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.color': 'rgba(0,0,0,0.5)',
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.coords.adjust': [0,0],
+ 'chart.tooltips.highlight': true,
+ 'chart.stepped': false,
+
+ 'chart.key': [],
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+
+ 'chart.contextmenu': null,
+
+ 'chart.ylabels': true,
+ 'chart.ylabels.count': 5,
+ 'chart.ylabels.inside': false,
+ 'chart.ylabels.invert': false,
+ 'chart.ylabels.specific': null,
+
+ 'chart.xlabels.inside': false,
+ 'chart.xlabels.inside.color': 'rgba(255,255,255,0.5)',
+
+ 'chart.noaxes': false,
+ 'chart.noyaxis': false,
+ 'chart.noxaxis': false,
+
+ 'chart.noendxtick': false,
+ 'chart.units.post': '',
+ 'chart.units.pre': '',
+ 'chart.scale.decimals': null,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.crosshairs': false,
+ 'chart.crosshairs.color': '#333',
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.axesontop': false,
+ 'chart.filled.range': false,
+ 'chart.variant': null,
+ 'chart.axis.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 15,
+ 'chart.zoom.delay': 33,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.backdrop': false,
+ 'chart.backdrop.size': 30,
+ 'chart.backdrop.alpha': 0.2,
+ 'chart.resizable': false,
+ 'chart.adjustable': false,
+ 'chart.noredraw': false,
+ 'chart.outofbounds': false,
+ 'chart.chromefix': true
+ }
+
+ /**
+ * Change null arguments to empty arrays
+ */
+ for (var i=1; i<arguments.length; ++i) {
+ if (typeof(arguments[i]) == 'null' || !arguments[i]) {
+ arguments[i] = [];
+ }
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[LINE] Fatal error: The common library does not appear to have been included');
+ }
+
+
+ /**
+ * Store the original data. Thiss aqlso allows for giving arguments as one big array.
+ */
+ this.original_data = [];
+
+ for (var i=1; i<arguments.length; ++i) {
+ if (arguments[1] && typeof(arguments[1]) == 'object' && arguments[1][0] && typeof(arguments[1][0]) == 'object' && typeof(arguments[1][0][0]) == 'number') {
+
+ var tmp = [];
+
+ for (var i=0; i<arguments[1].length; ++i) {
+ tmp[i] = RGraph.array_clone(arguments[1][i]);
+ }
+
+ for (var j=0; j<tmp.length; ++j) {
+ this.original_data[j] = RGraph.array_clone(tmp[j]);
+ }
+
+ } else {
+ this.original_data[i - 1] = RGraph.array_clone(arguments[i]);
+ }
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[LINE] Fatal error: no canvas support');
+ return;
+ }
+
+ /**
+ * Store the data here as one big array
+ */
+ this.data_arr = [];
+
+ for (var i=1; i<arguments.length; ++i) {
+ for (var j=0; j<arguments[i].length; ++j) {
+ this.data_arr.push(arguments[i][j]);
+ }
+ }
+ }
+
+
+ /**
+ * An all encompassing accessor
+ *
+ * @param string name The name of the property
+ * @param mixed value The value of the property
+ */
+ RGraph.Line.prototype.Set = function (name, value)
+ {
+ // Consolidate the tooltips
+ if (name == 'chart.tooltips') {
+
+ var tooltips = [];
+
+ for (var i=1; i<arguments.length; i++) {
+ if (typeof(arguments[i]) == 'object' && arguments[i][0]) {
+ for (var j=0; j<arguments[i].length; j++) {
+ tooltips.push(arguments[i][j]);
+ }
+
+ } else if (typeof(arguments[i]) == 'function') {
+ tooltips = arguments[i];
+
+ } else {
+ tooltips.push(arguments[i]);
+ }
+ }
+
+ // Because "value" is used further down at the end of this function, set it to the expanded array os tooltips
+ value = tooltips;
+ }
+
+ /**
+ * Reverse the tickmarks to make them correspond to the right line
+ */
+ if (name == 'chart.tickmarks' && typeof(value) == 'object' && value) {
+ value = RGraph.array_reverse(value);
+ }
+
+ /**
+ * Inverted Y axis should show the bottom end of the scale
+ */
+ if (name == 'chart.ylabels.invert' && value && this.Get('chart.ymin') == null) {
+ this.Set('chart.ymin', 0);
+ }
+
+ /**
+ * If (buggy) Chrome and the linewidth is 1, change it to 1.01
+ */
+ if (name == 'chart.linewidth' && navigator.userAgent.match(/Chrome/) && value == 1) {
+ value = 1.01;
+ }
+
+ this.properties[name] = value;
+ }
+
+
+ /**
+ * An all encompassing accessor
+ *
+ * @param string name The name of the property
+ */
+ RGraph.Line.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+ /**
+ * The function you call to draw the line chart
+ */
+ RGraph.Line.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+
+ /**
+ * Check for Chrome 6 and shadow
+ *
+ * TODO Remove once it's been fixed (for a while)
+ * SEARCH TAGS: CHROME FIX SHADOW BUG
+ */
+ if ( this.Get('chart.shadow')
+ && navigator.userAgent.match(/Chrome/)
+ && this.Get('chart.linewidth') <= 1
+ && this.Get('chart.chromefix')
+ && this.Get('chart.shadow.blur') > 0) {
+ alert('[RGRAPH WARNING] Chrome 6 has a shadow bug, meaning you should increase the linewidth to at least 1.01');
+ }
+
+
+ // Cache the gutter as an object variable
+ this.gutter = this.Get('chart.gutter');
+
+ // Reset the data back to that which was initially supplied
+ this.data = RGraph.array_clone(this.original_data);
+
+
+ // Reset the max value
+ this.max = 0;
+
+ /**
+ * Reverse the datasets so that the data and the labels tally
+ */
+ this.data = RGraph.array_reverse(this.data);
+
+ if (this.Get('chart.filled') && !this.Get('chart.filled.range') && this.data.length > 1) {
+
+ var accumulation = [];
+
+ for (var set=0; set<this.data.length; ++set) {
+ for (var point=0; point<this.data[set].length; ++point) {
+ this.data[set][point] = Number(accumulation[point] ? accumulation[point] : 0) + this.data[set][point];
+ accumulation[point] = this.data[set][point];
+ }
+ }
+ }
+
+ /**
+ * Get the maximum Y scale value
+ */
+ if (this.Get('chart.ymax')) {
+
+ this.max = this.Get('chart.ymax');
+ this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+
+ this.scale = [
+ ( ((this.max - this.min) * (1/5)) + this.min).toFixed(this.Get('chart.scale.decimals')),
+ ( ((this.max - this.min) * (2/5)) + this.min).toFixed(this.Get('chart.scale.decimals')),
+ ( ((this.max - this.min) * (3/5)) + this.min).toFixed(this.Get('chart.scale.decimals')),
+ ( ((this.max - this.min) * (4/5)) + this.min).toFixed(this.Get('chart.scale.decimals')),
+ this.max.toFixed(this.Get('chart.scale.decimals'))
+ ];
+
+ // Check for negative values
+ if (!this.Get('chart.outofbounds')) {
+ for (dataset=0; dataset<this.data.length; ++dataset) {
+ for (var datapoint=0; datapoint<this.data[dataset].length; datapoint++) {
+
+ // Check for negative values
+ this.hasnegativevalues = (this.data[dataset][datapoint] < 0) || this.hasnegativevalues;
+ }
+ }
+ }
+
+ } else {
+
+ this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+
+ // Work out the max Y value
+ for (dataset=0; dataset<this.data.length; ++dataset) {
+ for (var datapoint=0; datapoint<this.data[dataset].length; datapoint++) {
+
+ this.max = Math.max(this.max, this.data[dataset][datapoint] ? Math.abs(parseFloat(this.data[dataset][datapoint])) : 0);
+
+ // Check for negative values
+ if (!this.Get('chart.outofbounds')) {
+ this.hasnegativevalues = (this.data[dataset][datapoint] < 0) || this.hasnegativevalues;
+ }
+ }
+ }
+
+ // 20th April 2009 - moved out of the above loop
+ this.scale = RGraph.getScale(Math.abs(parseFloat(this.max)), this);
+ this.max = this.scale[4] ? this.scale[4] : 0;
+
+ if (this.Get('chart.ymin')) {
+ this.scale[0] = ((this.max - this.Get('chart.ymin')) * (1/5)) + this.Get('chart.ymin');
+ this.scale[1] = ((this.max - this.Get('chart.ymin')) * (2/5)) + this.Get('chart.ymin');
+ this.scale[2] = ((this.max - this.Get('chart.ymin')) * (3/5)) + this.Get('chart.ymin');
+ this.scale[3] = ((this.max - this.Get('chart.ymin')) * (4/5)) + this.Get('chart.ymin');
+ this.scale[4] = ((this.max - this.Get('chart.ymin')) * (5/5)) + this.Get('chart.ymin');
+ }
+
+ if (typeof(this.Get('chart.scale.decimals')) == 'number') {
+ this.scale[0] = Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[1] = Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[2] = Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[3] = Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[4] = Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'));
+ }
+ }
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Reset the coords array otherwise it will keep growing
+ */
+ this.coords = [];
+
+ /**
+ * Work out a few things. They need to be here because they depend on things you can change before you
+ * call Draw() but after you instantiate the object
+ */
+ this.grapharea = this.canvas.height - ( (2 * this.gutter));
+ this.halfgrapharea = this.grapharea / 2;
+ this.halfTextHeight = this.Get('chart.text.size') / 2;
+
+ // Check the combination of the X axis position and if there any negative values
+ //
+ // 19th Dec 2010 - removed for Opera since it can be reported incorrectly whn there
+ // are multiple graphs on the page
+ if (this.Get('chart.xaxispos') == 'bottom' && this.hasnegativevalues && navigator.userAgent.indexOf('Opera') == -1) {
+ alert('[LINE] You have negative values and the X axis is at the bottom. This is not good...');
+ }
+
+ if (this.Get('chart.variant') == '3d') {
+ RGraph.Draw3DAxes(this);
+ }
+
+ // Progressively Draw the chart
+ RGraph.background.Draw(this);
+
+ /**
+ * Draw any horizontal bars that have been defined
+ */
+ if (this.Get('chart.background.hbars') && this.Get('chart.background.hbars').length > 0) {
+ RGraph.DrawBars(this);
+ }
+
+ if (this.Get('chart.axesontop') == false) {
+ this.DrawAxes();
+ }
+
+ /**
+ * Handle the appropriate shadow color. This now facilitates an array of differing
+ * shadow colors
+ */
+ var shadowColor = this.Get('chart.shadow.color');
+
+ if (typeof(shadowColor) == 'object') {
+ shadowColor = RGraph.array_reverse(RGraph.array_clone(this.Get('chart.shadow.color')));
+ }
+
+ for (var i=(this.data.length - 1), j=0; i>=0; i--, j++) {
+
+ this.context.beginPath();
+
+ /**
+ * Turn on the shadow if required
+ */
+ if (this.Get('chart.shadow') && !this.Get('chart.filled')) {
+
+ /**
+ * Accommodate an array of shadow colors as well as a single string
+ */
+ if (typeof(shadowColor) == 'object' && shadowColor[i - 1]) {
+ this.context.shadowColor = shadowColor[i];
+ } else if (typeof(shadowColor) == 'object') {
+ this.context.shadowColor = shadowColor[0];
+ } else if (typeof(shadowColor) == 'string') {
+ this.context.shadowColor = shadowColor;
+ }
+
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+
+ } else if (this.Get('chart.filled') && this.Get('chart.shadow')) {
+ alert('[LINE] Shadows are not permitted when the line is filled');
+ }
+
+ /**
+ * Draw the line
+ */
+
+ if (this.Get('chart.fillstyle')) {
+ if (typeof(this.Get('chart.fillstyle')) == 'object' && this.Get('chart.fillstyle')[j]) {
+ var fill = this.Get('chart.fillstyle')[j];
+
+ } else if (typeof(this.Get('chart.fillstyle')) == 'string') {
+ var fill = this.Get('chart.fillstyle');
+
+ } else {
+ alert('[LINE] Warning: chart.fillstyle must be either a string or an array with the same number of elements as you have sets of data');
+ }
+ } else if (this.Get('chart.filled')) {
+ var fill = this.Get('chart.colors')[j];
+
+ } else {
+ var fill = null;
+ }
+
+ /**
+ * Figure out the tickmark to use
+ */
+ if (this.Get('chart.tickmarks') && typeof(this.Get('chart.tickmarks')) == 'object') {
+ var tickmarks = this.Get('chart.tickmarks')[i];
+ } else if (this.Get('chart.tickmarks') && typeof(this.Get('chart.tickmarks')) == 'string') {
+ var tickmarks = this.Get('chart.tickmarks');
+ } else if (this.Get('chart.tickmarks') && typeof(this.Get('chart.tickmarks')) == 'function') {
+ var tickmarks = this.Get('chart.tickmarks');
+ } else {
+ var tickmarks = null;
+ }
+
+
+ this.DrawLine(this.data[i],
+ this.Get('chart.colors')[j],
+ fill,
+ this.GetLineWidth(j),
+ tickmarks);
+
+ this.context.stroke();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
+ * If tooltips are defined, handle them
+ */
+ if (this.Get('chart.tooltips') && (this.Get('chart.tooltips').length || typeof(this.Get('chart.tooltips')) == 'function')) {
+
+ // Need to register this object for redrawing
+ if (this.Get('chart.tooltips.highlight')) {
+ RGraph.Register(this);
+ }
+
+ canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = canvas.__object__;
+ var point = obj.getPoint(e);
+
+ if (obj.Get('chart.tooltips.highlight')) {
+ RGraph.Register(obj);
+ }
+
+ if ( point
+ && typeof(point[0]) == 'object'
+ && typeof(point[1]) == 'number'
+ && typeof(point[2]) == 'number'
+ && typeof(point[3]) == 'number'
+ ) {
+
+ // point[0] is the graph object
+ var xCoord = point[1];
+ var yCoord = point[2];
+ var idx = point[3];
+
+ if ((obj.Get('chart.tooltips')[idx] || typeof(obj.Get('chart.tooltips')) == 'function')) {
+
+ // Get the tooltip text
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[idx]) == 'function') {
+ var text = obj.Get('chart.tooltips')[idx](idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = String(obj.Get('chart.tooltips')[idx]);
+
+ } else {
+ var text = '';
+ }
+
+ // Chnage the pointer to a hand
+ canvas.style.cursor = 'pointer';
+
+ /**
+ * If the tooltip is the same one as is currently visible (going by the array index), don't do squat and return.
+ */
+ if (RGraph.Registry.Get('chart.tooltip') && RGraph.Registry.Get('chart.tooltip').__index__ == idx && RGraph.Registry.Get('chart.tooltip').__canvas__.id == canvas.id) {
+ return;
+ }
+
+ /**
+ * Redraw the graph
+ */
+ if (obj.Get('chart.tooltips.highlight')) {
+ // Redraw the graph
+ RGraph.Redraw();
+ }
+
+ // SHOW THE CORRECT TOOLTIP
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, idx);
+
+ // Store the tooltip index on the tooltip object
+ RGraph.Registry.Get('chart.tooltip').__index__ = Number(idx);
+
+ /**
+ * Highlight the graph
+ */
+ if (obj.Get('chart.tooltips.highlight')) {
+ context.beginPath();
+ context.moveTo(xCoord, yCoord);
+ context.arc(xCoord, yCoord, 2, 0, 6.28, 0);
+ context.strokeStyle = '#999';
+ context.fillStyle = 'white';
+ context.stroke();
+ context.fill();
+ }
+
+ e.stopPropagation();
+ return;
+ }
+ }
+
+ /**
+ * Not over a hotspot?
+ */
+ canvas.style.cursor = 'default';
+ }
+
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
+ * If the axes have been requested to be on top, do that
+ */
+ if (this.Get('chart.axesontop')) {
+ this.DrawAxes();
+ }
+
+ /**
+ * Draw the labels
+ */
+ this.DrawLabels();
+
+ /**
+ * Draw the range if necessary
+ */
+ this.DrawRange();
+
+ // Draw a key if necessary
+ if (this.Get('chart.key').length) {
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.colors'));
+ }
+
+ /**
+ * Draw " above" labels if enabled
+ */
+ if (this.Get('chart.labels.above')) {
+ this.DrawAboveLabels();
+ }
+
+ /**
+ * Draw the "in graph" labels
+ */
+ RGraph.DrawInGraphLabels(this);
+
+ /**
+ * Draw crosschairs
+ */
+ RGraph.DrawCrosshairs(this);
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * Redraw the lines if a filled range is on the cards
+ */
+ if (this.Get('chart.filled') && this.Get('chart.filled.range') && this.data.length == 2) {
+
+ this.context.beginPath();
+ var len = this.coords.length / 2;
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.strokeStyle = this.Get('chart.colors')[0];
+
+ for (var i=0; i<len; ++i) {
+ if (i == 0) {
+ this.context.moveTo(this.coords[i][0], this.coords[i][1]);
+ } else {
+ this.context.lineTo(this.coords[i][0], this.coords[i][1]);
+ }
+ }
+
+ this.context.stroke();
+
+
+ this.context.beginPath();
+
+ if (this.Get('chart.colors')[1]) {
+ this.context.strokeStyle = this.Get('chart.colors')[1];
+ }
+
+ for (var i=this.coords.length - 1; i>=len; --i) {
+ if (i == (this.coords.length - 1) ) {
+ this.context.moveTo(this.coords[i][0], this.coords[i][1]);
+ } else {
+ this.context.lineTo(this.coords[i][0], this.coords[i][1]);
+ }
+ }
+
+ this.context.stroke();
+ } else if (this.Get('chart.filled') && this.Get('chart.filled.range')) {
+ alert('[LINE] You must have only two sets of data for a filled range chart');
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+ /**
+ * This function enables the zoom in area mode
+ */
+ if (this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ZoomArea(this);
+ }
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * This function enables adjustments
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the axes
+ */
+ RGraph.Line.prototype.DrawAxes = function ()
+ {
+ var gutter = this.gutter;
+
+ // Don't draw the axes?
+ if (this.Get('chart.noaxes')) {
+ return;
+ }
+
+ // Turn any shadow off
+ RGraph.NoShadow(this);
+
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = this.Get('chart.axis.color');
+ this.context.beginPath();
+
+ // Draw the X axis
+ if (this.Get('chart.noxaxis') == false) {
+ if (this.Get('chart.xaxispos') == 'center') {
+ this.context.moveTo(gutter, this.grapharea / 2 + gutter);
+ this.context.lineTo(this.canvas.width - gutter, this.grapharea / 2 + gutter);
+ } else {
+ this.context.moveTo(gutter, this.canvas.height - gutter);
+ this.context.lineTo(this.canvas.width - gutter, this.canvas.height - gutter);
+ }
+ }
+
+ // Draw the Y axis
+ if (this.Get('chart.noyaxis') == false) {
+ if (this.Get('chart.yaxispos') == 'left') {
+ this.context.moveTo(gutter, gutter);
+ this.context.lineTo(gutter, this.canvas.height - (gutter) );
+ } else {
+ this.context.moveTo(this.canvas.width - gutter, gutter);
+ this.context.lineTo(this.canvas.width - gutter, this.canvas.height - gutter );
+ }
+ }
+
+ /**
+ * Draw the X tickmarks
+ */
+ if (this.Get('chart.noxaxis') == false) {
+ var xTickInterval = (this.canvas.width - (2 * gutter)) / (this.Get('chart.xticks') ? this.Get('chart.xticks') : this.data[0].length);
+
+ for (x=gutter + (this.Get('chart.yaxispos') == 'left' ? xTickInterval : 0); x<=(this.canvas.width - gutter + 1 ); x+=xTickInterval) {
+
+ if (this.Get('chart.yaxispos') == 'right' && x >= (this.canvas.width - gutter - 1) ) {
+ break;
+ }
+
+ // If the last tick is not desired...
+ if (this.Get('chart.noendxtick')) {
+ if (this.Get('chart.yaxispos') == 'left' && x >= (this.canvas.width - gutter)) {
+ break;
+ } else if (this.Get('chart.yaxispos') == 'right' && x == gutter) {
+ continue;
+ }
+ }
+
+ var yStart = this.Get('chart.xaxispos') == 'center' ? (this.canvas.height / 2) - 3 : this.canvas.height - gutter;
+ var yEnd = this.Get('chart.xaxispos') == 'center' ? yStart + 6 : this.canvas.height - gutter - (x % 60 == 0 ? this.Get('chart.largexticks') * this.Get('chart.tickdirection') : this.Get('chart.smallxticks') * this.Get('chart.tickdirection'));
+
+ this.context.moveTo(x, yStart);
+ this.context.lineTo(x, yEnd);
+ }
+
+ // Draw an extra tickmark if there is no X axis, but there IS a Y axis
+ } else if (this.Get('chart.noyaxis') == false) {
+
+ if (this.Get('chart.yaxispos') == 'left') {
+ this.context.moveTo(this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.Get('chart.gutter') - this.Get('chart.smallyticks'), this.canvas.height - this.Get('chart.gutter'));
+ } else {
+ this.context.moveTo(this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.canvas.width - this.Get('chart.gutter') + this.Get('chart.smallyticks'), this.canvas.height - this.Get('chart.gutter'));
+ }
+ }
+
+ /**
+ * Draw the Y tickmarks
+ */
+ if (this.Get('chart.noyaxis') == false) {
+ var counter = 0;
+ var adjustment = 0;
+
+ if (this.Get('chart.yaxispos') == 'right') {
+ adjustment = (this.canvas.width - (2 * gutter));
+ }
+
+ if (this.Get('chart.xaxispos') == 'center') {
+ var interval = (this.grapharea / 10);
+ var lineto = (this.Get('chart.yaxispos') == 'left' ? gutter : this.canvas.width - gutter + this.Get('chart.smallyticks'));
+
+ // Draw the upper halves Y tick marks
+ for (y=gutter; y < (this.grapharea / 2) + gutter; y+=interval) {
+ this.context.moveTo((this.Get('chart.yaxispos') == 'left' ? gutter - this.Get('chart.smallyticks') : this.canvas.width - gutter), y);
+ this.context.lineTo(lineto, y);
+ }
+
+ // Draw the lower halves Y tick marks
+ for (y=gutter + (this.halfgrapharea) + interval; y <= this.grapharea + gutter; y+=interval) {
+ this.context.moveTo((this.Get('chart.yaxispos') == 'left' ? gutter - this.Get('chart.smallyticks') : this.canvas.width - gutter), y);
+ this.context.lineTo(lineto, y);
+ }
+
+ } else {
+ var lineto = (this.Get('chart.yaxispos') == 'left' ? gutter - this.Get('chart.smallyticks') : this.canvas.width - gutter + this.Get('chart.smallyticks'));
+
+ for (y=gutter; y < (this.canvas.height - gutter) && counter < 10; y+=( (this.canvas.height - (2 * gutter)) / 10) ) {
+
+ this.context.moveTo(gutter + adjustment, y);
+ this.context.lineTo(lineto, y);
+
+ var counter = counter +1;
+ }
+ }
+
+ // Draw an extra X tickmark
+ } else if (this.Get('chart.noxaxis') == false) {
+ if (this.Get('chart.yaxispos') == 'left') {
+ this.context.moveTo(this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + this.Get('chart.smallxticks'));
+ } else {
+ this.context.moveTo(this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));
+ this.context.lineTo(this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + this.Get('chart.smallxticks'));
+ }
+ }
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draw the text labels for the axes
+ */
+ RGraph.Line.prototype.DrawLabels = function ()
+ {
+ this.context.strokeStyle = 'black';
+ this.context.fillStyle = this.Get('chart.text.color');
+ this.context.lineWidth = 1;
+
+ // Turn off any shadow
+ RGraph.NoShadow(this);
+
+ // This needs to be here
+ var font = this.Get('chart.text.font');
+ var gutter = this.Get('chart.gutter');
+ var text_size = this.Get('chart.text.size');
+ var context = this.context;
+ var canvas = this.canvas;
+
+ // Draw the Y axis labels
+ if (this.Get('chart.ylabels') && this.Get('chart.ylabels.specific') == null) {
+
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var xpos = this.Get('chart.yaxispos') == 'left' ? gutter - 5 : this.canvas.width - gutter + 5;
+ var align = this.Get('chart.yaxispos') == 'left' ? 'right' : 'left';
+
+ var numYLabels = this.Get('chart.ylabels.count');
+ var bounding = false;
+ var bgcolor = this.Get('chart.ylabels.inside') ? this.Get('chart.ylabels.inside.color') : null;
+
+
+ /**
+ * If the Y labels are inside the Y axis, invert the alignment
+ */
+ if (this.Get('chart.ylabels.inside') == true && align == 'left') {
+ xpos -= 10;
+ align = 'right';
+ bounding = true;
+
+
+ } else if (this.Get('chart.ylabels.inside') == true && align == 'right') {
+ xpos += 10;
+ align = 'left';
+ bounding = true;
+ }
+
+
+
+ if (this.Get('chart.xaxispos') == 'center') {
+ var half = this.grapharea / 2;
+
+ if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
+ // Draw the upper halves labels
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (0/5) * half ) + this.halfTextHeight, RGraph.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor);
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (1/5) * half ) + this.halfTextHeight, RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (3/5) * half ) + this.halfTextHeight, RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (2/5) * half ) + this.halfTextHeight, RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (4/5) * half ) + this.halfTextHeight, RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ // Draw the lower halves labels
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (6/5) * half ) + this.halfTextHeight, '-' + RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (8/5) * half ) + this.halfTextHeight, '-' + RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (7/5) * half ) + this.halfTextHeight, '-' + RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (9/5) * half ) + this.halfTextHeight, '-' + RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ RGraph.Text(context, font, text_size, xpos, gutter + ( (10/5) * half ) + this.halfTextHeight, '-' + RGraph.number_format(this, (this.scale[4] == '1.0' ? '1.0' : this.scale[4]), units_pre, units_post), null, align, bounding, null, bgcolor);
+
+ } else if (numYLabels == 10) {
+
+ // 10 Y labels
+ var interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ // This draws the upper halves labels
+ RGraph.Text(context,font, text_size, xpos, gutter + this.halfTextHeight + ((i/20) * (this.grapharea) ), RGraph.number_format(this, ((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this.Get('chart.scale.decimals'))),units_pre, units_post), null, align, bounding, null, bgcolor);
+
+ // And this draws the lower halves labels
+ RGraph.Text(context, font, text_size, xpos,
+
+ gutter + this.halfTextHeight + ((i/20) * this.grapharea) + (this.grapharea / 2) + (this.grapharea / 20),
+
+ '-' + RGraph.number_format(this, (this.scale[4] - ((this.scale[4] / numYLabels) * (numYLabels - i - 1))).toFixed((this.Get('chart.scale.decimals'))),units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ } else {
+ alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
+ }
+
+ // Draw the lower limit if chart.ymin is specified
+ if (typeof(this.Get('chart.ymin')) == 'number') {
+ RGraph.Text(context, font, text_size, xpos, this.canvas.height / 2, RGraph.number_format(this, this.Get('chart.ymin').toFixed(this.Get('chart.scale.decimals')), units_pre, units_post), 'center', align, bounding, null, bgcolor);
+ }
+
+ // No X axis - so draw 0
+ if (this.Get('chart.noxaxis') == true) {
+ RGraph.Text(context,font,text_size,xpos,gutter + ( (5/5) * half ) + this.halfTextHeight,'0',null, align, bounding, null, bgcolor);
+ }
+
+ } else {
+
+ /**
+ * Accommodate reversing the Y labels
+ */
+ if (this.Get('chart.ylabels.invert')) {
+ this.scale = RGraph.array_reverse(this.scale);
+ this.context.translate(0, this.grapharea * 0.2);
+ if (typeof(this.Get('chart.ymin')) == null) {
+ this.Set('chart.ymin', 0);
+ }
+ }
+
+ if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight + ((0/5) * (this.grapharea ) ), RGraph.number_format(this, this.scale[4], units_pre, units_post), null, align, bounding, null, bgcolor);
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight + ((3/5) * (this.grapharea) ), RGraph.number_format(this, this.scale[1], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight + ((1/5) * (this.grapharea) ), RGraph.number_format(this, this.scale[3], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight + ((2/5) * (this.grapharea ) ), RGraph.number_format(this, this.scale[2], units_pre, units_post), null, align, bounding, null, bgcolor);
+ RGraph.Text(context, font, text_size, xpos, gutter + this.halfTextHeight + ((4/5) * (this.grapharea) ), RGraph.number_format(this, this.scale[0], units_pre, units_post), null, align, bounding, null, bgcolor);
+ }
+
+ } else if (numYLabels == 10) {
+
+ // 10 Y labels
+ var interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context,font,text_size,xpos,gutter + this.halfTextHeight + ((i/10) * (this.grapharea) ),RGraph.number_format(this,((this.scale[4] / numYLabels) * (numYLabels - i)).toFixed((this.Get('chart.scale.decimals'))),units_pre,units_post),null,align,bounding,null,bgcolor);
+ }
+
+ } else {
+ alert('[LINE SCALE] The number of Y labels must be 1/3/5/10');
+ }
+
+
+ /**
+ * Accommodate translating back after reversing the labels
+ */
+ if (this.Get('chart.ylabels.invert')) {
+ this.context.translate(0, 0 - (this.grapharea * 0.2));
+ }
+
+ // Draw the lower limit if chart.ymin is specified
+ if (typeof(this.Get('chart.ymin')) == 'number') {
+ RGraph.Text(context,font,text_size,xpos,this.Get('chart.ylabels.invert') ? gutter : this.canvas.height - gutter,RGraph.number_format(this, this.Get('chart.ymin').toFixed(this.Get('chart.scale.decimals')), units_pre, units_post),'center',align,bounding,null,bgcolor);
+ }
+ }
+
+ // No X axis - so draw 0
+ if ( this.Get('chart.noxaxis') == true
+ && this.Get('chart.ymin') == null
+ ) {
+
+ RGraph.Text(context,font,text_size,xpos,this.canvas.height - gutter + this.halfTextHeight,'0',null, align, bounding, null, bgcolor);
+ }
+
+ } else if (this.Get('chart.ylabels') && typeof(this.Get('chart.ylabels.specific')) == 'object') {
+
+ // A few things
+ var gap = this.grapharea / this.Get('chart.ylabels.specific').length;
+ var halign = this.Get('chart.yaxispos') == 'left' ? 'right' : 'left';
+ var bounding = false;
+ var bgcolor = null;
+
+ // Figure out the X coord based on the position of the axis
+ if (this.Get('chart.yaxispos') == 'left') {
+ var x = gutter - 5;
+
+ if (this.Get('chart.ylabels.inside')) {
+ x += 10;
+ halign = 'left';
+ bounding = true;
+ bgcolor = 'rgba(255,255,255,0.5)';
+ }
+
+ } else if (this.Get('chart.yaxispos') == 'right') {
+ var x = this.canvas.width - gutter + 5;
+
+ if (this.Get('chart.ylabels.inside')) {
+ x -= 10;
+ halign = 'right';
+ bounding = true;
+ bgcolor = 'rgba(255,255,255,0.5)';
+ }
+ }
+
+
+ // Draw the labels
+ if (this.Get('chart.xaxispos') == 'center') {
+
+ // Draw the top halfs labels
+ for (var i=0; i<this.Get('chart.ylabels.specific').length; ++i) {
+ var y = gutter + ((this.grapharea / (this.Get('chart.ylabels.specific').length * 2) ) * i);
+ RGraph.Text(context, font, text_size,x,y,String(this.Get('chart.ylabels.specific')[i]), 'center', halign, bounding, 0, bgcolor);
+ }
+
+ // Now reverse the labels and draw the bottom half
+ var reversed_labels = RGraph.array_reverse(this.Get('chart.ylabels.specific'));
+
+ // Draw the bottom halfs labels
+ for (var i=0; i<reversed_labels.length; ++i) {
+ var y = (this.grapharea / 2) + gutter + ((this.grapharea / (reversed_labels.length * 2) ) * (i + 1));
+ RGraph.Text(context, font, text_size,x,y,String(reversed_labels[i]), 'center', halign, bounding, 0, bgcolor);
+ }
+
+ } else {
+ for (var i=0; i<this.Get('chart.ylabels.specific').length; ++i) {
+ var y = gutter + ((this.grapharea / this.Get('chart.ylabels.specific').length) * i);
+ RGraph.Text(context, font, text_size,x,y,String(this.Get('chart.ylabels.specific')[i]), 'center', halign, bounding, 0, bgcolor);
+ }
+ }
+ }
+
+ // Draw the X axis labels
+ if (this.Get('chart.labels') && this.Get('chart.labels').length > 0) {
+
+ var yOffset = 13;
+ var bordered = false;
+ var bgcolor = null;
+
+ if (this.Get('chart.xlabels.inside')) {
+ yOffset = -5;
+ bordered = true;
+ bgcolor = this.Get('chart.xlabels.inside.color');
+ }
+
+ /**
+ * Text angle
+ */
+ var angle = 0;
+ var valign = null;
+ var halign = 'center';
+
+ if (typeof(this.Get('chart.text.angle')) == 'number' && this.Get('chart.text.angle') > 0) {
+ angle = -1 * this.Get('chart.text.angle');
+ valign = 'center';
+ halign = 'right';
+ yOffset = 5
+ }
+
+ this.context.fillStyle = this.Get('chart.text.color');
+ var numLabels = this.Get('chart.labels').length;
+
+ for (i=0; i<numLabels; ++i) {
+
+ // Changed 8th Nov 2010 to be not reliant on the coords
+ //if (this.Get('chart.labels')[i] && this.coords && this.coords[i] && this.coords[i][0]) {
+ if (this.Get('chart.labels')[i]) {
+
+ var labelX = ((this.canvas.width - (2 * this.Get('chart.gutter')) - (2 * this.Get('chart.hmargin'))) / (numLabels - 1) ) * i;
+ labelX += this.Get('chart.gutter') + this.Get('chart.hmargin');
+
+ /**
+ * Account for an unrelated number of labels
+ */
+ if (this.Get('chart.labels').length != this.data[0].length) {
+ labelX = this.gutter + this.Get('chart.hmargin') + ((this.canvas.width - (2 * this.gutter) - (2 * this.Get('chart.hmargin'))) * (i / (this.Get('chart.labels').length - 1)));
+ }
+
+ // This accounts for there only being one point on the chart
+ if (!labelX) {
+ labelX = this.gutter + this.Get('chart.hmargin');
+ }
+
+ RGraph.Text(context, font,text_size,labelX,(this.canvas.height - gutter) + yOffset,String(this.Get('chart.labels')[i]),valign,halign,bordered,angle,bgcolor);
+ }
+ }
+
+ }
+
+ this.context.stroke();
+ this.context.fill();
+
+ }
+
+
+ /**
+ * Draws the line
+ */
+ RGraph.Line.prototype.DrawLine = function (lineData, color, fill, linewidth, tickmarks)
+ {
+ var penUp = false;
+ var yPos = 0;
+ var xPos = 0;
+ this.context.lineWidth = 1;
+ var lineCoords = [];
+ var gutter = this.Get('chart.gutter');
+
+ // Work out the X interval
+ var xInterval = (this.canvas.width - (2 * this.Get('chart.hmargin')) - ( (2 * this.gutter)) ) / (lineData.length - 1);
+
+ // Loop thru each value given, plotting the line
+ for (i=0; i<lineData.length; i++) {
+
+ yPos = this.canvas.height - ( ( (lineData[i] - (lineData[i] > 0 ? this.Get('chart.ymin') : (-1 * this.Get('chart.ymin')) ) ) / (this.max - this.min) ) * ((this.canvas.height - (2 * this.gutter)) ));
+
+ if (this.Get('chart.ylabels.invert')) {
+ yPos -= gutter;
+ yPos -= gutter;
+ yPos = this.canvas.height - yPos;
+ }
+
+ // Make adjustments depending on the X axis position
+ if (this.Get('chart.xaxispos') == 'center') {
+ yPos /= 2;
+ } else if (this.Get('chart.xaxispos') == 'bottom') {
+ yPos -= this.gutter; // Without this the line is out of place due to the gutter
+ }
+
+ // Null data points
+ if (lineData[i] == null) {
+ yPos = null;
+ }
+
+ // Not always very noticeable, but it does have an effect
+ // with thick lines
+ this.context.lineCap = 'round';
+ this.context.lineJoin = 'round';
+
+ // Plot the line if we're at least on the second iteration
+ if (i > 0) {
+ xPos = xPos + xInterval;
+ } else {
+ xPos = this.Get('chart.hmargin') + gutter; // Might need to be this.gutter - 27th August 2010
+ }
+
+ /**
+ * Add the coords to an array
+ */
+ this.coords.push([xPos, yPos]);
+ lineCoords.push([xPos, yPos]);
+ }
+
+ this.context.stroke();
+
+ /**
+ * For IE only: Draw the shadow ourselves as ExCanvas doesn't produce shadows
+ */
+ if (RGraph.isIE8() && this.Get('chart.shadow')) {
+ this.DrawIEShadow(lineCoords, this.context.shadowColor);
+ }
+
+ /**
+ * Now draw the actual line [FORMERLY SECOND]
+ */
+ this.context.beginPath();
+ this.context.strokeStyle = 'rgba(240,240,240,0.9)'; // Almost transparent - changed on 10th May 2010
+ //this.context.strokeStyle = fill;
+ if (fill) this.context.fillStyle = fill;
+
+ var isStepped = this.Get('chart.stepped');
+ var isFilled = this.Get('chart.filled');
+
+
+ for (var i=0; i<lineCoords.length; ++i) {
+
+ xPos = lineCoords[i][0];
+ yPos = lineCoords[i][1];
+
+ var prevY = (lineCoords[i - 1] ? lineCoords[i - 1][1] : null);
+ var isLast = (i + 1) == lineCoords.length;
+
+ /**
+ * This nullifys values which are out-of-range
+ */
+ if (prevY < this.Get('chart.gutter') || prevY > (this.canvas.height - this.Get('chart.gutter')) ) {
+ penUp = true;
+ }
+
+ if (i == 0 || penUp || !yPos || !prevY || prevY < this.gutter) {
+ if (this.Get('chart.filled') && !this.Get('chart.filled.range')) {
+ this.context.moveTo(xPos + 1, this.canvas.height - this.gutter - (this.Get('chart.xaxispos') == 'center' ? (this.canvas.height - (2 * this.gutter)) / 2 : 0) -1);
+ this.context.lineTo(xPos + 1, yPos);
+
+ } else {
+ this.context.moveTo(xPos, yPos);
+ }
+
+ penUp = false;
+
+ } else {
+
+ // Draw the stepped part of stepped lines
+ if (isStepped) {
+ this.context.lineTo(xPos, lineCoords[i - 1][1]);
+ }
+
+ if ((yPos >= this.gutter && yPos <= (this.canvas.height - this.gutter)) || this.Get('chart.outofbounds')) {
+
+ if (isLast && this.Get('chart.filled') && !this.Get('chart.filled.range') && this.Get('chart.yaxispos') == 'right') {
+ xPos -= 1;
+ }
+
+
+ // Added 8th September 2009
+ if (!isStepped || !isLast) {
+ this.context.lineTo(xPos, yPos);
+
+ if (isFilled && lineCoords[i+1] && lineCoords[i+1][1] == null) {
+ this.context.lineTo(xPos, this.canvas.height - this.gutter);
+ }
+
+ // Added August 2010
+ } else if (isStepped && isLast) {
+ this.context.lineTo(xPos,yPos);
+ }
+
+
+ penUp = false;
+ } else {
+ penUp = true;
+ }
+ }
+ }
+
+ if (this.Get('chart.filled') && !this.Get('chart.filled.range')) {
+ var fillStyle = this.Get('chart.fillstyle');
+
+ this.context.lineTo(xPos, this.canvas.height - this.gutter - 1 - + (this.Get('chart.xaxispos') == 'center' ? (this.canvas.height - (2 * this.gutter)) / 2 : 0));
+ this.context.fillStyle = fill;
+
+ this.context.fill();
+ this.context.beginPath();
+ }
+
+ /**
+ * FIXME this may need removing when Chrome is fixed
+ * SEARCH TAGS: CHROME SHADOW BUG
+ */
+ if (navigator.userAgent.match(/Chrome/) && this.Get('chart.shadow') && this.Get('chart.chromefix') && this.Get('chart.shadow.blur') > 0) {
+
+ for (var i=lineCoords.length - 1; i>=0; --i) {
+ if (
+ typeof(lineCoords[i][1]) != 'number'
+ || (typeof(lineCoords[i+1]) == 'object' && typeof(lineCoords[i+1][1]) != 'number')
+ ) {
+ this.context.moveTo(lineCoords[i][0],lineCoords[i][1]);
+ } else {
+ this.context.lineTo(lineCoords[i][0],lineCoords[i][1]);
+ }
+ }
+ }
+
+ this.context.stroke();
+
+
+ if (this.Get('chart.backdrop')) {
+ this.DrawBackdrop(lineCoords, color);
+ }
+
+ // Now redraw the lines with the correct line width
+ this.RedrawLine(lineCoords, color, linewidth);
+
+ this.context.stroke();
+
+ // Draw the tickmarks
+ for (var i=0; i<lineCoords.length; ++i) {
+
+ i = Number(i);
+
+ if (isStepped && i == (lineCoords.length - 1)) {
+ this.context.beginPath();
+ //continue;
+ }
+
+ if (
+ (
+ tickmarks != 'endcircle'
+ && tickmarks != 'endsquare'
+ && tickmarks != 'filledendsquare'
+ && tickmarks != 'endtick'
+ && tickmarks != 'arrow'
+ && tickmarks != 'filledarrow'
+ )
+ || (i == 0 && tickmarks != 'arrow' && tickmarks != 'filledarrow')
+ || i == (lineCoords.length - 1)
+ ) {
+
+ var prevX = (i <= 0 ? null : lineCoords[i - 1][0]);
+ var prevY = (i <= 0 ? null : lineCoords[i - 1][1]);
+
+ this.DrawTick(lineData, lineCoords[i][0], lineCoords[i][1], color, false, prevX, prevY, tickmarks, i);
+
+ // Draws tickmarks on the stepped bits of stepped charts. Takend out 14th July 2010
+ //
+ //if (this.Get('chart.stepped') && lineCoords[i + 1] && this.Get('chart.tickmarks') != 'endsquare' && this.Get('chart.tickmarks') != 'endcircle' && this.Get('chart.tickmarks') != 'endtick') {
+ // this.DrawTick(lineCoords[i + 1][0], lineCoords[i][1], color);
+ //}
+ }
+ }
+
+ // Draw something off canvas to skirt an annoying bug
+ this.context.beginPath();
+ this.context.arc(this.canvas.width + 50, this.canvas.height + 50, 2, 0, 6.38, 1);
+ }
+
+
+ /**
+ * This functions draws a tick mark on the line
+ *
+ * @param xPos int The x position of the tickmark
+ * @param yPos int The y position of the tickmark
+ * @param color str The color of the tickmark
+ * @param bool Whether the tick is a shadow. If it is, it gets offset by the shadow offset
+ */
+ RGraph.Line.prototype.DrawTick = function (lineData, xPos, yPos, color, isShadow, prevX, prevY, tickmarks, index)
+ {
+ var gutter = this.Get('chart.gutter');
+
+ // If the yPos is null - no tick
+ if ((yPos == null || yPos > (this.canvas.height - gutter) || yPos < gutter) && !this.Get('chart.outofbounds')) {
+ return;
+ }
+
+ this.context.beginPath();
+
+ var offset = 0;
+
+ // Reset the stroke and lineWidth back to the same as what they were when the line was drawm
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.strokeStyle = isShadow ? this.Get('chart.shadow.color') : this.context.strokeStyle;
+ this.context.fillStyle = isShadow ? this.Get('chart.shadow.color') : this.context.strokeStyle;
+
+ // Cicular tick marks
+ if ( tickmarks == 'circle'
+ || tickmarks == 'filledcircle'
+ || tickmarks == 'endcircle') {
+
+ if (tickmarks == 'circle'|| tickmarks == 'filledcircle' || (tickmarks == 'endcircle') ) {
+ this.context.beginPath();
+ this.context.arc(xPos + offset, yPos + offset, this.Get('chart.ticksize'), 0, 360 / (180 / Math.PI), false);
+
+ if (tickmarks == 'filledcircle') {
+ this.context.fillStyle = isShadow ? this.Get('chart.shadow.color') : this.context.strokeStyle;
+ } else {
+ this.context.fillStyle = isShadow ? this.Get('chart.shadow.color') : 'white';
+ }
+
+ this.context.fill();
+ this.context.stroke();
+ }
+
+ // Halfheight "Line" style tick marks
+ } else if (tickmarks == 'halftick') {
+ this.context.beginPath();
+ this.context.moveTo(xPos, yPos);
+ this.context.lineTo(xPos, yPos + this.Get('chart.ticksize'));
+
+ this.context.stroke();
+
+ // Tick style tickmarks
+ } else if (tickmarks == 'tick') {
+ this.context.beginPath();
+ this.context.moveTo(xPos, yPos - this.Get('chart.ticksize'));
+ this.context.lineTo(xPos, yPos + this.Get('chart.ticksize'));
+
+ this.context.stroke();
+
+ // Endtick style tickmarks
+ } else if (tickmarks == 'endtick') {
+ this.context.beginPath();
+ this.context.moveTo(xPos, yPos - this.Get('chart.ticksize'));
+ this.context.lineTo(xPos, yPos + this.Get('chart.ticksize'));
+
+ this.context.stroke();
+
+ // "Cross" style tick marks
+ } else if (tickmarks == 'cross') {
+ this.context.beginPath();
+ this.context.moveTo(xPos - this.Get('chart.ticksize'), yPos - this.Get('chart.ticksize'));
+ this.context.lineTo(xPos + this.Get('chart.ticksize'), yPos + this.Get('chart.ticksize'));
+ this.context.moveTo(xPos + this.Get('chart.ticksize'), yPos - this.Get('chart.ticksize'));
+ this.context.lineTo(xPos - this.Get('chart.ticksize'), yPos + this.Get('chart.ticksize'));
+
+ this.context.stroke();
+
+ // A white bordered circle
+ } else if (tickmarks == 'borderedcircle' || tickmarks == 'dot') {
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = this.Get('chart.tickmarks.dot.color');
+ this.context.fillStyle = this.Get('chart.tickmarks.dot.color');
+
+ // The outer white circle
+ this.context.beginPath();
+ this.context.arc(xPos, yPos, this.Get('chart.ticksize'), 0, 360 / (180 / Math.PI), false);
+ this.context.closePath();
+
+
+ this.context.fill();
+ this.context.stroke();
+
+ // Now do the inners
+ this.context.beginPath();
+ this.context.fillStyle = color;
+ this.context.strokeStyle = color;
+ this.context.arc(xPos, yPos, this.Get('chart.ticksize') - 2, 0, 360 / (180 / Math.PI), false);
+
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ } else if ( tickmarks == 'square'
+ || tickmarks == 'filledsquare'
+ || (tickmarks == 'endsquare')
+ || (tickmarks == 'filledendsquare') ) {
+
+ this.context.fillStyle = 'white';
+ this.context.strokeStyle = this.context.strokeStyle; // FIXME Is this correct?
+
+ this.context.beginPath();
+ this.context.strokeRect(xPos - this.Get('chart.ticksize'), yPos - this.Get('chart.ticksize'), this.Get('chart.ticksize') * 2, this.Get('chart.ticksize') * 2);
+
+ // Fillrect
+ if (tickmarks == 'filledsquare' || tickmarks == 'filledendsquare') {
+ this.context.fillStyle = isShadow ? this.Get('chart.shadow.color') : this.context.strokeStyle;
+ this.context.fillRect(xPos - this.Get('chart.ticksize'), yPos - this.Get('chart.ticksize'), this.Get('chart.ticksize') * 2, this.Get('chart.ticksize') * 2);
+
+ } else if (tickmarks == 'square' || tickmarks == 'endsquare') {
+ this.context.fillStyle = isShadow ? this.Get('chart.shadow.color') : 'white';
+ this.context.fillRect((xPos - this.Get('chart.ticksize')) + 1, (yPos - this.Get('chart.ticksize')) + 1, (this.Get('chart.ticksize') * 2) - 2, (this.Get('chart.ticksize') * 2) - 2);
+ }
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * FILLED arrowhead
+ */
+ } else if (tickmarks == 'filledarrow') {
+
+ var x = Math.abs(xPos - prevX);
+ var y = Math.abs(yPos - prevY);
+
+ if (yPos < prevY) {
+ var a = Math.atan(x / y) + 1.57;
+ } else {
+ var a = Math.atan(y / x) + 3.14;
+ }
+
+ this.context.beginPath();
+ this.context.moveTo(xPos, yPos);
+ this.context.arc(xPos, yPos, 7, a - 0.5, a + 0.5, false);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * Arrow head, NOT filled
+ */
+ } else if (tickmarks == 'arrow') {
+
+ var x = Math.abs(xPos - prevX);
+ var y = Math.abs(yPos - prevY);
+
+ if (yPos < prevY) {
+ var a = Math.atan(x / y) + 1.57;
+ } else {
+ var a = Math.atan(y / x) + 3.14;
+ }
+
+ this.context.beginPath();
+ this.context.moveTo(xPos, yPos);
+ this.context.arc(xPos, yPos, 7, a - 0.5 - (document.all ? 0.1 : 0.01), a - 0.4, false);
+
+ this.context.moveTo(xPos, yPos);
+ this.context.arc(xPos, yPos, 7, a + 0.5 + (document.all ? 0.1 : 0.01), a + 0.5, true);
+
+
+ this.context.stroke();
+
+ /**
+ * Custom tick drawing function
+ */
+ } else if (typeof(tickmarks) == 'function') {
+ tickmarks(this, lineData, lineData[index], index, xPos, yPos, color, prevX, prevY);
+ }
+ }
+
+
+ /**
+ * Draws a filled range if necessary
+ */
+ RGraph.Line.prototype.DrawRange = function ()
+ {
+ /**
+ * Fill the range if necessary
+ */
+ if (this.Get('chart.filled.range') && this.Get('chart.filled')) {
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.fillstyle');
+ this.context.strokeStyle = this.Get('chart.fillstyle');
+ this.context.lineWidth = 1;
+ var len = (this.coords.length / 2);
+
+ for (var i=0; i<len; ++i) {
+ if (i == 0) {
+ this.context.moveTo(this.coords[i][0], this.coords[i][1])
+ } else {
+ this.context.lineTo(this.coords[i][0], this.coords[i][1])
+ }
+ }
+
+ for (var i=this.coords.length - 1; i>=len; --i) {
+ this.context.lineTo(this.coords[i][0], this.coords[i][1])
+ }
+ this.context.stroke();
+ this.context.fill();
+ }
+ }
+
+
+ /**
+ * Redraws the line with the correct line width etc
+ *
+ * @param array coords The coordinates of the line
+ */
+ RGraph.Line.prototype.RedrawLine = function (coords, color, linewidth)
+ {
+ if (this.Get('chart.noredraw')) {
+ return;
+ }
+
+ this.context.beginPath();
+ this.context.strokeStyle = (typeof(color) == 'object' && color ? color[0] : color);
+ this.context.lineWidth = linewidth;
+
+ var len = coords.length;
+ var gutter = this.gutter;
+ var width = this.canvas.width;
+ var height = this.canvas.height;
+ var penUp = false;
+
+ for (var i=0; i<len; ++i) {
+
+ var xPos = coords[i][0];
+ var yPos = coords[i][1];
+
+ if (i > 0) {
+ var prevX = coords[i - 1][0];
+ var prevY = coords[i - 1][1];
+ }
+
+
+ if ((
+ (i == 0 && coords[i])
+ || (yPos < gutter)
+ || (prevY < gutter)
+ || (yPos > (height - gutter))
+ || (i > 0 && prevX > (width - gutter))
+ || (i > 0 && prevY > (height - gutter))
+ || prevY == null
+ || penUp == true
+ ) && !this.Get('chart.outofbounds')) {
+
+ this.context.moveTo(coords[i][0], coords[i][1]);
+
+ penUp = false;
+
+ } else {
+
+ if (this.Get('chart.stepped') && i > 0) {
+ this.context.lineTo(coords[i][0], coords[i - 1][1]);
+ }
+
+ // Don't draw the last bit of a stepped chart. Now DO
+ //if (!this.Get('chart.stepped') || i < (coords.length - 1)) {
+ this.context.lineTo(coords[i][0], coords[i][1]);
+ //}
+ penUp = false;
+ }
+ }
+
+ /**
+ * If two colors are specified instead of one, go over the up bits
+ */
+ if (this.Get('chart.colors.alternate') && typeof(color) == 'object' && color[0] && color[1]) {
+ for (var i=1; i<len; ++i) {
+
+ var prevX = coords[i - 1][0];
+ var prevY = coords[i - 1][1];
+
+ this.context.beginPath();
+ this.context.strokeStyle = color[coords[i][1] < prevY ? 0 : 1];
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.moveTo(prevX, prevY);
+ this.context.lineTo(coords[i][0], coords[i][1]);
+ this.context.stroke();
+ }
+ }
+ }
+
+
+ /**
+ * This function is used by MSIE only to manually draw the shadow
+ *
+ * @param array coords The coords for the line
+ */
+ RGraph.Line.prototype.DrawIEShadow = function (coords, color)
+ {
+ var offsetx = this.Get('chart.shadow.offsetx');
+ var offsety = this.Get('chart.shadow.offsety');
+
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.strokeStyle = color;
+ this.context.beginPath();
+
+ for (var i=0; i<coords.length; ++i) {
+ if (i == 0) {
+ this.context.moveTo(coords[i][0] + offsetx, coords[i][1] + offsety);
+ } else {
+ this.context.lineTo(coords[i][0] + offsetx, coords[i][1] + offsety);
+ }
+ }
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draw the backdrop
+ */
+ RGraph.Line.prototype.DrawBackdrop = function (coords, color)
+ {
+ var size = this.Get('chart.backdrop.size');
+ this.context.lineWidth = size;
+ this.context.globalAlpha = this.Get('chart.backdrop.alpha');
+ this.context.strokeStyle = color;
+ this.context.lineJoin = 'miter';
+
+ this.context.beginPath();
+ this.context.moveTo(coords[0][0], coords[0][1]);
+ for (var j=1; j<coords.length; ++j) {
+ this.context.lineTo(coords[j][0], coords[j][1]);
+ }
+
+ this.context.stroke();
+
+ // Reset the alpha value
+ this.context.globalAlpha = 1;
+ this.context.lineJoin = 'round';
+ RGraph.NoShadow(this);
+ }
+
+
+ /**
+ * Returns the linewidth
+ */
+ RGraph.Line.prototype.GetLineWidth = function (i)
+ {
+ var linewidth = this.Get('chart.linewidth');
+
+ if (typeof(linewidth) == 'number') {
+ return linewidth;
+
+ } else if (typeof(linewidth) == 'object') {
+ if (linewidth[i]) {
+ return linewidth[i];
+ } else {
+ return linewidth[0];
+ }
+
+ alert('[LINE] Error! chart.linewidth should be a single number or an array of one or more numbers');
+ }
+ }
+
+
+ /**
+ * The getPoint() method - used to get the point the mouse is currently over, if any
+ *
+ * @param object e The event object
+ */
+ RGraph.Line.prototype.getPoint = function (e)
+ {
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = e.target.__object__;
+ var mouseXY = RGraph.getMouseXY(e);
+ var mouseX = mouseXY[0];
+ var mouseY = mouseXY[1];
+
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ var xCoord = obj.coords[i][0];
+ var yCoord = obj.coords[i][1];
+
+ if ( mouseX <= (xCoord + 5 + obj.Get('chart.tooltips.coords.adjust')[0])
+ && mouseX >= (xCoord - 5 + obj.Get('chart.tooltips.coords.adjust')[0])
+ && mouseY <= (yCoord + 5 + obj.Get('chart.tooltips.coords.adjust')[1])
+ && mouseY >= (yCoord - 5 + obj.Get('chart.tooltips.coords.adjust')[1])) {
+
+ return [obj, xCoord, yCoord, i];
+ }
+ }
+ }
+
+
+ /**
+ * Draws the above line labels
+ */
+ RGraph.Line.prototype.DrawAboveLabels = function ()
+ {
+ var context = this.context;
+ var size = this.Get('chart.labels.above.size');
+ var font = this.Get('chart.text.font');
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+
+ context.beginPath();
+
+ // Don't need to check that chart.labels.above is enabled here, it's been done already
+ for (var i=0; i<this.coords.length; ++i) {
+ var coords = this.coords[i];
+
+ RGraph.Text(context, font, size, coords[0], coords[1] - 5 - size, RGraph.number_format(this, this.data_arr[i], units_pre, units_post), 'center', 'center', true, null, 'rgba(255, 255, 255, 0.7)');
+ }
+
+ context.fill();
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The bar chart constructor
+ *
+ * @param string canvas The canvas ID
+ * @param min integer The minimum value
+ * @param max integer The maximum value
+ * @param value integer The indicated value
+ */
+ RGraph.Meter = function (id, min, max, value)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.canvas.__object__ = this;
+ this.type = 'meter';
+ this.min = min;
+ this.max = max;
+ this.value = value;
+ this.centerx = null;
+ this.centery = null;
+ this.radius = null;
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Various config type stuff
+ this.properties = {
+ 'chart.gutter': 25,
+ 'chart.linewidth': 2,
+ 'chart.border.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.color': 'black',
+ 'chart.green.start': ((this.max - this.min) * 0.35) + this.min,
+ 'chart.green.end': this.max,
+ 'chart.green.color': '#207A20',
+ 'chart.yellow.start': ((this.max - this.min) * 0.1) + this.min,
+ 'chart.yellow.end': ((this.max - this.min) * 0.35) + this.min,
+ 'chart.yellow.color': '#D0AC41',
+ 'chart.red.start': this.min,
+ 'chart.red.end': ((this.max - this.min) * 0.1) + this.min,
+ 'chart.red.color': '#9E1E1E',
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.contextmenu': null,
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 15,
+ 'chart.zoom.delay': 33,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.shadow': false,
+ 'chart.shadow.color': 'rgba(0,0,0,0.5)',
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.reszable': false
+ }
+
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[METER] No canvas support');
+ return;
+ }
+
+ // Check the canvasText library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[METER] Fatal error: The common library does not appear to have been included');
+ }
+
+ /**
+ * Constrain the value to be within the min and max
+ */
+ if (this.value > this.max) this.value = this.max;
+ if (this.value < this.min) this.value = this.min;
+ }
+
+
+ /**
+ * A setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Meter.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Meter.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+ /**
+ * The function you call to draw the bar chart
+ */
+ RGraph.Meter.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+
+ // Cache the gutter as a object variable because it's used a lot
+ this.gutter = this.Get('chart.gutter');
+
+ this.centerx = this.canvas.width / 2;
+ this.centery = this.canvas.height - this.gutter;
+ this.radius = Math.min(this.canvas.width - (2 * this.gutter), this.canvas.height - (2 * this.gutter));
+
+ this.DrawBackground();
+ this.DrawNeedle();
+ this.DrawLabels();
+
+ /**
+ * Draw the title
+ */
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.gutter);
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+
+ /**
+ * For MSIE only, to cover the spurious lower ends of the circle
+ */
+ if (document.all) {
+ // Cover the left tail
+ this.context.beginPath();
+ this.context.moveTo(this.gutter, this.canvas.height - this.gutter);
+ this.context.fillStyle = 'white';
+ this.context.fillRect(this.centerx - this.radius - 5, this.canvas.height - this.gutter + 1, 10, this.gutter);
+ this.context.fill();
+
+ // Cover the right tail
+ this.context.beginPath();
+ this.context.moveTo(this.canvas.width - this.gutter, this.canvas.height - this.gutter);
+ this.context.fillStyle = 'white';
+ this.context.fillRect(this.centerx + this.radius - 5, this.canvas.height - this.gutter + 1, 10, this.gutter);
+ this.context.fill();
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the background of the chart
+ */
+ RGraph.Meter.prototype.DrawBackground = function ()
+ {
+ // Draw the shadow
+ if (this.Get('chart.shadow')) {
+ this.context.beginPath();
+ this.context.fillStyle = 'white';
+ this.context.shadowColor = this.Get('chart.shadow.color');
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+
+ this.context.arc(this.centerx, this.centery, this.radius, 3.14, 6.28, false);
+ //this.context.arc(this.centerx, this.centery, , 0, 6.28, false);
+ this.context.fill();
+
+
+ this.context.beginPath();
+ var r = (this.radius * 0.06) > 40 ? 40 : (this.radius * 0.06);
+ this.context.arc(this.centerx, this.centery, r, 0, 6.28, 0);
+ this.context.fill();
+
+ RGraph.NoShadow(this);
+ }
+
+ // First, draw the grey tickmarks
+ this.context.beginPath();
+ this.context.strokeStyle = '#bbb'
+ for (var i=0; i<3.14; i+=(0.13/3)) {
+ this.context.arc(this.centerx, this.centery, this.radius, 3.14 + i, 3.1415 + i, 0);
+ this.context.lineTo(this.centerx, this.centery);
+ }
+ this.context.stroke();
+
+
+ // First, draw the tickmarks
+ for (var i=0; i<3.14; i+=0.13) {
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.border.color');
+ this.context.arc(this.centerx, this.centery, this.radius, 3.14 + i, 3.1415 + i, 0);
+ this.context.lineTo(this.centerx, this.centery)
+ this.context.stroke();
+ }
+
+ // Draw the white circle that makes the tickmarks
+ this.context.beginPath();
+ this.context.fillStyle = 'white'
+ this.context.arc(this.centerx, this.centery, this.radius - 4, 3.1415927, 6.28, false);
+ this.context.closePath();
+ this.context.fill();
+
+ // Draw the green area
+ this.context.strokeStyle = this.Get('chart.green.color');
+ this.context.fillStyle = this.Get('chart.green.color');
+ this.context.beginPath();
+ this.context.arc(this.centerx,this.centery,this.radius * 0.85,(((this.Get('chart.green.start') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,(((this.Get('chart.green.end') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,false);
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the yellow area
+ this.context.strokeStyle = this.Get('chart.yellow.color');
+ this.context.fillStyle = this.Get('chart.yellow.color');
+ this.context.beginPath(); this.context.arc(this.centerx,this.centery,this.radius * 0.85,(((this.Get('chart.yellow.start') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,(((this.Get('chart.yellow.end') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,false)
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the yellow area
+ this.context.strokeStyle = this.Get('chart.red.color');
+ this.context.fillStyle = this.Get('chart.red.color');
+ this.context.beginPath();
+ this.context.arc(this.centerx,this.centery,this.radius * 0.85,(((this.Get('chart.red.start') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,(((this.Get('chart.red.end') - this.min) / (this.max - this.min)) * 3.1415927) + 3.1415927,false);
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the outline
+ this.context.strokeStyle = this.Get('chart.border.color');
+ this.context.lineWidth = this.Get('chart.linewidth');
+
+ this.context.beginPath();
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, this.radius, 3.1415927, 6.2831854, false);
+ this.context.closePath();
+
+ this.context.stroke();
+
+ // Reset the linewidth back to 1
+ this.context.lineWidth = 1;
+ }
+
+
+ /**
+ * Draws the pointer
+ */
+ RGraph.Meter.prototype.DrawNeedle = function ()
+ {
+ // First draw the circle at the bottom
+ this.context.fillStyle = 'black';
+ this.context.lineWidth = this.radius >= 200 ? 7 : 3;
+ this.context.lineCap = 'round';
+
+ // Now, draw the pointer
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+ var a = (((this.value - this.min) / (this.max - this.min)) * 3.14) + 3.14;
+ this.context.arc(this.centerx, this.centery, this.radius * 0.7, a, a + 0.001, false);
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.stroke();
+
+ // Draw the triangular needle head
+ this.context.beginPath();
+ this.context.lineWidth = 1;
+ //this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, (this.radius * 0.7) + 15, a, a + 0.001, 0);
+ this.context.arc(this.centerx, this.centery, (this.radius * 0.7) - 15, a + 0.087, a + 0.087999, 0);
+ this.context.arc(this.centerx, this.centery, (this.radius * 0.7) - 15, a - 0.087, a - 0.087999, 1);
+ this.context.fill();
+
+ // Draw the center circle
+ var r = (this.radius * 0.06) > 40 ? 40 : (this.radius * 0.06);
+
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, r, 0, 6.28, 0);
+ this.context.fill();
+
+ // Draw the centre bit of the circle
+ this.context.fillStyle = 'white';
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, r - 2, 0, 6.28, 0);
+ this.context.fill();
+ }
+
+
+ /**
+ * Draws the labels
+ */
+ RGraph.Meter.prototype.DrawLabels = function ()
+ {
+ var context = this.context;
+ var radius = this.radius;
+ var text_size = this.Get('chart.text.size');
+ var text_font = this.Get('chart.text.font');
+ var units_post = this.Get('chart.units.post');
+ var units_pre = this.Get('chart.units.pre');
+ var centerx = this.centerx;
+ var centery = this.centery;
+ var min = this.min;
+ var max = this.max;
+
+ context.fillStyle = this.Get('chart.text.color');
+ context.lineWidth = 1;
+
+ context.beginPath();
+
+
+ RGraph.Text(context, text_font, text_size, centerx - radius + (0.075 * radius), centery - 10, units_pre + min + units_post, 'center', 'left', false, 270);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(0.62819 / 2) * (radius - (0.085 * radius)) ),centery - (Math.sin(0.682819 / 2) * (radius - (0.085 * radius)) ),units_pre + (((max - min) * (1/10)) + min) + units_post,'center','center', false, 288);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(0.62819) * (radius - (0.085 * radius)) ),centery - (Math.sin(0.682819) * (radius - (0.085 * radius)) ),units_pre + (((max - min) * (2/10)) + min) + units_post,'center','center', false, 306);
+ RGraph.Text(context, text_font, text_size,centerx - (Math.cos(0.95) * (radius - (0.085 * radius)) ),centery - (Math.sin(0.95) * (radius - (0.0785 * radius)) ),units_pre + (((max - min) * (3/10)) + min) + units_post,'center', 'center', false, 320);
+ RGraph.Text(context, text_font, text_size,centerx - (Math.cos(1.2566) * (radius - (0.085 * radius)) ),centery - (Math.sin(1.2566) * (radius - (0.0785 * radius)) ),units_pre + (((max - min) * (4/10)) + min) + units_post,'center', 'center', false, 342);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(1.57) * (radius - (0.075 * radius)) ),centery - (Math.sin(1.57) * (radius - (0.075 * radius)) ),units_pre + (((max - min) * (5/10)) + min) + units_post,'center','center', false, 0);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(1.88495562) * (radius - (0.075 * radius)) ),centery - (Math.sin(1.88495562) * (radius - (0.075 * radius)) ),units_pre + (((max - min)* (6/10)) + min) + units_post,'center','center', false, 18);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(2.1989) * (radius - (0.075 * radius)) ),centery - (Math.sin(2.1989) * (radius - (0.075 * radius)) ),units_pre + (((max - min)* (7/10)) + min) + units_post,'center','center', false, 36);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(2.51327416) * (radius - (0.075 * radius)) ),centery - (Math.sin(2.51327416) * (radius - (0.075 * radius)) ), units_pre + (((max - min) * (8/10)) + min) + units_post,'center','center', false, 54);
+ RGraph.Text(context,text_font,text_size,centerx - (Math.cos(2.82764832) * (radius - (0.075 * radius)) ),centery - (Math.sin(2.82764832) * (radius - (0.075 * radius)) ),units_pre + (((max - min) * (9/10)) + min) + units_post,'center','center', false, 72);
+ RGraph.Text(context, text_font, text_size,centerx + radius - (0.075 * radius),centery - 10,units_pre + (max) + units_post, 'center', 'right', false, 90);
+
+ context.fill();
+ context.stroke();
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ ModalDialog = {}
+ ModalDialog.dialog = null;
+ ModalDialog.background = null;
+ ModalDialog.offset = 50;
+ ModalDialog.events = [];
+
+ /**
+ * Shows the dialog with the supplied DIV acting as the contents
+ *
+ * @param string id The ID of the DIV to use as the dialogs contents
+ * @param int width The width of the dialog
+ */
+ ModalDialog.Show = function (id, width)
+ {
+ ModalDialog.id = id;
+ ModalDialog.width = width;
+
+ ModalDialog.ShowBackground();
+ ModalDialog.ShowDialog();
+
+ // Install the event handlers
+ window.onresize = ModalDialog.Resize;
+
+
+ // Call them initially
+ ModalDialog.Resize();
+
+ ModalDialog.FireCustomEvent('onmodaldialog');
+ }
+
+
+ /**
+ * Shows the background semi-transparent darkened DIV
+ */
+ ModalDialog.ShowBackground = function ()
+ {
+ // Create the background if neccessary
+ ModalDialog.background = document.createElement('DIV');
+ ModalDialog.background.className = 'ModalDialog_background';
+ ModalDialog.background.style.position = 'fixed';
+ ModalDialog.background.style.top = 0;
+ ModalDialog.background.style.left = 0;
+ ModalDialog.background.style.width = (screen.width + 100) + 'px';
+ ModalDialog.background.style.height = (screen.height + 100) + 'px';
+ ModalDialog.background.style.backgroundColor = 'rgb(204,204,204)';
+ ModalDialog.background.style.opacity = 0;
+ ModalDialog.background.style.zIndex = 3276;
+ ModalDialog.background.style.filter = "Alpha(opacity=50)";
+
+ document.body.appendChild(ModalDialog.background);
+
+ ModalDialog.background.style.visibility = 'visible';
+ }
+
+
+ /**
+ * Shows the dialog itself
+ */
+ ModalDialog.ShowDialog = function ()
+ {
+ // Create the DIV if necessary
+ if (!ModalDialog.dialog) {
+ ModalDialog.dialog = document.createElement('DIV');
+
+ ModalDialog.dialog.id = 'ModalDialog_dialog';
+ ModalDialog.dialog.className = 'ModalDialog_dialog';
+
+ var borderRadius = '15px';
+
+ ModalDialog.dialog.style.borderRadius = borderRadius;
+ ModalDialog.dialog.style.MozBorderRadius = borderRadius;
+ ModalDialog.dialog.style.WebkitBorderRadius = borderRadius;
+
+ ModalDialog.dialog.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ ModalDialog.dialog.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
+ ModalDialog.dialog.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 3px 3px 3px';
+
+ ModalDialog.dialog.style.position = 'fixed';
+ ModalDialog.dialog.style.backgroundColor = 'white';
+ ModalDialog.dialog.style.width = parseInt(ModalDialog.width) + 'px';
+ ModalDialog.dialog.style.border = '2px solid #999';
+ ModalDialog.dialog.style.zIndex = 32767;
+ ModalDialog.dialog.style.padding = '5px';
+ ModalDialog.dialog.style.paddingTop = '25px';
+ ModalDialog.dialog.style.opacity = 0;
+
+ if (document.all) {
+ ModalDialog.dialog.style.zIndex = 32767;
+ }
+
+
+
+ // Accomodate various browsers
+ if (navigator.userAgent.indexOf('Opera') != -1) {
+ ModalDialog.dialog.style.paddingTop = '25px';
+
+ } else if (navigator.userAgent.indexOf('MSIE') != -1) {
+ ModalDialog.dialog.style.paddingTop = '25px';
+
+ } else if (navigator.userAgent.indexOf('Safari') != -1) {
+ ModalDialog.dialog.style.paddingTop = '25px';
+ }
+
+ document.body.appendChild(ModalDialog.dialog);
+
+
+ // Now create the grey bar at the top of the dialog
+ var bar = document.createElement('DIV');
+ bar.className = 'ModalDialog_topbar';
+ bar.style.top = 0;
+ bar.style.left = 0;
+ bar.style.width = '100%';//(ModalDialog.dialog.offsetWidth - 4) + 'px';
+ bar.style.height = '20px';
+ bar.style.backgroundColor = '#bbb';
+ bar.style.borderBottom = '2px solid #999';
+ //bar.style.zIndex = 50000;
+ bar.style.position = 'absolute';
+ var borderRadius = '11px';
+ bar.style.WebkitBorderTopLeftRadius = borderRadius;
+ bar.style.WebkitBorderTopRightRadius = borderRadius;
+ bar.style.MozBorderRadiusTopleft = borderRadius;
+ bar.style.MozBorderRadiusTopright = borderRadius;
+ bar.style.borderTopRightRadius = borderRadius;
+ bar.style.borderTopLeftRadius = borderRadius;
+ ModalDialog.dialog.appendChild(bar);
+
+ // Add the content div
+ var content = document.createElement('DIV');
+ //content.style.paddingTop = '20px';
+ content.style.width = '100%';
+ content.style.height = '100%';
+ ModalDialog.dialog.appendChild(content);
+
+ content.innerHTML = document.getElementById(ModalDialog.id).innerHTML;
+
+ // Now reposition the dialog in the center
+ ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
+ ModalDialog.dialog.style.top = '30%';
+ }
+
+ // Show the dialog
+ ModalDialog.dialog.style.visibility = 'visible';
+
+ // A simple fade-in effect
+ setTimeout('ModalDialog.dialog.style.opacity = 0.2', 50);
+ setTimeout('ModalDialog.dialog.style.opacity = 0.4', 100);
+ setTimeout('ModalDialog.dialog.style.opacity = 0.6', 150);
+ setTimeout('ModalDialog.dialog.style.opacity = 0.8', 200);
+ setTimeout('ModalDialog.dialog.style.opacity = 1', 250);
+
+ setTimeout('ModalDialog.background.style.opacity = 0.1', 50);
+ setTimeout('ModalDialog.background.style.opacity = 0.2', 100);
+ setTimeout('ModalDialog.background.style.opacity = 0.3', 150);
+ setTimeout('ModalDialog.background.style.opacity = 0.4', 200);
+ setTimeout('ModalDialog.background.style.opacity = 0.5', 250);
+ }
+
+
+ /**
+ * Hides everything
+ */
+ ModalDialog.Close = function ()
+ {
+ if (ModalDialog.dialog) {
+ ModalDialog.dialog.style.visibility = 'hidden';
+ ModalDialog.dialog.style.opacity = 0;
+ }
+
+ if (ModalDialog.background) {
+ ModalDialog.background.style.visibility = 'hidden';
+ ModalDialog.background.style.opacity = 0;
+ }
+ }
+
+ // An alias
+ ModalDialog.Hide = ModalDialog.Close
+
+
+ /**
+ * Accommodate the window being resized
+ */
+ ModalDialog.Resize = function ()
+ {
+ if (ModalDialog.dialog) {
+ ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
+ }
+
+ ModalDialog.background.style.width = '2500px';
+ ModalDialog.background.style.height = '2500px';
+ }
+
+
+ /**
+ * Returns the page height
+ *
+ * @return int The page height
+ */
+ ModalDialog.AddCustomEventListener = function (name, func)
+ {
+ if (typeof(ModalDialog.events) == 'undefined') {
+ ModalDialog.events = [];
+ }
+
+ ModalDialog.events.push([name, func]);
+ }
+
+
+ /**
+ * Used to fire the ModalDialog custom event
+ *
+ * @param object obj The graph object that fires the event
+ * @param string event The name of the event to fire
+ */
+ ModalDialog.FireCustomEvent = function (name)
+ {
+ for (var i=0; i<ModalDialog.events.length; ++i) {
+ if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
+ ModalDialog.events[i][1]();
+ }
+ }
+ }
+
+
+ /**
+ * Returns true if the browser is IE8
+ */
+ ModalDialog.isIE8 = function ()
+ {
+ return document.all && (navigatot.userAgent.indexOf('MSIE 8') > 0);
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The odometer constructor. Pass it the ID of the canvas tag, the start value of the odo,
+ * the end value, and the value that the pointer should point to.
+ *
+ * @param string id The ID of the canvas tag
+ * @param int start The start value of the Odo
+ * @param int end The end value of the odo
+ * @param int value The indicated value (what the needle points to)
+ */
+ RGraph.Odometer = function (id, start, end, value)
+ {
+ this.id = id
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.canvas.__object__ = this;
+ this.type = 'odo';
+ this.isRGraph = true;
+ this.start = start;
+ this.end = end;
+ this.value = value;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ this.properties = {
+ 'chart.value.text': false,
+ 'chart.needle.color': 'black',
+ 'chart.needle.width': 2,
+ 'chart.needle.head': true,
+ 'chart.needle.tail': true,
+ 'chart.needle.type': 'pointer',
+ 'chart.needle.extra': [],
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.green.max': end * 0.75,
+ 'chart.red.min': end * 0.9,
+ 'chart.green.color': 'green',
+ 'chart.yellow.color': 'yellow',
+ 'chart.red.color': 'red',
+ 'chart.label.area': 35,
+ 'chart.gutter': 25,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.contextmenu': null,
+ 'chart.linewidth': 1,
+ 'chart.shadow.inner': false,
+ 'chart.shadow.inner.color': 'black',
+ 'chart.shadow.inner.offsetx': 3,
+ 'chart.shadow.inner.offsety': 3,
+ 'chart.shadow.inner.blur': 6,
+ 'chart.shadow.outer': false,
+ 'chart.shadow.outer.color': '#666',
+ 'chart.shadow.outer.offsetx': 0,
+ 'chart.shadow.outer.offsety': 0,
+ 'chart.shadow.outer.blur': 15,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.scale.decimals': 0,
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.border': false,
+ 'chart.tickmarks.highlighted': false,
+ 'chart.zerostart': false,
+ 'chart.labels': null,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.value.units.pre': '',
+ 'chart.value.units.post': ''
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[ODO] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A peudo setter
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Odometer.prototype.Set = function (name, value)
+ {
+ if (name == 'chart.needle.style') {
+ alert('[RGRAPH] The RGraph property chart.needle.style has changed to chart.needle.color');
+ }
+
+ if (name == 'chart.needle.thickness') {
+ name = 'chart.needle.width';
+ }
+
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A getter
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Odometer.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * Draws the odometer
+ */
+ RGraph.Odometer.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ // Work out a few things
+ this.radius = Math.min(this.canvas.width / 2, this.canvas.height / 2) - this.Get('chart.gutter') - (this.Get('chart.border') ? 25 : 0);
+ this.diameter = 2 * this.radius;
+ this.centerx = this.canvas.width / 2;
+ this.centery = this.canvas.height / 2;
+ this.range = this.end - this.start;
+
+ this.context.lineWidth = this.Get('chart.linewidth');
+
+ // Draw the background
+ this.DrawBackground();
+
+ // And lastly, draw the labels
+ this.DrawLabels();
+
+ // Draw the needle
+ this.DrawNeedle(this.value, this.Get('chart.needle.color'));
+
+ /**
+ * Draw any extra needles
+ */
+ if (this.Get('chart.needle.extra').length > 0) {
+ for (var i=0; i<this.Get('chart.needle.extra').length; ++i) {
+ var needle = this.Get('chart.needle.extra')[i];
+ this.DrawNeedle(needle[0], needle[1]);
+ }
+ }
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+ /**
+ * Draws the background
+ */
+ RGraph.Odometer.prototype.DrawBackground = function ()
+ {
+ this.context.beginPath();
+
+ /**
+ * Turn on the shadow if need be
+ */
+ if (this.Get('chart.shadow.outer')) {
+ RGraph.SetShadow(this, this.Get('chart.shadow.outer.color'), this.Get('chart.shadow.outer.offsetx'), this.Get('chart.shadow.outer.offsety'), this.Get('chart.shadow.outer.blur'));
+ }
+
+ var backgroundColor = '#eee';
+
+ // Draw the grey border
+ this.context.fillStyle = backgroundColor;
+ this.context.arc(this.centerx, this.centery, this.radius, 0.0001, 6.28, false);
+ this.context.fill();
+
+ /**
+ * Turn off the shadow
+ */
+ RGraph.NoShadow(this);
+
+
+ // Draw a circle
+ this.context.strokeStyle = '#666';
+ this.context.arc(this.centerx, this.centery, this.radius, 0, 6.28, false);
+
+ // Now draw a big white circle to make the lines appear as tick marks
+ // This is solely for Chrome
+ this.context.fillStyle = backgroundColor;
+ this.context.arc(this.centerx, this.centery, this.radius, 0, 6.28, false);
+ this.context.fill();
+
+ /**
+ * Draw more tickmarks
+ */
+ this.context.beginPath();
+ this.context.strokeStyle = '#bbb';
+
+ for (var i=0; i<=360; i+=3) {
+ this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.degrees2Radians(i), false);
+ this.context.lineTo(this.centerx, this.centery);
+ }
+ this.context.stroke();
+
+ this.context.beginPath();
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = 'black';
+
+ // Now draw a big white circle to make the lines appear as tick marks
+ this.context.fillStyle = backgroundColor;
+ this.context.strokeStyle = backgroundColor;
+ this.context.arc(this.centerx, this.centery, this.radius - 5, 0, 6.28, false);
+ this.context.fill();
+ this.context.stroke();
+
+ // Gray lines at 18 degree intervals
+ this.context.beginPath();
+ this.context.strokeStyle = '#ddd';
+ for (var i=0; i<360; i+=18) {
+ this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.degrees2Radians(i), false);
+ this.context.lineTo(this.centerx, this.centery);
+ }
+ this.context.stroke();
+
+ // Redraw the outer circle
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+ this.context.arc(this.centerx, this.centery, this.radius, 0, 6.2830, false);
+ this.context.stroke();
+
+ /**
+ * Now draw the center bits shadow if need be
+ */
+ if (this.Get('chart.shadow.inner')) {
+ this.context.beginPath();
+ RGraph.SetShadow(this, this.Get('chart.shadow.inner.color'), this.Get('chart.shadow.inner.offsetx'), this.Get('chart.shadow.inner.offsety'), this.Get('chart.shadow.inner.blur'));
+ this.context.arc(this.centerx, this.centery, this.radius - this.Get('chart.label.area'), 0, 6.28, 0);
+ this.context.fill();
+ this.context.stroke();
+
+ /**
+ * Turn off the shadow
+ */
+ RGraph.NoShadow(this);
+ }
+
+ // Now draw the green area
+ var greengrad = this.canvas.getContext('2d').createRadialGradient(this.canvas.width / 2, this.canvas.height / 2, 0, this.canvas.width / 2, this.canvas.height / 2, this.canvas.width / 2, this.canvas.width / 2);
+ greengrad.addColorStop(0, 'white');
+ greengrad.addColorStop(1, this.Get('chart.green.color'));
+
+ // Draw the "tick highlight"
+ if (this.Get('chart.tickmarks.highlighted')) {
+ this.context.beginPath();
+ this.context.lineWidth = 5;
+ this.context.strokeStyle = greengrad;
+ this.context.arc(this.centerx, this.centery, this.radius - 2.5,
+
+ -1.57,
+ ((this.Get('chart.green.max') / this.end) * 6.2830) - 1.57,
+ 0);
+
+ this.context.stroke();
+
+ this.context.lineWidth = 1;
+ }
+
+ this.context.beginPath();
+ this.context.fillStyle = greengrad;
+ this.context.arc(
+ this.centerx,
+ this.centery,
+ this.radius - this.Get('chart.label.area'),
+ -1.57,
+ ( (this.Get('chart.green.max') / this.end) * 6.2830) - 1.57,
+ false
+ );
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.fill();
+
+
+ // Now draw the yellow area
+ var yellowgrad = this.canvas.getContext('2d').createRadialGradient(this.canvas.width / 2, this.canvas.height / 2, 0, this.canvas.width / 2, this.canvas.height / 2, this.canvas.width / 2, this.canvas.width / 2);
+ yellowgrad.addColorStop(0, 'white');
+ yellowgrad.addColorStop(1, this.Get('chart.yellow.color'));
+
+ // Draw the "tick highlight"
+ if (this.Get('chart.tickmarks.highlighted')) {
+ this.context.beginPath();
+ this.context.lineWidth = 5;
+ this.context.strokeStyle = yellowgrad;
+ this.context.arc(this.centerx, this.centery, this.radius - 2.5, (
+
+ (this.Get('chart.green.max') / this.end) * 6.2830) - 1.57,
+ ((this.Get('chart.red.min') / this.end) * 6.2830) - 1.57,
+ 0);
+
+ this.context.stroke();
+
+ this.context.lineWidth = 1;
+ }
+
+ this.context.beginPath();
+ this.context.fillStyle = yellowgrad;
+ this.context.arc(
+ this.centerx,
+ this.centery,
+ this.radius - this.Get('chart.label.area'),
+ ( (this.Get('chart.green.max') / this.end) * 6.2830) - 1.57,
+ ( (this.Get('chart.red.min') / this.end) * 6.2830) - 1.57,
+ false
+ );
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.fill();
+
+
+ // Now draw the red area if they're defined
+ var redgrad = this.canvas.getContext('2d').createRadialGradient(this.canvas.width / 2, this.canvas.height / 2, 0, this.canvas.width / 2, this.canvas.height / 2, this.canvas.width / 2, this.canvas.width / 2);
+ redgrad.addColorStop(0, 'white');
+ redgrad.addColorStop(1, this.Get('chart.red.color'));
+
+
+ // Draw the "tick highlight"
+ if (this.Get('chart.tickmarks.highlighted')) {
+ this.context.beginPath();
+ this.context.lineWidth = 5;
+ this.context.strokeStyle = redgrad;
+ this.context.arc(this.centerx, this.centery, this.radius - 2.5, ( (this.Get('chart.red.min') / this.end) * 6.2830) - 1.57,(2 * Math.PI) - (0.5 * Math.PI),0);
+ this.context.stroke();
+
+ this.context.lineWidth = 1;
+ }
+
+ this.context.beginPath();
+ this.context.fillStyle = redgrad;
+ this.context.strokeStyle = redgrad;
+ this.context.arc(
+ this.centerx,
+ this.centery,
+ this.radius - this.Get('chart.label.area'),
+ ( (this.Get('chart.red.min') / this.end) * 6.2830) - 1.57,
+ 6.2830 - (0.25 * 6.2830),
+ false
+ );
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.closePath();
+ this.context.fill();
+
+
+ /**
+ * Draw the thick border
+ */
+ if (this.Get('chart.border')) {
+ var grad = this.context.createRadialGradient(this.centerx, this.centery, this.radius, this.centerx, this.centery, this.radius + 15);
+ grad.addColorStop(1, '#BEBCB0');
+ grad.addColorStop(0.5, '#F0EFEA');
+ grad.addColorStop(0, '#BEBCB0');
+
+ this.context.beginPath();
+ this.context.fillStyle = grad;
+ this.context.strokeStyle = grad;
+ this.context.lineWidth = 22;
+ this.context.arc(this.centerx, this.centery, this.radius + 9, 0, 2 * Math.PI, 0);
+ this.context.stroke();
+ }
+
+ // Put the linewidth back to what it was
+ this.context.lineWidth = this.Get('chart.linewidth');
+
+
+ /**
+ * Draw the title if specified
+ */
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), null, this.Get('chart.text.size') + 2);
+ }
+
+
+ // Draw the big tick marks
+ for (var i=18; i<=360; i+=36) {
+ this.context.beginPath();
+ this.context.strokeStyle = '#999';
+ this.context.lineWidth = 2;
+ this.context.arc(this.centerx, this.centery, this.radius - 1, RGraph.degrees2Radians(i), RGraph.degrees2Radians(i+0.01), false);
+ this.context.arc(this.centerx, this.centery, this.radius - 7, RGraph.degrees2Radians(i), RGraph.degrees2Radians(i+0.01), false);
+ this.context.stroke();
+ }
+
+ }
+
+
+ /**
+ * Draws the needle of the odometer
+ */
+ RGraph.Odometer.prototype.DrawNeedle = function (value, color)
+ {
+ // ===== First draw a grey background circle =====
+
+ this.context.fillStyle = '#999';
+
+ this.context.beginPath();
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, 10, 0, 6.28, false);
+ this.context.fill();
+ this.context.closePath();
+
+ this.context.fill();
+
+ // ===============================================
+
+ this.context.fillStyle = color
+ this.context.strokeStyle = '#666';
+
+ // Draw the centre bit
+ this.context.beginPath();
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, 8, 0, 6.28, false);
+ this.context.fill();
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ if (this.Get('chart.needle.type') == 'pointer') {
+
+ this.context.strokeStyle = color;
+ this.context.lineWidth = this.Get('chart.needle.width');
+ this.context.lineCap = 'round';
+ this.context.lineJoin = 'round';
+
+ // Draw the needle
+ this.context.beginPath();
+ // The trailing bit on the opposite side of the dial
+ this.context.beginPath();
+ this.context.moveTo(this.centerx, this.centery);
+
+ if (this.Get('chart.needle.tail')) {
+ this.context.arc(this.centerx,
+ this.centery,
+ 20,
+ (((value / this.range) * 360) + 90) / 57.3,
+ (((value / this.range) * 360) + 90 + 0.01) / 57.3, // The 0.01 avoids a bug in ExCanvas and Chrome 6
+ false
+ );
+ }
+
+ // Draw the long bit on the opposite side
+ this.context.arc(this.centerx,
+ this.centery,
+ this.radius - this.Get('chart.label.area') - 10,
+ (((value / this.range) * 360) - 90) / 57.3,
+ (((value / this.range) * 360) - 90 + 0.1 ) / 57.3, // The 0.1 avoids a bug in ExCanvas and Chrome 6
+ false
+ );
+ this.context.closePath();
+
+ //this.context.stroke();
+ //this.context.fill();
+
+
+ } else if (this.Get('chart.needle.type') == 'triangle') {
+
+ this.context.lineWidth = 0.01;
+ this.context.lineEnd = 'square';
+ this.context.lineJoin = 'miter';
+
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+ this.context.fillStyle = color;
+ this.context.arc(this.centerx, this.centery, 7, (((value / this.range) * 360)) / 57.3, ((((value / this.range) * 360)) + 0.01) / 57.3, 0);
+ this.context.arc(this.centerx, this.centery, 7, (((value / this.range) * 360) + 180) / 57.3, ((((value / this.range) * 360) + 180) + 0.01)/ 57.3, 0);
+ this.context.arc(this.centerx, this.centery, this.radius - this.Get('chart.label.area') - 10, (((value / this.range) * 360) - 90) / 57.3, ((((value / this.range) * 360) - 90) / 57.3) + 0.01, 0);
+ this.context.closePath();
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * This is here to accomodate the MSIE/ExCanvas combo
+ */
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, 7, 0, 6.28, 0);
+ this.context.closePath();
+ this.context.fill();
+ }
+
+
+ this.context.stroke();
+ this.context.fill();
+
+ // Draw the mini center circle
+ this.context.beginPath();
+ this.context.fillStyle = color;
+ this.context.arc(this.centerx, this.centery, this.Get('chart.needle.type') == 'pointer' ? 7 : 12, 0.01, 6.2830, false);
+ this.context.fill();
+
+ // This draws the arrow at the end of the line
+ if (this.Get('chart.needle.head') && this.Get('chart.needle.type') == 'pointer') {
+ this.context.lineWidth = 1;
+ this.context.fillStyle = color;
+
+ // round, bevel, miter
+ this.context.lineJoin = 'miter';
+ this.context.lineCap = 'butt';
+
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, this.radius - this.Get('chart.label.area')-5, (((value / this.range) * 360) - 90) / 57.3, (((value / this.range) * 360) - 90 + 0.1) / 57.3, false);
+ this.context.arc(this.centerx, this.centery, this.radius - this.Get('chart.label.area') - 20, RGraph.degrees2Radians( ((value / this.range) * 360) - 85), RGraph.degrees2Radians( ((value / this.range) * 360) - 95), 1);
+ this.context.closePath();
+
+ this.context.fill();
+ //this.context.stroke();
+ }
+
+ /**
+ * Draw a white circle at the centre
+ */
+ this.context.beginPath();
+ this.context.fillStyle = 'gray';
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx,this.centery,2,0,6.2795,false);
+ this.context.closePath();
+
+ this.context.fill();
+ }
+
+ /**
+ * Draws the labels for the Odo
+ */
+ RGraph.Odometer.prototype.DrawLabels = function ()
+ {
+ var context = this.context;
+ var size = this.Get('chart.text.size');
+ var font = this.Get('chart.text.font');
+ var centerx = this.centerx;
+ var centery = this.centery;
+ var r = this.radius - (this.Get('chart.label.area') / 2);
+ var end = this.end;
+ var decimals = this.Get('chart.scale.decimals');
+ var labels = this.Get('chart.labels');
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+
+ context.beginPath();
+ context.fillStyle = this.Get('chart.text.color');
+
+ /**
+ * If label are specified, use those
+ */
+ if (labels) {
+ for (var i=0; i<labels.length; ++i) {
+
+ RGraph.Text(context,
+ font,
+ size,
+ centerx + (Math.cos(((i / labels.length) * 6.28) - 1.57) * (this.radius - (this.Get('chart.label.area') / 2) ) ), // Sin A = Opp / Hyp
+ centery + (Math.sin(((i / labels.length) * 6.28) - 1.57) * (this.radius - (this.Get('chart.label.area') / 2) ) ), // Cos A = Adj / Hyp
+ String(units_pre + labels[i] + units_post),
+ 'center',
+ 'center');
+ }
+
+ /**
+ * If not, use the maximum value
+ */
+ } else {
+ RGraph.Text(context, font, size, centerx + (0.588 * r ), centery - (0.809 * r ), String(units_pre + (end * (1/10)).toFixed(decimals) + units_post), 'center', 'center', false, 36);
+ RGraph.Text(context, font, size, centerx + (0.951 * r ), centery - (0.309 * r), String(units_pre + (end * (2/10)).toFixed(decimals) + units_post), 'center', 'center', false, 72);
+ RGraph.Text(context, font, size, centerx + (0.949 * r), centery + (0.287 * r), String(units_pre + (end * (3/10)).toFixed(decimals) + units_post), 'center', 'center', false, 108);
+ RGraph.Text(context, font, size, centerx + (0.588 * r ), centery + (0.809 * r ), String(units_pre + (end * (4/10)).toFixed(decimals) + units_post), 'center', 'center', false, 144);
+ RGraph.Text(context, font, size, centerx, centery + r, String(units_pre + (end * (5/10)).toFixed(decimals) + units_post), 'center', 'center', false, 180);
+ RGraph.Text(context, font, size, centerx - (0.588 * r ), centery + (0.809 * r ), String(units_pre + (end * (6/10)).toFixed(decimals) + units_post), 'center', 'center', false, 216);
+ RGraph.Text(context, font, size, centerx - (0.949 * r), centery + (0.300 * r), a = String(units_pre + (end * (7/10)).toFixed(decimals) + units_post), 'center', 'center', false, 252);
+ RGraph.Text(context, font, size, centerx - (0.951 * r), centery - (0.309 * r), String(units_pre + (end * (8/10)).toFixed(decimals) + units_post), 'center', 'center', false, 288);
+ RGraph.Text(context, font, size, centerx - (0.588 * r ), centery - (0.809 * r ), String(units_pre + (end * (9/10)).toFixed(decimals) + units_post), 'center', 'center', false, 324);
+ RGraph.Text(context, font, size, centerx, centery - r, this.Get('chart.zerostart') ? units_pre + '0' : String(units_pre + (end * (10/10)).toFixed(decimals) + units_post), 'center', 'center', false, 360);
+ }
+
+ this.context.fill();
+
+ /**
+ * Draw the text label below the center point
+ */
+ if (this.Get('chart.value.text')) {
+ context.strokeStyle = 'black';
+ RGraph.Text(context, font, size + 2, centerx, centery + size + 2 + 10, String(this.Get('chart.value.units.pre') + this.value + this.Get('chart.value.units.post')), 'center', 'center', true, null, 'white');
+ }
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The pie chart constructor
+ *
+ * @param data array The data to be represented on the pie chart
+ */
+ RGraph.Pie = function (id, data)
+ {
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext("2d");
+ this.canvas.__object__ = this;
+ this.total = 0;
+ this.subTotal = 0;
+ this.angles = [];
+ this.data = data;
+ this.properties = [];
+ this.type = 'pie';
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+ this.properties = {
+ 'chart.colors': ['rgb(255,0,0)', '#ddd', 'rgb(0,255,0)', 'rgb(0,0,255)', 'pink', 'yellow', 'red', 'rgb(0,255,255)', 'black', 'white'],
+ 'chart.strokestyle': '#999',
+ 'chart.linewidth': 1,
+ 'chart.labels': [],
+ 'chart.labels.sticks': false,
+ 'chart.labels.sticks.color': '#aaa',
+ 'chart.segments': [],
+ 'chart.gutter': 25,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.shadow': false,
+ 'chart.shadow.color': 'rgba(0,0,0,0.5)',
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.shadow.blur': 3,
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.contextmenu': null,
+ 'chart.tooltips': [],
+ 'chart.tooltips.event': 'onclick',
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.radius': null,
+ 'chart.highlight.style': '3d',
+ 'chart.highlight.style.2d.color': 'rgba(255,255,255,0.5)',
+ 'chart.border': false,
+ 'chart.border.color': 'rgba(255,255,255,0.5)',
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.align': 'center',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.variant': 'pie'
+ }
+
+ /**
+ * Calculate the total
+ */
+ for (var i=0,len=data.length; i<len; i++) {
+ this.total += data[i];
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[PIE] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A generic setter
+ */
+ RGraph.Pie.prototype.Set = function (name, value)
+ {
+ this.properties[name] = value;
+ }
+
+
+ /**
+ * A generic getter
+ */
+ RGraph.Pie.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+ /**
+ * This draws the pie chart
+ */
+ RGraph.Pie.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+
+ this.diameter = Math.min(this.canvas.height, this.canvas.width) - (2 * this.Get('chart.gutter'));
+ this.radius = this.Get('chart.radius') ? this.Get('chart.radius') : this.diameter / 2;
+ // this.centerx now defined below
+ this.centery = this.canvas.height / 2;
+ this.subTotal = 0;
+ this.angles = [];
+
+ /**
+ * Alignment (Pie is center aligned by default) Only if centerx is not defined - donut defines the centerx
+ */
+ if (this.Get('chart.align') == 'left') {
+ this.centerx = this.radius + this.Get('chart.gutter');
+
+ } else if (this.Get('chart.align') == 'right') {
+ this.centerx = this.canvas.width - (this.radius + this.Get('chart.gutter'));
+
+ } else {
+ this.centerx = this.canvas.width / 2;
+ }
+
+ /**
+ * Draw the shadow if required
+ */
+ if (this.Get('chart.shadow')) {
+
+ var offsetx = document.all ? this.Get('chart.shadow.offsetx') : 0;
+ var offsety = document.all ? this.Get('chart.shadow.offsety') : 0;
+
+ this.context.beginPath();
+ this.context.fillStyle = this.Get('chart.shadow.color');
+
+ this.context.shadowColor = this.Get('chart.shadow.color');
+ this.context.shadowBlur = this.Get('chart.shadow.blur');
+ this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.shadow.offsety');
+
+ this.context.arc(this.centerx + offsetx, this.centery + offsety, this.radius, 0, 6.28, 0);
+
+ this.context.fill();
+
+ // Now turn off the shadow
+ RGraph.NoShadow(this);
+ }
+
+ /**
+ * The total of the array of values
+ */
+ this.total = RGraph.array_sum(this.data);
+
+ for (var i=0,len=this.data.length; i<len; i++) {
+ var angle = (this.data[i] / this.total) * 360;
+
+ this.DrawSegment(angle,
+ this.Get('chart.colors')[i],
+ i == (this.data.length - 1));
+ }
+
+ /**
+ * Redraw the seperating lines
+ */
+ if (this.Get('chart.linewidth') > 0) {
+ this.context.beginPath();
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+
+ for (var i=0,len=this.angles.length; i<len; ++i) {
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, this.radius, this.angles[i][0] / 57.3, (this.angles[i][0] + 0.01) / 57.3, 0);
+ }
+
+ this.context.stroke();
+
+ /**
+ * And finally redraw the border
+ */
+ this.context.beginPath();
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery, this.radius, 0, 6.28, 0);
+ this.context.stroke();
+ }
+
+ /**
+ * Draw label sticks
+ */
+ if (this.Get('chart.labels.sticks')) {
+ this.DrawSticks();
+
+ // Redraw the border going around the Pie chart if the stroke style is NOT white
+ if (
+ this.Get('chart.strokestyle') != 'white'
+ && this.Get('chart.strokestyle') != '#fff'
+ && this.Get('chart.strokestyle') != '#fffffff'
+ && this.Get('chart.strokestyle') != 'rgb(255,255,255)'
+ && this.Get('chart.strokestyle') != 'rgba(255,255,255,0)'
+ ) {
+
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.arc(this.centerx, this.centery, this.radius, 0, 6.28, false);
+ this.context.stroke();
+ }
+ }
+
+ /**
+ * Draw the labels
+ */
+ this.DrawLabels();
+
+ /**
+ * Draw the title
+ */
+ if (this.Get('chart.align') == 'left') {
+ var centerx = this.radius + this.Get('chart.gutter');
+
+ } else if (this.Get('chart.align') == 'right') {
+ var centerx = this.canvas.width - (this.radius + this.Get('chart.gutter'));
+
+ } else {
+ var centerx = null;
+ }
+
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), centerx, this.Get('chart.text.size') + 2);
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Tooltips
+ */
+ if (this.Get('chart.tooltips').length) {
+
+ /**
+ * Register this object for redrawing
+ */
+ RGraph.Register(this);
+
+ /**
+ * The onclick event
+ */
+ //this.canvas.onclick = function (e)
+ var canvas_onclick_func = function (e)
+ {
+ RGraph.HideZoomedCanvas();
+
+ e = RGraph.FixEventObject(e);
+
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+ var obj = e.target.__object__;
+
+ var x = mouseCoords[0] - obj.centerx;
+ var y = mouseCoords[1] - obj.centery;
+ var theta = Math.atan(y / x); // RADIANS
+ var hyp = y / Math.sin(theta);
+
+
+
+ /**
+ * If it's actually a donut make sure the hyp is bigger
+ * than the size of the hole in the middle
+ */
+ if (obj.Get('chart.variant') == 'donut' && Math.abs(hyp) < (obj.radius / 2)) {
+ return;
+ }
+
+ /**
+ * The angles for each segment are stored in "angles",
+ * so go through that checking if the mouse position corresponds
+ */
+ var isDonut = obj.Get('chart.variant') == 'donut';
+ var hStyle = obj.Get('chart.highlight.style');
+ var segment = RGraph.getSegment(e);
+
+ if (segment) {
+
+
+ if (RGraph.Registry.Get('chart.tooltip') && segment[5] == RGraph.Registry.Get('chart.tooltip').__index__) {
+ return;
+ } else {
+ RGraph.Redraw();
+ }
+
+ if (isDonut || hStyle == '2d') {
+
+ context.beginPath();
+
+ context.fillStyle = obj.Get('chart.highlight.style.2d.color');
+
+ context.moveTo(obj.centerx, obj.centery);
+ context.arc(obj.centerx, obj.centery, obj.radius, RGraph.degrees2Radians(obj.angles[segment[5]][0]), RGraph.degrees2Radians(obj.angles[segment[5]][1]), 0);
+ context.lineTo(obj.centerx, obj.centery);
+ context.closePath();
+
+ context.fill();
+
+ //Removed 7th December 2010
+ //context.stroke();
+
+ } else {
+
+ context.lineWidth = 2;
+
+ /**
+ * Draw a white segment where the one that has been clicked on was
+ */
+ context.fillStyle = 'white';
+ context.strokeStyle = 'white';
+ context.beginPath();
+ context.moveTo(obj.centerx, obj.centery);
+ context.arc(obj.centerx, obj.centery, obj.radius, obj.angles[segment[5]][0] / 57.3, obj.angles[segment[5]][1] / 57.3, 0);
+ context.stroke();
+ context.fill();
+
+ context.lineWidth = 1;
+
+ context.shadowColor = '#666';
+ context.shadowBlur = 3;
+ context.shadowOffsetX = 3;
+ context.shadowOffsetY = 3;
+
+ // Draw the new segment
+ context.beginPath();
+ context.fillStyle = obj.Get('chart.colors')[segment[5]];
+ context.strokeStyle = 'rgba(0,0,0,0)';
+ context.moveTo(obj.centerx - 3, obj.centery - 3);
+ context.arc(obj.centerx - 3, obj.centery - 3, obj.radius, RGraph.degrees2Radians(obj.angles[segment[5]][0]), RGraph.degrees2Radians(obj.angles[segment[5]][1]), 0);
+ context.lineTo(obj.centerx - 3, obj.centery - 3);
+ context.closePath();
+
+ context.stroke();
+ context.fill();
+
+ // Turn off the shadow
+ RGraph.NoShadow(obj);
+
+ /**
+ * If a border is defined, redraw that
+ */
+ if (obj.Get('chart.border')) {
+ context.beginPath();
+ context.strokeStyle = obj.Get('chart.border.color');
+ context.lineWidth = 5;
+ context.arc(obj.centerx - 3, obj.centery - 3, obj.radius - 2, RGraph.degrees2Radians(obj.angles[i][0]), RGraph.degrees2Radians(obj.angles[i][1]), 0);
+ context.stroke();
+ }
+ }
+
+ /**
+ * If a tooltip is defined, show it
+ */
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = String(obj.Get('chart.tooltips')(segment[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[segment[5]]) == 'function') {
+ var text = String(obj.Get('chart.tooltips')[segment[5]](segment[5]));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = String(obj.Get('chart.tooltips')[segment[5]]);
+
+ } else {
+ var text = '';
+ }
+
+ if (text) {
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, segment[5]);
+ }
+
+ /**
+ * Need to redraw the key?
+ */
+ if (obj.Get('chart.key') && obj.Get('chart.key').length && obj.Get('chart.key.position') == 'graph') {
+ RGraph.DrawKey(obj, obj.Get('chart.key'), obj.Get('chart.colors'));
+ }
+
+ e.stopPropagation();
+
+ return;
+ }
+ }
+ var event_name = this.Get('chart.tooltips.event') == 'onmousemove' ? 'mousemove' : 'click';
+
+ this.canvas.addEventListener(event_name, canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, event_name, canvas_onclick_func);
+
+
+
+
+
+
+
+
+ /**
+ * The onmousemove event for changing the cursor
+ */
+ //this.canvas.onmousemove = function (e)
+ var canvas_onmousemove_func = function (e)
+ {
+ RGraph.HideZoomedCanvas();
+
+ e = RGraph.FixEventObject(e);
+
+ var segment = RGraph.getSegment(e);
+
+ if (segment) {
+ e.target.style.cursor = 'pointer';
+
+ return;
+ }
+
+ /**
+ * Put the cursor back to null
+ */
+ e.target.style.cursor = 'default';
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+
+ /**
+ * If a border is pecified, draw it
+ */
+ if (this.Get('chart.border')) {
+ this.context.beginPath();
+ this.context.lineWidth = 5;
+ this.context.strokeStyle = this.Get('chart.border.color');
+
+ this.context.arc(this.centerx,
+ this.centery,
+ this.radius - 2,
+ 0,
+ 6.28,
+ 0);
+
+ this.context.stroke();
+ }
+
+ /**
+ * Draw the kay if desired
+ */
+ if (this.Get('chart.key') != null) {
+ //this.Set('chart.key.position', 'graph');
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.colors'));
+ }
+
+
+ /**
+ * If this is actually a donut, draw a big circle in the middle
+ */
+ if (this.Get('chart.variant') == 'donut') {
+ this.context.beginPath();
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = 'white';//this.Get('chart.fillstyle');
+ this.context.arc(this.centerx, this.centery, this.radius / 2, 0, 6.28, 0);
+ this.context.stroke();
+ this.context.fill();
+ }
+
+ RGraph.NoShadow(this);
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws a single segment of the pie chart
+ *
+ * @param int degrees The number of degrees for this segment
+ */
+ RGraph.Pie.prototype.DrawSegment = function (degrees, color, last)
+ {
+ var context = this.context;
+ var canvas = this.canvas;
+ var subTotal = this.subTotal;
+
+ context.beginPath();
+
+ context.fillStyle = color;
+ context.strokeStyle = this.Get('chart.strokestyle');
+ context.lineWidth = 0;
+
+ context.arc(this.centerx,
+ this.centery,
+ this.radius,
+ subTotal / 57.3,
+ (last ? 360 : subTotal + degrees) / 57.3,
+ 0);
+
+ context.lineTo(this.centerx, this.centery);
+
+ // Keep hold of the angles
+ this.angles.push([subTotal, subTotal + degrees])
+ this.context.closePath();
+
+ this.context.fill();
+
+ /**
+ * Calculate the segment angle
+ */
+ this.Get('chart.segments').push([subTotal, subTotal + degrees]);
+ this.subTotal += degrees;
+ }
+
+ /**
+ * Draws the graphs labels
+ */
+ RGraph.Pie.prototype.DrawLabels = function ()
+ {
+ var hAlignment = 'left';
+ var vAlignment = 'center';
+ var labels = this.Get('chart.labels');
+ var context = this.context;
+
+ /**
+ * Turn the shadow off
+ */
+ RGraph.NoShadow(this);
+
+ context.fillStyle = 'black';
+ context.beginPath();
+
+ /**
+ * Draw the key (ie. the labels)
+ */
+ if (labels && labels.length) {
+
+ var text_size = this.Get('chart.text.size');
+
+ for (i=0; i<labels.length; ++i) {
+
+ /**
+ * T|his ensures that if we're given too many labels, that we don't get an error
+ */
+ if (typeof(this.Get('chart.segments')[i]) == 'undefined') {
+ continue;
+ }
+
+ // Move to the centre
+ context.moveTo(this.centerx,this.centery);
+
+ var a = this.Get('chart.segments')[i][0] + ((this.Get('chart.segments')[i][1] - this.Get('chart.segments')[i][0]) / 2);
+
+ /**
+ * Alignment
+ */
+ if (a < 90) {
+ hAlignment = 'left';
+ vAlignment = 'center';
+ } else if (a < 180) {
+ hAlignment = 'right';
+ vAlignment = 'center';
+ } else if (a < 270) {
+ hAlignment = 'right';
+ vAlignment = 'center';
+ } else if (a < 360) {
+ hAlignment = 'left';
+ vAlignment = 'center';
+ }
+
+ context.fillStyle = this.Get('chart.text.color');
+
+ RGraph.Text(context,
+ this.Get('chart.text.font'),
+ text_size,
+ this.centerx + ((this.radius + 10)* Math.cos(a / 57.3)) + (this.Get('chart.labels.sticks') ? (a < 90 || a > 270 ? 2 : -2) : 0),
+ this.centery + (((this.radius + 10) * Math.sin(a / 57.3))),
+ labels[i],
+ vAlignment,
+ hAlignment);
+ }
+
+ context.fill();
+ }
+ }
+
+
+ /**
+ * This function draws the pie chart sticks (for the labels)
+ */
+ RGraph.Pie.prototype.DrawSticks = function ()
+ {
+ var context = this.context;
+ var segments = this.Get('chart.segments');
+ var offset = this.Get('chart.linewidth') / 2;
+
+ for (var i=0; i<segments.length; ++i) {
+
+ var degrees = segments[i][1] - segments[i][0];
+
+ context.beginPath();
+ context.strokeStyle = this.Get('chart.labels.sticks.color');
+ context.lineWidth = 1;
+
+ var midpoint = (segments[i][0] + (degrees / 2)) / 57.3;
+
+ context.arc(this.centerx,
+ this.centery,
+ this.radius + 7,
+ midpoint,
+ midpoint + 0.01,
+ 0);
+
+
+ context.arc(this.centerx,
+ this.centery,
+ this.radius - offset,
+ midpoint,
+ midpoint + 0.01,
+ 0);
+
+ context.stroke();
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The rose chart constuctor
+ *
+ * @param object canvas
+ * @param array data
+ */
+ RGraph.Rose = function (id, data)
+ {
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.data = data;
+ this.canvas.__object__ = this;
+ this.type = 'rose';
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ this.centerx = 0;
+ this.centery = 0;
+ this.radius = 0;
+
+ this.max = 0;
+
+ this.properties = {
+ 'chart.colors': ['rgb(255,0,0)', 'rgb(0,255,255)', 'rgb(0,255,0)', 'rgb(127,127,127)', 'rgb(0,0,255)', 'rgb(255,128,255)'],
+ 'chart.colors.alpha': null,
+ 'chart.strokestyle': 'black',
+ 'chart.gutter': 25,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.labels': null,
+ 'chart.labels.position': 'center',
+ 'chart.labels.axes': 'nsew',
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.text.size': 10,
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.contextmenu': null,
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.adjustable': false,
+ 'chart.ymax': null,
+ 'chart.ymin': 0,
+ 'chart.scale.decimals': null
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[ROSE] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A simple setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the property
+ */
+ RGraph.Rose.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A simple getter
+ *
+ * @param string name The name of the property to get
+ */
+ RGraph.Rose.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * This method draws the rose chart
+ */
+ RGraph.Rose.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // Calculate the radius
+ this.radius = (Math.min(this.canvas.width, this.canvas.height) / 2);
+ this.centerx = this.canvas.width / 2;
+ this.centery = this.canvas.height / 2;
+ this.angles = [];
+ this.total = 0;
+ this.startRadians = 0;
+
+ /**
+ * Change the centerx marginally if the key is defined
+ */
+ if (this.Get('chart.key') && this.Get('chart.key').length > 0 && this.Get('chart.key').length >= 3) {
+ this.centerx = this.centerx - this.Get('chart.gutter') + 5;
+ }
+
+ this.DrawBackground();
+ this.DrawRose();
+ this.DrawLabels();
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Tooltips
+ */
+ if (this.Get('chart.tooltips')) {
+
+ /**
+ * Register this object for redrawing
+ */
+ RGraph.Register(this);
+
+ /**
+ * The onclick event
+ */
+ var canvas_onclick_func = function (e)
+ {
+ var obj = e.target.__object__;
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+
+ e = RGraph.FixEventObject(e);
+
+ RGraph.Redraw();
+
+ var segment = RGraph.getSegment(e);
+ if (segment && obj.Get('chart.tooltips')[segment[5]]) {
+ context.beginPath();
+ context.strokeStyle = 'black';
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.arc(segment[0], segment[1], segment[2], segment[3] / 57.3, segment[4] / 57.3, false);
+ context.lineTo(obj.centerx, obj.centery);
+ context.closePath();
+ context.fill();
+ context.stroke();
+
+ context.strokeStyle = 'rgba(0,0,0,0)';
+ obj.DrawLabels();
+
+ /**
+ * Show the tooltip
+ */
+ RGraph.Tooltip(canvas, obj.Get('chart.tooltips')[segment[5]], e.pageX, e.pageY, segment[5]);
+
+ e.stopPropagation();
+
+ return;
+ }
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+
+
+ /**
+ * The onmousemove event
+ */
+ var canvas_onmousemove_func = function (e)
+ {
+ var obj = e.target.__object__;
+ var canvas = e.target;
+ var context = canvas.getContext('2d');
+
+ e = RGraph.FixEventObject(e);
+
+ var segment = RGraph.getSegment(e);
+
+ if (segment && obj.Get('chart.tooltips')[segment[5]]) {
+ canvas.style.cursor = 'pointer';
+ return;
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+
+ /**
+ * This function enables adjusting
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+ /**
+ * This method draws the rose charts background
+ */
+ RGraph.Rose.prototype.DrawBackground = function ()
+ {
+ this.context.lineWidth = 1;
+
+ // Draw the background grey circles
+ this.context.strokeStyle = '#ccc';
+ for (var i=15; i<this.radius - this.Get('chart.gutter') - (document.all ? 5 : 0); i+=15) {// Radius must be greater than 0 for Opera to work
+ //this.context.moveTo(this.centerx + i, this.centery);
+
+ // Radius must be greater than 0 for Opera to work
+ this.context.arc(this.centerx, this.centery, i, 0, (2 * Math.PI), 0);
+ }
+ this.context.stroke();
+
+ // Draw the background lines that go from the center outwards
+ this.context.beginPath();
+ for (var i=15; i<360; i+=15) {
+
+ // Radius must be greater than 0 for Opera to work
+ this.context.arc(this.centerx, this.centery, this.radius - this.Get('chart.gutter'), i / 57.3, (i + 0.1) / 57.3, 0); // The 0.01 avoids a bug in Chrome 6
+
+ this.context.lineTo(this.centerx, this.centery);
+ }
+ this.context.stroke();
+
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+
+ // Draw the X axis
+ this.context.moveTo(this.centerx - this.radius + this.Get('chart.gutter'), this.centery);
+ this.context.lineTo(this.centerx + this.radius - this.Get('chart.gutter'), this.centery);
+
+ // Draw the X ends
+ this.context.moveTo(this.centerx - this.radius + this.Get('chart.gutter'), this.centery - 5);
+ this.context.lineTo(this.centerx - this.radius + this.Get('chart.gutter'), this.centery + 5);
+ this.context.moveTo(this.centerx + this.radius - this.Get('chart.gutter'), this.centery - 5);
+ this.context.lineTo(this.centerx + this.radius - this.Get('chart.gutter'), this.centery + 5);
+
+ // Draw the X check marks
+ for (var i=(this.centerx - this.radius + this.Get('chart.gutter')); i<(this.centerx + this.radius - this.Get('chart.gutter')); i+=20) {
+ this.context.moveTo(i, this.centery - 3);
+ this.context.lineTo(i, this.centery + 3);
+ }
+
+ // Draw the Y check marks
+ for (var i=(this.centery - this.radius + this.Get('chart.gutter')); i<(this.centery + this.radius - this.Get('chart.gutter')); i+=20) {
+ this.context.moveTo(this.centerx - 3, i);
+ this.context.lineTo(this.centerx + 3, i);
+ }
+
+ // Draw the Y axis
+ this.context.moveTo(this.centerx, this.centery - this.radius + this.Get('chart.gutter'));
+ this.context.lineTo(this.centerx, this.centery + this.radius - this.Get('chart.gutter'));
+
+ // Draw the Y ends
+ this.context.moveTo(this.centerx - 5, this.centery - this.radius + this.Get('chart.gutter'));
+ this.context.lineTo(this.centerx + 5, this.centery - this.radius + this.Get('chart.gutter'));
+
+ this.context.moveTo(this.centerx - 5, this.centery + this.radius - this.Get('chart.gutter'));
+ this.context.lineTo(this.centerx + 5, this.centery + this.radius - this.Get('chart.gutter'));
+
+ // Stroke it
+ this.context.closePath();
+ this.context.stroke();
+ }
+
+
+ /**
+ * This method draws a set of data on the graph
+ */
+ RGraph.Rose.prototype.DrawRose = function ()
+ {
+ var data = this.data;
+
+ // Must be at least two data points
+ if (data.length < 2) {
+ alert('[ROSE] Must be at least two data points! [' + data + ']');
+ return;
+ }
+
+ // Work out the maximum value and the sum
+ if (!this.Get('chart.ymax')) {
+ this.scale = RGraph.getScale(RGraph.array_max(data), this);
+ this.max = this.scale[4];
+ } else {
+ var ymax = this.Get('chart.ymax');
+ var ymin = this.Get('chart.ymin');
+
+ this.scale = [
+ ((ymax - ymin) * 0.2) + ymin,
+ ((ymax - ymin) * 0.4) + ymin,
+ ((ymax - ymin) * 0.6) + ymin,
+ ((ymax - ymin) * 0.8) + ymin,
+ ((ymax - ymin) * 1 + ymin)
+ ];
+ this.max = this.scale[4];
+ }
+
+ this.sum = RGraph.array_sum(data);
+
+ // Move to the centre
+ this.context.moveTo(this.centerx, this.centery);
+
+ this.context.stroke(); // Stroke the background so it stays grey
+
+ // Transparency
+ if (this.Get('chart.colors.alpha')) {
+ this.context.globalAlpha = this.Get('chart.colors.alpha');
+ }
+
+ // Draw the Rose segments
+ for (var i=0; i<this.data.length; ++i) {
+
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+
+ if (this.Get('chart.colors')[i]) {
+ this.context.fillStyle = this.Get('chart.colors')[i];
+ }
+
+ var segmentRadians = (1 / this.data.length) * (2 * Math.PI);
+
+ this.context.beginPath(); // Begin the segment
+
+ var radius = ((this.data[i] - this.Get('chart.ymin')) / (this.max - this.Get('chart.ymin'))) * (this.radius - this.Get('chart.gutter') - 10);
+
+ this.context.arc(this.centerx, this.centery, radius, this.startRadians - (Math.PI / 2), this.startRadians + segmentRadians - (Math.PI / 2), 0);
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.fill();
+ this.context.closePath(); // End the segment
+
+ // Store the start and end angles
+ this.angles.push([
+ ((this.startRadians - (Math.PI / 2)) * 57.3) + 90,
+ (((this.startRadians + segmentRadians) - (Math.PI / 2)) * 57.3) + 90,
+ radius
+ ]);
+
+ this.startRadians += segmentRadians;
+ this.context.stroke();
+ }
+
+ // Turn off the transparency
+ if (this.Get('chart.colors.alpha')) {
+ this.context.globalAlpha = 1;
+ }
+
+ // Draw the title if any has been set
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), this.centerx, this.Get('chart.text.size') + 2);
+ }
+ }
+
+
+ /**
+ * Unsuprisingly, draws the labels
+ */
+ RGraph.Rose.prototype.DrawLabels = function ()
+ {
+ this.context.lineWidth = 1;
+ var key = this.Get('chart.key');
+
+ if (key && key.length) {
+ RGraph.DrawKey(this, key, this.Get('chart.colors'));
+ }
+
+ // Set the color to black
+ this.context.fillStyle = 'black';
+ this.context.strokeStyle = 'black';
+
+ var r = this.radius - 10;
+ var font_face = this.Get('chart.text.font');
+ var font_size = this.Get('chart.text.size');
+ var context = this.context;
+ var axes = this.Get('chart.labels.axes').toLowerCase();
+
+ // Draw any labels
+
+ if (typeof(this.Get('chart.labels')) == 'object' && this.Get('chart.labels')) {
+ this.DrawCircularLabels(context, this.Get('chart.labels'), font_face, font_size, r + 10);
+ }
+
+
+ var color = 'rgba(255,255,255,0.8)';
+
+ // The "North" axis labels
+ if (axes.indexOf('n') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r - this.Get('chart.gutter')) * 0.2), String(Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r - this.Get('chart.gutter')) * 0.4), String(Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r - this.Get('chart.gutter')) * 0.6), String(Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r - this.Get('chart.gutter')) * 0.8), String(Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - r + this.Get('chart.gutter'), String(Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ }
+
+ // The "South" axis labels
+ if (axes.indexOf('s') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r - this.Get('chart.gutter')) * 0.2), String(Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r - this.Get('chart.gutter')) * 0.4), String(Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r - this.Get('chart.gutter')) * 0.6), String(Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r - this.Get('chart.gutter')) * 0.8), String(Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + r - this.Get('chart.gutter'), String(Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ }
+
+ // The "East" axis labels
+ if (axes.indexOf('e') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r - this.Get('chart.gutter')) * 0.2), this.centery, String(Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r - this.Get('chart.gutter')) * 0.4), this.centery, String(Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r - this.Get('chart.gutter')) * 0.6), this.centery, String(Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r - this.Get('chart.gutter')) * 0.8), this.centery, String(Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + r - this.Get('chart.gutter'), this.centery, String(Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ }
+
+ // The "West" axis labels
+ if (axes.indexOf('w') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r - this.Get('chart.gutter')) * 0.2), this.centery, String(Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r - this.Get('chart.gutter')) * 0.4), this.centery, String(Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r - this.Get('chart.gutter')) * 0.6), this.centery, String(Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r - this.Get('chart.gutter')) * 0.8), this.centery, String(Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - r + this.Get('chart.gutter'), this.centery, String(Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'))), 'center', 'center', true, false, color);
+ }
+
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery, typeof(this.Get('chart.ymin')) == 'number' ? String(Number(this.Get('chart.ymin')).toFixed(this.Get('chart.scale.decimals'))) : '0', 'center', 'center', true, false, color);
+ }
+
+
+ /**
+ * Draws the circular labels that go around the charts
+ *
+ * @param labels array The labels that go around the chart
+ */
+ RGraph.Rose.prototype.DrawCircularLabels = function (context, labels, font_face, font_size, r)
+ {
+ var position = this.Get('chart.labels.position');
+ var r = r - this.Get('chart.gutter') + 10;
+
+ for (var i=0; i<labels.length; ++i) {
+
+
+ var a = (360 / labels.length) * (i + 1) - (360 / (labels.length * 2));
+ var a = a - 90 + (this.Get('chart.labels.position') == 'edge' ? ((360 / labels.length) / 2) : 0);
+
+ var x = Math.cos(a / 57.29577866666) * (r + 10);
+ var y = Math.sin(a / 57.29577866666) * (r + 10);
+
+ RGraph.Text(context, font_face, font_size, this.centerx + x, this.centery + y, String(labels[i]), 'center', 'center');
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The chart constuctor
+ *
+ * @param object canvas
+ * @param array data
+ */
+ RGraph.Rscatter = function (id, data)
+ {
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.data = data;
+ this.canvas.__object__ = this;
+ this.type = 'rscatter';
+ this.hasTooltips = false;
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ this.centerx = 0;
+ this.centery = 0;
+ this.radius = 0;
+ this.max = 0;
+
+ this.properties = {
+ 'chart.colors': [], // This is used internally for the key
+ 'chart.colors.default': 'black',
+ 'chart.gutter': 25,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.labels': null,
+ 'chart.labels.position': 'center',
+ 'chart.labels.axes': 'nsew',
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.text.size': 10,
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.contextmenu': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.tooltips.hotspot': 3,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.resizable': false,
+ 'chart.adjustable': false,
+ 'chart.ymax': null,
+ 'chart.ymin': 0,
+ 'chart.tickmarks': 'cross',
+ 'chart.ticksize': 3,
+ 'chart.scale.decimals': null,
+ 'chart.scale.round': false
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[RSCATTER] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A simple setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the property
+ */
+ RGraph.Rscatter.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A simple getter
+ *
+ * @param string name The name of the property to get
+ */
+ RGraph.Rscatter.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * This method draws the rose chart
+ */
+ RGraph.Rscatter.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // Calculate the radius
+ this.radius = (Math.min(this.canvas.width, this.canvas.height) / 2) - this.Get('chart.gutter');
+ this.centerx = this.canvas.width / 2;
+ this.centery = this.canvas.height / 2;
+ this.coords = [];
+
+ /**
+ * Work out the scale
+ */
+ var max = this.Get('chart.ymax');
+ var min = this.Get('chart.ymin');
+
+ if (typeof(max) == 'number') {
+ this.max = max;
+ this.scale = [((max - min) * 0.2) + min,((max - min) * 0.4) + min,((max - min) * 0.6) + min,((max - min) * 0.8) + min,((max - min) * 1.0) + min,];
+
+ } else {
+ for (var i=0; i<this.data.length; ++i) {
+ this.max = Math.max(this.max, this.data[i][1]);
+ }
+ this.scale = RGraph.getScale(this.max, this);
+ this.max = this.scale[4];
+
+ // Hmmmmmmmm
+ if (String(this.scale[0]).indexOf('e') == -1) {
+ this.scale[0] = Number(this.scale[0]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[1] = Number(this.scale[1]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[2] = Number(this.scale[2]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[3] = Number(this.scale[3]).toFixed(this.Get('chart.scale.decimals'));
+ this.scale[4] = Number(this.scale[4]).toFixed(this.Get('chart.scale.decimals'));
+ }
+ }
+
+ /**
+ * Change the centerx marginally if the key is defined
+ */
+ if (this.Get('chart.key') && this.Get('chart.key').length > 0 && this.Get('chart.key').length >= 3) {
+ this.centerx = this.centerx - this.Get('chart.gutter') + 5;
+ }
+
+ /**
+ * Populate the colors array for the purposes of generating the key
+ */
+ if (typeof(this.Get('chart.key')) == 'object' && RGraph.is_array(this.Get('chart.key')) && this.Get('chart.key')[0]) {
+ for (var i=0; i<this.data.length; ++i) {
+ if (this.data[i][2] && typeof(this.data[i][2]) == 'string') {
+ this.Get('chart.colors').push(this.data[i][2]);
+ }
+ }
+ }
+
+ this.DrawBackground();
+ this.DrawRscatter();
+ this.DrawLabels();
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Tooltips
+ */
+ if (this.hasTooltips) {
+
+ /**
+ * Register this object for redrawing
+ */
+ RGraph.Register(this);
+
+ /**
+ * The onmousemove event
+ */
+ var canvas_onmousemove_func = function (event)
+ {
+ event = RGraph.FixEventObject(event);
+
+ var mouseCoords = RGraph.getMouseXY(event);
+ var mouseX = mouseCoords[0];
+ var mouseY = mouseCoords[1];
+ var obj = event.target.__object__;
+ var canvas = obj.canvas;
+ var context = obj.context;
+ var overHotspot = false;
+ var offset = obj.Get('chart.tooltips.hotspot'); // This is how far the hotspot extends
+
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ var xCoord = obj.coords[i][0];
+ var yCoord = obj.coords[i][1];
+ var tooltip = obj.coords[i][3];
+
+ if (
+ mouseX < (xCoord + offset) &&
+ mouseX > (xCoord - offset) &&
+ mouseY < (yCoord + offset) &&
+ mouseY > (yCoord - offset) &&
+ typeof(tooltip) == 'string' &&
+ tooltip.length > 0
+ ) {
+
+ overHotspot = true;
+ canvas.style.cursor = 'pointer';
+
+ if (!RGraph.Registry.Get('chart.tooltip') || RGraph.Registry.Get('chart.tooltip').__text__ != tooltip) {
+
+ if (obj.Get('chart.tooltips.highlight')) {
+ RGraph.Redraw();
+ }
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(tooltip) == 'function') {
+ var text = String(tooltip(i));
+
+ } else {
+ var text = String(tooltip);
+ }
+
+ RGraph.Tooltip(canvas, text, event.pageX + 5, event.pageY - 5, i);
+
+ /**
+ * Highlight the tickmark
+ */
+ if (obj.Get('chart.tooltips.highlight')) {
+ context.beginPath();
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.arc(xCoord, yCoord, 3, 0, 6.2830, 0);
+ context.fill();
+ }
+ }
+ }
+ }
+
+ if (!overHotspot) {
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+ // Draw the title if any has been set
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), this.centerx, this.Get('chart.text.size') + 2);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+ /**
+ * This method draws the rose charts background
+ */
+ RGraph.Rscatter.prototype.DrawBackground = function ()
+ {
+ this.context.lineWidth = 1;
+
+ // Draw the background grey circles
+ this.context.strokeStyle = '#ccc';
+ for (var i=15; i<this.radius - (document.all ? 5 : 0); i+=15) {// Radius must be greater than 0 for Opera to work
+ //this.context.moveTo(this.centerx + i, this.centery);
+
+ // Radius must be greater than 0 for Opera to work
+ this.context.arc(this.centerx, this.centery, i, 0, (2 * Math.PI), 0);
+ }
+ this.context.stroke();
+
+ // Draw the background lines that go from the center outwards
+ this.context.beginPath();
+ for (var i=15; i<360; i+=15) {
+
+ // Radius must be greater than 0 for Opera to work
+ this.context.arc(this.centerx, this.centery, this.radius, i / 57.3, (i + 0.01) / 57.3, 0);
+
+ this.context.lineTo(this.centerx, this.centery);
+ }
+ this.context.stroke();
+
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+
+ // Draw the X axis
+ this.context.moveTo(this.centerx - this.radius, this.centery);
+ this.context.lineTo(this.centerx + this.radius, this.centery);
+
+ // Draw the X ends
+ this.context.moveTo(this.centerx - this.radius, this.centery - 5);
+ this.context.lineTo(this.centerx - this.radius, this.centery + 5);
+ this.context.moveTo(this.centerx + this.radius, this.centery - 5);
+ this.context.lineTo(this.centerx + this.radius, this.centery + 5);
+
+ // Draw the X check marks
+ for (var i=(this.centerx - this.radius); i<(this.centerx + this.radius); i+=20) {
+ this.context.moveTo(i, this.centery - 3);
+ this.context.lineTo(i, this.centery + 3);
+ }
+
+ // Draw the Y check marks
+ for (var i=(this.centery - this.radius); i<(this.centery + this.radius); i+=20) {
+ this.context.moveTo(this.centerx - 3, i);
+ this.context.lineTo(this.centerx + 3, i);
+ }
+
+ // Draw the Y axis
+ this.context.moveTo(this.centerx, this.centery - this.radius);
+ this.context.lineTo(this.centerx, this.centery + this.radius);
+
+ // Draw the Y ends
+ this.context.moveTo(this.centerx - 5, this.centery - this.radius);
+ this.context.lineTo(this.centerx + 5, this.centery - this.radius);
+
+ this.context.moveTo(this.centerx - 5, this.centery + this.radius);
+ this.context.lineTo(this.centerx + 5, this.centery + this.radius);
+
+ // Stroke it
+ this.context.closePath();
+ this.context.stroke();
+ }
+
+
+ /**
+ * This method draws a set of data on the graph
+ */
+ RGraph.Rscatter.prototype.DrawRscatter = function ()
+ {
+ var data = this.data;
+
+ for (var i=0; i<data.length; ++i) {
+
+ var d1 = data[i][0];
+ var d2 = data[i][1];
+ var a = d1 / (180 / Math.PI); // RADIANS
+ var r = ( (d2 - this.Get('chart.ymin')) / (this.max - this.Get('chart.ymin')) ) * this.radius;
+ var x = Math.sin(a) * r;
+ var y = Math.cos(a) * r;
+ var color = data[i][2] ? data[i][2] : this.Get('chart.colors.default');
+ var tooltip = data[i][3] ? data[i][3] : null;
+
+ if (tooltip && tooltip.length) {
+ this.hasTooltips = true;
+ }
+
+ /**
+ * Account for the correct quadrant
+ */
+ x = x + this.centerx;
+ y = this.centery - y;
+
+
+ this.DrawTick(x, y, color);
+
+ // Populate the coords array with the coordinates and the tooltip
+ this.coords.push([x, y, color, tooltip]);
+ }
+ }
+
+
+ /**
+ * Unsuprisingly, draws the labels
+ */
+ RGraph.Rscatter.prototype.DrawLabels = function ()
+ {
+ this.context.lineWidth = 1;
+ var key = this.Get('chart.key');
+
+ // Set the color to black
+ this.context.fillStyle = 'black';
+ this.context.strokeStyle = 'black';
+
+ var r = this.radius;
+ var color = this.Get('chart.text.color');
+ var font_face = this.Get('chart.text.font');
+ var font_size = this.Get('chart.text.size');
+ var context = this.context;
+ var axes = this.Get('chart.labels.axes').toLowerCase();
+
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ // Draw any labels
+ if (typeof(this.Get('chart.labels')) == 'object' && this.Get('chart.labels')) {
+ this.DrawCircularLabels(context, this.Get('chart.labels'), font_face, font_size, r);
+ }
+
+
+ var color = 'rgba(255,255,255,0.8)';
+
+ // The "North" axis labels
+ if (axes.indexOf('n') > -1) {
+ RGraph.Text(context,font_face,font_size,this.centerx,this.centery - ((r) * 0.2),String(this.scale[0]),'center','center',true,false,color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r) * 0.4), String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r) * 0.6), String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - ((r) * 0.8), String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - r, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "South" axis labels
+ if (axes.indexOf('s') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r) * 0.2), String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r) * 0.4), String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r) * 0.6), String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + ((r) * 0.8), String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + r, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "East" axis labels
+ if (axes.indexOf('e') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r) * 0.2), this.centery, String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r) * 0.4), this.centery, String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r) * 0.6), this.centery, String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + ((r) * 0.8), this.centery, String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + r, this.centery, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "West" axis labels
+ if (axes.indexOf('w') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r) * 0.2), this.centery, String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r) * 0.4), this.centery, String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r) * 0.6), this.centery, String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - ((r) * 0.8), this.centery, String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - r, this.centery, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // Draw the center minimum value (but only if there's at least one axes labels stipulated)
+ if (this.Get('chart.labels.axes').length > 0) {
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery, this.Get('chart.ymin') > 0 ? String(this.Get('chart.ymin').toFixed(this.Get('chart.scale.decimals'))) : '0', 'center', 'center', true, false, color);
+ }
+
+ /**
+ * Draw the key
+ */
+ if (key && key.length) {
+ RGraph.DrawKey(this, key, this.Get('chart.colors'));
+ }
+ }
+
+
+ /**
+ * Draws the circular labels that go around the charts
+ *
+ * @param labels array The labels that go around the chart
+ */
+ RGraph.Rscatter.prototype.DrawCircularLabels = function (context, labels, font_face, font_size, r)
+ {
+ var position = this.Get('chart.labels.position');
+ var r = r + 10;
+
+ for (var i=0; i<labels.length; ++i) {
+
+
+ var a = (360 / labels.length) * (i + 1) - (360 / (labels.length * 2));
+ var a = a - 90 + (this.Get('chart.labels.position') == 'edge' ? ((360 / labels.length) / 2) : 0);
+
+ var x = Math.cos(a / 57.29577866666) * (r + 10);
+ var y = Math.sin(a / 57.29577866666) * (r + 10);
+
+ RGraph.Text(context, font_face, font_size, this.centerx + x, this.centery + y, String(labels[i]), 'center', 'center');
+ }
+ }
+
+
+ /**
+ * Draws a single tickmark
+ */
+ RGraph.Rscatter.prototype.DrawTick = function (x, y, color)
+ {
+ var tickmarks = this.Get('chart.tickmarks');
+ var ticksize = this.Get('chart.ticksize');
+
+ this.context.strokeStyle = color;
+ this.context.fillStyle = color;
+
+ // Cross
+ if (tickmarks == 'cross') {
+
+ this.context.beginPath();
+ this.context.moveTo(x + ticksize, y + ticksize);
+ this.context.lineTo(x - ticksize, y - ticksize);
+ this.context.stroke();
+
+ this.context.beginPath();
+ this.context.moveTo(x - ticksize, y + ticksize);
+ this.context.lineTo(x + ticksize, y - ticksize);
+ this.context.stroke();
+
+ // Circle
+ } else if (tickmarks == 'circle') {
+
+ this.context.beginPath();
+ this.context.arc(x, y, ticksize, 0, 6.2830, false);
+ this.context.fill();
+
+ // Square
+ } else if (tickmarks == 'square') {
+
+ this.context.beginPath();
+ this.context.fillRect(x - ticksize, y - ticksize, 2 * ticksize, 2 * ticksize);
+ this.context.fill();
+
+ // Diamond shape tickmarks
+ } else if (tickmarks == 'diamond') {
+
+ this.context.beginPath();
+ this.context.moveTo(x, y - ticksize);
+ this.context.lineTo(x + ticksize, y);
+ this.context.lineTo(x, y + ticksize);
+ this.context.lineTo(x - ticksize, y);
+ this.context.closePath();
+ this.context.fill();
+
+ // Plus style tickmarks
+ } else if (tickmarks == 'plus') {
+
+ this.context.lineWidth = 1;
+
+ this.context.beginPath();
+ this.context.moveTo(x, y - ticksize);
+ this.context.lineTo(x, y + ticksize);
+ this.context.moveTo(x - ticksize, y);
+ this.context.lineTo(x + ticksize, y);
+ this.context.stroke();
+ }
+ }
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The scatter graph constructor
+ *
+ * @param object canvas The cxanvas object
+ * @param array data The chart data
+ */
+ RGraph.Scatter = function (id, data)
+ {
+ // Get the canvas and context objects
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.canvas.__object__ = this;
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+ this.max = 0;
+ this.coords = [];
+ this.data = [];
+ this.type = 'scatter';
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ // Various config properties
+ this.properties = {
+ 'chart.background.barcolor1': 'white',
+ 'chart.background.barcolor2': 'white',
+ 'chart.background.grid': true,
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.hsize': 20,
+ 'chart.background.grid.vsize': 20,
+ 'chart.background.hbars': null,
+ 'chart.background.vbars': null,
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 7,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.text.size': 10,
+ 'chart.text.angle': 0,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.hotspot': 3,
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.tooltips.coords.adjust': [0,0],
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.tickmarks': 'cross',
+ 'chart.ticksize': 5,
+ 'chart.xticks': true,
+ 'chart.xaxis': true,
+ 'chart.gutter': 25,
+ 'chart.xmax': 0,
+ 'chart.ymax': null,
+ 'chart.ymin': null,
+ 'chart.scale.decimals': null,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.xaxis': '',
+ 'chart.title.yaxis': '',
+ 'chart.title.xaxis.pos': 0.25,
+ 'chart.title.yaxis.pos': 0.25,
+ 'chart.labels': [],
+ 'chart.ylabels': true,
+ 'chart.ylabels.count': 5,
+ 'chart.contextmenu': null,
+ 'chart.defaultcolor': 'black',
+ 'chart.xaxispos': 'bottom',
+ 'chart.yaxispos': 'left',
+ 'chart.noendxtick': false,
+ 'chart.crosshairs': false,
+ 'chart.crosshairs.color': '#333',
+ 'chart.crosshairs.linewidth': 1,
+ 'chart.crosshairs.coords': false,
+ 'chart.crosshairs.coords.fixed':true,
+ 'chart.crosshairs.coords.fadeout':false,
+ 'chart.crosshairs.coords.labels.x': 'X',
+ 'chart.crosshairs.coords.labels.y': 'Y',
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.line': false,
+ 'chart.line.linewidth': 1,
+ 'chart.line.colors': ['green', 'red'],
+ 'chart.line.shadow.color': 'rgba(0,0,0,0)',
+ 'chart.line.shadow.blur': 2,
+ 'chart.line.shadow.offsetx': 3,
+ 'chart.line.shadow.offsety': 3,
+ 'chart.line.stepped': false,
+ 'chart.noaxes': false,
+ 'chart.key': [],
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.axis.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.boxplot.width': 8,
+ 'chart.resizable': false,
+ 'chart.xmin': 0
+ }
+
+ // Handle multiple datasets being given as one argument
+ if (arguments[1][0] && arguments[1][0][0] && typeof(arguments[1][0][0][0]) == 'number') {
+ // Store the data set(s)
+ for (var i=0; i<arguments[1].length; ++i) {
+ this.data[i] = arguments[1][i];
+ }
+
+ // Handle multiple data sets being supplied as seperate arguments
+ } else {
+ // Store the data set(s)
+ for (var i=1; i<arguments.length; ++i) {
+ this.data[i - 1] = arguments[i];
+ }
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[SCATTER] No canvas support');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[SCATTER] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A simple setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the property
+ */
+ RGraph.Scatter.prototype.Set = function (name, value)
+ {
+ /**
+ * This is here because the key expects a name of "chart.colors"
+ */
+ if (name == 'chart.line.colors') {
+ this.properties['chart.colors'] = value;
+ }
+
+ /**
+ * Allow compatibility with older property names
+ */
+ if (name == 'chart.tooltip.hotspot') {
+ name = 'chart.tooltips.hotspot';
+ }
+
+ /**
+ * chart.yaxispos should be left or right
+ */
+ if (name == 'chart.yaxispos' && value != 'left' && value != 'right') {
+ alert("[SCATTER] chart.yaxispos should be left or right. You've set it to: '" + value + "' Changing it to left");
+ value = 'left';
+ }
+
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A simple getter
+ *
+ * @param string name The name of the property to set
+ */
+ RGraph.Scatter.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+ /**
+ * The function you call to draw the line chart
+ */
+ RGraph.Scatter.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // Go through all the data points and see if a tooltip has been given
+ this.Set('chart.tooltips', false);
+ this.hasTooltips = false;
+ var overHotspot = false;
+
+ // Reset the coords array
+ this.coords = [];
+
+ if (!RGraph.isIE8()) {
+ for (var i=0; i<this.data.length; ++i) {
+ for (var j =0;j<this.data[i].length; ++j) {
+ if (this.data[i][j] && this.data[i][j][3] && typeof(this.data[i][j][3]) == 'string' && this.data[i][j][3].length) {
+ this.Set('chart.tooltips', [1]); // An array
+ this.hasTooltips = true;
+ }
+ }
+ }
+ }
+
+ // Reset the maximum value
+ this.max = 0;
+
+ // Work out the maximum Y value
+ if (this.Get('chart.ymax') && this.Get('chart.ymax') > 0) {
+
+ this.scale = [];
+ this.max = this.Get('chart.ymax');
+ this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+
+ this.scale[0] = ((this.max - this.min) * (1/5)) + this.min;
+ this.scale[1] = ((this.max - this.min) * (2/5)) + this.min;
+ this.scale[2] = ((this.max - this.min) * (3/5)) + this.min;
+ this.scale[3] = ((this.max - this.min) * (4/5)) + this.min;
+ this.scale[4] = ((this.max - this.min) * (5/5)) + this.min;
+
+ var decimals = this.Get('chart.scale.decimals');
+
+ this.scale = [
+ Number(this.scale[0]).toFixed(decimals),
+ Number(this.scale[1]).toFixed(decimals),
+ Number(this.scale[2]).toFixed(decimals),
+ Number(this.scale[3]).toFixed(decimals),
+ Number(this.scale[4]).toFixed(decimals)
+ ];
+
+ } else {
+
+ var i = 0;
+ var j = 0;
+
+ for (i=0; i<this.data.length; ++i) {
+ for (j=0; j<this.data[i].length; ++j) {
+ this.max = Math.max(this.max, typeof(this.data[i][j][1]) == 'object' ? RGraph.array_max(this.data[i][j][1]) : Math.abs(this.data[i][j][1]));
+ }
+ }
+
+ this.scale = RGraph.getScale(this.max, this);
+
+ this.max = this.scale[4];
+ this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+
+ if (this.min) {
+ this.scale[0] = ((this.max - this.min) * (1/5)) + this.min;
+ this.scale[1] = ((this.max - this.min) * (2/5)) + this.min;
+ this.scale[2] = ((this.max - this.min) * (3/5)) + this.min;
+ this.scale[3] = ((this.max - this.min) * (4/5)) + this.min;
+ this.scale[4] = ((this.max - this.min) * (5/5)) + this.min;
+ }
+
+
+ if (typeof(this.Get('chart.scale.decimals')) == 'number') {
+ var decimals = this.Get('chart.scale.decimals');
+
+ this.scale = [
+ Number(this.scale[0]).toFixed(decimals),
+ Number(this.scale[1]).toFixed(decimals),
+ Number(this.scale[2]).toFixed(decimals),
+ Number(this.scale[3]).toFixed(decimals),
+ Number(this.scale[4]).toFixed(decimals)
+ ];
+ }
+ }
+
+ this.grapharea = this.canvas.height - (2 * this.Get('chart.gutter'));
+
+ // Progressively Draw the chart
+ RGraph.background.Draw(this);
+
+ /**
+ * Draw any horizontal bars that have been specified
+ */
+ if (this.Get('chart.background.hbars') && this.Get('chart.background.hbars').length) {
+ RGraph.DrawBars(this);
+ }
+
+ /**
+ * Draw any vertical bars that have been specified
+ */
+ if (this.Get('chart.background.vbars') && this.Get('chart.background.vbars').length) {
+ this.DrawVBars();
+ }
+
+ if (!this.Get('chart.noaxes')) {
+ this.DrawAxes();
+ }
+
+ this.DrawLabels();
+
+ i = 0;
+ for(i=0; i<this.data.length; ++i) {
+ this.DrawMarks(i);
+
+ // Set the shadow
+ this.context.shadowColor = this.Get('chart.line.shadow.color');
+ this.context.shadowOffsetX = this.Get('chart.line.shadow.offsetx');
+ this.context.shadowOffsetY = this.Get('chart.line.shadow.offsety');
+ this.context.shadowBlur = this.Get('chart.line.shadow.blur');
+
+ this.DrawLine(i);
+
+ // Turn the shadow off
+ RGraph.NoShadow(this);
+ }
+
+
+ if (this.Get('chart.line')) {
+ for (var i=0;i<this.data.length; ++i) {
+ this.DrawMarks(i); // Call this again so the tickmarks appear over the line
+ }
+ }
+
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Install the event handler for tooltips
+ */
+ if (this.hasTooltips) {
+
+ /**
+ * Register all charts
+ */
+ RGraph.Register(this);
+
+ var overHotspot = false;
+
+ var canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = e.target;
+ var obj = canvas.__object__;
+ var context = canvas.getContext('2d');
+ var mouseCoords = RGraph.getMouseXY(e);
+ var overHotspot = false;
+
+ /**
+ * Now loop through each point comparing the coords
+ */
+
+ var offset = obj.Get('chart.tooltips.hotspot'); // This is how far the hotspot extends
+
+ for (var set=0; set<obj.coords.length; ++set) {
+ for (var i=0; i<obj.coords[set].length; ++i) {
+
+ var adjust = obj.Get('chart.tooltips.coords.adjust');
+ var xCoord = obj.coords[set][i][0] + adjust[0];
+ var yCoord = obj.coords[set][i][1] + adjust[1];
+ var tooltip = obj.coords[set][i][2];
+
+ if (mouseCoords[0] <= (xCoord + offset) &&
+ mouseCoords[0] >= (xCoord - offset) &&
+ mouseCoords[1] <= (yCoord + offset) &&
+ mouseCoords[1] >= (yCoord - offset) &&
+ tooltip &&
+ tooltip.length > 0) {
+
+ overHotspot = true;
+ canvas.style.cursor = 'pointer';
+
+ if (
+ !RGraph.Registry.Get('chart.tooltip') ||
+ RGraph.Registry.Get('chart.tooltip').__text__ != tooltip ||
+ RGraph.Registry.Get('chart.tooltip').__index__ != i ||
+ RGraph.Registry.Get('chart.tooltip').__dataset__ != set
+ ) {
+
+ if (obj.Get('chart.tooltips.highlight')) {
+ RGraph.Redraw();
+ }
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(tooltip) == 'function') {
+ var text = String(tooltip(i));
+
+ } else {
+ var text = String(tooltip);
+ }
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+ RGraph.Registry.Get('chart.tooltip').__dataset__ = set;
+
+ /**
+ * Draw a circle around the mark
+ */
+ if (obj.Get('chart.tooltips.highlight')) {
+ context.beginPath();
+ context.fillStyle = 'rgba(255,255,255,0.5)';
+ context.arc(xCoord, yCoord, 3, 0, 6.28, 0);
+ context.fill();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Reset the pointer
+ */
+ if (!overHotspot) {
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+
+ /**
+ * Draw the key if necessary
+ */
+ if (this.Get('chart.key') && this.Get('chart.key').length) {
+ RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.line.colors'));
+ }
+
+
+ /**
+ * Draw crosschairs
+ */
+ RGraph.DrawCrosshairs(this);
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the axes of the scatter graph
+ */
+ RGraph.Scatter.prototype.DrawAxes = function ()
+ {
+ var canvas = this.canvas;
+ var context = this.context;
+ var graphHeight = this.canvas.height - (this.Get('chart.gutter') * 2);
+ var gutter = this.Get('chart.gutter');
+
+ context.beginPath();
+ context.strokeStyle = this.Get('chart.axis.color');
+ context.lineWidth = 1;
+
+ // Draw the Y axis
+ if (this.Get('chart.yaxispos') == 'left') {
+ context.moveTo(gutter, gutter);
+ context.lineTo(gutter, this.canvas.height - gutter);
+ } else {
+ context.moveTo(canvas.width - gutter, gutter);
+ context.lineTo(canvas.width - gutter, canvas.height - gutter);
+ }
+
+
+ // Draw the X axis
+ if (this.Get('chart.xaxis')) {
+ if (this.Get('chart.xaxispos') == 'center') {
+ context.moveTo(gutter, canvas.height / 2);
+ context.lineTo(canvas.width - gutter, canvas.height / 2);
+ } else {
+ context.moveTo(gutter, canvas.height - gutter);
+ context.lineTo(canvas.width - gutter, canvas.height - gutter);
+ }
+ }
+
+ /**
+ * Draw the Y tickmarks
+ */
+ for (y=gutter; y < canvas.height - gutter + (this.Get('chart.xaxispos') == 'center' ? 1 : 0) ; y+=(graphHeight / 5) / 2) {
+
+ // This is here to accomodate the X axis being at the center
+ if (y == (canvas.height / 2) ) continue;
+
+ if (this.Get('chart.yaxispos') == 'left') {
+ context.moveTo(gutter, y);
+ context.lineTo(gutter - 3, y);
+ } else {
+ context.moveTo(canvas.width - gutter +3, y);
+ context.lineTo(canvas.width - gutter, y);
+ }
+ }
+
+
+ /**
+ * Draw the X tickmarks
+ */
+ if (this.Get('chart.xticks') && this.Get('chart.xaxis')) {
+
+ var x = 0;
+ var y = (this.Get('chart.xaxispos') == 'center') ? (this.canvas.height / 2) : (this.canvas.height - gutter);
+ this.xTickGap = (this.canvas.width - (2 * gutter) ) / this.Get('chart.labels').length;
+
+ for (x = (gutter + (this.Get('chart.yaxispos') == 'left' ? this.xTickGap / 2 : 0) ); x<=(canvas.width - gutter - (this.Get('chart.yaxispos') == 'left' ? 0 : 1)); x += this.xTickGap / 2) {
+
+ if (this.Get('chart.yaxispos') == 'left' && this.Get('chart.noendxtick') == true && x == (canvas.width - gutter) ) {
+ continue;
+
+ } else if (this.Get('chart.yaxispos') == 'right' && this.Get('chart.noendxtick') == true && x == gutter) {
+ continue;
+ }
+
+ context.moveTo(x, y - (this.Get('chart.xaxispos') == 'center' ? 3 : 0));
+ context.lineTo(x, y + 3);
+ }
+ }
+
+ context.stroke();
+ }
+
+
+ /**
+ * Draws the labels on the scatter graph
+ */
+ RGraph.Scatter.prototype.DrawLabels = function ()
+ {
+ this.context.fillStyle = this.Get('chart.text.color');
+ var font = this.Get('chart.text.font');
+ var xMin = this.Get('chart.xmin');
+ var xMax = this.Get('chart.xmax');
+ var yMax = this.scale[4];
+ var gutter = this.Get('chart.gutter');
+ var text_size = this.Get('chart.text.size');
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var numYLabels = this.Get('chart.ylabels.count');
+ var context = this.context;
+ var canvas = this.canvas;
+
+ this.halfTextHeight = text_size / 2;
+
+
+ this.halfGraphHeight = (this.canvas.height - (2 * this.Get('chart.gutter'))) / 2;
+
+ /**
+ * Draw the Y yaxis labels, be it at the top or center
+ */
+ if (this.Get('chart.ylabels')) {
+
+ var xPos = this.Get('chart.yaxispos') == 'left' ? gutter - 5 : canvas.width - gutter + 5;
+ var align = this.Get('chart.yaxispos') == 'right' ? 'left' : 'right';
+
+ if (this.Get('chart.xaxispos') == 'center') {
+
+
+ /**
+ * Specific Y labels
+ */
+ if (typeof(this.Get('chart.ylabels.specific')) == 'object') {
+
+ var labels = this.Get('chart.ylabels.specific');
+
+ for (var i=0; i<this.Get('chart.ylabels.specific').length; ++i) {
+ var y = gutter + (i * (this.grapharea / (labels.length * 2) ) );
+ RGraph.Text(context, font, text_size, xPos, y, labels[i], 'center', align);
+ }
+
+ var reversed_labels = RGraph.array_reverse(labels);
+
+ for (var i=0; i<reversed_labels.length; ++i) {
+ var y = gutter + (this.grapharea / 2) + ((i+1) * (this.grapharea / (labels.length * 2) ) );
+
+ RGraph.Text(context, font, text_size, xPos, y, reversed_labels[i], 'center', align);
+ }
+
+ return;
+ }
+
+
+ if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
+ // Draw the top halves labels
+ RGraph.Text(context, font, text_size, xPos, gutter, RGraph.number_format(this, this.scale[4], units_pre, units_post), 'center', align);
+
+
+ if (numYLabels >= 5) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (1/10) ), RGraph.number_format(this, this.scale[3], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (3/10) ), RGraph.number_format(this, this.scale[1], units_pre, units_post), 'center', align);
+ }
+
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (2/10) ), RGraph.number_format(this, this.scale[2], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (4/10) ), RGraph.number_format(this, this.scale[0], units_pre, units_post), 'center', align);
+ }
+
+ // Draw the bottom halves labels
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (1/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this, this.scale[0], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (3/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this, this.scale[2], units_pre, units_post), 'center', align);
+ }
+
+ if (numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (2/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this, this.scale[1], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (4/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this, this.scale[3], units_pre, units_post), 'center', align);
+ }
+
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (5/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this, this.scale[4], units_pre, units_post), 'center', align);
+
+ } else if (numYLabels == 10) {
+ // 10 Y labels
+ var interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context, font, text_size, xPos,gutter + ((canvas.height - (2 * gutter)) * (i/20) ),RGraph.number_format(this,
+
+ (this.max - (this.max * (i/10))).toFixed(this.Get('chart.scale.decimals')),
+
+ units_pre, units_post),'center', align);
+ RGraph.Text(context, font, text_size, xPos,gutter + ((canvas.height - (2 * gutter)) * (i/20) ) + (this.grapharea / 2) + (this.grapharea / 20),'-' + RGraph.number_format(this, ((this.max * (i/10)) + (this.max * (1/10))).toFixed((this.Get('chart.scale.decimals'))), units_pre, units_post), 'center', align);
+ }
+
+ } else {
+ alert('[SCATTER SCALE] Number of Y labels can be 1/3/5/10 only');
+ }
+
+ } else {
+
+ var xPos = this.Get('chart.yaxispos') == 'left' ? gutter - 5 : canvas.width - gutter + 5;
+ var align = this.Get('chart.yaxispos') == 'right' ? 'left' : 'right';
+
+ /**
+ * Specific Y labels
+ */
+ if (typeof(this.Get('chart.ylabels.specific')) == 'object') {
+
+ var labels = this.Get('chart.ylabels.specific');
+
+ for (var i=0; i<this.Get('chart.ylabels.specific').length; ++i) {
+ var y = gutter + (i * (this.grapharea / labels.length) );
+
+ RGraph.Text(context, font, text_size, xPos, y, labels[i], 'center', align);
+ }
+
+ return;
+ }
+
+ if (numYLabels == 1 || numYLabels == 3 || numYLabels == 5) {
+ RGraph.Text(context, font, text_size, xPos, gutter, RGraph.number_format(this, this.scale[4], units_pre, units_post), 'center', align);
+
+ if (numYLabels >= 5) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (1/5) ), RGraph.number_format(this, this.scale[3], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (3/5) ), RGraph.number_format(this, this.scale[1], units_pre, units_post), 'center', align);
+ }
+
+ if (numYLabels >= 3) {
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (2/5) ), RGraph.number_format(this, this.scale[2], units_pre, units_post), 'center', align);
+ RGraph.Text(context, font, text_size, xPos, gutter + ((canvas.height - (2 * gutter)) * (4/5) ), RGraph.number_format(this, this.scale[0], units_pre, units_post), 'center', align);
+ }
+ } else if (numYLabels == 10) {
+
+ // 10 Y labels
+ var interval = (this.grapharea / numYLabels) / 2;
+
+ for (var i=0; i<numYLabels; ++i) {
+ RGraph.Text(context, font, text_size, xPos,gutter + ((canvas.height - (2 * gutter)) * (i/10) ),RGraph.number_format(this,(this.max - (this.max * (i/10))).toFixed((this.Get('chart.scale.decimals'))), units_pre, units_post), 'center', align);
+ }
+
+ } else {
+ alert('[SCATTER SCALE] Number of Y labels can be 1/3/5/10 only');
+ }
+
+ if (this.Get('chart.ymin')) {
+ RGraph.Text(context, font, text_size, xPos, canvas.height - gutter,RGraph.number_format(this, this.Get('chart.ymin').toFixed(this.Get('chart.scale.decimals')), units_pre, units_post),'center', align);
+ }
+ }
+ }
+
+ // Put the text on the X axis
+ var graphArea = this.canvas.width - (2 * gutter);
+ var xInterval = graphArea / this.Get('chart.labels').length;
+ var xPos = gutter;
+ var yPos = (this.canvas.height - gutter) + 15;
+ var labels = this.Get('chart.labels');
+
+ /**
+ * Text angle
+ */
+ var angle = 0;
+ var valign = null;
+ var halign = 'center';
+
+ if (this.Get('chart.text.angle') > 0) {
+ angle = -1 * this.Get('chart.text.angle');
+ valign = 'center';
+ halign = 'right';
+ yPos -= 10;
+ }
+
+ for (i=0; i<labels.length; ++i) {
+
+ if (typeof(labels[i]) == 'object') {
+
+ RGraph.Text(context, font, this.Get('chart.text.size'), gutter + (graphArea * ((labels[i][1] - xMin) / (this.Get('chart.xmax') - xMin))) + 5, yPos, String(labels[i][0]), valign, angle != 0 ? 'right' : 'left', null, angle);
+
+ /**
+ * Draw the gray indicator line
+ */
+ this.context.beginPath();
+ this.context.strokeStyle = '#bbb';
+ this.context.moveTo(gutter + (graphArea * ((labels[i][1] - xMin)/ (this.Get('chart.xmax') - xMin))), this.canvas.height - gutter);
+ this.context.lineTo(gutter + (graphArea * ((labels[i][1] - xMin)/ (this.Get('chart.xmax') - xMin))), this.canvas.height - gutter + 20);
+ this.context.stroke();
+
+ } else {
+ RGraph.Text(context, font, this.Get('chart.text.size'), xPos + (this.xTickGap / 2), yPos, String(labels[i]), valign, halign, null, angle);
+ }
+
+ // Do this for the next time around
+ xPos += xInterval;
+ }
+ }
+
+
+ /**
+ * Draws the actual scatter graph marks
+ *
+ * @param i integer The dataset index
+ */
+ RGraph.Scatter.prototype.DrawMarks = function (i)
+ {
+ /**
+ * Reset the coords array
+ */
+ this.coords[i] = [];
+
+ /**
+ * Plot the values
+ */
+ var xmax = this.Get('chart.xmax');
+ var default_color = this.Get('chart.defaultcolor');
+
+ for (var j=0; j<this.data[i].length; ++j) {
+ /**
+ * This is here because tooltips are optional
+ */
+ var data_point = this.data[i];
+
+ var xCoord = data_point[j][0];
+ var yCoord = data_point[j][1];
+ var color = data_point[j][2] ? data_point[j][2] : default_color;
+ var tooltip = (data_point[j] && data_point[j][3]) ? data_point[j][3] : null;
+
+
+ this.DrawMark(
+ i,
+ xCoord,
+ yCoord,
+ xmax,
+ this.scale[4],
+ color,
+ tooltip,
+ this.coords[i],
+ data_point
+ );
+ }
+ }
+
+
+ /**
+ * Draws a single scatter mark
+ */
+ RGraph.Scatter.prototype.DrawMark = function (index, x, y, xMax, yMax, color, tooltip, coords, data)
+ {
+ var tickmarks = this.Get('chart.tickmarks');
+ var tickSize = this.Get('chart.ticksize');
+ var gutter = this.Get('chart.gutter');
+ var xMin = this.Get('chart.xmin');
+ var x = ((x - xMin) / (xMax - xMin)) * (this.canvas.width - (2 * gutter));
+ var originalX = x;
+ var originalY = y;
+
+ /**
+ * This allows chart.tickmarks to be an array
+ */
+
+ if (tickmarks && typeof(tickmarks) == 'object') {
+ tickmarks = tickmarks[index];
+ }
+
+
+ /**
+ * This allows chart.ticksize to be an array
+ */
+ if (typeof(tickSize) == 'object') {
+ var tickSize = tickSize[index];
+ var halfTickSize = tickSize / 2;
+ } else {
+ var halfTickSize = tickSize / 2;
+ }
+
+
+ /**
+ * This bit is for boxplots only
+ */
+ if ( typeof(y) == 'object'
+ && typeof(y[0]) == 'number'
+ && typeof(y[1]) == 'number'
+ && typeof(y[2]) == 'number'
+ && typeof(y[3]) == 'number'
+ && typeof(y[4]) == 'number'
+ ) {
+
+ var yMin = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+ this.Set('chart.boxplot', true);
+ this.graphheight = this.canvas.height - (2 * gutter);
+
+ if (this.Get('chart.xaxispos') == 'center') {
+ this.graphheight /= 2;
+ }
+
+ var y0 = (this.graphheight) - ((y[4] - yMin) / (yMax - yMin)) * (this.graphheight);
+ var y1 = (this.graphheight) - ((y[3] - yMin) / (yMax - yMin)) * (this.graphheight);
+ var y2 = (this.graphheight) - ((y[2] - yMin) / (yMax - yMin)) * (this.graphheight);
+ var y3 = (this.graphheight) - ((y[1] - yMin) / (yMax - yMin)) * (this.graphheight);
+ var y4 = (this.graphheight) - ((y[0] - yMin) / (yMax - yMin)) * (this.graphheight);
+
+ var col1 = y[5];
+ var col2 = y[6];
+
+ // Override the boxWidth
+ if (typeof(y[7]) == 'number') {
+ var boxWidth = y[7];
+ }
+
+ var y = this.graphheight - y2;
+
+ } else {
+ var yMin = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;
+ var y = (( (y - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter)));
+ }
+
+ /**
+ * Account for the X axis being at the centre
+ */
+ if (this.Get('chart.xaxispos') == 'center') {
+ y /= 2;
+ y += this.halfGraphHeight;
+ }
+
+ // This is so that points are on the graph, and not the gutter
+ x += gutter;
+ y = this.canvas.height - gutter - y;
+
+ this.context.beginPath();
+
+ // Color
+ this.context.strokeStyle = color;
+
+ /**
+ * Boxplots
+ */
+ if ( this.Get('chart.boxplot')
+ && typeof(y0) == 'number'
+ && typeof(y1) == 'number'
+ && typeof(y2) == 'number'
+ && typeof(y3) == 'number'
+ && typeof(y4) == 'number'
+ ) {
+
+ var boxWidth = boxWidth ? boxWidth : this.Get('chart.boxplot.width');
+ var halfBoxWidth = boxWidth / 2;
+
+ this.context.beginPath();
+
+ // Draw the upper coloured box if a value is specified
+ if (col1) {
+ this.context.fillStyle = col1;
+ this.context.fillRect(x - halfBoxWidth, y1 + gutter, boxWidth, y2 - y1);
+ }
+
+ // Draw the lower coloured box if a value is specified
+ if (col2) {
+ this.context.fillStyle = col2;
+ this.context.fillRect(x - halfBoxWidth, y2 + gutter, boxWidth, y3 - y2);
+ }
+
+ this.context.strokeRect(x - halfBoxWidth, y1 + gutter, boxWidth, y3 - y1);
+ this.context.stroke();
+
+ // Now draw the whiskers
+ this.context.beginPath();
+ this.context.moveTo(x - halfBoxWidth, y0 + gutter);
+ this.context.lineTo(x + halfBoxWidth, y0 + gutter);
+
+ this.context.moveTo(x, y0 + gutter);
+ this.context.lineTo(x, y1 + gutter);
+
+ this.context.moveTo(x - halfBoxWidth, y4 + gutter);
+ this.context.lineTo(x + halfBoxWidth, y4 + gutter);
+
+ this.context.moveTo(x, y4 + gutter);
+ this.context.lineTo(x, y3 + gutter);
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draw the tickmark, but not for boxplots
+ */
+
+ if (!y0 && !y1 && !y2 && !y3 && !y4) {
+
+ this.graphheight = this.canvas.height - (2 * gutter);
+
+
+
+ if (tickmarks == 'circle') {
+ this.context.arc(x, y, halfTickSize, 0, 6.28, 0);
+ this.context.fillStyle = color;
+ this.context.fill();
+
+ } else if (tickmarks == 'plus') {
+
+ this.context.moveTo(x, y - halfTickSize);
+ this.context.lineTo(x, y + halfTickSize);
+ this.context.moveTo(x - halfTickSize, y);
+ this.context.lineTo(x + halfTickSize, y);
+ this.context.stroke();
+
+ } else if (tickmarks == 'square') {
+ this.context.strokeStyle = color;
+ this.context.fillStyle = color;
+ this.context.fillRect(
+ x - halfTickSize,
+ y - halfTickSize,
+ tickSize,
+ tickSize
+ );
+ //this.context.fill();
+
+ } else if (tickmarks == 'cross') {
+
+ this.context.moveTo(x - halfTickSize, y - halfTickSize);
+ this.context.lineTo(x + halfTickSize, y + halfTickSize);
+ this.context.moveTo(x + halfTickSize, y - halfTickSize);
+ this.context.lineTo(x - halfTickSize, y + halfTickSize);
+
+ this.context.stroke();
+
+ /**
+ * Diamond shape tickmarks
+ */
+ } else if (tickmarks == 'diamond') {
+ this.context.fillStyle = this.context.strokeStyle;
+
+ this.context.moveTo(x, y - halfTickSize);
+ this.context.lineTo(x + halfTickSize, y);
+ this.context.lineTo(x, y + halfTickSize);
+ this.context.lineTo(x - halfTickSize, y);
+ this.context.lineTo(x, y - halfTickSize);
+
+ this.context.fill();
+ this.context.stroke();
+
+ /**
+ * Custom tickmark style
+ */
+ } else if (typeof(tickmarks) == 'function') {
+
+ var graphWidth = this.canvas.width - (2 * this.Get('chart.gutter'))
+ var xVal = ((x - this.Get('chart.gutter')) / graphWidth) * xMax;
+ var yVal = ((this.graphheight - (y - this.Get('chart.gutter'))) / this.graphheight) * yMax;
+
+ tickmarks(this, data, x, y, xVal, yVal, xMax, yMax, color)
+
+ /**
+ * No tickmarks
+ */
+ } else if (tickmarks == null) {
+
+ /**
+ * Unknown tickmark type
+ */
+ } else {
+ alert('[SCATTER] (' + this.id + ') Unknown tickmark style: ' + tickmarks );
+ }
+ }
+
+ /**
+ * Add the tickmark to the coords array
+ */
+ coords.push([x, y, tooltip]);
+ }
+
+
+ /**
+ * Draws an optional line connecting the tick marks.
+ *
+ * @param i The index of the dataset to use
+ */
+ RGraph.Scatter.prototype.DrawLine = function (i)
+ {
+ if (this.Get('chart.line') && this.coords[i].length >= 2) {
+
+ this.context.lineCap = 'round';
+ this.context.lineJoin = 'round';
+ this.context.lineWidth = this.GetLineWidth(i);// i is the index of the set of coordinates
+ this.context.strokeStyle = this.Get('chart.line.colors')[i];
+ this.context.beginPath();
+
+ var len = this.coords[i].length;
+
+ for (var j=0; j<this.coords[i].length; ++j) {
+
+ var xPos = this.coords[i][j][0];
+ var yPos = this.coords[i][j][1];
+
+ if (j == 0) {
+ this.context.moveTo(xPos, yPos);
+ } else {
+
+ // Stepped?
+ var stepped = this.Get('chart.line.stepped');
+
+ if ( (typeof(stepped) == 'boolean' && stepped)
+ || (typeof(stepped) == 'object' && stepped[i])
+ ) {
+ this.context.lineTo(this.coords[i][j][0], this.coords[i][j - 1][1]);
+ }
+
+ this.context.lineTo(xPos, yPos);
+ }
+ }
+
+ this.context.stroke();
+ }
+
+ /**
+ * Set the linewidth back to 1
+ */
+ this.context.lineWidth = 1;
+ }
+
+
+ /**
+ * Returns the linewidth
+ *
+ * @param number i The index of the "line" (/set of coordinates)
+ */
+ RGraph.Scatter.prototype.GetLineWidth = function (i)
+ {
+ var linewidth = this.Get('chart.line.linewidth');
+
+ if (typeof(linewidth) == 'number') {
+ return linewidth;
+
+ } else if (typeof(linewidth) == 'object') {
+ if (linewidth[i]) {
+ return linewidth[i];
+ } else {
+ return linewidth[0];
+ }
+
+ alert('[SCATTER] Error! chart.linewidth should be a single number or an array of one or more numbers');
+ }
+ }
+
+
+ /**
+ * Draws vertical bars. Line chart doesn't use a horizontal scale, hence this function
+ * is not common
+ */
+ RGraph.Scatter.prototype.DrawVBars = function ()
+ {
+ var canvas = this.canvas;
+ var context = this.context;
+ var vbars = this.Get('chart.background.vbars');
+ var gutter = this.Get('chart.gutter');
+ var graphWidth = canvas.width - gutter - gutter;
+
+ if (vbars) {
+
+ var xmax = this.Get('chart.xmax');
+
+ for (var i=0; i<vbars.length; ++i) {
+ var startX = ((vbars[i][0] / xmax) * graphWidth) + gutter;
+ var width = (vbars[i][1] / xmax) * graphWidth;
+
+ context.beginPath();
+ context.fillStyle = vbars[i][2];
+ context.fillRect(startX, gutter, width, (canvas.height - gutter - gutter));
+ context.fill();
+ }
+ }
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+
+
+
+ /**
+ * This is the RGraph.skeleton.js file which you can use as a base for creating new graph types.
+ */
+
+
+
+
+ /**
+ * Having this here means that the RGraph libraries can be included in any order, instead of you having
+ * to include the common core library first.
+ */
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+
+
+
+ /**
+ * The chart constructor. This function sets up the object. It takes the ID (the HTML attribute) of the canvas as the
+ * first argument and the data as the second. If you need to change this, you can.
+ *
+ * @param string id The canvas tag ID
+ * @param array data The chart data
+ */
+ RGraph.Skeleton = function (id, data)
+ {
+ /**
+ * Set these as object properties so they don't have to be constantly retrieved. Note that using a dollar
+ * function - $() - can cause conflicts with popular javascript libraries, eg jQuery. It's therefore best
+ * to stick to document.getElementById(). Setting the canvas and context as object properties means you
+ * can reference them like this: myObj.canvas
+ * myObj.context
+ */
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
+
+ /**
+ * This puts a reference to this object on to the canvas. Useful in event handling.
+ */
+ this.canvas.__object__ = this;
+
+ /**
+ * This defines the type of this graph type and should be a one word description.
+ */
+ this.type = 'skeleton';
+
+ /**
+ * This facilitates easy object identification, and should be true
+ */
+ this.isRGraph = true;
+
+ /**
+ * This does a few things, for example adding the .fillText() method to the canvas 2D context when
+ * it doesn't exist. This facilitates the graphs to be still shown in older browser (though without
+ * text obviously). You'll find the function in RGraph.common.core.js
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ /**
+ * Some example background properties, as used by the method RGraph.background.Draw()
+ */
+ this.properties = {
+ 'chart.gutter': 25,
+ 'chart.colors': ['red','blue'],
+ 'chart.background.barcolor1': 'rgba(0,0,0,0)',
+ 'chart.background.barcolor2': 'rgba(0,0,0,0)',
+ 'chart.background.grid': true,
+ 'chart.background.grid.color': '#ddd',
+ 'chart.background.grid.width': 1,
+ 'chart.background.grid.hsize': 20,
+ 'chart.background.grid.vsize': 20,
+ 'chart.background.grid.vlines': true,
+ 'chart.background.grid.hlines': true,
+ 'chart.background.grid.border': true,
+ 'chart.background.grid.autofit':false,
+ 'chart.background.grid.autofit.numhlines': 7,
+ 'chart.background.grid.autofit.numvlines': 20,
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.contextmenu': null,
+ 'chart.labels': null,
+ 'chart.labels.ingraph': null,
+ 'chart.labels.above': false,
+ 'chart.labels.above.decimals': 0,
+ 'chart.labels.above.size': null,
+ 'chart.scale.decimals': 0,
+ 'chart.scale.point': '.',
+ 'chart.scale.thousand': ',',
+ 'chart.crosshairs': false,
+ 'chart.crosshairs.color': '#333',
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'graph',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.xaxis': '',
+ 'chart.title.yaxis': '',
+ 'chart.title.xaxis.pos': 0.25,
+ 'chart.title.yaxis.pos': 0.25,
+ 'chart.text.color': 'black',
+ 'chart.text.size': 10,
+ 'chart.text.angle': 0,
+ 'chart.text.font': 'Verdana',
+ 'chart.resizable': false,
+ 'chart.adjustable': false,
+ 'chart.hmargin': 5,
+ 'chart.shadow': false,
+ 'chart.shadow.color': '#666',
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.shadow.blur': 3,
+ 'chart.tooltips': null,
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.event': 'onclick',
+ 'chart.tooltips.coords.adjust': [0,0],
+ 'chart.tooltips.highlight': true,
+ }
+
+ /**
+ * A simple check that the browser has canvas support
+ */
+ if (!this.canvas) {
+ alert('[BAR] No canvas support');
+ return;
+ }
+
+ /**
+ * Check that the common library has been included
+ */
+ if (typeof(RGraph) == 'undefined') {
+ alert('[SKELETON] Fatal error: The common library does not appear to have been included');
+ }
+
+ /**
+ * Store the data that was passed to this constructor
+ */
+ this.data = data;
+
+ /**
+ * This can be used to store the coordinates of shapes on the graph
+ */
+ this.coords = [];
+ }
+
+
+
+
+ /**
+ * A setter method for setting graph properties. It can be used like this: obj.Set('chart.background.grid', false);
+ *
+ * @param name string The name of the property to set
+ * @param value mixed The value of the property
+ */
+ RGraph.Skeleton.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+
+
+ /**
+ * A getter method for retrieving graph properties. It can be used like this: obj.Get('chart.background.grid');
+ * This can be used inside your methods that draw the graph.
+ *
+ * @param name string The name of the property to get
+ */
+ RGraph.Skeleton.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+
+
+ /**
+ * The function you call to draw the chart after you have set all of the graph properties
+ */
+ RGraph.Bar.prototype.Draw = function ()
+ {
+ /**
+ * Fire the custom RGraph onbeforedraw event (which should be fired before the chart is drawn)
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+
+
+
+ /*************************
+ * Draw the chart here... *
+ *************************/
+
+
+
+
+ /**
+ * These call common functions, that facilitate some of RGraps features
+ */
+
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Draw "in graph" labels
+ */
+ if (this.Get('chart.labels.ingraph')) {
+ RGraph.DrawInGraphLabels(this);
+ }
+
+ /**
+ * Draw crosschairs
+ */
+ if (this.Get('chart.crosshairs')) {
+ RGraph.DrawCrosshairs(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+
+ /**
+ * This function enables adjusting
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the custom RGraph ondraw event (which should be fired when you have drawn the chart)
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
--- /dev/null
+/**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The traditional radar chart constructor
+ *
+ * @param string id The ID of the canvas
+ * @param array data An array of data to represent
+ */
+ RGraph.Tradar = function (id, data)
+ {
+ this.id = id;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.canvas.__object__ = this;
+ this.size = null;// Set in the .Draw() method
+ this.data = data;
+ this.max = RGraph.array_max(this.data);
+ this.type = 'tradar';
+ this.coords = [];
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+
+ this.properties = {
+ 'chart.gutter': 25,
+ 'chart.linewidth': 1,
+ 'chart.color': 'red',
+ 'chart.circle': 0,
+ 'chart.circle.fill': 'red',
+ 'chart.circle.stroke': 'black',
+ 'chart.labels': [],
+ 'chart.labels.offsetx': 10,
+ 'chart.labels.offsety': 10,
+ 'chart.background.circles': true,
+ 'chart.text.size': 10,
+ 'chart.text.font': 'Verdana',
+ 'chart.text.color': 'black',
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.title.color': 'black',
+ 'chart.linewidth': 1,
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'gutter',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key': null,
+ 'chart.key.background': 'white',
+ 'chart.key.position': 'gutter',
+ 'chart.key.shadow': false,
+ 'chart.key.shadow.color': '#666',
+ 'chart.key.shadow.blur': 3,
+ 'chart.key.shadow.offsetx': 2,
+ 'chart.key.shadow.offsety': 2,
+ 'chart.key.position.gutter.boxed': true,
+ 'chart.key.position.x': null,
+ 'chart.key.position.y': null,
+ 'chart.key.color.shape': 'square',
+ 'chart.key.rounded': true,
+ 'chart.contextmenu': null,
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.thumbnail.width': 75,
+ 'chart.zoom.thumbnail.height': 75,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.resizable': false,
+ 'chart.labels.axes': 'nsew',
+ 'chart.ymax': null
+ }
+
+ // Must have at least 3 points
+ if (this.data.length < 3) {
+ alert('[TRADAR] You must specify at least 3 data points');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[TRADAR] Fatal error: The RGraph common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A simple setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the property
+ */
+ RGraph.Tradar.prototype.Set = function (name, value)
+ {
+ this.properties[name] = value;
+
+ /**
+ * If the name is chart.color, set chart.colors too
+ */
+ if (name == 'chart.color') {
+ this.properties['chart.colors'] = [value];
+ }
+ }
+
+
+ /**
+ * A simple hetter
+ *
+ * @param string name The name of the property to get
+ */
+ RGraph.Tradar.prototype.Get = function (name)
+ {
+ return this.properties[name];
+ }
+
+
+ /**
+ * The draw method which does all the brunt of the work
+ */
+ RGraph.Tradar.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ this.centerx = this.canvas.width / 2;
+ this.centery = this.canvas.height / 2;
+ this.size = Math.min(this.canvas.width, this.canvas.height) - (2 * this.Get('chart.gutter'));
+
+ // Work out the maximum value and the sum
+ if (!this.Get('chart.ymax')) {
+ this.scale = RGraph.getScale(RGraph.array_max(this.data), this);
+ this.max = this.scale[4];
+ } else {
+ var ymax = this.Get('chart.ymax');
+
+ this.scale = [
+ ymax * 0.2,
+ ymax * 0.4,
+ ymax * 0.6,
+ ymax * 0.8,
+ ymax * 1
+ ];
+ this.max = this.scale[4];
+ }
+
+ this.DrawBackground();
+ this.DrawAxes();
+ this.DrawCircle();
+ this.DrawAxisLabels();
+ this.DrawChart();
+ this.DrawLabels();
+
+ // Draw the title
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'))
+ }
+
+ // Draw the key if necessary
+ // obj, key, colors
+ if (this.Get('chart.key')) {
+ RGraph.DrawKey(this, this.Get('chart.key'), [this.Get('chart.color'), this.Get('chart.circle.fill')]);
+ }
+
+ /**
+ * Show the context menu
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+
+ /**
+ * This function enables adjusting
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draws the background circles
+ */
+ RGraph.Tradar.prototype.DrawBackground = function ()
+ {
+ var color = '#ddd';
+
+ /**
+ * Draws the background circles
+ */
+ if (this.Get('chart.background.circles')) {
+
+ this.context.strokeStyle = color;
+ this.context.beginPath();
+
+ for (var r=5; r<(this.size / 2); r+=15) {
+
+ this.context.moveTo(this.centerx, this.centery);
+ this.context.arc(this.centerx, this.centery,r, 0, 6.28, 0);
+ }
+
+ this.context.stroke();
+ }
+
+
+ /**
+ * Draw diagonals
+ */
+ this.context.strokeStyle = color;
+ for (var i=0; i<360; i+=15) {
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, this.size / 2, (i / 360) * (2 * Math.PI), ((i+0.01) / 360) * (2 * Math.PI), 0); // The 0.01 avoids a bug in Chrome 6
+ this.context.lineTo(this.centerx, this.centery);
+ this.context.stroke();
+ }
+ }
+
+
+ /**
+ * Draws the axes
+ */
+ RGraph.Tradar.prototype.DrawAxes = function ()
+ {
+ this.context.strokeStyle = 'black';
+
+ var halfsize = this.size / 2;
+
+ this.context.beginPath();
+
+ /**
+ * The Y axis
+ */
+ this.context.moveTo(this.centerx, this.centery + halfsize);
+ this.context.lineTo(this.centerx, this.centery - halfsize);
+
+
+ // Draw the bits at either end of the Y axis
+ this.context.moveTo(this.centerx - 5, this.centery + halfsize);
+ this.context.lineTo(this.centerx + 5, this.centery + halfsize);
+ this.context.moveTo(this.centerx - 5, this.centery - halfsize);
+ this.context.lineTo(this.centerx + 5, this.centery - halfsize);
+
+ // Draw X axis tick marks
+ for (var y=(this.centery - halfsize); y<(this.centery + halfsize); y+=15) {
+ this.context.moveTo(this.centerx - 3, y);
+ this.context.lineTo(this.centerx + 3, y);
+ }
+
+ /**
+ * The X axis
+ */
+ this.context.moveTo(this.centerx - halfsize, this.centery);
+ this.context.lineTo(this.centerx + halfsize, this.centery);
+
+ // Draw the bits at the end of the X axis
+ this.context.moveTo(this.centerx - halfsize, this.centery - 5);
+ this.context.lineTo(this.centerx - halfsize, this.centery + 5);
+ this.context.moveTo(this.centerx + halfsize, this.centery - 5);
+ this.context.lineTo(this.centerx + halfsize, this.centery + 5);
+
+ // Draw X axis tick marks
+ for (var x=(this.centerx - halfsize); x<(this.centerx + halfsize); x+=15) {
+ this.context.moveTo(x, this.centery - 3);
+ this.context.lineTo(x, this.centery + 3);
+ }
+
+ /**
+ * Finally draw it to the canvas
+ */
+ this.context.stroke();
+ }
+
+
+ /**
+ * The function which actually draws the radar chart
+ */
+ RGraph.Tradar.prototype.DrawChart = function ()
+ {
+ for (var i=0; i<this.data.length; ++i) {
+ this.coords[i] = this.GetCoordinates(i);
+ }
+
+ /**
+ * Now go through the coords and draw the chart itself
+ */
+ this.context.strokeStyle = this.Get('chart.strokestyle');
+ this.context.fillStyle = this.Get('chart.color');
+ this.context.lineWidth = this.Get('chart.linewidth');
+ this.context.beginPath();
+
+ for (i=0; i<this.coords.length; ++i) {
+ if (i == 0) {
+ this.context.moveTo(this.coords[i][0], this.coords[i][1]);
+ } else {
+ this.context.lineTo(this.coords[i][0], this.coords[i][1]);
+ }
+ }
+
+ this.context.closePath();
+
+ this.context.fill();
+ this.context.stroke();
+
+ /**
+ * Can now handletooltips
+ */
+ if (this.Get('chart.tooltips')) {
+
+ RGraph.Register(this);
+
+ var canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+ var x = e.offsetX;
+ var y = e.offsetY;
+ var overHotspot = false;
+
+ for (var i=0; i<obj.coords.length; ++i) {
+
+ var xCoord = obj.coords[i][0];
+ var yCoord = obj.coords[i][1];
+ var tooltips = obj.Get('chart.tooltips');
+ var idx = Number(i);
+
+ if (
+ (tooltips[i] || tooltips) // The order here is important due to short circuiting
+ && x < (xCoord + 5)
+ && x > (xCoord - 5)
+ && y > (yCoord - 5)
+ && y < (yCoord + 5)
+ ) {
+
+ if (!RGraph.Registry.Get('chart.tooltip') || RGraph.Registry.Get('chart.tooltip').__index__ != idx) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = String(obj.Get('chart.tooltips')(i));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[i]) == 'function') {
+ var text = String(obj.Get('chart.tooltips')[i](i));
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[i]) == 'string') {
+ var text = String(obj.Get('chart.tooltips')[i]);
+
+ } else {
+ var text = null;
+ }
+
+ if (typeof(text) == 'string' && text.length) {
+
+ overHotspot = true;
+ obj.canvas.style.cursor = 'pointer';
+
+ RGraph.Clear(obj.canvas);
+ obj.Draw();
+
+ if (obj.Get('chart.tooltips.highlight')) {
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'gray';
+ obj.context.fillStyle = 'white';
+ obj.context.arc(xCoord, yCoord, 2, 0, 6.28, 0);
+ obj.context.fill();
+ obj.context.stroke();
+ }
+
+ RGraph.Tooltip(obj.canvas, text, e.pageX, e.pageY, idx);
+ }
+ } else if (RGraph.Registry.Get('chart.tooltip') && RGraph.Registry.Get('chart.tooltip').__index__ == idx) {
+ overHotspot = true;
+ obj.canvas.style.cursor = 'pointer';
+ }
+ }
+ }
+
+ if (!overHotspot) {
+ obj.canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+ }
+
+
+ /**
+ * Gets the coordinates for a particular mark
+ *
+ * @param number i The index of the data (ie which one it is)
+ * @return array A two element array of the coordinates
+ */
+ RGraph.Tradar.prototype.GetCoordinates = function (i)
+ {
+ // The number of data points
+ var len = this.data.length;
+
+ // The magnitude of the data (NOT the x/y coords)
+ var mag = (this.data[i] / this.max) * (this.size / 2);
+
+ /**
+ * Get the angle
+ */
+ var angle = (6.28 / len) * i; // In radians
+
+ /**
+ * Work out the X/Y coordinates
+ */
+ var x = Math.cos(angle) * mag;
+ var y = Math.sin(angle) * mag;
+
+ /**
+ * Put the coordinate in the right quadrant
+ */
+ x = this.centerx + x;
+ y = this.centery + (i == 0 ? 0 : y);
+
+ return [x,y];
+ }
+
+
+ /**
+ * This function adds the labels to the chart
+ */
+ RGraph.Tradar.prototype.DrawLabels = function ()
+ {
+ var labels = this.Get('chart.labels');
+
+ if (labels && labels.length > 0) {
+
+ this.context.lineWidth = 1;
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ var offsetx = this.Get('chart.labels.offsetx'); // Not used yet
+ var offsety = this.Get('chart.labels.offsety'); // Not used yet
+
+ for (var i=0; i<labels.length; ++i) {
+
+ var x = this.coords[i][0];
+ var y = this.coords[i][1];
+ var text = labels[i];
+ var hAlign = 'center';
+ var vAlign = 'center';
+ var quartile = (i / this.coords.length);
+ var offsetx = this.Get('chart.labels.offsetx');
+ var offsety = this.Get('chart.labels.offsety');
+
+ // ~Manually do labels on the right middle axis
+ if (i == 0) {
+ hAlign = 'left';
+ vAlign = 'center';
+ x += offsetx;
+
+ } else {
+
+ hAlign = (x < this.centerx) ? 'right' : 'left';
+ vAlign = (y < this.centery) ? 'bottom' : 'top';
+ x += (x < this.centerx) ? (-1 * offsetx) : offsetx;
+ y += (y < this.centery) ? (-1 * offsety) : offsety;
+
+ if (i / this.data.length == 0.25) { x -= offsetx; hAlign = 'center';
+ } else if (i / this.data.length == 0.5) { y -= offsety; vAlign = 'center';
+ } else if (i / this.data.length == 0.75) { x += offsetx; hAlign = 'center'; }
+ }
+
+ // context, font, size, x, y, text
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size'), x, y, text, vAlign, hAlign, true, null, 'white');
+ }
+ }
+ }
+
+
+ /**
+ * Draws the circle. No arguments as it gets the information from the object properties.
+ */
+ RGraph.Tradar.prototype.DrawCircle = function ()
+ {
+ var circle = {};
+ circle.limit = this.Get('chart.circle');
+ circle.fill = this.Get('chart.circle.fill');
+ circle.stroke = this.Get('chart.circle.stroke');
+
+ if (circle.limit) {
+
+ var r = (circle.limit / this.max) * (this.size / 2);
+
+ this.context.fillStyle = circle.fill;
+ this.context.strokeStyle = circle.stroke;
+
+ this.context.beginPath();
+ this.context.arc(this.centerx, this.centery, r, 0, 6.28, 0);
+ this.context.fill();
+ this.context.stroke();
+ }
+ }
+
+
+ /**
+ * Unsuprisingly, draws the labels
+ */
+ RGraph.Tradar.prototype.DrawAxisLabels = function ()
+ {
+ this.context.lineWidth = 1;
+
+ // Set the color to black
+ this.context.fillStyle = 'black';
+ this.context.strokeStyle = 'black';
+
+ var r = (this.size/ 2);
+ var font_face = this.Get('chart.text.font');
+ var font_size = this.Get('chart.text.size');
+ var context = this.context;
+ var axes = this.Get('chart.labels.axes').toLowerCase();
+ var color = 'rgba(255,255,255,0.8)';
+
+ // The "North" axis labels
+ if (axes.indexOf('n') > -1) {
+ RGraph.Text(context,font_face,font_size,this.centerx,this.centery - (r * 0.2),String(this.scale[0]),'center','center',true,false,color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - (r * 0.4), String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - (r * 0.6), String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - (r * 0.8), String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery - r, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "South" axis labels
+ if (axes.indexOf('s') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + (r * 0.2), String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + (r * 0.4), String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + (r * 0.6), String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + (r * 0.8), String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery + r, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "East" axis labels
+ if (axes.indexOf('e') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx + (r * 0.2), this.centery, String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + (r * 0.4), this.centery, String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + (r * 0.6), this.centery, String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + (r * 0.8), this.centery, String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx + r, this.centery, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ // The "West" axis labels
+ if (axes.indexOf('w') > -1) {
+ RGraph.Text(context, font_face, font_size, this.centerx - (r * 0.2), this.centery, String(this.scale[0]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - (r * 0.4), this.centery, String(this.scale[1]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - (r * 0.6), this.centery, String(this.scale[2]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - (r * 0.8), this.centery, String(this.scale[3]), 'center', 'center', true, false, color);
+ RGraph.Text(context, font_face, font_size, this.centerx - r, this.centery, String(this.scale[4]), 'center', 'center', true, false, color);
+ }
+
+ RGraph.Text(context, font_face, font_size, this.centerx, this.centery, '0', 'center', 'center', true, false, color);
+ }
\ No newline at end of file
--- /dev/null
+ /**
+ * o------------------------------------------------------------------------------o
+ * | This file is part of the RGraph package - you can learn more at: |
+ * | |
+ * | http://www.rgraph.net |
+ * | |
+ * | This package is licensed under the RGraph license. For all kinds of business |
+ * | purposes there is a small one-time licensing fee to pay and for non |
+ * | commercial purposes it is free to use. You can read the full license here: |
+ * | |
+ * | http://www.rgraph.net/LICENSE.txt |
+ * o------------------------------------------------------------------------------o
+ */
+
+ if (typeof(RGraph) == 'undefined') RGraph = {};
+
+ /**
+ * The progress bar constructor
+ *
+ * @param int id The ID of the canvas tag
+ * @param int value The indicated value of the meter.
+ * @param int max The end value (the upper most) of the meter
+ */
+ RGraph.VProgress = function (id, value, max)
+ {
+ this.id = id;
+ this.max = max;
+ this.value = value;
+ this.canvas = document.getElementById(id);
+ this.context = this.canvas.getContext('2d');
+ this.canvas.__object__ = this;
+ this.type = 'vprogress';
+ this.coords = [];
+ this.isRGraph = true;
+
+
+ /**
+ * Compatibility with older browsers
+ */
+ RGraph.OldBrowserCompat(this.context);
+
+ this.properties = {
+ 'chart.colors': ['#0c0'],
+ 'chart.tickmarks': true,
+ 'chart.tickmarks.color': 'black',
+ 'chart.tickmarks.inner': false,
+ 'chart.gutter': 25,
+ 'chart.numticks': 10,
+ 'chart.numticks.inner': 50,
+ 'chart.background.color': '#eee',
+ 'chart.shadow': false,
+ 'chart.shadow.color': 'rgba(0,0,0,0.5)',
+ 'chart.shadow.blur': 3,
+ 'chart.shadow.offsetx': 3,
+ 'chart.shadow.offsety': 3,
+ 'chart.title': '',
+ 'chart.title.background': null,
+ 'chart.title.hpos': null,
+ 'chart.title.vpos': null,
+ 'chart.width': 0,
+ 'chart.height': 0,
+ 'chart.text.size': 10,
+ 'chart.text.color': 'black',
+ 'chart.text.font': 'Verdana',
+ 'chart.contextmenu': null,
+ 'chart.units.pre': '',
+ 'chart.units.post': '',
+ 'chart.tooltips': [],
+ 'chart.tooltips.effect': 'fade',
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
+ 'chart.tooltips.highlight': true,
+ 'chart.tooltips.coords.adjust': [0,0],
+ 'chart.annotatable': false,
+ 'chart.annotate.color': 'black',
+ 'chart.zoom.mode': 'canvas',
+ 'chart.zoom.factor': 1.5,
+ 'chart.zoom.fade.in': true,
+ 'chart.zoom.fade.out': true,
+ 'chart.zoom.hdir': 'right',
+ 'chart.zoom.vdir': 'down',
+ 'chart.zoom.frames': 10,
+ 'chart.zoom.delay': 50,
+ 'chart.zoom.shadow': true,
+ 'chart.zoom.background': true,
+ 'chart.zoom.action': 'zoom',
+ 'chart.arrows': false,
+ 'chart.margin': 0,
+ 'chart.resizable': false,
+ 'chart.label.inner': false,
+ 'chart.labels.count': 10,
+ 'chart.labels.position': 'right',
+ 'chart.adjustable': false,
+ 'chart.min': 0,
+ 'chart.scale.decimals': 0
+ }
+
+ // Check for support
+ if (!this.canvas) {
+ alert('[PROGRESS] No canvas support');
+ return;
+ }
+
+ // Check the common library has been included
+ if (typeof(RGraph) == 'undefined') {
+ alert('[PROGRESS] Fatal error: The common library does not appear to have been included');
+ }
+ }
+
+
+ /**
+ * A generic setter
+ *
+ * @param string name The name of the property to set
+ * @param string value The value of the poperty
+ */
+ RGraph.VProgress.prototype.Set = function (name, value)
+ {
+ this.properties[name.toLowerCase()] = value;
+ }
+
+
+ /**
+ * A generic getter
+ *
+ * @param string name The name of the property to get
+ */
+ RGraph.VProgress.prototype.Get = function (name)
+ {
+ return this.properties[name.toLowerCase()];
+ }
+
+
+ /**
+ * Draws the progress bar
+ */
+ RGraph.VProgress.prototype.Draw = function ()
+ {
+ /**
+ * Fire the onbeforedraw event
+ */
+ RGraph.FireCustomEvent(this, 'onbeforedraw');
+
+ /**
+ * Clear all of this canvases event handlers (the ones installed by RGraph)
+ */
+ RGraph.ClearEventListeners(this.id);
+
+ // Figure out the width and height
+ this.width = this.canvas.width - (2 * this.Get('chart.gutter'));
+ this.height = this.canvas.height - (2 * this.Get('chart.gutter'));
+ this.coords = [];
+
+ this.Drawbar();
+ this.DrawTickMarks();
+ this.DrawLabels();
+
+ this.context.stroke();
+ this.context.fill();
+
+ /**
+ * Setup the context menu if required
+ */
+ if (this.Get('chart.contextmenu')) {
+ RGraph.ShowContext(this);
+ }
+
+ /**
+ * Alternatively, show the tooltip if requested
+ */
+ if (typeof(this.Get('chart.tooltips')) == 'function' || this.Get('chart.tooltips').length) {
+
+ // Need to register this object for redrawing
+ RGraph.Register(this);
+
+ /**
+ * Install the window onclick handler
+ */
+ window.onclick = function ()
+ {
+ RGraph.Redraw();
+ }
+
+
+ /**
+ * Install the onclick event handler for the tooltips
+ */
+ //this.canvas.onclick = function (e)
+ var canvas_onclick_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Redraw the graph first, in effect resetting the graph to as it was when it was first drawn
+ * This "deselects" any already selected bar
+ */
+ RGraph.Redraw();
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0] - obj.Get('chart.tooltips.coords.adjust')[0];
+ var mouseY = mouseCoords[1] - obj.Get('chart.tooltips.coords.adjust')[1];
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+ var idx = i;
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+
+ /**
+ * Get the tooltip text
+ */
+ if (typeof(obj.Get('chart.tooltips')) == 'function') {
+ var text = obj.Get('chart.tooltips')(idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[idx]) == 'function') {
+ var text = obj.Get('chart.tooltips')[idx](idx);
+
+ } else if (typeof(obj.Get('chart.tooltips')) == 'object') {
+ var text = obj.Get('chart.tooltips')[idx];
+
+ } else {
+ var text = null;
+ }
+
+ /**
+ * Show a tooltip if it's defined
+ */
+ if (text) {
+
+ obj.context.beginPath();
+ obj.context.strokeStyle = 'black';
+ obj.context.fillStyle = 'rgba(255,255,255,0.5)';
+ obj.context.strokeRect(left, top, width, height);
+ obj.context.fillRect(left, top, width, height);
+
+ obj.context.stroke();
+ obj.context.fill();
+
+ RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);
+ }
+ }
+ }
+
+ /**
+ * Stop the event bubbling
+ */
+ e.stopPropagation();
+ }
+ this.canvas.addEventListener('click', canvas_onclick_func, false);
+ RGraph.AddEventListener(this.id, 'click', canvas_onclick_func);
+
+
+ /**
+ * If the cursor is over a hotspot, change the cursor to a hand
+ */
+ //this.canvas.onmousemove = function (e)
+ var canvas_onmousemove_func = function (e)
+ {
+ e = RGraph.FixEventObject(e);
+
+ var canvas = document.getElementById(this.id);
+ var obj = canvas.__object__;
+
+ /**
+ * Get the mouse X/Y coordinates
+ */
+ var mouseCoords = RGraph.getMouseXY(e);
+
+ /**
+ * Loop through the bars determining if the mouse is over a bar
+ */
+ for (var i=0; i<obj.coords.length; i++) {
+
+ var mouseX = mouseCoords[0] - obj.Get('chart.tooltips.coords.adjust')[0]; // In relation to the canvas
+ var mouseY = mouseCoords[1] - obj.Get('chart.tooltips.coords.adjust')[1]; // In relation to the canvas
+ var left = obj.coords[i][0];
+ var top = obj.coords[i][1];
+ var width = obj.coords[i][2];
+ var height = obj.coords[i][3];
+
+ if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
+ canvas.style.cursor = 'pointer';
+ break;
+ }
+
+ canvas.style.cursor = 'default';
+ }
+ }
+ this.canvas.addEventListener('mousemove', canvas_onmousemove_func, false);
+ RGraph.AddEventListener(this.id, 'mousemove', canvas_onmousemove_func);
+ }
+
+ /**
+ * If the canvas is annotatable, do install the event handlers
+ */
+ if (this.Get('chart.annotatable')) {
+ RGraph.Annotate(this);
+ }
+
+ /**
+ * This bit shows the mini zoom window if requested
+ */
+ if (this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area') {
+ RGraph.ShowZoomWindow(this);
+ }
+
+
+ /**
+ * This function enables resizing
+ */
+ if (this.Get('chart.resizable')) {
+ RGraph.AllowResizing(this);
+ }
+
+ /**
+ * Instead of using RGraph.common.adjusting.js, handle them here
+ */
+ if (this.Get('chart.adjustable')) {
+ RGraph.AllowAdjusting(this);
+ }
+
+ /**
+ * Fire the RGraph ondraw event
+ */
+ RGraph.FireCustomEvent(this, 'ondraw');
+ }
+
+
+ /**
+ * Draw the bar itself
+ */
+ RGraph.VProgress.prototype.Drawbar = function ()
+ {
+ // Set a shadow if requested
+ if (this.Get('chart.shadow')) {
+ RGraph.SetShadow(this, this.Get('chart.shadow.color'), this.Get('chart.shadow.offsetx'), this.Get('chart.shadow.offsety'), this.Get('chart.shadow.blur'));
+ }
+
+ // Draw the shadow for MSIE
+ if (document.all && this.Get('chart.shadow')) {
+ this.context.fillStyle = this.Get('chart.shadow.color');
+ this.context.fillRect(this.Get('chart.gutter') + this.Get('chart.shadow.offsetx'), this.Get('chart.gutter') + this.Get('chart.shadow.offsety'), this.width, this.height);
+ }
+
+ // Draw the outline
+ this.context.fillStyle = this.Get('chart.background.color');
+ this.context.strokeStyle = 'black';
+ this.context.strokeRect(this.Get('chart.gutter'), this.Get('chart.gutter'), this.width, this.height);
+ this.context.fillRect(this.Get('chart.gutter'), this.Get('chart.gutter'), this.width, this.height);
+
+ // Turn off any shadow
+ RGraph.NoShadow(this);
+
+ this.context.strokeStyle = 'black';
+ this.context.fillStyle = this.Get('chart.colors')[0];
+ var margin = this.Get('chart.margin');
+ var barHeight = this.canvas.height - this.Get('chart.gutter') - this.Get('chart.gutter');
+
+ // Draw the actual bar itself
+ if (typeof(this.value) == 'number') {
+
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = '#999';
+
+ } else if (typeof(this.value) == 'object') {
+
+ this.context.beginPath();
+ this.context.strokeStyle = '#999';
+
+ var startPoint = this.canvas.height - this.Get('chart.gutter');
+
+ for (var i=0; i<this.value.length; ++i) {
+
+ var segmentHeight = ( (this.value[i] - this.Get('chart.min')) / (this.max - this.Get('chart.min')) ) * barHeight;
+
+ this.context.fillStyle = this.Get('chart.colors')[i];
+
+ this.context.fillRect(this.Get('chart.gutter') + margin, startPoint - segmentHeight, this.width - margin - margin, segmentHeight);
+ this.context.strokeRect(this.Get('chart.gutter') + margin, startPoint - segmentHeight, this.width - margin - margin, segmentHeight);
+
+
+ // Store the coords
+ this.coords.push([this.Get('chart.gutter') + margin, startPoint - segmentHeight, this.width - margin - margin, segmentHeight]);
+
+ startPoint -= segmentHeight;
+ }
+
+ }
+
+ /**
+ * Inner tickmarks
+ */
+ if (this.Get('chart.tickmarks.inner')) {
+
+ var spacing = (this.canvas.height - this.Get('chart.gutter') - this.Get('chart.gutter')) / this.Get('chart.numticks.inner');
+
+ this.context.lineWidth = 1;
+ this.context.strokeStyle = '#999';
+
+ this.context.beginPath();
+
+ for (var y = this.Get('chart.gutter'); y<this.canvas.height - this.Get('chart.gutter'); y+=spacing) {
+ this.context.moveTo(this.Get('chart.gutter'), y);
+ this.context.lineTo(this.Get('chart.gutter') + 3, y);
+
+ this.context.moveTo(this.canvas.width - this.Get('chart.gutter'), y);
+ this.context.lineTo(this.canvas.width - this.Get('chart.gutter') - 3, y);
+ }
+
+ this.context.stroke();
+ }
+
+ /**
+ * Draw the actual bar
+ */
+ var barHeight = Math.min(this.height, ( (this.value - this.Get('chart.min')) / (this.max - this.Get('chart.min')) ) * this.height);
+
+ this.context.beginPath();
+ this.context.strokeStyle = 'black';
+
+ if (typeof(this.value) == 'number') {
+ this.context.strokeRect(this.Get('chart.gutter') + margin, this.Get('chart.gutter') + this.height - barHeight, this.width - margin - margin, barHeight);
+ this.context.fillRect(this.Get('chart.gutter') + margin, this.Get('chart.gutter') + this.height - barHeight, this.width - margin - margin, barHeight);
+ }
+
+
+ /**
+ * Draw the arrows indicating the level if requested
+ */
+ if (this.Get('chart.arrows')) {
+ var x = this.Get('chart.gutter') - 4;
+ var y = this.canvas.height - this.Get('chart.gutter') - barHeight;
+
+ this.context.lineWidth = 1;
+ this.context.fillStyle = 'black';
+ this.context.strokeStyle = 'black';
+
+ this.context.beginPath();
+ this.context.moveTo(x, y);
+ this.context.lineTo(x - 4, y - 2);
+ this.context.lineTo(x - 4, y + 2);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+
+ x += this.width + 8;
+
+ this.context.beginPath();
+ this.context.moveTo(x, y);
+ this.context.lineTo(x + 4, y - 2);
+ this.context.lineTo(x + 4, y + 2);
+ this.context.closePath();
+
+ this.context.stroke();
+ this.context.fill();
+ }
+
+
+
+
+ /**
+ * Draw the "in-bar" label
+ */
+ if (this.Get('chart.label.inner')) {
+ this.context.beginPath();
+ this.context.fillStyle = 'black';
+ RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size') + 2, this.canvas.width / 2, this.canvas.height - this.Get('chart.gutter') - barHeight - 5, String(this.Get('chart.units.pre') + this.value + this.Get('chart.units.post')), 'bottom', 'center');
+ this.context.fill();
+ }
+
+
+ // Store the coords
+ this.coords.push([this.Get('chart.gutter') + margin, this.Get('chart.gutter') + this.height - barHeight, this.width - margin - margin, barHeight]);
+ }
+
+ /**
+ * The function that draws the tick marks. Apt name...
+ */
+ RGraph.VProgress.prototype.DrawTickMarks = function ()
+ {
+ var gutter = this.Get('chart.gutter');
+
+ this.context.strokeStyle = this.Get('chart.tickmarks.color');
+
+ if (this.Get('chart.tickmarks')) {
+
+ var startX = this.Get('chart.labels.position') == 'left' ? (gutter - 4) : (this.canvas.width - gutter);
+ var endX = this.Get('chart.labels.position') == 'left' ? gutter : this.canvas.width - gutter + 4;
+
+ this.tickInterval = this.height / this.Get('chart.numticks');
+
+ this.context.beginPath();
+ for (var i=gutter; i<=(this.canvas.height - gutter - this.tickInterval); i+=this.tickInterval) {
+ this.context.moveTo(startX, i);
+ this.context.lineTo(endX, i);
+ }
+ }
+
+ // Not necessary ???
+ //this.context.stroke();
+ }
+
+
+ /**
+ * The function that draws the labels
+ */
+ RGraph.VProgress.prototype.DrawLabels = function ()
+ {
+ this.context.fillStyle = this.Get('chart.text.color');
+
+ var context = this.context;
+ var gutter = this.Get('chart.gutter');
+ var position = this.Get('chart.labels.position');
+ var xAlignment = position == 'left' ? 'right' : 'left';
+ var yAlignment = 'center';
+ var count = this.Get('chart.labels.count');
+ var units_pre = this.Get('chart.units.pre');
+ var units_post = this.Get('chart.units.post');
+ var text_size = this.Get('chart.text.size');
+ var text_font = this.Get('chart.text.font');
+
+ if (this.Get('chart.tickmarks')) {
+ for (var i=0; i<count ; ++i) {
+
+ var text = String(
+ ((( (this.max - this.Get('chart.min')) / count) * (count - i)) + this.Get('chart.min')).toFixed(this.Get('chart.scale.decimals'))
+ );
+
+ RGraph.Text(context, text_font, text_size, position == 'left' ? (gutter - 5) : (this.canvas.width - gutter + 5), (((this.canvas.height - (2 * gutter)) / count) * i) + gutter, units_pre + text + units_post, yAlignment, xAlignment);
+ }
+
+ if (this.Get('chart.min') != 0) {
+ RGraph.Text(context, text_font, text_size, position == 'left' ? (gutter - 5) : (this.canvas.width - gutter + 5), this.canvas.height - gutter, units_pre + String(this.Get('chart.min').toFixed(this.Get('chart.scale.decimals'))) + units_post, yAlignment, xAlignment);
+ }
+ }
+
+ // Draw the title text
+ if (this.Get('chart.title')) {
+ RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'), 0, this.Get('chart.text.size') + 2);
+ }
+ }
\ No newline at end of file
--- /dev/null
+<HEAD>
+<SCRIPT LANGUAGE="JavaScript">
+<!-- Beginning of JavaScript -
+
+var timeout;
+var x = 0;
+var step = 2;
+
+function start1(){
+if (x < 0){
+x=0;
+}
+
+window.parent.menu.scroll(x,0);
+x=x + step;
+timeout=setTimeout("start1()",50);
+}
+
+function start2(){
+if (x >=0 ){
+window.parent.menu.scroll(x,0);
+x = x - step;
+}
+
+timeout=setTimeout("start2()",50);
+}
+
+function stop1(){
+clearTimeout(timeout);
+}
+
+function top1(){
+window.parent.menu.scroll(0,0);
+x=0;
+}
+
+
+// - End of JavaScript - -->
+</SCRIPT>
+</HEAD>
+<Style>
+body {overflow-y:hidden;
+ background-color: #4d4c48;
+ color: white;}
+
+td {font-family:arial, helvetica; font-size:12px; font-weight:bold;}
+</style>
+<div name="b">
+<table border=0 ALIGN=center>
+<tr>
+<td ALIGN=center>
+<img src="./icons/weather.png" onMouseover="stop()" target="main" a href="www.weatherunderground.com">
+</td>
+<td ALIGN=center>
+<img src="./other_icons/lighting.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./other_icons/audio.png" onMouseover="stop()">
+</td>
+
+<td ALIGN=center>
+<img src="./other_icons/cameras.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./icons/weather.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./other_icons/climate.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./other_icons/events.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./icons/weather.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./icons/light.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./icons/music.png" onMouseover="stop()">
+</td>
+<td ALIGN=center>
+<img src="./other_icons/power.png" onMouseover="stop()">
+</td>
+</tr>
+<tr>
+<td ALIGN=center>
+Weather
+</td>
+<td ALIGN=center>
+Lighting
+</td>
+<td ALIGN=center>
+Music
+</td>
+<td ALIGN=center>
+Cameras
+</td>
+<td ALIGN=center>
+Security
+</td>
+<td ALIGN=center>
+Climate
+</td>
+<td ALIGN=center>
+News
+</td>
+<td ALIGN=center>
+Receipes
+</td>
+<td ALIGN=center>
+Groceries
+</td>
+<td ALIGN=center>
+Traffic
+</td>
+<td ALIGN=center>
+Power
+</td>
+
+</tr>
+
+
+</table>
+</div>
\ No newline at end of file
--- /dev/null
+MIDDLE ACTIONS
--- /dev/null
+<table border=0 valign=top>
+<tr valign=top><td>
+<script type="text/javascript" src="http://p3k.org/rss/proxy.r?textColor=black&align=&width=200&fontFace=&url=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_topstories.rss&compact=true&frameColor=black&showXmlButton=&boxFillColor=white&_=1300638062855&titleBarColor=lightblue&maxItems=5&titleBarTextColor=%23ffffff&"></script>
+</td><td>
+<script type="text/javascript" src="http://p3k.org/rss/proxy.r?textColor=black&width=200&align=&fontFace=&url=http%3A%2F%2Frss.slashdot.org%2FSlashdot%2Fslashdot&frameColor=black&compact=true&showXmlButton=&boxFillColor=white&_=1300638339827&titleBarColor=lightblue&maxItems=5&titleBarTextColor=%23ffffff&"></script>
+</td><td>
+<script type="text/javascript" src="http://p3k.org/rss/proxy.r?textColor=black&align=&width=200&fontFace=&url=http%3A%2F%2Ffeeds.arstechnica.com%2Farstechnica%2Findex%2F&compact=true&frameColor=black&showXmlButton=&boxFillColor=white&_=1300638801947&titleBarColor=lightblue&maxItems=5&titleBarTextColor=%23ffffff&"></script>
+</td><td>
+<script type="text/javascript" src="http://p3k.org/rss/proxy.r?textColor=black&width=200&align=&fontFace=&url=http%3A%2F%2Fwww.npr.org%2Frss%2Frss.php%3Fid%3D1001&frameColor=black&compact=true&showXmlButton=&boxFillColor=white&_=1300638604842&titleBarColor=lightblue&maxItems=5&titleBarTextColor=%23ffffff&"></script>
+</td></tr>
+</table>
--- /dev/null
+<?
+
+include("xml2array.php");
+
+$cnnrss = curl_init();
+$nprrss = curl_init();
+$slashdotrss = curl_init();
+$arsrss = curl_init();
+
+curl_setopt($cnnrss, CURLOPT_URL,"http://rss.cnn.com/rss/cnn_topstories.rss");
+curl_setopt($slashdotrss, CURLOPT_URL,"http://rss.slashdot.org/Slashdot/slashdot");
+curl_setopt($arsrss, CURLOPT_URL,"http://feeds.arstechnica.com/arstechnica/index/");
+curl_setopt($nprrss, CURLOPT_URL,"http://www.npr.org/rss/rss.php?id=1001");
+
+
+curl_setopt($cnnrss, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($slashdotrss, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($arsrss, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($nprrss, CURLOPT_RETURNTRANSFER, 1);
+#curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+#curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+$output = curl_exec($cnnrss);
+$output2 = curl_exec($slashdotrss);
+$output3 = curl_exec($arsrss);
+$output4 = curl_exec($nprrss);
+
+#echo "<pre>";
+$array=xml2array($output);
+$array2=xml2array($output2);
+$array3=xml2array($output3);
+$array4=xml2array($output4);
+#print_r($array4);
+
+#exit();
+
+#echo "<center>";
+echo "<table border=1 width='75%'>";
+ echo "<tr bgcolor='SlateGrey ' align='center'><td><b>".$array['rss']['channel']['title']."</b></td><td><b>".$array2['rdf:RDF']['channel']['title']."</b></td><td><b>".$array3['rss']['channel']['title']."</b></td><td><b>".$array4['rss']['channel']['title']."</b></td></tr>";
+ echo "<tr><td>".$array['rss']['channel']['item']['0']['title']."</td><td>".$array2['rdf:RDF']['item']['0']['title']."</td><td>".$array3['rss']['channel']['item']['0']['title']."</td><td>".$array4['rss']['channel']['item']['0']['title']."</td></tr>";
+ echo "<tr><td>".$array['rss']['channel']['item']['1']['title']."</td><td>".$array2['rdf:RDF']['item']['1']['title']."</td><td>".$array3['rss']['channel']['item']['1']['title']."</td><td>".$array4['rss']['channel']['item']['1']['title']."</td></tr>";
+ echo "<tr><td>".$array['rss']['channel']['item']['2']['title']."</td><td>".$array2['rdf:RDF']['item']['2']['title']."</td><td>".$array3['rss']['channel']['item']['2']['title']."</td><td>".$array4['rss']['channel']['item']['2']['title']."</td></tr>";
+ echo "<tr><td>".$array['rss']['channel']['item']['3']['title']."</td><td>".$array2['rdf:RDF']['item']['3']['title']."</td><td>".$array3['rss']['channel']['item']['3']['title']."</td><td>".$array4['rss']['channel']['item']['3']['title']."</td></tr>";
+ echo "<tr><td>".$array['rss']['channel']['item']['4']['title']."</td><td>".$array2['rdf:RDF']['item']['4']['title']."</td><td>".$array3['rss']['channel']['item']['4']['title']."</td><td>".$array4['rss']['channel']['item']['4']['title']."</td></tr>";
+echo "</table>";
+#echo "</center>";
+?>
--- /dev/null
+<?php\r
+\r
+/*\r
+ * pxWeather - PHP/XML Weather Retrieval\r
+ * by Jonathan Abbett\r
+ * jonathan[at]abbett[dot]org\r
+ *\r
+ *\r
+ *\r
+ */\r
+\r
+require_once("xmlize-php5.inc.php");\r
+\r
+/*\r
+** Constants\r
+*/\r
+define("PXWEATHER_URL", 0); // to set $_url\r
+define("PXWEATHER_CACHE", 1); // to set $_cache\r
+define("PXWEATHER_CACHEFOR", 2); // to set $_age\r
+define("PXWEATHER_CACHEAT", 3); // to set $_cachepath\r
+\r
+class Weather {\r
+\r
+\r
+ // The URL from whence to retreive XML weather data\r
+ var $_url = "http://www.weather.unisys.com/forexml.cgi";\r
+ // If true, will use a local file cache\r
+ var $_cache = false;\r
+ // How many minutes to keep the cached data\r
+ var $_age = 60;\r
+ // If cache-enabled, use this directory for storing data\r
+ var $_cachepath = "cache";\r
+\r
+\r
+\r
+\r
+ var $_xml = null; // to store our xml array\r
+ var $_city = "boston"; // The city we're interested in\r
+ var $_force = false; // If true, will override the cache and fetch data fresh\r
+\r
+\r
+ /*\r
+ ** Constructor\r
+ */\r
+ function Weather($city = "Boston", $force = false) {\r
+\r
+ $this->_city = $city;\r
+ $this->_force = $force;\r
+\r
+ }\r
+\r
+ function setOption($option, $value) {\r
+\r
+ switch($option) {\r
+ case EASYWEATHER_URL:\r
+ $this->_url = $value;\r
+ break;\r
+ case EASYWEATHER_CACHE:\r
+ $this->_cache = $value;\r
+ break;\r
+ case EASYWEATHER_CACHEFOR:\r
+ $this->_age = $value;\r
+ break;\r
+ case EASYWEATHER_CACHEAT:\r
+ $this->_cachepath = $value;\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
+ /*\r
+ ** Return a pretty-printed version of the XML array\r
+ */\r
+ function toString($array = null) {\r
+\r
+ if ($array == null) {\r
+ $array = $this->_xml;\r
+ }\r
+\r
+ echo "<pre>";\r
+ print_r($array);\r
+ echo "</pre>";\r
+ }\r
+\r
+ /*\r
+ ** Return a specific field from the current weather report\r
+ */\r
+ function getCurrent($field) {\r
+ $o = $this->_getObservation();\r
+\r
+ if (array_key_exists($field, $o)) {\r
+ return $o[$field];\r
+ }\r
+ else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+ function getSunrise() {\r
+ $a = $this->_getAlmanac();\r
+\r
+ return $a["sunrise"];\r
+ }\r
+\r
+ function getSunset() {\r
+ $a = $this->_getAlmanac();\r
+\r
+ return $a["sunset"];\r
+ }\r
+\r
+ function getForecasts() {\r
+\r
+ // need to remove a layer of separation\r
+\r
+ $forecasts = $this->_xml["forexml"]["#"]["forecast"];\r
+\r
+ $returnArray = array();\r
+\r
+ $i = 0;\r
+\r
+ foreach ($forecasts as $forecast) {\r
+ $returnArray[$i] = $forecast["@"];\r
+ $i++;\r
+ }\r
+\r
+ return $returnArray;\r
+\r
+ }\r
+\r
+ function getDaycasts() {\r
+\r
+ // need to remove a layer of separation\r
+\r
+ $daycasts = $this->_xml["forexml"]["#"]["daycast"];\r
+\r
+ $returnArray = array();\r
+\r
+ $i = 0;\r
+\r
+ foreach ($daycasts as $daycast) {\r
+ $returnArray[$i] = $daycast["@"];\r
+ $i++;\r
+ }\r
+\r
+ return $returnArray;\r
+ }\r
+\r
+ /*\r
+ ** Returns a weather condition string given a code (i.e 'TS')\r
+ */\r
+ function weatherString($code) {\r
+\r
+ switch($code) {\r
+ case "TS":\r
+ return "Thunderstorms";\r
+ break;\r
+ case "RA":\r
+ return "Rain";\r
+ break;\r
+ case "MC":\r
+ return "Mostly cloudy";\r
+ break;\r
+ case "SU":\r
+ return "Sunny";\r
+ break;\r
+ case "MO":\r
+ return "Mostly clear";\r
+ break;\r
+ case "PC":\r
+ return "Partly cloudy";\r
+ break;\r
+ case "SN":\r
+ return "Snow";\r
+ break;\r
+ case "CL":\r
+ return "Overcast";\r
+ break;\r
+ case "FG":\r
+ return "Fog";\r
+ break;\r
+ }\r
+\r
+ return null;\r
+\r
+ }\r
+\r
+ function load() {\r
+\r
+ $filename = "$this->_cachepath/weather.$this->_city.cache";\r
+\r
+ // if not force, check cache for valid file\r
+ if (!$this->_force && $this->_cache) {\r
+\r
+ if (file_exists($filename)\r
+ && filemtime($filename) > (time() - ($this->_age * 60))) {\r
+\r
+ $file = fopen($filename, "r");\r
+ $this->_xml = unserialize(fread($file, filesize($filename)));\r
+ fclose($file);\r
+\r
+ return;\r
+ }\r
+ }\r
+\r
+ // if force, or no valid cache file, get XML fresh\r
+\r
+ $this->_xml = $this->_getXML();\r
+\r
+ if ($this->_cache) {\r
+ $file = fopen($filename, "w");\r
+ fwrite($file, serialize($this->_xml));\r
+ fclose($file);\r
+ }\r
+\r
+ }\r
+\r
+ function _getXML() {\r
+\r
+ $ch = curl_init();\r
+ curl_setopt($ch, CURLOPT_URL, $this->_url . "?" . $this->_city);\r
+ curl_setopt($ch, CURLOPT_HEADER, false);\r
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r
+
+ #echo $this->_url . "?" . $this->_city;
+ #exit;
+
+ $xml = curl_exec($ch);\r
+\r
+ #print_r($xml);
+ #exit;
+
+ if (curl_errno($ch)) {\r
+ trigger_error("cURL Error in Weather._getXML: " . curl_error($ch), E_WARNING);\r
+ return null;\r
+ }\r
+\r
+ curl_close($ch);\r
+\r
+ return xmlize($xml);\r
+\r
+ }\r
+\r
+ function _getObservation() {\r
+\r
+ return $this->_xml["forexml"]["#"]["observation"][0]["@"];\r
+\r
+ }\r
+\r
+ // array with keys "sunrise" and "sunset"\r
+ function _getAlmanac() {\r
+\r
+ return $this->_xml["forexml"]["#"]["almanac"][0]["@"];\r
+ }\r
+\r
+}\r
+ \r
+?>
--- /dev/null
+ GNU GENERAL PUBLIC LICENSE\r
+ Version 2, June 1991\r
+\r
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+ Preamble\r
+\r
+ The licenses for most software are designed to take away your\r
+freedom to share and change it. By contrast, the GNU General Public\r
+License is intended to guarantee your freedom to share and change free\r
+software--to make sure the software is free for all its users. This\r
+General Public License applies to most of the Free Software\r
+Foundation's software and to any other program whose authors commit to\r
+using it. (Some other Free Software Foundation software is covered by\r
+the GNU Library General Public License instead.) You can apply it to\r
+your programs, too.\r
+\r
+ When we speak of free software, we are referring to freedom, not\r
+price. Our General Public Licenses are designed to make sure that you\r
+have the freedom to distribute copies of free software (and charge for\r
+this service if you wish), that you receive source code or can get it\r
+if you want it, that you can change the software or use pieces of it\r
+in new free programs; and that you know you can do these things.\r
+\r
+ To protect your rights, we need to make restrictions that forbid\r
+anyone to deny you these rights or to ask you to surrender the rights.\r
+These restrictions translate to certain responsibilities for you if you\r
+distribute copies of the software, or if you modify it.\r
+\r
+ For example, if you distribute copies of such a program, whether\r
+gratis or for a fee, you must give the recipients all the rights that\r
+you have. You must make sure that they, too, receive or can get the\r
+source code. And you must show them these terms so they know their\r
+rights.\r
+\r
+ We protect your rights with two steps: (1) copyright the software, and\r
+(2) offer you this license which gives you legal permission to copy,\r
+distribute and/or modify the software.\r
+\r
+ Also, for each author's protection and ours, we want to make certain\r
+that everyone understands that there is no warranty for this free\r
+software. If the software is modified by someone else and passed on, we\r
+want its recipients to know that what they have is not the original, so\r
+that any problems introduced by others will not reflect on the original\r
+authors' reputations.\r
+\r
+ Finally, any free program is threatened constantly by software\r
+patents. We wish to avoid the danger that redistributors of a free\r
+program will individually obtain patent licenses, in effect making the\r
+program proprietary. To prevent this, we have made it clear that any\r
+patent must be licensed for everyone's free use or not licensed at all.\r
+\r
+ The precise terms and conditions for copying, distribution and\r
+modification follow.\r
+\f\r
+ GNU GENERAL PUBLIC LICENSE\r
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+ 0. This License applies to any program or other work which contains\r
+a notice placed by the copyright holder saying it may be distributed\r
+under the terms of this General Public License. The "Program", below,\r
+refers to any such program or work, and a "work based on the Program"\r
+means either the Program or any derivative work under copyright law:\r
+that is to say, a work containing the Program or a portion of it,\r
+either verbatim or with modifications and/or translated into another\r
+language. (Hereinafter, translation is included without limitation in\r
+the term "modification".) Each licensee is addressed as "you".\r
+\r
+Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope. The act of\r
+running the Program is not restricted, and the output from the Program\r
+is covered only if its contents constitute a work based on the\r
+Program (independent of having been made by running the Program).\r
+Whether that is true depends on what the Program does.\r
+\r
+ 1. You may copy and distribute verbatim copies of the Program's\r
+source code as you receive it, in any medium, provided that you\r
+conspicuously and appropriately publish on each copy an appropriate\r
+copyright notice and disclaimer of warranty; keep intact all the\r
+notices that refer to this License and to the absence of any warranty;\r
+and give any other recipients of the Program a copy of this License\r
+along with the Program.\r
+\r
+You may charge a fee for the physical act of transferring a copy, and\r
+you may at your option offer warranty protection in exchange for a fee.\r
+\r
+ 2. You may modify your copy or copies of the Program or any portion\r
+of it, thus forming a work based on the Program, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+ a) You must cause the modified files to carry prominent notices\r
+ stating that you changed the files and the date of any change.\r
+\r
+ b) You must cause any work that you distribute or publish, that in\r
+ whole or in part contains or is derived from the Program or any\r
+ part thereof, to be licensed as a whole at no charge to all third\r
+ parties under the terms of this License.\r
+\r
+ c) If the modified program normally reads commands interactively\r
+ when run, you must cause it, when started running for such\r
+ interactive use in the most ordinary way, to print or display an\r
+ announcement including an appropriate copyright notice and a\r
+ notice that there is no warranty (or else, saying that you provide\r
+ a warranty) and that users may redistribute the program under\r
+ these conditions, and telling the user how to view a copy of this\r
+ License. (Exception: if the Program itself is interactive but\r
+ does not normally print such an announcement, your work based on\r
+ the Program is not required to print an announcement.)\r
+\f\r
+These requirements apply to the modified work as a whole. If\r
+identifiable sections of that work are not derived from the Program,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works. But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Program, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Program.\r
+\r
+In addition, mere aggregation of another work not based on the Program\r
+with the Program (or with a work based on the Program) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+ 3. You may copy and distribute the Program (or a work based on it,\r
+under Section 2) in object code or executable form under the terms of\r
+Sections 1 and 2 above provided that you also do one of the following:\r
+\r
+ a) Accompany it with the complete corresponding machine-readable\r
+ source code, which must be distributed under the terms of Sections\r
+ 1 and 2 above on a medium customarily used for software interchange; or,\r
+\r
+ b) Accompany it with a written offer, valid for at least three\r
+ years, to give any third party, for a charge no more than your\r
+ cost of physically performing source distribution, a complete\r
+ machine-readable copy of the corresponding source code, to be\r
+ distributed under the terms of Sections 1 and 2 above on a medium\r
+ customarily used for software interchange; or,\r
+\r
+ c) Accompany it with the information you received as to the offer\r
+ to distribute corresponding source code. (This alternative is\r
+ allowed only for noncommercial distribution and only if you\r
+ received the program in object code or executable form with such\r
+ an offer, in accord with Subsection b above.)\r
+\r
+The source code for a work means the preferred form of the work for\r
+making modifications to it. For an executable work, complete source\r
+code means all the source code for all modules it contains, plus any\r
+associated interface definition files, plus the scripts used to\r
+control compilation and installation of the executable. However, as a\r
+special exception, the source code distributed need not include\r
+anything that is normally distributed (in either source or binary\r
+form) with the major components (compiler, kernel, and so on) of the\r
+operating system on which the executable runs, unless that component\r
+itself accompanies the executable.\r
+\r
+If distribution of executable or object code is made by offering\r
+access to copy from a designated place, then offering equivalent\r
+access to copy the source code from the same place counts as\r
+distribution of the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\f\r
+ 4. You may not copy, modify, sublicense, or distribute the Program\r
+except as expressly provided under this License. Any attempt\r
+otherwise to copy, modify, sublicense or distribute the Program is\r
+void, and will automatically terminate your rights under this License.\r
+However, parties who have received copies, or rights, from you under\r
+this License will not have their licenses terminated so long as such\r
+parties remain in full compliance.\r
+\r
+ 5. You are not required to accept this License, since you have not\r
+signed it. However, nothing else grants you permission to modify or\r
+distribute the Program or its derivative works. These actions are\r
+prohibited by law if you do not accept this License. Therefore, by\r
+modifying or distributing the Program (or any work based on the\r
+Program), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Program or works based on it.\r
+\r
+ 6. Each time you redistribute the Program (or any work based on the\r
+Program), the recipient automatically receives a license from the\r
+original licensor to copy, distribute or modify the Program subject to\r
+these terms and conditions. You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties to\r
+this License.\r
+\r
+ 7. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License. If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Program at all. For example, if a patent\r
+license would not permit royalty-free redistribution of the Program by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Program.\r
+\r
+If any portion of this section is held invalid or unenforceable under\r
+any particular circumstance, the balance of the section is intended to\r
+apply and the section as a whole is intended to apply in other\r
+circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system, which is\r
+implemented by public license practices. Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\f\r
+ 8. If the distribution and/or use of the Program is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Program under this License\r
+may add an explicit geographical distribution limitation excluding\r
+those countries, so that distribution is permitted only in or among\r
+countries not thus excluded. In such case, this License incorporates\r
+the limitation as if written in the body of this License.\r
+\r
+ 9. The Free Software Foundation may publish revised and/or new versions\r
+of the General Public License from time to time. Such new versions will\r
+be similar in spirit to the present version, but may differ in detail to\r
+address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number. If the Program\r
+specifies a version number of this License which applies to it and "any\r
+later version", you have the option of following the terms and conditions\r
+either of that version or of any later version published by the Free\r
+Software Foundation. If the Program does not specify a version number of\r
+this License, you may choose any version ever published by the Free Software\r
+Foundation.\r
+\r
+ 10. If you wish to incorporate parts of the Program into other free\r
+programs whose distribution conditions are different, write to the author\r
+to ask for permission. For software which is copyrighted by the Free\r
+Software Foundation, write to the Free Software Foundation; we sometimes\r
+make exceptions for this. Our decision will be guided by the two goals\r
+of preserving the free status of all derivatives of our free software and\r
+of promoting the sharing and reuse of software generally.\r
+\r
+ NO WARRANTY\r
+\r
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\r
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\r
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\r
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
+REPAIR OR CORRECTION.\r
+\r
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGES.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\f\r
+ How to Apply These Terms to Your New Programs\r
+\r
+ If you develop a new program, and you want it to be of the greatest\r
+possible use to the public, the best way to achieve this is to make it\r
+free software which everyone can redistribute and change under these terms.\r
+\r
+ To do so, attach the following notices to the program. It is safest\r
+to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least\r
+the "copyright" line and a pointer to where the full notice is found.\r
+\r
+ <one line to give the program's name and a brief idea of what it does.>\r
+ Copyright (C) <year> <name of author>\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ This program is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with this program; if not, write to the Free Software\r
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+If the program is interactive, make it output a short notice like this\r
+when it starts in an interactive mode:\r
+\r
+ Gnomovision version 69, Copyright (C) year name of author\r
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
+ This is free software, and you are welcome to redistribute it\r
+ under certain conditions; type `show c' for details.\r
+\r
+The hypothetical commands `show w' and `show c' should show the appropriate\r
+parts of the General Public License. Of course, the commands you use may\r
+be called something other than `show w' and `show c'; they could even be\r
+mouse-clicks or menu items--whatever suits your program.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the program, if\r
+necessary. Here is a sample; alter the names:\r
+\r
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program\r
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.\r
+\r
+ <signature of Ty Coon>, 1 April 1989\r
+ Ty Coon, President of Vice\r
+\r
+This General Public License does not permit incorporating your program into\r
+proprietary programs. If your program is a subroutine library, you may\r
+consider it more useful to permit linking proprietary applications with the\r
+library. If this is what you want to do, use the GNU Library General\r
+Public License instead of this License.\r
--- /dev/null
+pxWeather - Readme\r
+==================\r
+\r
+ A PHP class to retrieve, parse, and organize weather data for easy\r
+ access.\r
+ \r
+ Version 0.1\r
+ -----------\r
+ http://pxweather.abbett.org/\r
+ \r
+ \r
+ Copyright (C) 2005 Jonathan M. Abbett\r
+ <jonathan_at_abbett_dot_org>\r
+ \r
+\r
+ This program is free software; you can redistribute it and/or modify \r
+ it under the terms of the GNU General Public License version 2, as \r
+ published by the Free Software Foundation.\r
+\r
+ This program is distributed in the hope that it will be useful, but \r
+ WITHOUT ANY WARRANTY; without even the implied warranty of \r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+ General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with this program; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\r
+ USA\r
+ \r
+ \r
+ Requirements:\r
+ PHP 4.1.0 or later, installed with cURL support\r
+ \r
+ \r
+ Summary:\r
+ pxWeather gives you easy access to National Weather Service forecasts\r
+ and current conditions for integration into your PHP application. To\r
+ improve performance and decrease load on the data source, pxWeather\r
+ can cache weather data locally.\r
+\r
+ \r
+ Download:\r
+ The latest version will always be available at\r
+ https://sourceforge.net/projects/pxweather/\r
+\r
+ \r
+ Credits:\r
+ Many thanks go to Hans Anderson for his XMLize utility, which makes\r
+ short work of XML parsing. XMLize, which is included in this \r
+ distribution, can be found at http://www.hansanderson.com/php/xml/\r
+\r
+ \r
+ Installation:\r
+ - Decompress your .zip or .tar.gz file.\r
+ - Copy pxweather.inc.php to your PHP-enabled website.\r
+ - If you use PHP5, copy xmlize-php5.inc.php to the same directory\r
+ on your website. If you use PHP4, copy xmlize-php4.inc.php.\r
+ - If you intend to use caching, create a new directory for cache\r
+ files to live. Make sure it has proper read/write permissions set.\r
+\r
+ (NOTE: by default, pxWeather will use the local subdirectory \r
+ "cache" to read/write cache files. You may use pxWeather's\r
+ setOption method to set a different directory.)\r
+\r
+\r
+ Testing Your Installation:\r
+ Test your installation with the following bit of code. This code\r
+ assumes it's running in the same directory as pxweather/xmlize and\r
+ that caching uses the default settings.\r
+ \r
+ <?php\r
+ \r
+ require_once("pxweather.class.php");\r
+ $w = new Weather();\r
+ $w->load();\r
+ echo $w->getCurrent("temp.string");\r
+ \r
+ ?>\r
+ \r
+ When you run it, you should see the current temperature for\r
+ Boston, MA in degrees Farenheit and Celsius.\r
+\r
+ \r
+ Configuring pxWeather:\r
+ All pxWeather configuration is done through the class constructor\r
+ and the class's setOption method. The examples below assume you've\r
+ already loaded pxweather.class.php, as above.\r
+ \r
+ To set a city other than Boston, MA, call the constructor with the\r
+ $city variable set:\r
+ \r
+ <?php\r
+ \r
+ $w = new Weather($city = "Miami");\r
+ \r
+ ?>\r
+ \r
+ Sometimes, two cities (i.e. Portland, ME and Portland, OR) have the\r
+ same name. So, in any case where there might be ambiguity, consider\r
+ using the ICAO location code for your city. The FAA maintains a \r
+ list of codes for the USA at\r
+ https://pilotweb.nas.faa.gov/qryhtml/icao/USA.html\r
+ \r
+ <?php\r
+ \r
+ // Portland, OR\r
+ $w = new Weather($city = "KPDX");\r
+ \r
+ // Portland, ME\r
+ $w = new Weather($city = "KPWM");\r
+ \r
+ ?>\r
+ \r
+ To force pxWeather to ignore its cache, and retrieve data directly\r
+ from the source, you can call the constructor with the $force \r
+ variable set to true:\r
+ \r
+ <?php\r
+ \r
+ $w = new Weather($city = "Austin", $force = true);\r
+ \r
+ ?>\r
+ \r
+ Other, less-common settings can be changed with the setOption method.\r
+ For example, to disable caching:\r
+ \r
+ <?php\r
+ \r
+ $w = new Weather();\r
+ $w->setOption("PXWEATHER_CACHE", false);\r
+ \r
+ ?>\r
+ \r
+ Four options may be set this way:\r
+ \r
+ PXWEATHER_URL (URL)\r
+ The URL used to retrieve XML weather data.\r
+\r
+ PXWEATHER_CACHE (true/false)\r
+ Enable/disable caching; enabled by default.\r
+\r
+ PXWEATHER_CACHEFOR (number)\r
+ Number of minutes to keep cached data; 60 by default.\r
+\r
+ PXWEATHER_CACHEAT (path)\r
+ The directory where cache files should be stored; 'cache' by\r
+ default.\r
+\r
+ \r
+ Accessing Data:\r
+ pxWeather extracts four kinds of data from the XML feed:\r
+ \r
+ 1. Current conditions\r
+ 2. Almanac times\r
+ 3. Forecasts\r
+ 4. Daycasts\r
+ \r
+ Current conditions can be retrieved with the getCurrent()\r
+ method, which takes a field name as argument. The following are\r
+ valid field names:\r
+ \r
+ FIELD NAME EXAMPLE VALUE\r
+ ----------------- ---------------------\r
+ city Boston, MA\r
+ longname Boston, MA\r
+ ident KBOS\r
+ latitude 42.37\r
+ longitude -71.03\r
+ timezone -5\r
+ daylight_saving 1\r
+ night 0\r
+ weather_code PC\r
+ observation_name KBOS (Boston, MA)\r
+ time 5 PM EDT 24 JUN 05\r
+ temp.string 86 F (30 C)\r
+ temp.F 86\r
+ temp.C 30\r
+ dewpt.string 53 F (11 C)\r
+ dewpt.F 53\r
+ dewpt.C 11\r
+ rel_hum.string 32 %\r
+ rel_hum.percent 32\r
+ wind.string SW at 17 knt\r
+ wind_direct SW\r
+ wind_speed.knt 17\r
+ heat_index.F 84\r
+ pressure.string 1016.7 mb (30.03 in)\r
+ pressure.mb 1016.7\r
+ pressure.in 30.03\r
+ skies mostly cloudy\r
+ text_weather haze\r
+ \r
+ The example from above:\r
+ \r
+ <?php\r
+ \r
+ require_once("pxweather.class.php");\r
+ $w = new Weather();\r
+ $w->load();\r
+ echo $w->getCurrent('temp.string');\r
+ \r
+ ?>\r
+ \r
+ Almanac times (sunrise, sunset) can be retrieved with the methods\r
+ getSunrise() and getSunset(). They take no arguments, and return\r
+ time strings in 12-hour format (i.e. 5:08 AM).\r
+ \r
+ Forecasts include a day name, a weather code, a low or high\r
+ temperature, and a text description of the forecast. Forecasts for\r
+ approximately the next six days and nights can be retrieved with the\r
+ getForecasts() method, which takes no arguments. The method returns\r
+ an array containing all forecasts. The example below cycles through\r
+ each forecast, translates its weather code into a readable string\r
+ with the weatherString() method, and prints high/low temperatures\r
+ and text forecast.\r
+ \r
+ <?php\r
+ \r
+ require_once("pxweather.class.php");\r
+ $w = new Weather();\r
+ $w->load();\r
+ \r
+ echo "<pre>";\r
+ \r
+ foreach($w->getForecasts() as $forecast)\r
+ {\r
+ echo "FORECAST FOR " . $forecast['day']. ":\n";\r
+ echo $w->weatherString($forecast['weather']) . "\n";\r
+ \r
+ if (isset($forecast['low_temp']))\r
+ echo "Low temperature: " . $forecast['low_temp'] . "\n";\r
+\r
+ if (isset($forecast['high_temp']))\r
+ echo "High temperature: " . $forecast['high_temp'] . "\n";\r
+ \r
+ echo "Description: " . $forecast['text'] . "\n\n";\r
+ \r
+ }\r
+ \r
+ echo "</pre>";\r
+ \r
+ ?>\r
+ \r
+ Daycasts are very similar to forecasts, but are not split into \r
+ individual day and night reports and do not have text forecast\r
+ descriptions. An example like above:\r
+ \r
+ <?php\r
+\r
+ require_once("pxweather.class.php");\r
+ $w = new Weather();\r
+ $w->load();\r
+ \r
+ echo "<pre>";\r
+ \r
+ foreach($w->getDaycasts() as $daycast)\r
+ {\r
+ echo "DAYCAST FOR " . $daycast['day']. ":\n";\r
+ echo $w->weatherString($daycast['weather']) . "\n";\r
+\r
+ if (isset($daycast['low_temp']))\r
+ echo "Low temperature: " . $daycast['low_temp'] . "\n";\r
+\r
+ if (isset($daycast['high_temp']))\r
+ echo "High temperature: " . $daycast['high_temp'] . "\n\n";\r
+ }\r
+ \r
+ echo "</pre>";\r
+ \r
+\r
+ ?>\r
+ \r
+ If you want to inspect the entire weather data structure, use the \r
+ toString() method:\r
+ \r
+ <?php\r
+ \r
+ require_once("pxweather.class.php");\r
+ $w = new Weather();\r
+ $w->load();\r
+ \r
+ $w->toString();\r
+ \r
+ ?>\r
+\r
+ \r
+ Feedback and Requests:\r
+ SourceForge hosts a variety of forums to express your constructive\r
+ feedback:\r
+ \r
+ - Feature Requests\r
+ http://sourceforge.net/tracker/?atid=753105&group_id=142667\r
+ - Support Requests\r
+ http://sourceforge.net/tracker/?atid=753103&group_id=142667\r
+ - Open Discussion\r
+ http://sourceforge.net/forum/forum.php?forum_id=477711\r
+ \r
+ All feedback and requests should be channeled through those outlets,\r
+ and not sent by e-mail.\r
+ \r
+ \r
+ Thank you for using pxWeather!\r
--- /dev/null
+<?php\r
+\r
+/*\r
+ * pxWeather - PHP/XML Weather Retrieval\r
+ * by Jonathan Abbett\r
+ * jonathan[at]abbett[dot]org\r
+ *\r
+ *\r
+ *\r
+ */\r
+\r
+require_once("xmlize-php5.inc.php");\r
+\r
+/*\r
+** Constants\r
+*/\r
+define("PXWEATHER_URL", 0); // to set $_url\r
+define("PXWEATHER_CACHE", 1); // to set $_cache\r
+define("PXWEATHER_CACHEFOR", 2); // to set $_age\r
+define("PXWEATHER_CACHEAT", 3); // to set $_cachepath\r
+\r
+class Weather {\r
+\r
+\r
+ // The URL from whence to retreive XML weather data\r
+ var $_url = "http://www.weather.unisys.com/forexml.cgi";\r
+ // If true, will use a local file cache\r
+ var $_cache = true;\r
+ // How many minutes to keep the cached data\r
+ var $_age = 60;\r
+ // If cache-enabled, use this directory for storing data\r
+ var $_cachepath = "cache";\r
+\r
+\r
+\r
+\r
+ var $_xml = null; // to store our xml array\r
+ var $_city = "boston"; // The city we're interested in\r
+ var $_force = false; // If true, will override the cache and fetch data fresh\r
+\r
+\r
+ /*\r
+ ** Constructor\r
+ */\r
+ function Weather($city = "Boston", $force = false) {\r
+\r
+ $this->_city = strtoupper($city);\r
+ $this->_force = $force;\r
+\r
+ }\r
+\r
+ function setOption($option, $value) {\r
+\r
+ switch($option) {\r
+ case EASYWEATHER_URL:\r
+ $this->_url = $value;\r
+ break;\r
+ case EASYWEATHER_CACHE:\r
+ $this->_cache = $value;\r
+ break;\r
+ case EASYWEATHER_CACHEFOR:\r
+ $this->_age = $value;\r
+ break;\r
+ case EASYWEATHER_CACHEAT:\r
+ $this->_cachepath = $value;\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
+ /*\r
+ ** Return a pretty-printed version of the XML array\r
+ */\r
+ function toString($array = null) {\r
+\r
+ if ($array == null) {\r
+ $array = $this->_xml;\r
+ }\r
+\r
+ echo "<pre>";\r
+ print_r($array);\r
+ echo "</pre>";\r
+ }\r
+\r
+ /*\r
+ ** Return a specific field from the current weather report\r
+ */\r
+ function getCurrent($field) {\r
+ $o = $this->_getObservation();\r
+\r
+ if (array_key_exists($field, $o)) {\r
+ return $o[$field];\r
+ }\r
+ else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+ function getSunrise() {\r
+ $a = $this->_getAlmanac();\r
+\r
+ return $a["sunrise"];\r
+ }\r
+\r
+ function getSunset() {\r
+ $a = $this->_getAlmanac();\r
+\r
+ return $a["sunset"];\r
+ }\r
+\r
+ function getForecasts() {\r
+\r
+ // need to remove a layer of separation\r
+\r
+ $forecasts = $this->_xml["forexml"]["#"]["forecast"];\r
+\r
+ $returnArray = array();\r
+\r
+ $i = 0;\r
+\r
+ foreach ($forecasts as $forecast) {\r
+ $returnArray[$i] = $forecast["@"];\r
+ $i++;\r
+ }\r
+\r
+ return $returnArray;\r
+\r
+ }\r
+\r
+ function getDaycasts() {\r
+\r
+ // need to remove a layer of separation\r
+\r
+ $daycasts = $this->_xml["forexml"]["#"]["daycast"];\r
+\r
+ $returnArray = array();\r
+\r
+ $i = 0;\r
+\r
+ foreach ($daycasts as $daycast) {\r
+ $returnArray[$i] = $daycast["@"];\r
+ $i++;\r
+ }\r
+\r
+ return $returnArray;\r
+ }\r
+\r
+ /*\r
+ ** Returns a weather condition string given a code (i.e 'TS')\r
+ */\r
+ function weatherString($code) {\r
+\r
+ switch($code) {\r
+ case "TS":\r
+ return "Thunderstorms";\r
+ break;\r
+ case "RA":\r
+ return "Rain";\r
+ break;\r
+ case "MC":\r
+ return "Mostly cloudy";\r
+ break;\r
+ case "SU":\r
+ return "Sunny";\r
+ break;\r
+ case "MO":\r
+ return "Mostly clear";\r
+ break;\r
+ case "PC":\r
+ return "Partly cloudy";\r
+ break;\r
+ case "SN":\r
+ return "Snow";\r
+ break;\r
+ case "CL":\r
+ return "Overcast";\r
+ break;\r
+ case "FG":\r
+ return "Fog";\r
+ break;\r
+ }\r
+\r
+ return null;\r
+\r
+ }\r
+\r
+ function load() {\r
+\r
+ $filename = "$this->_cachepath/weather.$this->_city.cache";\r
+\r
+ // if not force, check cache for valid file\r
+ if (!$this->_force && $this->_cache) {\r
+\r
+ if (file_exists($filename)\r
+ && filemtime($filename) > (time() - ($this->_age * 60))) {\r
+\r
+ $file = fopen($filename, "r");\r
+ $this->_xml = unserialize(fread($file, filesize($filename)));\r
+ fclose($file);\r
+\r
+ return;\r
+ }\r
+ }\r
+\r
+ // if force, or no valid cache file, get XML fresh\r
+\r
+ $this->_xml = $this->_getXML();\r
+\r
+ if ($this->_cache) {\r
+ $file = fopen($filename, "w");\r
+ fwrite($file, serialize($this->_xml));\r
+ fclose($file);\r
+ }\r
+\r
+ }\r
+\r
+ function _getXML() {\r
+\r
+ $ch = curl_init();\r
+ curl_setopt($ch, CURLOPT_URL, $this->_url . "?" . $this->_city);\r
+ curl_setopt($ch, CURLOPT_HEADER, false);\r
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r
+\r
+ $xml = curl_exec($ch);\r
+\r
+ if (curl_errno($ch)) {\r
+ trigger_error("cURL Error in Weather._getXML: " . curl_error($ch), E_WARNING);\r
+ return null;\r
+ }\r
+\r
+ curl_close($ch);\r
+\r
+ return xmlize($xml);\r
+\r
+ }\r
+\r
+ function _getObservation() {\r
+\r
+ return $this->_xml["forexml"]["#"]["observation"][0]["@"];\r
+\r
+ }\r
+\r
+ // array with keys "sunrise" and "sunset"\r
+ function _getAlmanac() {\r
+\r
+ return $this->_xml["forexml"]["#"]["almanac"][0]["@"];\r
+ }\r
+\r
+}\r
+ \r
+?>
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+/* xmlize() is by Hans Anderson, www.hansanderson.com/contact/\r
+ *\r
+ * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL].\r
+ * some code in xml_depth is based on code written by other PHPers\r
+ * as well as one Perl script. Poor programming practice and organization\r
+ * on my part is to blame for the credit these people aren't receiving.\r
+ * None of the code was copyrighted, though.\r
+ *\r
+ * This is a stable release, 1.0. I don't foresee any changes, but you\r
+ * might check http://www.hansanderson.com/php/xml/ to see\r
+ *\r
+ * usage: $xml = xmlize($xml_data);\r
+ *\r
+ * See the function traverse_xmlize() for information about the\r
+ * structure of the array, it's much easier to explain by showing you.\r
+ * Be aware that the array is very complex. I use xmlize all the time,\r
+ * but still need to use traverse_xmlize or print_r() quite often to\r
+ * show me the structure!\r
+ *\r
+ */\r
+\r
+function xmlize($data, $WHITE=1) {\r
+\r
+ $data = trim($data);\r
+ $vals = $index = $array = array();\r
+ $parser = xml_parser_create();\r
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);\r
+ xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);\r
+ if ( !xml_parse_into_struct($parser, $data, $vals, $index) )\r
+ {\r
+ die(sprintf("XML error: %s at line %d",\r
+ xml_error_string(xml_get_error_code($parser)),\r
+ xml_get_current_line_number($parser)));\r
+\r
+ }\r
+ xml_parser_free($parser);\r
+\r
+ $i = 0; \r
+\r
+ $tagname = $vals[$i]['tag'];\r
+ if ( isset ($vals[$i]['attributes'] ) )\r
+ {\r
+ $array[$tagname]['@'] = $vals[$i]['attributes'];\r
+ } else {\r
+ $array[$tagname]['@'] = array();\r
+ }\r
+\r
+ $array[$tagname]["#"] = xml_depth($vals, $i);\r
+\r
+ return $array;\r
+}\r
+\r
+/* \r
+ *\r
+ * You don't need to do anything with this function, it's called by\r
+ * xmlize. It's a recursive function, calling itself as it goes deeper\r
+ * into the xml levels. If you make any improvements, please let me know.\r
+ *\r
+ *\r
+ */\r
+\r
+function xml_depth($vals, &$i) { \r
+ $children = array(); \r
+\r
+ if ( isset($vals[$i]['value']) )\r
+ {\r
+ array_push($children, $vals[$i]['value']);\r
+ }\r
+\r
+ while (++$i < count($vals)) { \r
+\r
+ switch ($vals[$i]['type']) { \r
+\r
+ case 'open': \r
+\r
+ if ( isset ( $vals[$i]['tag'] ) )\r
+ {\r
+ $tagname = $vals[$i]['tag'];\r
+ } else {\r
+ $tagname = '';\r
+ }\r
+\r
+ if ( isset ( $children[$tagname] ) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if ( isset ( $vals[$i]['attributes'] ) ) {\r
+ $children[$tagname][$size]['@'] = $vals[$i]["attributes"];\r
+ }\r
+\r
+ $children[$tagname][$size]['#'] = xml_depth($vals, $i);\r
+\r
+ break; \r
+\r
+\r
+ case 'cdata':\r
+ array_push($children, $vals[$i]['value']); \r
+ break; \r
+\r
+ case 'complete': \r
+ $tagname = $vals[$i]['tag'];\r
+\r
+ if( isset ($children[$tagname]) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if( isset ( $vals[$i]['value'] ) )\r
+ {\r
+ $children[$tagname][$size]["#"] = $vals[$i]['value'];\r
+ } else {\r
+ $children[$tagname][$size]["#"] = '';\r
+ }\r
+\r
+ if ( isset ($vals[$i]['attributes']) ) {\r
+ $children[$tagname][$size]['@']\r
+ = $vals[$i]['attributes'];\r
+ } \r
+\r
+ break; \r
+\r
+ case 'close':\r
+ return $children; \r
+ break;\r
+ } \r
+\r
+ } \r
+\r
+ return $children;\r
+\r
+}\r
+\r
+\r
+/* function by acebone@f2s.com, a HUGE help!\r
+ *\r
+ * this helps you understand the structure of the array xmlize() outputs\r
+ *\r
+ * usage:\r
+ * traverse_xmlize($xml, 'xml_');\r
+ * print '<pre>' . implode("", $traverse_array . '</pre>';\r
+ *\r
+ *\r
+ */ \r
+\r
+function traverse_xmlize($array, $arrName = "array", $level = 0) {\r
+\r
+ foreach($array as $key=>$val)\r
+ {\r
+ if ( is_array($val) )\r
+ {\r
+ traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);\r
+ } else {\r
+ $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";\r
+ }\r
+ }\r
+\r
+ return 1;\r
+\r
+}\r
+\r
+?>
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+/* xmlize() is by Hans Anderson, me@hansanderson.com\r
+ *\r
+ * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL].\r
+ * some code in xml_depth is based on code written by other PHPers\r
+ * as well as one Perl script. Poor programming practice and organization\r
+ * on my part is to blame for the credit these people aren't receiving.\r
+ * None of the code was copyrighted, though.\r
+ *\r
+ * This is a stable release, 1.0. I don't foresee any changes, but you\r
+ * might check http://www.hansanderson.com/php/xml/ to see\r
+ *\r
+ * usage: $xml = xmlize($array);\r
+ *\r
+ * See the function traverse_xmlize() for information about the\r
+ * structure of the array, it's much easier to explain by showing you.\r
+ * Be aware that the array is somewhat tricky. I use xmlize all the time,\r
+ * but still need to use traverse_xmlize quite often to show me the structure!\r
+\r
+ ## THIS IS A PHP 5 VERSION:\r
+\r
+ > attached is the modified script. Basically it has a new optional parameter\r
+ > to specify an OUTPUT encoding. If not specified, it defaults to UTF-8.\r
+ > I recommend you to read this PHP bug. There you can see how PHP4, PHP5.0.0\r
+ > and PHP5.0.2 will handle this.\r
+ > http://bugs.php.net/bug.php?id=29711\r
+ > Ciao, Eloy :-)\r
+ ##\r
+ *\r
+ */\r
+\r
+function xmlize($data, $WHITE=1, $encoding='UTF-8') {\r
+\r
+ $data = trim($data);\r
+ $vals = $index = $array = array();\r
+ $parser = xml_parser_create($encoding);\r
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);\r
+ xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);\r
+ xml_parse_into_struct($parser, $data, $vals, $index);\r
+ xml_parser_free($parser);\r
+\r
+ $i = 0;\r
+\r
+ $tagname = $vals[$i]['tag'];\r
+ if ( isset ($vals[$i]['attributes'] ) )\r
+ {\r
+ $array[$tagname]['@'] = $vals[$i]['attributes'];\r
+ } else {\r
+ $array[$tagname]['@'] = array();\r
+ }\r
+\r
+ $array[$tagname]["#"] = xml_depth($vals, $i);\r
+\r
+\r
+ return $array;\r
+}\r
+\r
+/*\r
+ *\r
+ * You don't need to do anything with this function, it's called by\r
+ * xmlize. It's a recursive function, calling itself as it goes deeper\r
+ * into the xml levels. If you make any improvements, please let me know.\r
+ *\r
+ *\r
+ */\r
+\r
+function xml_depth($vals, &$i) {\r
+ $children = array();\r
+\r
+ if ( isset($vals[$i]['value']) )\r
+ {\r
+ array_push($children, $vals[$i]['value']);\r
+ }\r
+\r
+ while (++$i < count($vals)) {\r
+\r
+ switch ($vals[$i]['type']) {\r
+\r
+ case 'open':\r
+\r
+ if ( isset ( $vals[$i]['tag'] ) )\r
+ {\r
+ $tagname = $vals[$i]['tag'];\r
+ } else {\r
+ $tagname = '';\r
+ }\r
+\r
+ if ( isset ( $children[$tagname] ) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if ( isset ( $vals[$i]['attributes'] ) ) {\r
+ $children[$tagname][$size]['@'] = $vals[$i]["attributes"];\r
+\r
+ }\r
+\r
+ $children[$tagname][$size]['#'] = xml_depth($vals, $i);\r
+\r
+ break;\r
+\r
+\r
+ case 'cdata':\r
+ array_push($children, $vals[$i]['value']);\r
+ break;\r
+\r
+ case 'complete':\r
+ $tagname = $vals[$i]['tag'];\r
+\r
+ if( isset ($children[$tagname]) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if( isset ( $vals[$i]['value'] ) )\r
+ {\r
+ $children[$tagname][$size]["#"] = $vals[$i]['value'];\r
+ } else {\r
+ $children[$tagname][$size]["#"] = '';\r
+ }\r
+\r
+ if ( isset ($vals[$i]['attributes']) ) {\r
+ $children[$tagname][$size]['@']\r
+ = $vals[$i]['attributes'];\r
+ }\r
+\r
+ break;\r
+\r
+ case 'close':\r
+ return $children;\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
+ return $children;\r
+\r
+\r
+}\r
+\r
+\r
+/* function by acebone@f2s.com, a HUGE help!\r
+ *\r
+ * this helps you understand the structure of the array xmlize() outputs\r
+ *\r
+ * usage:\r
+ * traverse_xmlize($xml, 'xml_');\r
+ * print '<pre>' . implode("", $traverse_array . '</pre>';\r
+ *\r
+ *\r
+ */\r
+\r
+function traverse_xmlize($array, $arrName = "array", $level = 0) {\r
+\r
+ foreach($array as $key=>$val)\r
+ {\r
+ if ( is_array($val) )\r
+ {\r
+ traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);\r
+ } else {\r
+ $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";\r
+ }\r
+ }\r
+\r
+ return 1;\r
+\r
+}\r
+\r
+?>
\ No newline at end of file
--- /dev/null
+<HEAD>
+<Style>
+body {background-color: #4d4c48;}
+</style>
+<SCRIPT LANGUAGE="JavaScript">
+<!-- Beginning of JavaScript -
+
+var timeout;
+var x = 0;
+var step = 2;
+
+function start1(){
+ x=window.parent.menu.pageXOffset;
+ if (x < 0){
+ x=0;
+ }
+ x=x + step;
+ window.parent.menu.scroll(x,0);
+
+ timeout=setTimeout("start1()",50);
+}
+
+function start2(){
+ if (x >=0 ){
+ window.parent.menu.scroll(x,0);
+ x = x - step;
+ }
+
+ timeout=setTimeout("start2()",50);
+}
+
+function stop1(){
+ clearTimeout(timeout);
+}
+
+function top1(){
+ window.parent.menu.scroll(0,0);
+ x=0;
+}
+
+
+// - End of JavaScript - -->
+
+</SCRIPT>
+</HEAD>
+<img src="./icons/right-arrow.png" onMouseDown="stop1();start1();" onMouseup="stop1()" aligh="left">
--- /dev/null
+<center>
+<iframe id="frame" src="weather1.html" frameborder="0">
+</iframe><b>
+</font>
+</b>
+</center>
--- /dev/null
+0
\ No newline at end of file
--- /dev/null
+<img width="50%" height="50%" id="security" src="http://zoneminder/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=15&buffer=1000&connkey=255759&rand=1358806895">
+<table border=1>
+<tr><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security1.html', 'contentarea');">CAM1</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security2.html', 'contentarea');">CAM2</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security3.html', 'contentarea');">CAM3</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security4.html', 'contentarea');">CAM4</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security5.html', 'contentarea');">CAM5</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security6.html', 'contentarea');">CAM6</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('security7.html', 'contentarea');">CAM7</a>
+</td>
+</tr>
+</table>
--- /dev/null
+<?
+$device=$_GET['device'];
+$state=$_GET['state'];
+
+$fields = array(
+ 'node'=>$device,
+ 'submit'=>$state
+);
+
+foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
+rtrim($fields_string,'&');
+
+
+$ch = curl_init();
+
+curl_setopt($ch, CURLOPT_URL,"http://isy99/change");
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+curl_setopt($ch,CURLOPT_POST,count($fields));
+curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
+
+
+
+
+$output = curl_exec($ch);
+
+#echo "<pre>";
+
+#print_r($output);
+
+exit;
+
+?>
--- /dev/null
+<?
+$device=$_GET['device'];
+$state=$_GET['state'];
+
+$fields = array(
+ 'node'=>$device,
+ 'submit'=>$state
+);
+
+foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
+rtrim($fields_string,'&');
+
+$ch = curl_init();
+
+if ("nodes"==substr($device,0,5)) {
+ $string="http://isy99/rest/nodes/".rawurlencode(substr($device,-10))."/cmd/$state";
+} else {
+ if ($state=="DON") {
+ $state="runThen";
+ } else {
+ $state="runElse";
+ }
+ $string="http://isy99/rest/programs/".rawurlencode(substr($device,-4))."/$state";
+}
+curl_setopt($ch, CURLOPT_URL,"$string");
+
+#echo "-$string-";
+#exit;
+
+#echo "http://isy99/rest/nodes/$device/cmd/$state";
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+curl_setopt($ch, CURLOPT_HEADER, 0);
+#curl_setopt($ch,CURLOPT_POST,count($fields));
+#curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
+
+
+
+$output = curl_exec($ch);
+
+#echo "<pre>";
+
+#print_r($output);
+
+#curl_close($ch);
+?>
--- /dev/null
+<?
+$person=$_GET['person'];
+$state=$_GET['status'];
+
+include("includes.php");
+
+echo "$person,$status";
+
+summon($person,$status);
+?>
--- /dev/null
+<?php
+// Thermometer image script
+// Ken True - webmaster@Saratoga-weather.org
+// error_reporting(E_ALL); // uncomment to run testing
+// Version 1.00 - 17-Sep-2007 - Initial release
+// Version 1.01 - 18-Nov-2007 - added GD test, autoscale function, updated for sce=view on IIS systems
+// Version 1.02 - 23-Nov-2007 - fixed Notice: errata on min/max calculations
+// Version 1.03 - 28-Feb-2008 - added support for Carterlake/AJAX/PHP template integration
+// Version 1.04 - 02-Feb-2009 - added support for 'dark' template (white text instead of black)
+// Version 1.05 - 21-Oct-2009 - added support for Cumulus realtime.txt
+//
+// script available at http://saratoga-weather.org/scripts.php
+//
+// you may copy/modify/use this script as you see fit,
+// no warranty is expressed or implied.
+
+// This script reads WD clientraw.txt , VWS wflash.txt/wflash2.txt, or Cumulus realtime.txt
+// gets the current, high, low temperature and draws a
+// thermometer image (filled area + scale) on a transparent-background thermometer graphic
+// PNG.
+// usage on your page:
+//
+// <img src="thermometer.php" height="170" width="54" alt="current temperature, daily low/high" />
+//
+// New with version 1.01 - $autoScale = true; enables autoranging on output scale. The program will
+// add majortick values to maximum or substract majortick values from minimum to always show the
+// scale, current, minimum, maximum on the graphic.
+//------------ settings ------------------
+$wxSoftware = 'WD'; // 'WD' for Weather-Display, 'VWS' for Virtual Weather Station,
+ // 'CU' for Cumulus
+//
+$UOM = 'F'; // set to 'C' for Celsius/Centigrade, 'F'=Fahrenheit
+//
+$autoScale = true; // set to false to disable autoscale.
+//
+// you only have to set one of these correctly based on the $useWD selection
+// $wxSoftware = 'WD' : set the $clientrawfile
+// $wxSoftware = 'VWS': set the $wflashDir
+// $wxSoftware = 'CU': set the $realtimefile
+//
+$clientrawfile = './clientraw.txt'; // relative file address for WD clientraw.txt
+$wflashDir = './wflash/Data/'; // directory for the the VWS wflash.txt and wflash2.txt files
+// // relative to directory location of this script (include
+// // trailing '/' in the specification
+$realtimefile = './realtime.txt'; // relative file location for Cumulus realtime.txt file
+//
+// settings for ranges -- adjust for your climate :-)
+// Fahrenheit settings
+$TmaxF = 105; // maximum °F temperature on thermometer
+$TminF = 10; // minimum °F temperature on thermometer
+$TincrF = 5; // increment number of degrees °F for major/minor ticks on thermometer
+$TMajTickF = 10; // major tick with value when °F scale number divisible by this
+// Centigrade settings
+$TmaxC = 40; // maximum °C temperature on thermometer
+$TminC = -10; // minimum °C temperature on thermometer
+$TincrC = 2; // increment number of degrees °C for major/minor ticks on thermometer
+$TMajTickC = 10; // major tick with value when °C scale number divisible by this
+//
+$invertColor = true; // set to true if thermometer display is over black background
+$BlankGraphic = './thermometer-blank.png'; // relative file address for thermometer blank image PNG
+$BlankGraphicBlack = './thermometer-blank-black.png'; // for black background use
+//------------ end settings --------------
+// overrides from Settings.php if available
+if(file_exists("Settings.php")) { include_once("Settings.php"); }
+global $SITE;
+if (isset($SITE['uomTemp'])) {
+ $UOM = preg_replace('|°|is','',$SITE['uomTemp']);
+ if ($UOM <> 'F' and $UOM <> 'C') { $UOM = 'F'; }
+}
+if (isset($SITE['clientrawfile']) ) {$clientrawfile = $SITE['clientrawfile']; }
+if (isset($SITE['wflashdir']) ) {$wflashDir = $SITE['wflashdir']; }
+if (isset($SITE['realtimefile']) ) {$realtimefile = $SITE['realtimefile']; }
+$CSSstyle = '';
+# was there a style selected from the form input
+if (isset($_COOKIE['CSSstyle'])) {
+ $_SESSION['CSSstyle'] = $_COOKIE['CSSstyle'];
+ $CSSstyle = $_COOKIE['CSSstyle'];
+ } else if (isset($_SESSION['CSSstyle']) and $_SESSION['CSSstyle'] <> '' ) {
+ $CSSstyle = $_SESSION['CSSstyle'];
+ }
+if (preg_match('|black|i',$CSSstyle) ) {
+ $invertColor = true;
+}
+// end of overrides from Settings.php
+
+// -------------------begin code ------------------------------------------
+if (isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
+ //--self downloader --
+ $filenameReal = __FILE__;
+ $download_size = filesize($filenameReal);
+ header('Pragma: public');
+ header('Cache-Control: private');
+ header('Cache-Control: no-cache, must-revalidate');
+ header("Content-type: text/plain");
+ header("Accept-Ranges: bytes");
+ header("Content-Length: $download_size");
+ header('Connection: close');
+
+ readfile($filenameReal);
+ exit;
+}
+
+if( ! function_exists("gd_info")){
+ die("Sorry.. this script requires the GD library in PHP to function.");
+}
+
+
+if (isset($_REQUEST['sw']) and strtolower($_REQUEST['sw']) == 'wd') { $wxSoftware = 'WD'; } // testing
+if (isset($_REQUEST['sw']) and strtolower($_REQUEST['sw']) == 'vws') { $wxSoftware = 'VWS'; } // testing
+if (isset($_REQUEST['sw']) and strtolower($_REQUEST['sw']) == 'cu') { $wxSoftware = 'CU'; } // testing
+
+if (isset($_REQUEST['uom']) and strtolower($_REQUEST['uom']) == 'c') { $UOM = 'C'; }
+if (isset($_REQUEST['uom']) and strtolower($_REQUEST['uom']) == 'f') { $UOM = 'F'; }
+if (isset($_REQUEST['dark'])) {$invertColor = strtolower($_REQUEST['dark'])=='y'; }
+
+if ($wxSoftware == 'WD') { // Get the Weather-Display clientraw.txt data file
+
+ //$dataraw = file_get_contents($clientrawfile);
+
+ // clean up any blank lines
+
+ #$dataraw = trim($dataraw);
+ $dataraw = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/","\n",$dataraw);
+ $data = explode(" ", $dataraw);
+
+ //$curtemp = CtoF('50',1);
+ //$mintemp = CtoF('20',1);
+ //$maxtemp = CtoF('80',1);
+ #$curtemp = '<!--outsideTemp-->';
+ $curtemp = $_GET['t'];
+ $mintemp = $_GET['mint'];
+ $maxtemp = $_GET['maxt'];
+
+ } // end Weather Display data
+
+if ($wxSoftware == 'VWS') { // Get the VWS Weather Flash data files
+
+ $filename = "${wflashDir}wflash.txt";
+ $file = file($filename);
+ $file = implode('',$file);
+ $data = explode(",",$file);;
+
+ $curtemp = FtoC($data[9],1);
+
+ $filename = "${wflashDir}wflash2.txt";
+ $file = file($filename);
+ $file = implode('',$file);
+ $data = explode(",",$file);;
+
+ $mintemp = FtoC($data[92],1);
+ $maxtemp = FtoC($data[36],1);
+ }
+
+if ($wxSoftware == 'CU') { // Get the Cumulus realtime.txt file
+
+ $dataraw = file_get_contents($realtimefile);
+
+ // clean up any blank lines
+ $dataraw = trim($dataraw);
+ $dataraw = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/","\n",$dataraw);
+ $data = explode(" ", $dataraw);
+ $inUOM = $data[14];
+ if ($inUOM == 'F' and $UOM == 'C') {
+ $curtemp = FtoC($data[2],1);
+ $mintemp = FtoC($data[28],1);
+ $maxtemp = FtoC($data[26],1);
+ } elseif ($inUOM == 'C' and $UOM == 'F') {
+ $curtemp = CtoF($data[2],1);
+ $mintemp = CtoF($data[28],1);
+ $maxtemp = CtoF($data[26],1);
+ } else {
+ $curtemp = $data[2];
+ $mintemp = $data[28];
+ $maxtemp = $data[26];
+ $UOM = $inUOM;
+ }
+ }
+
+if (isset($_REQUEST['current'])) { $curtemp = $_REQUEST['current']; } // for testing
+if (isset($_REQUEST['min'])) { $mintemp = $_REQUEST['min']; } // for testing
+if (isset($_REQUEST['max'])) { $maxtemp = $_REQUEST['max']; } // for testing
+
+
+if ($UOM == 'F') { // use Fahrenheit settings
+ $Tmax = $TmaxF; // maximum temperature on thermometer
+ $Tmin = $TminF; // minimum temperature on thermometer
+ $Tincr = $TincrF; // increment number of degrees for major/minor ticks on thermometer
+ $TMajTick = $TMajTickF;// major tick with value when scale number divisible by this
+ } else { // use Centigrade settings
+ $Tmax = $TmaxC; // maximum temperature on thermometer
+ $Tmin = $TminC; // minimum temperature on thermometer
+ $Tincr = $TincrC; // increment number of degrees for major/minor ticks on thermometer
+ $TMajTick = $TMajTickC;// major tick with value when scale number divisible by this
+}
+
+ if($autoScale) { autoscale($curtemp,$mintemp,$maxtemp); }
+
+ genThermometer($curtemp, $mintemp,$maxtemp); // make graphic!
+
+return;
+
+// ----------- functions ----------------------------------------------------------
+//
+function genThermometer( $current,$min,$max ) {
+
+ global $UOM,$BlankGraphic,$BlankGraphicBlack,$wxSoftware,$invertColor;
+ global $Tmax,$Tmin,$Tincr,$TMajTick;
+
+// draw a filled thermometer with scale, min max on a blank thermometer image
+ $BGfile = $invertColor?$BlankGraphicBlack:$BlankGraphic;
+ $image = LoadPNG($BGfile);
+
+ // settings relative to the thermometer image file defines the drawing area
+ // for the thermometer filling
+ // these settings are SPECIFICALLY for the thermometer-blank.png image background
+
+ $minX = 20; // left
+ $maxX = 24; // right
+ $minY = 20; // top
+ $maxY = 140;// bottom
+
+
+ $width = imagesx($image);
+ $height = imagesy($image);
+ $font = 1;
+
+ $bg = imagecolorallocate($image,255,255,255 );
+ $tx = imagecolorallocate($image,0,0,0);
+ $blue = imagecolorallocate($image,0,0,255);
+ $red = imagecolorallocate($image,255,0,0);
+ if ($invertColor) {
+ $tx = imagecolorallocate($image,255,255,255);
+ $blue = imagecolorallocate($image,0,192,255);
+ $red = imagecolorallocate($image,255,32,32);
+ }
+
+ $Trange = $Tmax - $Tmin; // total temperature range
+
+ $Tpct = ($current-$Tmin)/($Trange); // percent for current temperature of range
+
+ $Y = (1-$Tpct)*($maxY-$minY)+$minY; // upper location for fill
+
+// fill the thermometer with a red bar from bottom to $Y
+ imagefilledrectangle( $image,
+ $minX,
+ $Y,
+ $maxX,
+ $maxY,
+ $red );
+
+// Draw tick marks and scale values on right
+
+ for ($T=$Tmin;$T<=$Tmax;$T+=$Tincr) {
+
+ $Tpct = ($T-$Tmin)/($Trange);
+ $Y = (1-$Tpct)*($maxY-$minY)+$minY;
+
+ if ($T == 0 or ($T % $TMajTick) == 0) { // Major Tick
+
+ imagefilledrectangle( $image,
+ $maxX+7 ,
+ $Y ,
+ $maxX+12,
+ $Y +1, $tx );
+
+ imagestring($image, $font,
+ $maxX + 14,
+ $Y - (ImageFontHeight($font)/2),
+ sprintf( "%2d", $T),$tx);
+ } else { // Minor tick
+ imagefilledrectangle( $image,
+ $maxX+7,
+ $Y ,
+ $maxX+9,
+ $Y +1, $tx );
+ }
+
+
+ } // end do ticks legend
+
+ if(isset($min)) { // put on minimum temp bar/value
+
+// $Tpct = ($min-$Tmin)/($Trange);
+ $Tpct = ( ( (float)$min-$Tmin )/ $Trange );
+ $Y = (1-$Tpct)*($maxY-$minY)+$minY;
+ imagefilledrectangle( $image,
+ $minX - 18,
+ $Y ,
+ $minX - 5,
+ $Y +1, $blue );
+ $tstr = sprintf('%2d',round($min,0));
+ $tsize = strlen($tstr)*imagefontwidth($font+1);
+ imagestring($image, $font+1,
+ $minX - $tsize - 3 ,
+ $Y + 2 ,
+ $tstr,$blue);
+
+ }
+
+ if(isset($max)) { // put on maximum temp bar/value
+
+ $Tpct = ($max-$Tmin)/($Trange);
+ $Y = (1-$Tpct)*($maxY-$minY)+$minY;
+ imagefilledrectangle( $image,
+ $minX - 18,
+ $Y ,
+ $minX - 5,
+ $Y +1, $red );
+
+ $tstr = sprintf('%2d',round($max,0));
+ $tsize = strlen($tstr)*imagefontwidth($font+1);
+
+ imagestring($image, $font+1,
+ $minX - $tsize - 3 ,
+ $Y - imagefontheight($font+1),
+ $tstr,$red);
+ }
+
+ // put legend on top with UOM
+
+ $cnt = '°' . $UOM;
+ imagestring( $image, $font+2, ($width/2)-((strlen($cnt)/2)*ImageFontWidth($font+2)),
+ (10-(ImageFontHeight($font+2) / 2)),
+ $cnt, $tx);
+
+// write current temperature on thermometer bulb
+// $tstr = sprintf('%2d',round($current,0));
+// $tsize = strlen($cnt)*imagefontwidth($font);
+
+// imagestring($image, $font,
+// ($minX+$maxX)/2 - $tsize/2 -2 ,
+// $maxY+6,
+// $tstr,$bg);
+
+
+//imagestring( $image, $font, ($width/2)-((strlen($wxSoftware)/2)*imagefontwidth($font)),
+// $height-imagefontheight($font),
+// $wxSoftware,$tx);
+
+ // send the image
+ header("content-type: image/png");
+ imagepng($image);
+ imagedestroy($image);
+
+} // end genThermometer
+
+// load PNG image
+function LoadPNG ($imgname) {
+ $im = @imagecreatefrompng ($imgname); /* Attempt to open */
+ if (!$im) { /* See if it failed */
+ $im = imagecreate (150, 30); /* Create a blank image */
+ $bgc = imagecolorallocate ($im, 255, 255, 255);
+ $tc = imagecolorallocate ($im, 0, 0, 0);
+ imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
+ /* Output an errmsg */
+ imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
+ }
+ return $im;
+}
+
+// CtoF: converts degrees Celcius to degress Farenheight (from Anolecomputing.com)
+function CtoF($value, $precision) {
+ global $UOM;
+ if ($UOM <> 'F') {
+ return round($value,$precision);
+ } else {
+ return round($value = (($value * 9 / 5) + 32),$precision);
+ }
+} // end function C_to_F
+
+// FtoC: converts degress Farenheight to degrees Celcius (from Anolecomputing.com)
+function FtoC($value, $precision) {
+ global $UOM;
+ if ($UOM == 'F') {
+ return round($value,$precision);
+ } else {
+ return round(($value - 32) * (5/9),$precision);
+ }
+} // end function F to C
+
+// autoscale function .. adjust scale to fit current conditions if need be.
+
+function autoscale($curtemp,$mintemp,$maxtemp) {
+
+ global $Tmax,$Tmin,$Tincr,$TMajTick;
+
+ $highest = max($curtemp,$Tmax,$maxtemp);
+ $lowest = min($curtemp,$Tmin,$mintemp);
+
+
+ while ($Tmax < $highest) {
+ $Tmax += $TMajTick;
+ }
+
+ while ($Tmin > $lowest) {
+ $Tmin = $Tmin - $TMajTick;
+ }
+
+ return;
+
+
+}
+?>
--- /dev/null
+<?
+
+include("includes.php");
+ include("xml2array.php");
+
+ echo "Outside: ";
+ get_data("outsideTemp");
+ echo " F<br>Inside:";
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL,"http://isy99/rest/nodes/2C%20B%202B%201");
+
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+ $output = curl_exec($ch);
+ $array=xml2array($output);
+ #echo "<pre>";
+ #print_r($array);
+ #exit;
+ echo substr(($array['nodeInfo']['node']['property']['0_attr']['formatted']),0,-1)." F";
+?>
--- /dev/null
+<img src="http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=DIX&brand=wui&num=6&delay=15&type=N0R&frame=0&scale=1.000&noclutter=0&t=1280084418&lat=40.10441971&lon=-75.11070251&label=Jenkintown%2C+PA&showstorms=0&map.x=400&map.y=240¢erx=400¢ery=240&transx=0&transy=0&showlabels=1&severe=0&rainsnow=0&lightning=1&smooth=0">
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <title>Google Maps JavaScript API Example: Traffic Overlays</title>
+ <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAEVw7F2FrOuAa5Y0vvjDw-hS4Kh9Yhf3T4FdRv0A-Zia9EqEJDhTpraMfVaMs-QO-RzRPqUC6tPLIqA"
+ type="text/javascript"></script>
+ <script type="text/javascript">
+
+ var map;
+ var trafficInfo;
+ var toggleState = 1;
+
+ function initialize() {
+ if (GBrowserIsCompatible()) {
+ map = new GMap2(document.getElementById("map_canvas"));
+ map.setCenter(new GLatLng(39.966596,-75.123825), 9);
+ map.setUIToDefault();
+ var trafficOptions = {incidents:true};
+ trafficInfo = new GTrafficOverlay(trafficOptions);
+ map.addOverlay(trafficInfo);
+ }
+ }
+
+ function toggleTraffic() {
+ if (toggleState == 1) {
+ map.removeOverlay(trafficInfo);
+ toggleState = 0;
+ } else {
+ map.addOverlay(trafficInfo);
+ toggleState = 1;
+ }
+ }
+ </script>
+ </head>
+
+ <body onload="initialize()">
+ <div id="map_canvas" style="width: 640px; height: 480px; float:left; border: 1px solid black;"></div>
+ <br clear="all"/>
+ <br/>
+ <input type="button" value="Toggle Traffic" onClick="toggleTraffic();"/>
+ <br/>
+ </body>
+</html>
+
--- /dev/null
+<iframe border=0 width=640 height=480 Marginwidth=0 Marginheight=0 src="traffic-iframe.html" scrolling=no>
--- /dev/null
+<table border=0>
+<tr style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather1.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Current Conditions</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather2.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Radar</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather3.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Forecast</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather4.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Local Lightning</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather5.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Nationwide Lightning</a>
+</td><td>
+<a href="javascript:clearTimeout(t);i=0;ajaxpage('weather6.php', 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);">Sun</a>
+</td>
+</table>
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<?
+if (isset($_GET['item'])) {
+ $item=$_GET['item'];
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.meter.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var meter1 = new RGraph.Meter('meter1', -20, 120, <? echo $itemRSS[$item]; ?>);
+
+ var grad1 = meter1.context.createRadialGradient(meter1.canvas.width / 2,meter1.canvas.height - 25,0,meter1.canvas.width / 2,meter1.canvas.height - 25,100);
+ grad1.addColorStop(0, 'red');
+ grad1.addColorStop(1, 'white');
+
+ var grad2 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad2.addColorStop(0, 'green');
+ grad2.addColorStop(1, 'white');
+
+ var grad3 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad3.addColorStop(0, 'blue');
+ grad3.addColorStop(1, 'white');
+
+ //meter1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show palette', RGraph.Showpalette], ['Clear annotations', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}], null, ['Cancel', function () {}]]);
+ meter1.Set('chart.annotatable', false);
+ meter1.Set('chart.labels.position', 'inside');
+ meter1.Set('chart.title', '<? echo $itemRSS[$item]; ?>');
+ meter1.Set('chart.title.vpos', 0.5);
+ meter1.Set('chart.title.color', 'black');
+ meter1.Set('chart.red.color', grad3);
+ meter1.Set('chart.yellow.color', grad2);
+ meter1.Set('chart.green.color', grad1);
+ meter1.Set('chart.red.start', -20);
+ meter1.Set('chart.red.end', 55);
+ meter1.Set('chart.yellow.start', 55);
+ meter1.Set('chart.yellow.end', 90);
+ meter1.Set('chart.green.start', 90);
+ meter1.Set('chart.green.end', 120);
+ meter1.Set('chart.shadow', true);
+ meter1.Set('chart.shadow.color', 'gray');
+ meter1.Set('chart.shadow.offsetx', 0);
+ meter1.Set('chart.shadow.offsety', 0);
+ meter1.Set('chart.shadow.blur', 15);
+ meter1.Set('chart.zoom.hdir', 'center');
+ meter1.Set('chart.zoom.vdir', 'center');
+ meter1.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}]]);
+ meter1.Draw();
+
+ }
+ </script>
+</head>
+<body>
+
+ <div style="text-align: center">
+ <canvas id="meter1" width="300" height="150"><div class="canvasfallback">[No canvas support]</div></canvas>
+ </div>
+
+</body>
+</html>
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<?
+if (isset($_GET['item'])) {
+ $item=$_GET['item'];
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.odo.js" ></script>
+
+ <script>
+ window.onload = function ()
+ {
+ // ID, MINIMUM, MAXIMUM, INDICATED VALUE
+ var odo2 = new RGraph.Odometer('odo2', 0, 360, <? echo $itemRSS[$item]; ?>);
+ odo2.Set('chart.annotatable', false);
+ //odo2.Set('chart.needle.thickness', 6);
+ odo2.Set('chart.needle.color', 'black');
+ odo2.Set('chart.needle.tail', false);
+ //odo2.Set('chart.needle.type', 'triangle');
+ odo2.Set('chart.label.area', 22);
+ odo2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(odo2.canvas); odo2.Draw();}]]);
+ //odo2.Set('chart.border', document.all ? false : true);
+ //odo2.Set('chart.tickmarks.highlighted', true);
+ odo2.Set('chart.labels', ['N','NE','E','SE','S','SW','W','NW']);
+ odo2.Set('chart.red.min', 360);
+ odo2.Set('chart.red.color', 'gray');
+ //odo2.Set('chart.value.text', true);
+ odo2.Set('chart.value.units.post', ' degrees');
+ odo2.Draw();
+ }
+ </script>
+</head>
+<body>
+
+ <div style="text-align: center">
+ <canvas id="odo2" width="200" height="200"><div class="canvasfallback">[No canvas support]</div></canvas>
+ </div>
+
+</body>
+</html>
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<?
+if (isset($_GET['item'])) {
+ $item=$_GET['item'];
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../libraries/RGraph.common.core.js" ></script>
+ <script src="../libraries/RGraph.common.context.js" ></script>
+ <script src="../libraries/RGraph.common.annotate.js" ></script>
+ <script src="../libraries/RGraph.common.tooltips.js" ></script>
+ <script src="../libraries/RGraph.common.zoom.js" ></script>
+ <script src="../libraries/RGraph.common.resizing.js" ></script>
+ <script src="../libraries/RGraph.meter.js" ></script>
+ <!--[if IE 8]><script src="../excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var meter1 = new RGraph.Meter('meter1', -20, 120, <? echo $itemRSS[$item]; ?>);
+
+ var grad1 = meter1.context.createRadialGradient(meter1.canvas.width / 2,meter1.canvas.height - 25,0,meter1.canvas.width / 2,meter1.canvas.height - 25,100);
+ grad1.addColorStop(0, 'red');
+ grad1.addColorStop(1, 'white');
+
+ var grad2 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad2.addColorStop(0, 'green');
+ grad2.addColorStop(1, 'white');
+
+ var grad3 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad3.addColorStop(0, 'blue');
+ grad3.addColorStop(1, 'white');
+
+ //meter1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show palette', RGraph.Showpalette], ['Clear annotations', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}], null, ['Cancel', function () {}]]);
+ meter1.Set('chart.annotatable', false);
+ meter1.Set('chart.labels.position', 'inside');
+ meter1.Set('chart.title', '<? echo $itemRSS[$item]; ?>');
+ meter1.Set('chart.title.vpos', 0.5);
+ meter1.Set('chart.title.color', 'black');
+ meter1.Set('chart.red.color', grad3);
+ meter1.Set('chart.yellow.color', grad2);
+ meter1.Set('chart.green.color', grad1);
+ meter1.Set('chart.red.start', -20);
+ meter1.Set('chart.red.end', 55);
+ meter1.Set('chart.yellow.start', 55);
+ meter1.Set('chart.yellow.end', 90);
+ meter1.Set('chart.green.start', 90);
+ meter1.Set('chart.green.end', 120);
+ meter1.Set('chart.shadow', true);
+ meter1.Set('chart.shadow.color', 'gray');
+ meter1.Set('chart.shadow.offsetx', 0);
+ meter1.Set('chart.shadow.offsety', 0);
+ meter1.Set('chart.shadow.blur', 15);
+ meter1.Set('chart.zoom.hdir', 'center');
+ meter1.Set('chart.zoom.vdir', 'center');
+ meter1.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}]]);
+ meter1.Draw();
+
+ }
+ </script>
+</head>
+<body>
+
+ <div style="text-align: center">
+ <canvas id="meter1" width="300" height="150"><div class="canvasfallback">[No canvas support]</div></canvas>
+ </div>
+
+</body>
+</html>
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<?
+function get_data($item) {
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+ echo $itemRSS[$item];
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="libraries/RGraph.common.core.js" ></script>
+ <script src="libraries/RGraph.common.context.js" ></script>
+ <script src="libraries/RGraph.common.annotate.js" ></script>
+ <script src="libraries/RGraph.common.tooltips.js" ></script>
+ <script src="libraries/RGraph.common.zoom.js" ></script>
+ <script src="libraries/RGraph.common.resizing.js" ></script>
+ <script src="libraries/RGraph.odo.js" ></script>
+ <!--[if IE 8]><script src="excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var odo2 = new RGraph.Odometer('odo2', 0, 360, <? get_data("windDirectionDegrees"); ?>);
+ odo2.Set('chart.annotatable', false);
+ //odo2.Set('chart.needle.thickness', 6);
+ odo2.Set('chart.needle.color', 'black');
+ odo2.Set('chart.needle.tail', false);
+ //odo2.Set('chart.needle.type', 'triangle');
+ odo2.Set('chart.label.area', 22);
+ odo2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(odo2.canvas); odo2.Draw();}]]);
+ //odo2.Set('chart.border', document.all ? false : true);
+ //odo2.Set('chart.tickmarks.highlighted', true);
+ odo2.Set('chart.labels', ['N','NE','E','SE','S','SW','W','NW']);
+ odo2.Set('chart.red.min', 360);
+ odo2.Set('chart.red.color', 'gray');
+ //odo2.Set('chart.value.text', true);
+ odo2.Set('chart.value.units.post', ' degrees');
+ odo2.Draw();
+
+ }
+ </script>
+</head>
+<body>
+
+ <canvas id="odo2" width="200" height="200"><div class="canvasfallback">[No canvas support]</div></canvas>
+</body>
+</html>
--- /dev/null
+<?php ob_start('ob_gzhandler') ?>
+<?
+function get_data($item) {
+ $doc = new DOMDocument();
+ $doc->load('http://weather/weather/all-output.xml');
+ $arrFeeds = array();
+ foreach ($doc->getElementsByTagName('weather') as $node) {
+ $itemRSS = array (
+ $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
+ );
+ array_push($arrFeeds, $itemRSS);
+ }
+ echo $itemRSS[$item];
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="libraries/RGraph.common.core.js" ></script>
+ <script src="libraries/RGraph.common.context.js" ></script>
+ <script src="libraries/RGraph.common.annotate.js" ></script>
+ <script src="libraries/RGraph.common.tooltips.js" ></script>
+ <script src="libraries/RGraph.common.zoom.js" ></script>
+ <script src="libraries/RGraph.common.resizing.js" ></script>
+ <script src="libraries/RGraph.meter.js" ></script>
+ <!--[if IE 8]><script src="excanvas/excanvas.compressed.js"></script><![endif]-->
+
+ <script>
+ window.onload = function ()
+ {
+ var meter1 = new RGraph.Meter('meter1', -20, 120, <? get_data("outsideTemp"); ?>);
+
+ var grad1 = meter1.context.createRadialGradient(meter1.canvas.width / 2,meter1.canvas.height - 25,0,meter1.canvas.width / 2,meter1.canvas.height - 25,100);
+ grad1.addColorStop(0, 'red');
+ grad1.addColorStop(1, 'white');
+
+ var grad2 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad2.addColorStop(0, 'green');
+ grad2.addColorStop(1, 'white');
+
+ var grad3 = meter1.context.createRadialGradient(meter1.canvas.width / 2, meter1.canvas.height - 25,0,meter1.canvas.width / 2, meter1.canvas.height - 25,100);
+ grad3.addColorStop(0, 'blue');
+ grad3.addColorStop(1, 'white');
+
+ //meter1.Set('chart.contextmenu', [['Zoom in', RGraph.Zoom], ['Show palette', RGraph.Showpalette], ['Clear annotations', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}], null, ['Cancel', function () {}]]);
+ meter1.Set('chart.annotatable', false);
+ meter1.Set('chart.labels.position', 'inside');
+ meter1.Set('chart.title', '<? get_data("outsideTemp"); ?>');
+ meter1.Set('chart.title.vpos', 0.5);
+ meter1.Set('chart.title.color', 'black');
+ meter1.Set('chart.red.color', grad3);
+ meter1.Set('chart.yellow.color', grad2);
+ meter1.Set('chart.green.color', grad1);
+ meter1.Set('chart.red.start', -20);
+ meter1.Set('chart.red.end', 55);
+ meter1.Set('chart.yellow.start', 55);
+ meter1.Set('chart.yellow.end', 90);
+ meter1.Set('chart.green.start', 90);
+ meter1.Set('chart.green.end', 120);
+ meter1.Set('chart.shadow', true);
+ meter1.Set('chart.shadow.color', 'gray');
+ meter1.Set('chart.shadow.offsetx', 0);
+ meter1.Set('chart.shadow.offsety', 0);
+ meter1.Set('chart.shadow.blur', 15);
+ meter1.Set('chart.zoom.hdir', 'center');
+ meter1.Set('chart.zoom.vdir', 'center');
+ meter1.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(meter1.canvas); meter1.Draw();}]]);
+ meter1.Draw();
+ }
+ </script>
+</head>
+<body>
+ <canvas id="meter1" width="300" height="150"><div class="canvasfallback">[No canvas support]</div></canvas>
+</td></tr>
+</table>
+</body>
+</html>
--- /dev/null
+var pages=new Array();
+ pages[0]="weather2.html";
+ pages[1]="weather3.html";
+ pages[2]="weather4.html";
+ pages[3]="weather5.html";
+ pages[4]="weather1.html";
+
+var i=0;
+var time=3000;
+
+function pageChange() {
+ alert(i);
+ ajaxpage(pages[i],'contentarea');
+ $i++;
+ if ($i==pages.length) {
+ $i=0;
+ }
+ setTimeout("pageChange()",time);
+}
+
+pageChange();
--- /dev/null
+<?
+include("xml2array.php");
+
+$ch = curl_init();
+
+curl_setopt($ch, CURLOPT_URL,"http://weather/weather/all-output.xml");
+
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
+
+$output = curl_exec($ch);
+
+#echo "<pre>";
+$array=xml2array($output);
+#print_r($array);
+?>
+
+<table border=0>
+<tr align='center' style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'><td>Temperature</td><td>Wind</td><td>Rain</td><td>Wind Chill</td></tr>
+<tr align='center'><td rowspan=3 align=center>
+<?
+ echo $array['rss']['weather']['outsideTemp']." °F<br>";
+ $temp=$array['rss']['weather']['outsideTemp'];
+ $mint=$array['rss']['weather']['lowOutsideTemp'];
+ $maxt=$array['rss']['weather']['hiOutsideTemp'];
+ echo "<table border=0>";
+ echo "<tr align=center><td>";
+ echo "<img src='thermometer.php?t=$temp&mint=$mint&maxt=$maxt'>";
+ echo "</td><td> Feels like<br>".$array['rss']['weather']['windchill']." °F<br>";
+ echo "</td></tr></table>";
+ echo "<table border=0>";
+ echo "<tr align=center style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'><td>Temp</td><td>High</td><td>Low</td></tr>";
+ echo "<tr align=center><td rowspan=2>Today:</td><td>$maxt °F</td><td>$mint °F</td></tr>";
+ echo "<tr align=center><td>".$array['rss']['weather']['hiOutsideTempTime']."</td><td>".$array['rss']['weather']['lowOutsideTempTime']."</td></tr>";
+ echo "</table>";
+?>
+
+</td><td>
+
+<?
+ echo $array['rss']['weather']['winddirection']."<br>";
+ echo $array['rss']['weather']['windspeed']." MPH<br>";
+ echo $array['rss']['weather']['windBeaufortScale']."<br>";
+ echo "Max wind ".$array['rss']['weather']['hiWindSpeed']." MPH at ".$array['rss']['weather']['hiWindSpeedTime'];
+?>
+
+</td><td>
+<table border=0>
+<?
+ echo "<tr align=center><td>Today:</td><td>".$array['rss']['weather']['dailyRain']."</td></tr>";
+ echo "<tr align=center><td>Rate (/hr):</td><td>".$array['rss']['weather']['rainrate']."</td></tr>";
+ echo "<tr align=center><td>High Rate:</td><td>".$array['rss']['weather']['hiRainRate']."</td></tr>";
+ echo "<tr align=center><td>Month Total:</td><td>".$array['rss']['weather']['monthlyRain']."</td></tr>";
+ echo "<tr align=center><td>Rain Season:</td><td>".$array['rss']['weather']['totalRain']."</td></tr>";
+?>
+</table>
+</td><td>
+<table border=0>
+<?
+ echo "<tr align=center><td>Current:</td><td>".$array['rss']['weather']['windchill']." °F</td></tr>";
+ echo "<tr align=center><td>Low:</td><td>".$array['rss']['weather']['lowWindchill']." °F<br>at ".$array['rss']['weather']['lowWindchillTime']."</td></tr>";
+?>
+</table>
+</td></tr>
+<tr align='center'><td style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'>Barometer</td><td style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'>Humidity/Dew Point</td><td></td>
+<tr align='center'><td>
+<table border=0>
+<?
+ echo "<tr align=center><td>Current:</td><td>".$array['rss']['weather']['barometer']." inHg</td></tr>";
+ echo "<tr align=center><td>1-Hr Trend:</td><td>".$array['rss']['weather']['baromtrend']."</td></tr>";
+?>
+</table>
+</td><td>
+<table border=0>
+<?
+ echo "<tr align=center><td>Humidity:</td><td>".$array['rss']['weather']['outsideHumidity']." %</td></tr>";
+ echo "<tr align=center><td>Today:</td><td>H: ".$array['rss']['weather']['hiHumidity']."%<br>L: ".$array['rss']['weather']['lowHumidity']."%</td></tr>";
+ echo "<tr align=center><td>Dew Point:</td><td>".$array['rss']['weather']['outsideDewPt']." °F</td></tr>";
+?>
+</table>
+
+</td><td></td>
+</table>
+
+<?php
+ include("weather-footer.php");
+?>
+
--- /dev/null
+function next_page() {
+ ajaxpage('weather3.html', 'contentarea')
+}
+
+t=setTimeout("next_page()",5000);
--- /dev/null
+<img width="75%" src="http://radblast.weatherunderground.com/cgi-bin/radar/WUNIDS_map?station=DIX&brand=wui&num=6&delay=15&type=N0R&frame=0&scale=1.000&noclutter=0&t=1144248527&lat=39.93652725&lon=-75.15544891&label=Philadelphia,+PA&showstorms=0&map.x=400&map.y=240¢erx=400¢ery=240&transx=0&transy=0&showlabels=1&severe=0&rainsnow=0&lightning=0">
+<?php
+ include("weather-footer.php");
+?>
--- /dev/null
+function next_page() {
+ ajaxpage('weather4.html', 'contentarea')
+}
+
+t=setTimeout("next_page()",5000);
--- /dev/null
+<?
+
+ require_once("pxweather.class.php");
+ $w = new Weather("19046", $force = true);
+ $w->load();
+
+ echo "<table border=1>";
+ echo "<tr>";
+
+ foreach($w->getDaycasts() as $forecast)
+ {
+ echo "<td><center>";
+ echo $forecast['day']. "<br>";
+ echo "<img src='icons/weather/".$w->weatherString($forecast['weather']).".png'><br>";
+ echo $w->weatherString($forecast['weather']) . "<br>";
+
+ if (isset($forecast['low_temp']))
+ echo "Low: " . $forecast['low_temp'] . "<br>";
+
+ if (isset($forecast['high_temp']))
+ echo "High: " . $forecast['high_temp'] . "<br>";
+
+ #echo "Description: " . $forecast['text'] . "<br><br>";
+ #echo "</td>";
+ echo "</center></td>";
+ }
+ echo "</tr>";
+ echo "</table>";
+?>
+<?php
+ include("weather-footer.php");
+?>
--- /dev/null
+function next_page() {
+ ajaxpage('weather5.html', 'contentarea')
+}
+
+t=setTimeout("next_page()",5000);
--- /dev/null
+<br>
+<img width="75%" src="http://radblast.weatherunderground.com/cgi-bin/radar/WUNIDS_map?station=DIX&brand=wui&num=6&delay=15&type=N0R&frame=0&scale=1.000&noclutter=0&t=1144248527&lat=39.93652725&lon=-75.15544891&label=Philadelphia,+PA&showstorms=0&map.x=400&map.y=240¢erx=400¢ery=240&transx=0&transy=0&showlabels=1&severe=0&rainsnow=0&lightning=1"></td></tr>
+
+<?php
+ include("weather-footer.php");
+?>
--- /dev/null
+function next_page() {
+ ajaxpage('weather1.html', 'contentarea')
+}
+
+t=setTimeout("next_page()",5000);
--- /dev/null
+<br>
+ Nation wide Lightning Strike Count<br>
+ <table WIDTH="640" BORDER="0" CELLSPACING="0" CELLPADDING="0" width="75%">
+ <tr>
+ <?
+ #$data=file_get_contents("https://thunderstorm.vaisala.com/tux/jsp/explorer/explorer.jsp");
+ #preg_match_all("/img src=\"(.*\.jpg)\?bar=(.*)\"/i", $data, $matches);
+ #$items=split("=", $matches[0][0]);
+ #$item=split("\"",$items[2]);
+ #$url="https://thunderstorm.vaisala.com/jsp/explorer/images/lts-image.jpg?bar=" . $item[0];
+ $url="http://thunderstorm.vaisala.com/explorer_files/lts-image.jpg";
+ ?>
+ <img SRC="<? echo $url ?>" HSPACE="0" VSPACE="0" BORDER="0" alt="Lightning Map" width="75%">
+ </td>
+ </tr>
+ </table>
+<?php
+ include("weather-footer.php");
+?>
--- /dev/null
+function next_page() {
+ ajaxpage('weather1.html', 'contentarea')
+}
+
+t=setTimeout("next_page()",5000);
--- /dev/null
+<br>
+<?php
+ $data=file_get_contents("http://sohowww.nascom.nasa.gov/data/realtime-update.html");
+ preg_match_all("/ width=256 height=256 src=\"(.*\.gif)\".*/i", $data, $matches);
+ $items=split("=", $matches[0][0]);
+ $item1=split(">",$items[3]);
+ $item2=split(">",$items[8]);
+ $item3=split(">",$items[13]);
+ $item4=split(">",$items[21]);
+ $item5=split(">",$items[26]);
+ $item6=split(">",$items[31]);
+ $img1="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item1[0]);
+ $img2="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item2[0]);
+ $img3="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item3[0]);
+ $img4="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item4[0]);
+ $img5="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item5[0]);
+ $img6="http://sohowww.nascom.nasa.gov".eregi_replace("\"","",$item6[0]);
+ ?>
+ <img src="<? echo $img1; ?>">
+ <img src="<? echo $img4; ?>"><br>
+ <img src="<? echo $img3; ?>">
+ <img src="<? echo $img2; ?>"><br>
+ <img src="<? echo $img5; ?>">
+ <img src="<? echo $img6; ?>"> <br>
+
+<?php
+ include("weather-footer.php");
+?>
--- /dev/null
+<?
+function xml2array($contents, $get_attributes=1, $priority = 'tag') {
+ if(!$contents) return array();
+
+ if(!function_exists('xml_parser_create')) {
+ //print "'xml_parser_create()' function not found!";
+ return array();
+ }
+
+ //Get the XML parser of PHP - PHP must have this module for the parser to work
+ $parser = xml_parser_create('');
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
+ xml_parse_into_struct($parser, trim($contents), $xml_values);
+ xml_parser_free($parser);
+
+ if(!$xml_values) return;//Hmm...
+
+ //Initializations
+ $xml_array = array();
+ $parents = array();
+ $opened_tags = array();
+ $arr = array();
+
+ $current = &$xml_array; //Refference
+
+ //Go through the tags.
+ $repeated_tag_index = array();//Multiple tags with same name will be turned into an array
+ foreach($xml_values as $data) {
+ unset($attributes,$value);//Remove existing values, or there will be trouble
+
+ //This command will extract these variables into the foreach scope
+ // tag(string), type(string), level(int), attributes(array).
+ extract($data);//We could use the array by itself, but this cooler.
+
+ $result = array();
+ $attributes_data = array();
+
+ if(isset($value)) {
+ if($priority == 'tag') $result = $value;
+ else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode
+ }
+
+ //Set the attributes too.
+ if(isset($attributes) and $get_attributes) {
+ foreach($attributes as $attr => $val) {
+ if($priority == 'tag') $attributes_data[$attr] = $val;
+ else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
+ }
+ }
+
+ //See tag status and do the needed.
+ if($type == "open") {//The starting of the tag '<tag>'
+ $parent[$level-1] = &$current;
+ if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
+ $current[$tag] = $result;
+ if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+
+ $current = &$current[$tag];
+
+ } else { //There was another element with the same tag name
+
+ if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+ $repeated_tag_index[$tag.'_'.$level]++;
+ } else {//This section will make the value an array if multiple tags with the same name appear together
+ $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
+ $repeated_tag_index[$tag.'_'.$level] = 2;
+
+ if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+ $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+ unset($current[$tag.'_attr']);
+ }
+
+ }
+ $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
+ $current = &$current[$tag][$last_item_index];
+ }
+
+ } elseif($type == "complete") { //Tags that ends in 1 line '<tag />'
+ //See if the key is already taken.
+ if(!isset($current[$tag])) { //New Key
+ $current[$tag] = $result;
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+ if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data;
+
+ } else { //If taken, put all things inside a list(array)
+ if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array...
+
+ // ...push the new element into that array.
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+
+ if($priority == 'tag' and $get_attributes and $attributes_data) {
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
+ }
+ $repeated_tag_index[$tag.'_'.$level]++;
+
+ } else { //If it is not an array...
+ $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
+ $repeated_tag_index[$tag.'_'.$level] = 1;
+ if($priority == 'tag' and $get_attributes) {
+ if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+
+ $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+ unset($current[$tag.'_attr']);
+ }
+
+ if($attributes_data) {
+ $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
+ }
+ }
+ $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
+ }
+ }
+
+ } elseif($type == 'close') { //End of tag '</tag>'
+ $current = &$parent[$level-1];
+ }
+ }
+
+ return($xml_array);
+}
+?>
--- /dev/null
+<?php\r
+\r
+/* xmlize() is by Hans Anderson, me@hansanderson.com\r
+ *\r
+ * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL].\r
+ * some code in xml_depth is based on code written by other PHPers\r
+ * as well as one Perl script. Poor programming practice and organization\r
+ * on my part is to blame for the credit these people aren't receiving.\r
+ * None of the code was copyrighted, though.\r
+ *\r
+ * This is a stable release, 1.0. I don't foresee any changes, but you\r
+ * might check http://www.hansanderson.com/php/xml/ to see\r
+ *\r
+ * usage: $xml = xmlize($array);\r
+ *\r
+ * See the function traverse_xmlize() for information about the\r
+ * structure of the array, it's much easier to explain by showing you.\r
+ * Be aware that the array is somewhat tricky. I use xmlize all the time,\r
+ * but still need to use traverse_xmlize quite often to show me the structure!\r
+\r
+ ## THIS IS A PHP 5 VERSION:\r
+\r
+ > attached is the modified script. Basically it has a new optional parameter\r
+ > to specify an OUTPUT encoding. If not specified, it defaults to UTF-8.\r
+ > I recommend you to read this PHP bug. There you can see how PHP4, PHP5.0.0\r
+ > and PHP5.0.2 will handle this.\r
+ > http://bugs.php.net/bug.php?id=29711\r
+ > Ciao, Eloy :-)\r
+ ##\r
+ *\r
+ */\r
+\r
+function xmlize($data, $WHITE=1, $encoding='UTF-8') {\r
+\r
+ $data = trim($data);\r
+ $vals = $index = $array = array();\r
+ $parser = xml_parser_create($encoding);\r
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);\r
+ xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);\r
+ xml_parse_into_struct($parser, $data, $vals, $index);\r
+ xml_parser_free($parser);\r
+\r
+ $i = 0;\r
+\r
+ $tagname = $vals[$i]['tag'];\r
+ if ( isset ($vals[$i]['attributes'] ) )\r
+ {\r
+ $array[$tagname]['@'] = $vals[$i]['attributes'];\r
+ } else {\r
+ $array[$tagname]['@'] = array();\r
+ }\r
+\r
+ $array[$tagname]["#"] = xml_depth($vals, $i);\r
+\r
+\r
+ return $array;\r
+}\r
+\r
+/*\r
+ *\r
+ * You don't need to do anything with this function, it's called by\r
+ * xmlize. It's a recursive function, calling itself as it goes deeper\r
+ * into the xml levels. If you make any improvements, please let me know.\r
+ *\r
+ *\r
+ */\r
+\r
+function xml_depth($vals, &$i) {\r
+ $children = array();\r
+\r
+ if ( isset($vals[$i]['value']) )\r
+ {\r
+ array_push($children, $vals[$i]['value']);\r
+ }\r
+\r
+ while (++$i < count($vals)) {\r
+\r
+ switch ($vals[$i]['type']) {\r
+\r
+ case 'open':\r
+\r
+ if ( isset ( $vals[$i]['tag'] ) )\r
+ {\r
+ $tagname = $vals[$i]['tag'];\r
+ } else {\r
+ $tagname = '';\r
+ }\r
+\r
+ if ( isset ( $children[$tagname] ) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if ( isset ( $vals[$i]['attributes'] ) ) {\r
+ $children[$tagname][$size]['@'] = $vals[$i]["attributes"];\r
+\r
+ }\r
+\r
+ $children[$tagname][$size]['#'] = xml_depth($vals, $i);\r
+\r
+ break;\r
+\r
+\r
+ case 'cdata':\r
+ array_push($children, $vals[$i]['value']);\r
+ break;\r
+\r
+ case 'complete':\r
+ $tagname = $vals[$i]['tag'];\r
+\r
+ if( isset ($children[$tagname]) )\r
+ {\r
+ $size = sizeof($children[$tagname]);\r
+ } else {\r
+ $size = 0;\r
+ }\r
+\r
+ if( isset ( $vals[$i]['value'] ) )\r
+ {\r
+ $children[$tagname][$size]["#"] = $vals[$i]['value'];\r
+ } else {\r
+ $children[$tagname][$size]["#"] = '';\r
+ }\r
+\r
+ if ( isset ($vals[$i]['attributes']) ) {\r
+ $children[$tagname][$size]['@']\r
+ = $vals[$i]['attributes'];\r
+ }\r
+\r
+ break;\r
+\r
+ case 'close':\r
+ return $children;\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
+ return $children;\r
+\r
+\r
+}\r
+\r
+\r
+/* function by acebone@f2s.com, a HUGE help!\r
+ *\r
+ * this helps you understand the structure of the array xmlize() outputs\r
+ *\r
+ * usage:\r
+ * traverse_xmlize($xml, 'xml_');\r
+ * print '<pre>' . implode("", $traverse_array . '</pre>';\r
+ *\r
+ *\r
+ */\r
+\r
+function traverse_xmlize($array, $arrName = "array", $level = 0) {\r
+\r
+ foreach($array as $key=>$val)\r
+ {\r
+ if ( is_array($val) )\r
+ {\r
+ traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);\r
+ } else {\r
+ $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";\r
+ }\r
+ }\r
+\r
+ return 1;\r
+\r
+}\r
+\r
+?>
\ No newline at end of file