graphael-rails 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/graphael-rails.gemspec +53 -12
  4. data/vendor/assets/javascripts/g.raphael/README.markdown +21 -0
  5. data/vendor/assets/javascripts/g.raphael/docs/blueprint-min.png +0 -0
  6. data/vendor/assets/javascripts/g.raphael/docs/dr-print.css +218 -0
  7. data/vendor/assets/javascripts/g.raphael/docs/dr.css +404 -0
  8. data/vendor/assets/javascripts/g.raphael/docs/reference.html +350 -0
  9. data/vendor/assets/javascripts/g.raphael/docs/reference.js +35 -0
  10. data/vendor/assets/javascripts/g.raphael/g.bar.js +621 -0
  11. data/vendor/assets/javascripts/g.raphael/g.dot.js +156 -0
  12. data/vendor/assets/javascripts/g.raphael/g.line.js +329 -0
  13. data/vendor/assets/javascripts/g.raphael/g.pie.js +255 -0
  14. data/vendor/assets/javascripts/g.raphael/g.raphael.js +887 -0
  15. data/vendor/assets/javascripts/g.raphael/g.raphael.json +9 -0
  16. data/vendor/assets/javascripts/g.raphael/min/g.bar-min.js +7 -0
  17. data/vendor/assets/javascripts/g.raphael/min/g.dot-min.js +7 -0
  18. data/vendor/assets/javascripts/g.raphael/min/g.line-min.js +7 -0
  19. data/vendor/assets/javascripts/g.raphael/min/g.pie-min.js +1 -0
  20. data/vendor/assets/javascripts/g.raphael/min/g.raphael-min.js +7 -0
  21. data/vendor/assets/javascripts/g.raphael/raphael-min.js +9 -0
  22. data/vendor/assets/javascripts/g.raphael/test/barchart.html +37 -0
  23. data/vendor/assets/javascripts/g.raphael/test/barchart2.html +51 -0
  24. data/vendor/assets/javascripts/g.raphael/test/brightness.html +47 -0
  25. data/vendor/assets/javascripts/g.raphael/test/css/demo-print.css +17 -0
  26. data/vendor/assets/javascripts/g.raphael/test/css/demo.css +21 -0
  27. data/vendor/assets/javascripts/g.raphael/test/dotchart.html +35 -0
  28. data/vendor/assets/javascripts/g.raphael/test/images/bg.png +0 -0
  29. data/vendor/assets/javascripts/g.raphael/test/images/bgbg.png +0 -0
  30. data/vendor/assets/javascripts/g.raphael/test/linechart.html +66 -0
  31. data/vendor/assets/javascripts/g.raphael/test/piechart.html +26 -0
  32. data/vendor/assets/javascripts/g.raphael/test/piechart2.html +46 -0
  33. data/vendor/assets/javascripts/g.raphael/test/tooltips.html +85 -0
  34. data/vendor/assets/javascripts/raphael/README.markdown +3 -0
  35. data/vendor/assets/javascripts/raphael/history.md +82 -0
  36. data/vendor/assets/javascripts/raphael/license.txt +21 -0
  37. data/vendor/assets/javascripts/raphael/make +45 -0
  38. data/vendor/assets/javascripts/raphael/raphael-min.js +10 -0
  39. data/vendor/assets/javascripts/raphael/raphael.core.js +5189 -0
  40. data/vendor/assets/javascripts/raphael/raphael.js +5815 -0
  41. data/vendor/assets/javascripts/raphael/raphael.svg.js +1360 -0
  42. data/vendor/assets/javascripts/raphael/raphael.vml.js +973 -0
  43. data/vendor/assets/javascripts/raphael/reference.html +2489 -0
  44. data/vendor/assets/javascripts/raphael/reference.js +248 -0
  45. metadata +47 -6
@@ -0,0 +1,350 @@
1
+ <!DOCTYPE html>
2
+ <!-- Generated with Dr.js -->
3
+ <html lang="en"><head><meta charset="utf-8"><title>g.Raphaël Reference</title><link rel="stylesheet" href="dr.css" media="screen"><link rel="stylesheet" href="dr-print.css" media="print"></head><body id="dr-js"><div id="dr"><ol class="dr-toc" id="dr-toc"><li class="dr-lvl0"><a href="#Element" class="{clas}"><span>Element</span></a></li><li class="dr-lvl1"><a href="#Element.blob" class="dr-method"><span>Element.blob()</span></a></li><li class="dr-lvl1"><a href="#Element.darker" class="dr-method"><span>Element.darker()</span></a></li><li class="dr-lvl1"><a href="#Element.drop" class="dr-method"><span>Element.drop()</span></a></li><li class="dr-lvl1"><a href="#Element.flag" class="dr-method"><span>Element.flag()</span></a></li><li class="dr-lvl1"><a href="#Element.label" class="dr-method"><span>Element.label()</span></a></li><li class="dr-lvl1"><a href="#Element.lighter" class="dr-method"><span>Element.lighter()</span></a></li><li class="dr-lvl1"><a href="#Element.popup" class="dr-method"><span>Element.popup()</span></a></li><li class="dr-lvl1"><a href="#Element.resetBrightness" class="dr-method"><span>Element.resetBrightness()</span></a></li><li class="dr-lvl1"><a href="#Element.tag" class="dr-method"><span>Element.tag()</span></a></li><li class="dr-lvl0"><a href="#Paper" class="{clas}"><span>Paper</span></a></li><li class="dr-lvl1"><a href="#Paper.blob" class="dr-method"><span>Paper.blob()</span></a></li><li class="dr-lvl1"><a href="#Paper.drop" class="dr-method"><span>Paper.drop()</span></a></li><li class="dr-lvl1"><a href="#Paper.flag" class="dr-method"><span>Paper.flag()</span></a></li><li class="dr-lvl1"><a href="#Paper.label" class="dr-method"><span>Paper.label()</span></a></li><li class="dr-lvl1"><a href="#Paper.popup" class="dr-method"><span>Paper.popup()</span></a></li><li class="dr-lvl1"><a href="#Paper.tag" class="dr-method"><span>Paper.tag()</span></a></li><li class="dr-lvl0"><a href="#g" class="{clas}"><span>g</span></a></li><li class="dr-lvl1"><a href="#g.colors" class="dr-array"><span>g.colors</span></a></li><li class="dr-lvl1"><a href="#g.shim" class="dr-object"><span>g.shim</span></a></li><li class="dr-lvl1"><a href="#g.txtattr" class="dr-object"><span>g.txtattr</span></a></li></ol><div class="dr-doc"><h1>g.Raphaël Reference</h1><div class="Element-section"><h2 id="Element" class="undefined"><i class="dr-trixie">&#160;</i>Element<a href="#Element" title="Link to this section" class="dr-hash">&#x2693;</a></h2>
4
+ <div class="extra" id="Element-extra"></div></div><div class="Element-blob-section"><h3 id="Element.blob" class="dr-method"><i class="dr-trixie">&#160;</i>Element.blob(angle, x, y)<a href="#Element.blob" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 375 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L375">&#x27ad;</a></h3>
5
+ <div class="extra" id="Element.blob-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'blob' tooltip. Can also be used on sets.
6
+ </p>
7
+ <p class="header">Parameters
8
+ </p>
9
+ <dl class="dr-parameters"><dt class="dr-param">angle</dt>
10
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
11
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
12
+ <dt class="dr-param">x</dt>
13
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
14
+ <dd class="dr-description">x coordinate of the blob's tail [default: Element's <code>x</code> or <code>cx</code>]</dd>
15
+ <dt class="dr-param">y</dt>
16
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
17
+ <dd class="dr-description">y coordinate of the blob's tail [default: Element's <code>x</code> or <code>cx</code>]</dd>
18
+ </dl>
19
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the blob</span></p>
20
+ <p class="header">Usage
21
+ </p>
22
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">8</span>).attr({
23
+ stroke: <i>"#fff"</i>,
24
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
25
+ }).blob(<span class="d">60</span>);
26
+ </code></pre>
27
+ </div><div class="Element-darker-section"><h3 id="Element.darker" class="dr-method"><i class="dr-trixie">&#160;</i>Element.darker(times)<a href="#Element.darker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 633 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L633">&#x27ad;</a></h3>
28
+ <div class="extra" id="Element.darker-extra"></div></div><div class="dr-method"><p>Makes the context element darker by decreasing the brightness and increasing the saturation by a given factor. Can be called on Sets.
29
+ </p>
30
+ <p class="header">Parameters
31
+ </p>
32
+ <dl class="dr-parameters"><dt class="dr-param">times</dt>
33
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
34
+ <dd class="dr-description">adjustment factor [default: <code>2</code>]</dd>
35
+ </dl>
36
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Element</span></p>
37
+ <p class="header">Usage
38
+ </p>
39
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">20</span>).attr({
40
+ fill: <i>"#ff0000"</i>,
41
+ stroke: <i>"#fff"</i>,
42
+ <i>"stroke-width"</i>: <span class="d">2</span>
43
+ }).darker(<span class="d">6</span>);
44
+ </code></pre>
45
+ </div><div class="Element-drop-section"><h3 id="Element.drop" class="dr-method"><i class="dr-trixie">&#160;</i>Element.drop(angle, x, y)<a href="#Element.drop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 225 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L225">&#x27ad;</a></h3>
46
+ <div class="extra" id="Element.drop-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'drop' tooltip. Can also be used on sets.
47
+ </p>
48
+ <p class="header">Parameters
49
+ </p>
50
+ <dl class="dr-parameters"><dt class="dr-param">angle</dt>
51
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
52
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
53
+ <dt class="dr-param">x</dt>
54
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
55
+ <dd class="dr-description">x coordinate of the drop's point [default: Element's <code>x</code> or <code>cx</code>]</dd>
56
+ <dt class="dr-param">y</dt>
57
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
58
+ <dd class="dr-description">y coordinate of the drop's point [default: Element's <code>x</code> or <code>cx</code>]</dd>
59
+ </dl>
60
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the drop</span></p>
61
+ <p class="header">Usage
62
+ </p>
63
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">8</span>).attr({
64
+ stroke: <i>"#fff"</i>,
65
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
66
+ }).drop(<span class="d">60</span>);
67
+ </code></pre>
68
+ </div><div class="Element-flag-section"><h3 id="Element.flag" class="dr-method"><i class="dr-trixie">&#160;</i>Element.flag(angle, x, y)<a href="#Element.flag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 281 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L281">&#x27ad;</a></h3>
69
+ <div class="extra" id="Element.flag-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'flag' tooltip. Can also be used on sets.
70
+ </p>
71
+ <p class="header">Parameters
72
+ </p>
73
+ <dl class="dr-parameters"><dt class="dr-param">angle</dt>
74
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
75
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
76
+ <dt class="dr-param">x</dt>
77
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
78
+ <dd class="dr-description">x coordinate of the flag's point [default: Element's <code>x</code> or <code>cx</code>]</dd>
79
+ <dt class="dr-param">y</dt>
80
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
81
+ <dd class="dr-description">y coordinate of the flag's point [default: Element's <code>x</code> or <code>cx</code>]</dd>
82
+ </dl>
83
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the flag</span></p>
84
+ <p class="header">Usage
85
+ </p>
86
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">10</span>).attr({
87
+ stroke: <i>"#fff"</i>,
88
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
89
+ }).flag(<span class="d">60</span>);
90
+ </code></pre>
91
+ </div><div class="Element-label-section"><h3 id="Element.label" class="dr-method"><i class="dr-trixie">&#160;</i>Element.label()<a href="#Element.label" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 346 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L346">&#x27ad;</a></h3>
92
+ <div class="extra" id="Element.label-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'label' tooltip. Can also be used on sets.
93
+ </p>
94
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the label.</span></p>
95
+ <p class="header">Usage
96
+ </p>
97
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">10</span>).attr({
98
+ stroke: <i>"#fff"</i>,
99
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
100
+ }).label();
101
+ </code></pre>
102
+ </div><div class="Element-lighter-section"><h3 id="Element.lighter" class="dr-method"><i class="dr-trixie">&#160;</i>Element.lighter(times)<a href="#Element.lighter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 597 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L597">&#x27ad;</a></h3>
103
+ <div class="extra" id="Element.lighter-extra"></div></div><div class="dr-method"><p>Makes the context element lighter by increasing the brightness and reducing the saturation by a given factor. Can be called on Sets.
104
+ </p>
105
+ <p class="header">Parameters
106
+ </p>
107
+ <dl class="dr-parameters"><dt class="dr-param">times</dt>
108
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
109
+ <dd class="dr-description">adjustment factor [default: <code>2</code>]</dd>
110
+ </dl>
111
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Element</span></p>
112
+ <p class="header">Usage
113
+ </p>
114
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">20</span>).attr({
115
+ fill: <i>"#ff0000"</i>,
116
+ stroke: <i>"#fff"</i>,
117
+ <i>"stroke-width"</i>: <span class="d">2</span>
118
+ }).lighter(<span class="d">6</span>);
119
+ </code></pre>
120
+ </div><div class="Element-popup-section"><h3 id="Element.popup" class="dr-method"><i class="dr-trixie">&#160;</i>Element.popup(dir, size, x, y)<a href="#Element.popup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 24 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L24">&#x27ad;</a></h3>
121
+ <div class="extra" id="Element.popup-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'popup' tooltip. Can also be used on sets.
122
+ </p>
123
+ <p class="header">Parameters
124
+ </p>
125
+ <dl class="dr-parameters"><dt class="dr-param">dir</dt>
126
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
127
+ <dd class="dr-description">location of Element relative to the tail: <code>'down'</code>, <code>'left'</code>, <code>'up'</code> [default], or <code>'right'</code>.</dd>
128
+ <dt class="dr-param">size</dt>
129
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
130
+ <dd class="dr-description">amount of bevel/padding around the Element, as well as half the width and height of the tail [default: <code>5</code>]</dd>
131
+ <dt class="dr-param">x</dt>
132
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
133
+ <dd class="dr-description">x coordinate of the popup's tail [default: Element's <code>x</code> or <code>cx</code>]</dd>
134
+ <dt class="dr-param">y</dt>
135
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
136
+ <dd class="dr-description">y coordinate of the popup's tail [default: Element's <code>y</code> or <code>cy</code>]</dd>
137
+ </dl>
138
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the popup</span></p>
139
+ <p class="header">Usage
140
+ </p>
141
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">5</span>).attr({
142
+ stroke: <i>"#fff"</i>,
143
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
144
+ }).popup();
145
+ </code></pre>
146
+ </div><div class="Element-resetBrightness-section"><h3 id="Element.resetBrightness" class="dr-method"><i class="dr-trixie">&#160;</i>Element.resetBrightness()<a href="#Element.resetBrightness" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 665 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L665">&#x27ad;</a></h3>
147
+ <div class="extra" id="Element.resetBrightness-extra"></div></div><div class="dr-method"><p>Resets brightness and saturation levels to their original values. See <a href="#Element.lighter" class="dr-link">Element.lighter</a> and <a href="#Element.darker" class="dr-link">Element.darker</a>. Can be called on Sets.
148
+ </p>
149
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Element</span></p>
150
+ <p class="header">Usage
151
+ </p>
152
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">20</span>).attr({
153
+ fill: <i>"#ff0000"</i>,
154
+ stroke: <i>"#fff"</i>,
155
+ <i>"stroke-width"</i>: <span class="d">2</span>
156
+ }).lighter(<span class="d">6</span>).resetBrightness();
157
+ </code></pre>
158
+ </div><div class="Element-tag-section"><h3 id="Element.tag" class="dr-method"><i class="dr-trixie">&#160;</i>Element.tag(angle, r, x, y)<a href="#Element.tag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 135 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L135">&#x27ad;</a></h3>
159
+ <div class="extra" id="Element.tag-extra"></div></div><div class="dr-method"><p>Puts the context Element in a 'tag' tooltip. Can also be used on sets.
160
+ </p>
161
+ <p class="header">Parameters
162
+ </p>
163
+ <dl class="dr-parameters"><dt class="dr-param">angle</dt>
164
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
165
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
166
+ <dt class="dr-param">r</dt>
167
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
168
+ <dd class="dr-description">radius of the loop [default: <code>5</code>]</dd>
169
+ <dt class="dr-param">x</dt>
170
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
171
+ <dd class="dr-description">x coordinate of the center of the tag loop [default: Element's <code>x</code> or <code>cx</code>]</dd>
172
+ <dt class="dr-param">y</dt>
173
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
174
+ <dd class="dr-description">y coordinate of the center of the tag loop [default: Element's <code>x</code> or <code>cx</code>]</dd>
175
+ </dl>
176
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">path element of the tag</span></p>
177
+ <p class="header">Usage
178
+ </p>
179
+ <pre class="javascript code"><code>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">15</span>).attr({
180
+ stroke: <i>"#fff"</i>,
181
+ fill: <i>"<span class="d">0</span>-#c9de96-#8ab66b:<span class="d">44</span>-#<span class="d">398235</span>"</i>
182
+ }).tag(<span class="d">60</span>);
183
+ </code></pre>
184
+ </div><div class="Paper-section"><h2 id="Paper" class="undefined"><i class="dr-trixie">&#160;</i>Paper<a href="#Paper" title="Link to this section" class="dr-hash">&#x2693;</a></h2>
185
+ <div class="extra" id="Paper-extra"></div></div><div class="Paper-blob-section"><h3 id="Paper.blob" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.blob(x, y, text, angle)<a href="#Paper.blob" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 569 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L569">&#x27ad;</a></h3>
186
+ <div class="extra" id="Paper.blob-extra"></div></div><div class="dr-method"><p>Puts the given text into a 'blob' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.blob" class="dr-link">Element.blob</a>
187
+ </p>
188
+ <p class="header">Parameters
189
+ </p>
190
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
191
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
192
+ <dd class="dr-description">x coordinate of the blob's tail</dd>
193
+ <dt class="dr-param">y</dt>
194
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
195
+ <dd class="dr-description">y coordinate of the blob's tail</dd>
196
+ <dt class="dr-param">text</dt>
197
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
198
+ <dd class="dr-description">text to place inside the blob</dd>
199
+ <dt class="dr-param">angle</dt>
200
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
201
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
202
+ </dl>
203
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the blob path and the text element</span></p>
204
+ <p class="header">Usage
205
+ </p>
206
+ <pre class="javascript code"><code>paper.blob(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>, <span class="d">60</span>);
207
+ </code></pre>
208
+ </div><div class="Paper-drop-section"><h3 id="Paper.drop" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.drop(x, y, text, angle)<a href="#Paper.drop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 545 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L545">&#x27ad;</a></h3>
209
+ <div class="extra" id="Paper.drop-extra"></div></div><div class="dr-method"><p>Puts the given text into a 'drop' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.drop" class="dr-link">Element.drop</a>
210
+ </p>
211
+ <p class="header">Parameters
212
+ </p>
213
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
214
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
215
+ <dd class="dr-description">x coordinate of the drop's point</dd>
216
+ <dt class="dr-param">y</dt>
217
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
218
+ <dd class="dr-description">y coordinate of the drop's point</dd>
219
+ <dt class="dr-param">text</dt>
220
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
221
+ <dd class="dr-description">text to place inside the drop</dd>
222
+ <dt class="dr-param">angle</dt>
223
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
224
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
225
+ </dl>
226
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the drop path and the text element</span></p>
227
+ <p class="header">Usage
228
+ </p>
229
+ <pre class="javascript code"><code>paper.drop(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>, <span class="d">60</span>);
230
+ </code></pre>
231
+ </div><div class="Paper-flag-section"><h3 id="Paper.flag" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.flag(x, y, text, angle)<a href="#Paper.flag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 521 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L521">&#x27ad;</a></h3>
232
+ <div class="extra" id="Paper.flag-extra"></div></div><div class="dr-method"><p>Puts the given <code>text</code> into a 'flag' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.flag" class="dr-link">Element.flag</a>
233
+ </p>
234
+ <p class="header">Parameters
235
+ </p>
236
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
237
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
238
+ <dd class="dr-description">x coordinate of the flag's point</dd>
239
+ <dt class="dr-param">y</dt>
240
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
241
+ <dd class="dr-description">y coordinate of the flag's point</dd>
242
+ <dt class="dr-param">text</dt>
243
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
244
+ <dd class="dr-description">text to place inside the flag</dd>
245
+ <dt class="dr-param">angle</dt>
246
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
247
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
248
+ </dl>
249
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the flag path and the text element</span></p>
250
+ <p class="header">Usage
251
+ </p>
252
+ <pre class="javascript code"><code>paper.flag(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>, <span class="d">60</span>);
253
+ </code></pre>
254
+ </div><div class="Paper-label-section"><h3 id="Paper.label" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.label(x, y, text)<a href="#Paper.label" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 445 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L445">&#x27ad;</a></h3>
255
+ <div class="extra" id="Paper.label-extra"></div></div><div class="dr-method"><p>Puts the given <code>text</code> into a 'label' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.label" class="dr-link">Element.label</a>
256
+ </p>
257
+ <p class="header">Parameters
258
+ </p>
259
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
260
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
261
+ <dd class="dr-description">x coordinate of the center of the label</dd>
262
+ <dt class="dr-param">y</dt>
263
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
264
+ <dd class="dr-description">y coordinate of the center of the label</dd>
265
+ <dt class="dr-param">text</dt>
266
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
267
+ <dd class="dr-description">text to place inside the label</dd>
268
+ </dl>
269
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the label path and the text element</span></p>
270
+ <p class="header">Usage
271
+ </p>
272
+ <pre class="javascript code"><code>paper.label(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>);
273
+ </code></pre>
274
+ </div><div class="Paper-popup-section"><h3 id="Paper.popup" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.popup(x, y, text, dir, size)<a href="#Paper.popup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 472 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L472">&#x27ad;</a></h3>
275
+ <div class="extra" id="Paper.popup-extra"></div></div><div class="dr-method"><p>Puts the given <code>text</code> into a 'popup' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.popup" class="dr-link">Element.popup</a>
276
+ </p>
277
+ <p>Note: The <code>dir</code> parameter has changed from g.Raphael 0.4.1 to 0.5. The options <code>0</code>, <code>1</code>, <code>2</code>, and <code>3</code> has been changed to <code>'down'</code>, <code>'left'</code>, <code>'up'</code>, and <code>'right'</code> respectively.
278
+ </p>
279
+ <p class="header">Parameters
280
+ </p>
281
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
282
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
283
+ <dd class="dr-description">x coordinate of the popup's tail</dd>
284
+ <dt class="dr-param">y</dt>
285
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
286
+ <dd class="dr-description">y coordinate of the popup's tail</dd>
287
+ <dt class="dr-param">text</dt>
288
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
289
+ <dd class="dr-description">text to place inside the popup</dd>
290
+ <dt class="dr-param">dir</dt>
291
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
292
+ <dd class="dr-description">location of the text relative to the tail: <code>'down'</code>, <code>'left'</code>, <code>'up'</code> [default], or <code>'right'</code>.</dd>
293
+ <dt class="dr-param">size</dt>
294
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
295
+ <dd class="dr-description">amount of padding around the Element [default: <code>5</code>]</dd>
296
+ </dl>
297
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the popup path and the text element</span></p>
298
+ <p class="header">Usage
299
+ </p>
300
+ <pre class="javascript code"><code>paper.popup(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>, <i>'down'</i>);
301
+ </code></pre>
302
+ </div><div class="Paper-tag-section"><h3 id="Paper.tag" class="dr-method"><i class="dr-trixie">&#160;</i>Paper.tag(x, y, text, angle, r)<a href="#Paper.tag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 497 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L497">&#x27ad;</a></h3>
303
+ <div class="extra" id="Paper.tag-extra"></div></div><div class="dr-method"><p>Puts the given text into a 'tag' tooltip. The text is given a default style according to <a href="#g.txtattr" class="dr-link">g.txtattr</a>. See <a href="#Element.tag" class="dr-link">Element.tag</a>
304
+ </p>
305
+ <p class="header">Parameters
306
+ </p>
307
+ <dl class="dr-parameters"><dt class="dr-param">x</dt>
308
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
309
+ <dd class="dr-description">x coordinate of the center of the tag loop</dd>
310
+ <dt class="dr-param">y</dt>
311
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
312
+ <dd class="dr-description">y coordinate of the center of the tag loop</dd>
313
+ <dt class="dr-param">text</dt>
314
+ <dd class="dr-type"><em class="dr-type-string">string</em></dd>
315
+ <dd class="dr-description">text to place inside the tag</dd>
316
+ <dt class="dr-param">angle</dt>
317
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
318
+ <dd class="dr-description">angle of orientation in degrees [default: <code>0</code>]</dd>
319
+ <dt class="dr-param">r</dt>
320
+ <dd class="dr-type"><em class="dr-type-number">number</em></dd>
321
+ <dd class="dr-description">radius of the loop [default: <code>5</code>]</dd>
322
+ </dl>
323
+ <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">set containing the tag path and the text element</span></p>
324
+ <p class="header">Usage
325
+ </p>
326
+ <pre class="javascript code"><code>paper.tag(<span class="d">50</span>, <span class="d">50</span>, <i>"$<span class="d">9.99</span>"</i>, <span class="d">60</span>);
327
+ </code></pre>
328
+ </div><div class="g-section"><h2 id="g" class="undefined"><i class="dr-trixie">&#160;</i>g<a href="#g" title="Link to this section" class="dr-hash">&#x2693;</a></h2>
329
+ <div class="extra" id="g-extra"></div></div><div class="g-colors-section"><h3 id="g.colors" class="dr-array"><i class="dr-trixie">&#160;</i>g.colors<a href="#g.colors" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 726 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L726">&#x27ad;</a></h3>
330
+ <div class="extra" id="g.colors-extra"></div></div><div class="dr-array"><p>An array of color values that charts will iterate through when drawing chart data values.
331
+ </p>
332
+ </div><div class="g-shim-section"><h3 id="g.shim" class="dr-object"><i class="dr-trixie">&#160;</i>g.shim<a href="#g.shim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 706 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L706">&#x27ad;</a></h3>
333
+ <div class="extra" id="g.shim-extra"></div></div><div class="dr-object"><p>An attribute object that charts will set on all generated shims (shims being the invisible objects that mouse events are bound to)
334
+ </p>
335
+ <p class="header">Default value
336
+ </p>
337
+ <pre class="javascript code"><code>{ stroke: <i>'none'</i>, fill: <i>'#<span class="d">000</span>'</i>, <i>'fill-opacity'</i>: <span class="d">0</span> }
338
+ </code></pre>
339
+ </div><div class="g-txtattr-section"><h3 id="g.txtattr" class="dr-object"><i class="dr-trixie">&#160;</i>g.txtattr<a href="#g.txtattr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 717 in the source" href="https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L717">&#x27ad;</a></h3>
340
+ <div class="extra" id="g.txtattr-extra"></div></div><div class="dr-object"><p>An attribute object that charts and tooltips will set on any generated text
341
+ </p>
342
+ <p class="header">Default value
343
+ </p>
344
+ <pre class="javascript code"><code>{ font: <i>'12px Arial, sans-serif'</i>, fill: <i>'#fff'</i> }
345
+ </code></pre>
346
+ </div></div></div>
347
+ <script src="../raphael-min.js"></script>
348
+ <script src="../g.raphael.js"></script>
349
+ <script src="reference.js"></script>
350
+ </body></html>
@@ -0,0 +1,35 @@
1
+ Raphael(function () {
2
+ var grad = {
3
+ stroke: "#fff",
4
+ fill: "0-#c9de96-#8ab66b:44-#398235"
5
+ },
6
+ fill = {
7
+ stroke: "#fff",
8
+ fill: "#ff0000",
9
+ "stroke-width": 2
10
+ };
11
+
12
+ function prepare(id) {
13
+ var div = document.getElementById(id);
14
+ div.style.cssText = "display:block;float:right;padding:10px;width:99px;height:99px;background:#2C53B0 url(./blueprint-min.png) no-repeat";
15
+ return Raphael(div, 99, 99);
16
+ }
17
+
18
+ prepare("Element.popup-extra").circle(50, 50, 5).attr(grad).popup();
19
+ prepare("Element.tag-extra").circle(50, 50, 15).attr(grad).tag(60);
20
+ prepare("Element.drop-extra").circle(50, 50, 8).attr(grad).drop(60);
21
+ prepare("Element.flag-extra").circle(50, 50, 10).attr(grad).flag(60);
22
+ prepare("Element.label-extra").circle(50, 50, 10).attr(grad).label();
23
+ prepare("Element.blob-extra").circle(50, 50, 8).attr(grad).blob(60);
24
+
25
+ prepare("Paper.popup-extra").popup(50, 50, "Hello", 'down');
26
+ prepare("Paper.tag-extra").tag(50, 50, "$9.99", 60);
27
+ prepare("Paper.drop-extra").drop(50, 50, "$10", 60);
28
+ prepare("Paper.flag-extra").flag(50, 50, "$9.99", 60);
29
+ prepare("Paper.label-extra").label(50, 50, "$9.99");
30
+ prepare("Paper.blob-extra").blob(50, 50, "Hello", 60);
31
+
32
+ prepare("Element.lighter-extra").circle(50, 50, 20).attr(fill).lighter(6);
33
+ prepare("Element.darker-extra").circle(50, 50, 20).attr(fill).darker(6);
34
+ prepare("Element.resetBrightness-extra").circle(50, 50, 20).attr(fill).lighter(6).resetBrightness();
35
+ });
@@ -0,0 +1,621 @@
1
+ /*!
2
+ * g.Raphael 0.5 - Charting library, based on Raphaël
3
+ *
4
+ * Copyright (c) 2009 Dmitry Baranovskiy (http://g.raphaeljs.com)
5
+ * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
6
+ */
7
+ (function () {
8
+ var mmin = Math.min,
9
+ mmax = Math.max;
10
+
11
+ function finger(x, y, width, height, dir, ending, isPath, paper) {
12
+ var path,
13
+ ends = { round: 'round', sharp: 'sharp', soft: 'soft', square: 'square' };
14
+
15
+ // dir 0 for horizontal and 1 for vertical
16
+ if ((dir && !height) || (!dir && !width)) {
17
+ return isPath ? "" : paper.path();
18
+ }
19
+
20
+ ending = ends[ending] || "square";
21
+ height = Math.round(height);
22
+ width = Math.round(width);
23
+ x = Math.round(x);
24
+ y = Math.round(y);
25
+
26
+ switch (ending) {
27
+ case "round":
28
+ if (!dir) {
29
+ var r = ~~(height / 2);
30
+
31
+ if (width < r) {
32
+ r = width;
33
+ path = [
34
+ "M", x + .5, y + .5 - ~~(height / 2),
35
+ "l", 0, 0,
36
+ "a", r, ~~(height / 2), 0, 0, 1, 0, height,
37
+ "l", 0, 0,
38
+ "z"
39
+ ];
40
+ } else {
41
+ path = [
42
+ "M", x + .5, y + .5 - r,
43
+ "l", width - r, 0,
44
+ "a", r, r, 0, 1, 1, 0, height,
45
+ "l", r - width, 0,
46
+ "z"
47
+ ];
48
+ }
49
+ } else {
50
+ r = ~~(width / 2);
51
+
52
+ if (height < r) {
53
+ r = height;
54
+ path = [
55
+ "M", x - ~~(width / 2), y,
56
+ "l", 0, 0,
57
+ "a", ~~(width / 2), r, 0, 0, 1, width, 0,
58
+ "l", 0, 0,
59
+ "z"
60
+ ];
61
+ } else {
62
+ path = [
63
+ "M", x - r, y,
64
+ "l", 0, r - height,
65
+ "a", r, r, 0, 1, 1, width, 0,
66
+ "l", 0, height - r,
67
+ "z"
68
+ ];
69
+ }
70
+ }
71
+ break;
72
+ case "sharp":
73
+ if (!dir) {
74
+ var half = ~~(height / 2);
75
+
76
+ path = [
77
+ "M", x, y + half,
78
+ "l", 0, -height, mmax(width - half, 0), 0, mmin(half, width), half, -mmin(half, width), half + (half * 2 < height),
79
+ "z"
80
+ ];
81
+ } else {
82
+ half = ~~(width / 2);
83
+ path = [
84
+ "M", x + half, y,
85
+ "l", -width, 0, 0, -mmax(height - half, 0), half, -mmin(half, height), half, mmin(half, height), half,
86
+ "z"
87
+ ];
88
+ }
89
+ break;
90
+ case "square":
91
+ if (!dir) {
92
+ path = [
93
+ "M", x, y + ~~(height / 2),
94
+ "l", 0, -height, width, 0, 0, height,
95
+ "z"
96
+ ];
97
+ } else {
98
+ path = [
99
+ "M", x + ~~(width / 2), y,
100
+ "l", 1 - width, 0, 0, -height, width - 1, 0,
101
+ "z"
102
+ ];
103
+ }
104
+ break;
105
+ case "soft":
106
+ if (!dir) {
107
+ r = mmin(width, Math.round(height / 5));
108
+ path = [
109
+ "M", x + .5, y + .5 - ~~(height / 2),
110
+ "l", width - r, 0,
111
+ "a", r, r, 0, 0, 1, r, r,
112
+ "l", 0, height - r * 2,
113
+ "a", r, r, 0, 0, 1, -r, r,
114
+ "l", r - width, 0,
115
+ "z"
116
+ ];
117
+ } else {
118
+ r = mmin(Math.round(width / 5), height);
119
+ path = [
120
+ "M", x - ~~(width / 2), y,
121
+ "l", 0, r - height,
122
+ "a", r, r, 0, 0, 1, r, -r,
123
+ "l", width - 2 * r, 0,
124
+ "a", r, r, 0, 0, 1, r, r,
125
+ "l", 0, height - r,
126
+ "z"
127
+ ];
128
+ }
129
+ }
130
+
131
+ if (isPath) {
132
+ return path.join(",");
133
+ } else {
134
+ return paper.path(path);
135
+ }
136
+ }
137
+
138
+ /*
139
+ * Vertical Barchart
140
+ */
141
+ function VBarchart(paper, x, y, width, height, values, opts) {
142
+ opts = opts || {};
143
+
144
+ var chartinst = this,
145
+ type = opts.type || "square",
146
+ gutter = parseFloat(opts.gutter || "20%"),
147
+ chart = paper.set(),
148
+ bars = paper.set(),
149
+ covers = paper.set(),
150
+ covers2 = paper.set(),
151
+ total = Math.max.apply(Math, values),
152
+ stacktotal = [],
153
+ multi = 0,
154
+ colors = opts.colors || chartinst.colors,
155
+ len = values.length;
156
+
157
+ if (Raphael.is(values[0], "array")) {
158
+ total = [];
159
+ multi = len;
160
+ len = 0;
161
+
162
+ for (var i = values.length; i--;) {
163
+ bars.push(paper.set());
164
+ total.push(Math.max.apply(Math, values[i]));
165
+ len = Math.max(len, values[i].length);
166
+ }
167
+
168
+ if (opts.stacked) {
169
+ for (var i = len; i--;) {
170
+ var tot = 0;
171
+
172
+ for (var j = values.length; j--;) {
173
+ tot +=+ values[j][i] || 0;
174
+ }
175
+
176
+ stacktotal.push(tot);
177
+ }
178
+ }
179
+
180
+ for (var i = values.length; i--;) {
181
+ if (values[i].length < len) {
182
+ for (var j = len; j--;) {
183
+ values[i].push(0);
184
+ }
185
+ }
186
+ }
187
+
188
+ total = Math.max.apply(Math, opts.stacked ? stacktotal : total);
189
+ }
190
+
191
+ total = (opts.to) || total;
192
+
193
+ var barwidth = width / (len * (100 + gutter) + gutter) * 100,
194
+ barhgutter = barwidth * gutter / 100,
195
+ barvgutter = opts.vgutter == null ? 20 : opts.vgutter,
196
+ stack = [],
197
+ X = x + barhgutter,
198
+ Y = (height - 2 * barvgutter) / total;
199
+
200
+ if (!opts.stretch) {
201
+ barhgutter = Math.round(barhgutter);
202
+ barwidth = Math.floor(barwidth);
203
+ }
204
+
205
+ !opts.stacked && (barwidth /= multi || 1);
206
+
207
+ for (var i = 0; i < len; i++) {
208
+ stack = [];
209
+
210
+ for (var j = 0; j < (multi || 1); j++) {
211
+ var h = Math.round((multi ? values[j][i] : values[i]) * Y),
212
+ top = y + height - barvgutter - h,
213
+ bar = finger(Math.round(X + barwidth / 2), top + h, barwidth, h, true, type, null, paper).attr({ stroke: "none", fill: colors[multi ? j : i] });
214
+
215
+ if (multi) {
216
+ bars[j].push(bar);
217
+ } else {
218
+ bars.push(bar);
219
+ }
220
+
221
+ bar.y = top;
222
+ bar.x = Math.round(X + barwidth / 2);
223
+ bar.w = barwidth;
224
+ bar.h = h;
225
+ bar.value = multi ? values[j][i] : values[i];
226
+
227
+ if (!opts.stacked) {
228
+ X += barwidth;
229
+ } else {
230
+ stack.push(bar);
231
+ }
232
+ }
233
+
234
+ if (opts.stacked) {
235
+ var cvr;
236
+
237
+ covers2.push(cvr = paper.rect(stack[0].x - stack[0].w / 2, y, barwidth, height).attr(chartinst.shim));
238
+ cvr.bars = paper.set();
239
+
240
+ var size = 0;
241
+
242
+ for (var s = stack.length; s--;) {
243
+ stack[s].toFront();
244
+ }
245
+
246
+ for (var s = 0, ss = stack.length; s < ss; s++) {
247
+ var bar = stack[s],
248
+ cover,
249
+ h = (size + bar.value) * Y,
250
+ path = finger(bar.x, y + height - barvgutter - !!size * .5, barwidth, h, true, type, 1, paper);
251
+
252
+ cvr.bars.push(bar);
253
+ size && bar.attr({path: path});
254
+ bar.h = h;
255
+ bar.y = y + height - barvgutter - !!size * .5 - h;
256
+ covers.push(cover = paper.rect(bar.x - bar.w / 2, bar.y, barwidth, bar.value * Y).attr(chartinst.shim));
257
+ cover.bar = bar;
258
+ cover.value = bar.value;
259
+ size += bar.value;
260
+ }
261
+
262
+ X += barwidth;
263
+ }
264
+
265
+ X += barhgutter;
266
+ }
267
+
268
+ covers2.toFront();
269
+ X = x + barhgutter;
270
+
271
+ if (!opts.stacked) {
272
+ for (var i = 0; i < len; i++) {
273
+ for (var j = 0; j < (multi || 1); j++) {
274
+ var cover;
275
+
276
+ covers.push(cover = paper.rect(Math.round(X), y + barvgutter, barwidth, height - barvgutter).attr(chartinst.shim));
277
+ cover.bar = multi ? bars[j][i] : bars[i];
278
+ cover.value = cover.bar.value;
279
+ X += barwidth;
280
+ }
281
+
282
+ X += barhgutter;
283
+ }
284
+ }
285
+
286
+ chart.label = function (labels, isBottom) {
287
+ labels = labels || [];
288
+ this.labels = paper.set();
289
+
290
+ var L, l = -Infinity;
291
+
292
+ if (opts.stacked) {
293
+ for (var i = 0; i < len; i++) {
294
+ var tot = 0;
295
+
296
+ for (var j = 0; j < (multi || 1); j++) {
297
+ tot += multi ? values[j][i] : values[i];
298
+
299
+ if (j == multi - 1) {
300
+ var label = paper.labelise(labels[i], tot, total);
301
+
302
+ L = paper.text(bars[i * (multi || 1) + j].x, y + height - barvgutter / 2, label).attr(txtattr).insertBefore(covers[i * (multi || 1) + j]);
303
+
304
+ var bb = L.getBBox();
305
+
306
+ if (bb.x - 7 < l) {
307
+ L.remove();
308
+ } else {
309
+ this.labels.push(L);
310
+ l = bb.x + bb.width;
311
+ }
312
+ }
313
+ }
314
+ }
315
+ } else {
316
+ for (var i = 0; i < len; i++) {
317
+ for (var j = 0; j < (multi || 1); j++) {
318
+ var label = paper.labelise(multi ? labels[j] && labels[j][i] : labels[i], multi ? values[j][i] : values[i], total);
319
+
320
+ L = paper.text(bars[i * (multi || 1) + j].x, isBottom ? y + height - barvgutter / 2 : bars[i * (multi || 1) + j].y - 10, label).attr(txtattr).insertBefore(covers[i * (multi || 1) + j]);
321
+
322
+ var bb = L.getBBox();
323
+
324
+ if (bb.x - 7 < l) {
325
+ L.remove();
326
+ } else {
327
+ this.labels.push(L);
328
+ l = bb.x + bb.width;
329
+ }
330
+ }
331
+ }
332
+ }
333
+ return this;
334
+ };
335
+
336
+ chart.hover = function (fin, fout) {
337
+ covers2.hide();
338
+ covers.show();
339
+ covers.mouseover(fin).mouseout(fout);
340
+ return this;
341
+ };
342
+
343
+ chart.hoverColumn = function (fin, fout) {
344
+ covers.hide();
345
+ covers2.show();
346
+ fout = fout || function () {};
347
+ covers2.mouseover(fin).mouseout(fout);
348
+ return this;
349
+ };
350
+
351
+ chart.click = function (f) {
352
+ covers2.hide();
353
+ covers.show();
354
+ covers.click(f);
355
+ return this;
356
+ };
357
+
358
+ chart.each = function (f) {
359
+ if (!Raphael.is(f, "function")) {
360
+ return this;
361
+ }
362
+ for (var i = covers.length; i--;) {
363
+ f.call(covers[i]);
364
+ }
365
+ return this;
366
+ };
367
+
368
+ chart.eachColumn = function (f) {
369
+ if (!Raphael.is(f, "function")) {
370
+ return this;
371
+ }
372
+ for (var i = covers2.length; i--;) {
373
+ f.call(covers2[i]);
374
+ }
375
+ return this;
376
+ };
377
+
378
+ chart.clickColumn = function (f) {
379
+ covers.hide();
380
+ covers2.show();
381
+ covers2.click(f);
382
+ return this;
383
+ };
384
+
385
+ chart.push(bars, covers, covers2);
386
+ chart.bars = bars;
387
+ chart.covers = covers;
388
+ return chart;
389
+ };
390
+
391
+ /**
392
+ * Horizontal Barchart
393
+ */
394
+ function HBarchart(paper, x, y, width, height, values, opts) {
395
+ opts = opts || {};
396
+
397
+ var chartinst = this,
398
+ type = opts.type || "square",
399
+ gutter = parseFloat(opts.gutter || "20%"),
400
+ chart = paper.set(),
401
+ bars = paper.set(),
402
+ covers = paper.set(),
403
+ covers2 = paper.set(),
404
+ total = Math.max.apply(Math, values),
405
+ stacktotal = [],
406
+ multi = 0,
407
+ colors = opts.colors || chartinst.colors,
408
+ len = values.length;
409
+
410
+ if (Raphael.is(values[0], "array")) {
411
+ total = [];
412
+ multi = len;
413
+ len = 0;
414
+
415
+ for (var i = values.length; i--;) {
416
+ bars.push(paper.set());
417
+ total.push(Math.max.apply(Math, values[i]));
418
+ len = Math.max(len, values[i].length);
419
+ }
420
+
421
+ if (opts.stacked) {
422
+ for (var i = len; i--;) {
423
+ var tot = 0;
424
+ for (var j = values.length; j--;) {
425
+ tot +=+ values[j][i] || 0;
426
+ }
427
+ stacktotal.push(tot);
428
+ }
429
+ }
430
+
431
+ for (var i = values.length; i--;) {
432
+ if (values[i].length < len) {
433
+ for (var j = len; j--;) {
434
+ values[i].push(0);
435
+ }
436
+ }
437
+ }
438
+
439
+ total = Math.max.apply(Math, opts.stacked ? stacktotal : total);
440
+ }
441
+
442
+ total = (opts.to) || total;
443
+
444
+ var barheight = Math.floor(height / (len * (100 + gutter) + gutter) * 100),
445
+ bargutter = Math.floor(barheight * gutter / 100),
446
+ stack = [],
447
+ Y = y + bargutter,
448
+ X = (width - 1) / total;
449
+
450
+ !opts.stacked && (barheight /= multi || 1);
451
+
452
+ for (var i = 0; i < len; i++) {
453
+ stack = [];
454
+
455
+ for (var j = 0; j < (multi || 1); j++) {
456
+ var val = multi ? values[j][i] : values[i],
457
+ bar = finger(x, Y + barheight / 2, Math.round(val * X), barheight - 1, false, type, null, paper).attr({stroke: "none", fill: colors[multi ? j : i]});
458
+
459
+ if (multi) {
460
+ bars[j].push(bar);
461
+ } else {
462
+ bars.push(bar);
463
+ }
464
+
465
+ bar.x = x + Math.round(val * X);
466
+ bar.y = Y + barheight / 2;
467
+ bar.w = Math.round(val * X);
468
+ bar.h = barheight;
469
+ bar.value = +val;
470
+
471
+ if (!opts.stacked) {
472
+ Y += barheight;
473
+ } else {
474
+ stack.push(bar);
475
+ }
476
+ }
477
+
478
+ if (opts.stacked) {
479
+ var cvr = paper.rect(x, stack[0].y - stack[0].h / 2, width, barheight).attr(chartinst.shim);
480
+
481
+ covers2.push(cvr);
482
+ cvr.bars = paper.set();
483
+
484
+ var size = 0;
485
+
486
+ for (var s = stack.length; s--;) {
487
+ stack[s].toFront();
488
+ }
489
+
490
+ for (var s = 0, ss = stack.length; s < ss; s++) {
491
+ var bar = stack[s],
492
+ cover,
493
+ val = Math.round((size + bar.value) * X),
494
+ path = finger(x, bar.y, val, barheight - 1, false, type, 1, paper);
495
+
496
+ cvr.bars.push(bar);
497
+ size && bar.attr({ path: path });
498
+ bar.w = val;
499
+ bar.x = x + val;
500
+ covers.push(cover = paper.rect(x + size * X, bar.y - bar.h / 2, bar.value * X, barheight).attr(chartinst.shim));
501
+ cover.bar = bar;
502
+ size += bar.value;
503
+ }
504
+
505
+ Y += barheight;
506
+ }
507
+
508
+ Y += bargutter;
509
+ }
510
+
511
+ covers2.toFront();
512
+ Y = y + bargutter;
513
+
514
+ if (!opts.stacked) {
515
+ for (var i = 0; i < len; i++) {
516
+ for (var j = 0; j < (multi || 1); j++) {
517
+ var cover = paper.rect(x, Y, width, barheight).attr(chartinst.shim);
518
+
519
+ covers.push(cover);
520
+ cover.bar = multi ? bars[j][i] : bars[i];
521
+ cover.value = cover.bar.value;
522
+ Y += barheight;
523
+ }
524
+
525
+ Y += bargutter;
526
+ }
527
+ }
528
+
529
+ chart.label = function (labels, isRight) {
530
+ labels = labels || [];
531
+ this.labels = paper.set();
532
+
533
+ for (var i = 0; i < len; i++) {
534
+ for (var j = 0; j < multi; j++) {
535
+ var label = paper.labelise(multi ? labels[j] && labels[j][i] : labels[i], multi ? values[j][i] : values[i], total),
536
+ X = isRight ? bars[i * (multi || 1) + j].x - barheight / 2 + 3 : x + 5,
537
+ A = isRight ? "end" : "start",
538
+ L;
539
+
540
+ this.labels.push(L = paper.text(X, bars[i * (multi || 1) + j].y, label).attr(txtattr).attr({ "text-anchor": A }).insertBefore(covers[0]));
541
+
542
+ if (L.getBBox().x < x + 5) {
543
+ L.attr({x: x + 5, "text-anchor": "start"});
544
+ } else {
545
+ bars[i * (multi || 1) + j].label = L;
546
+ }
547
+ }
548
+ }
549
+
550
+ return this;
551
+ };
552
+
553
+ chart.hover = function (fin, fout) {
554
+ covers2.hide();
555
+ covers.show();
556
+ fout = fout || function () {};
557
+ covers.mouseover(fin).mouseout(fout);
558
+ return this;
559
+ };
560
+
561
+ chart.hoverColumn = function (fin, fout) {
562
+ covers.hide();
563
+ covers2.show();
564
+ fout = fout || function () {};
565
+ covers2.mouseover(fin).mouseout(fout);
566
+ return this;
567
+ };
568
+
569
+ chart.each = function (f) {
570
+ if (!Raphael.is(f, "function")) {
571
+ return this;
572
+ }
573
+ for (var i = covers.length; i--;) {
574
+ f.call(covers[i]);
575
+ }
576
+ return this;
577
+ };
578
+
579
+ chart.eachColumn = function (f) {
580
+ if (!Raphael.is(f, "function")) {
581
+ return this;
582
+ }
583
+ for (var i = covers2.length; i--;) {
584
+ f.call(covers2[i]);
585
+ }
586
+ return this;
587
+ };
588
+
589
+ chart.click = function (f) {
590
+ covers2.hide();
591
+ covers.show();
592
+ covers.click(f);
593
+ return this;
594
+ };
595
+
596
+ chart.clickColumn = function (f) {
597
+ covers.hide();
598
+ covers2.show();
599
+ covers2.click(f);
600
+ return this;
601
+ };
602
+
603
+ chart.push(bars, covers, covers2);
604
+ chart.bars = bars;
605
+ chart.covers = covers;
606
+ return chart;
607
+ };
608
+
609
+ //inheritance
610
+ var F = function() {};
611
+ F.prototype = Raphael.g;
612
+ HBarchart.prototype = VBarchart.prototype = new F;
613
+
614
+ Raphael.fn.hbarchart = function(x, y, width, height, values, opts) {
615
+ return new HBarchart(this, x, y, width, height, values, opts);
616
+ };
617
+
618
+ Raphael.fn.barchart = function(x, y, width, height, values, opts) {
619
+ return new VBarchart(this, x, y, width, height, values, opts);
620
+ };
621
+ })();