rgraph-rails 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/rgraph-rails/version.rb +1 -1
  4. data/license.txt +4 -16
  5. data/vendor/assets/javascripts/RGraph.bar.js +3734 -241
  6. data/vendor/assets/javascripts/RGraph.bipolar.js +2005 -115
  7. data/vendor/assets/javascripts/RGraph.common.annotate.js +395 -35
  8. data/vendor/assets/javascripts/RGraph.common.context.js +595 -30
  9. data/vendor/assets/javascripts/RGraph.common.core.js +5282 -405
  10. data/vendor/assets/javascripts/RGraph.common.csv.js +276 -19
  11. data/vendor/assets/javascripts/RGraph.common.deprecated.js +450 -35
  12. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1395 -86
  13. data/vendor/assets/javascripts/RGraph.common.effects.js +1545 -90
  14. data/vendor/assets/javascripts/RGraph.common.key.js +753 -54
  15. data/vendor/assets/javascripts/RGraph.common.resizing.js +563 -37
  16. data/vendor/assets/javascripts/RGraph.common.sheets.js +352 -29
  17. data/vendor/assets/javascripts/RGraph.common.tooltips.js +450 -32
  18. data/vendor/assets/javascripts/RGraph.common.zoom.js +219 -14
  19. data/vendor/assets/javascripts/RGraph.drawing.background.js +570 -35
  20. data/vendor/assets/javascripts/RGraph.drawing.circle.js +544 -35
  21. data/vendor/assets/javascripts/RGraph.drawing.image.js +755 -52
  22. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +645 -41
  23. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +633 -37
  24. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +514 -36
  25. data/vendor/assets/javascripts/RGraph.drawing.poly.js +559 -39
  26. data/vendor/assets/javascripts/RGraph.drawing.rect.js +548 -35
  27. data/vendor/assets/javascripts/RGraph.drawing.text.js +664 -36
  28. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +812 -50
  29. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +856 -51
  30. data/vendor/assets/javascripts/RGraph.fuel.js +964 -58
  31. data/vendor/assets/javascripts/RGraph.funnel.js +984 -55
  32. data/vendor/assets/javascripts/RGraph.gantt.js +1354 -77
  33. data/vendor/assets/javascripts/RGraph.gauge.js +1421 -87
  34. data/vendor/assets/javascripts/RGraph.hbar.js +2562 -146
  35. data/vendor/assets/javascripts/RGraph.hprogress.js +1401 -80
  36. data/vendor/assets/javascripts/RGraph.line.js +4226 -244
  37. data/vendor/assets/javascripts/RGraph.meter.js +1280 -74
  38. data/vendor/assets/javascripts/RGraph.modaldialog.js +301 -19
  39. data/vendor/assets/javascripts/RGraph.odo.js +1264 -71
  40. data/vendor/assets/javascripts/RGraph.pie.js +2288 -137
  41. data/vendor/assets/javascripts/RGraph.radar.js +1847 -110
  42. data/vendor/assets/javascripts/RGraph.rose.js +1977 -108
  43. data/vendor/assets/javascripts/RGraph.rscatter.js +1432 -80
  44. data/vendor/assets/javascripts/RGraph.scatter.js +3036 -168
  45. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1120 -60
  46. data/vendor/assets/javascripts/RGraph.svg.bar.js +1067 -0
  47. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +247 -0
  48. data/vendor/assets/javascripts/RGraph.svg.common.core.js +3363 -0
  49. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +277 -0
  50. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1304 -0
  51. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +353 -0
  52. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +233 -0
  53. data/vendor/assets/javascripts/RGraph.svg.hbar.js +1141 -0
  54. data/vendor/assets/javascripts/RGraph.svg.line.js +1486 -0
  55. data/vendor/assets/javascripts/RGraph.svg.pie.js +781 -0
  56. data/vendor/assets/javascripts/RGraph.svg.radar.js +1326 -0
  57. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +817 -0
  58. data/vendor/assets/javascripts/RGraph.thermometer.js +1135 -62
  59. data/vendor/assets/javascripts/RGraph.vprogress.js +1470 -83
  60. data/vendor/assets/javascripts/RGraph.waterfall.js +1347 -80
  61. metadata +15 -3
@@ -0,0 +1,277 @@
1
+ // version: 2017-01-02
2
+ /**
3
+ * o--------------------------------------------------------------------------------o
4
+ * | This file is part of the RGraph package - you can learn more at: |
5
+ * | |
6
+ * | http://www.rgraph.net |
7
+ * | |
8
+ * | RGraph is licensed under the Open Source MIT license. That means that it's |
9
+ * | totally free to use! |
10
+ * o--------------------------------------------------------------------------------o
11
+ */
12
+
13
+ /**
14
+ * Initialise the various objects
15
+ */
16
+ RGraph = window.RGraph || {isRGraph: true};
17
+
18
+
19
+
20
+
21
+ RGraph.CSV = function (url, func)
22
+ {
23
+ var RG = RGraph,
24
+ ua = navigator.userAgent,
25
+ ma = Math;
26
+
27
+
28
+
29
+
30
+ /**
31
+ * Some default values
32
+ */
33
+ this.url = url;
34
+ this.ready = func;
35
+ this.data = null;
36
+ this.numrows = null;
37
+ this.numcols = null;
38
+ this.seperator = arguments[2] || ',';
39
+ this.endofline = arguments[3] || /\r?\n/;
40
+
41
+
42
+
43
+
44
+ /**
45
+ * A Custom split function
46
+ *
47
+ * @param string str The CSV string to split
48
+ * @param mixed char The character to split on - or it can also be an object like this:
49
+ * {
50
+ * preserve: false, // Whether to preserve whitespace
51
+ * char: ',' // The character to split on
52
+ * }
53
+ */
54
+ this.splitCSV = function (str, split)
55
+ {
56
+ // Defaults
57
+ var arr = [];
58
+ var field = '';
59
+ var inDoubleQuotes = false;
60
+ var inSingleQuotes = false;
61
+ var preserve = (typeof split === 'object' && split.preserve) ? true : false;
62
+
63
+ // The character to split the CSV string on
64
+ if (typeof split === 'object') {
65
+ if (typeof split.char === 'string') {
66
+ split = split.char;
67
+ } else {
68
+ split = ',';
69
+ }
70
+ } // If not an object just leave the char as it's supplied
71
+
72
+
73
+
74
+ for (var i=0,len=str.length; i<len; i+=1) {
75
+
76
+ char = str.charAt(i);
77
+
78
+ if ( (char === '"') && !inDoubleQuotes) {
79
+ inDoubleQuotes = true;
80
+ continue;
81
+
82
+ } else if ( (char === '"') && inDoubleQuotes) {
83
+ inDoubleQuotes = false;
84
+ continue;
85
+ }
86
+ if ( (char === "'") && !inSingleQuotes) {
87
+ inSingleQuotes = true;
88
+ continue;
89
+
90
+ } else if ( (char === "'") && inSingleQuotes) {
91
+ inSingleQuotes = false;
92
+ continue;
93
+
94
+ } else if (char === split && !inDoubleQuotes && !inSingleQuotes) {
95
+ // TODO look ahead in order to allow for multi-character seperators
96
+ arr.push(field);
97
+ field = '';
98
+ continue;
99
+
100
+ } else {
101
+ field = field + char;
102
+ }
103
+ }
104
+
105
+ // Add the last field
106
+ arr.push(field);
107
+
108
+ // Now trim each value if necessary
109
+ if (!preserve) {
110
+ for (i=0,len=arr.length; i<len; i+=1) {
111
+ arr[i] = arr[i].trim();
112
+ }
113
+ }
114
+
115
+ return arr;
116
+ };
117
+
118
+
119
+
120
+
121
+ /**
122
+ * This function splits the CSV data into an array so that it can be useful.
123
+ */
124
+ this.fetch = function ()
125
+ {
126
+ var sep = this.seperator,
127
+ eol = this.endofline,
128
+ obj = this;
129
+
130
+ if (this.url.substring(0,3) === 'id:' || this.url.substring(0,4) === 'str:') {
131
+
132
+ // Get rid of any surrounding whitespace
133
+ if (this.url.substring(0,3) === 'id:') {
134
+ var data = document.getElementById(this.url.substring(3)).innerHTML.trim();
135
+
136
+ } else if (this.url.substring(0,4) === 'str:') {
137
+ var data = this.url.substring(4).trim();
138
+ }
139
+
140
+ // Store the CSV data on the CSV object (ie - this object)
141
+ obj.data = data.split(eol);
142
+
143
+ // Store the number of rows
144
+ obj.numrows = obj.data.length;
145
+
146
+ for (var i=0,len=obj.data.length; i<len; i+=1) {
147
+
148
+
149
+ /**
150
+ * Split the individual line
151
+ */
152
+ //var row = obj.data[i].split(sep);
153
+ var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
154
+
155
+
156
+ if (!obj.numcols) {
157
+ obj.numcols = row.length;
158
+ }
159
+
160
+ /**
161
+ * If the cell is purely made up of numbers - convert it
162
+ */
163
+ for (var j=0; j<row.length; j+=1) {
164
+ if ((/^\-?[0-9.]+$/).test(row[j])) {
165
+ row[j] = parseFloat(row[j]);
166
+ }
167
+
168
+ // Assign the split-up-row back to the data array
169
+ obj.data[i] = row;
170
+ }
171
+ }
172
+
173
+ // Call the ready function straight away
174
+ obj.ready(obj);
175
+
176
+ } else {
177
+
178
+ RGraph.SVG.AJAX.getString(this.url, function (data)
179
+ {
180
+ data = data.replace(/(\r?\n)+$/, '');
181
+
182
+ /**
183
+ * Split the lines in the CSV
184
+ */
185
+ obj.data = data.split(eol);
186
+
187
+ /**
188
+ * Store the number of rows
189
+ */
190
+ obj.numrows = obj.data.length;
191
+
192
+
193
+
194
+ /**
195
+ * Loop thru each lines in the CSV file
196
+ */
197
+ for (var i=0,len=obj.data.length; i<len; i+=1) {
198
+ /**
199
+ * Use the new split function to split each row NOT preserving whitespace
200
+ */
201
+ //var row = obj.data[i].split(sep);
202
+ var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
203
+
204
+ if (!obj.numcols) {
205
+ obj.numcols = row.length;
206
+ }
207
+
208
+ /**
209
+ * If the cell is purely made up of numbers - convert it
210
+ */
211
+ for (var j=0; j<row.length; j+=1) {
212
+ if ((/^\-?[0-9.]+$/).test(row[j])) {
213
+ row[j] = parseFloat(row[j]);
214
+ }
215
+
216
+ // Assign the split-up-row back to the data array
217
+ obj.data[i] = row;
218
+ }
219
+
220
+ }
221
+
222
+ // Call the ready function straight away
223
+ obj.ready(obj);
224
+ });
225
+ }
226
+ };
227
+
228
+
229
+
230
+
231
+ /**
232
+ * Returns a row of the CSV file
233
+ *
234
+ * @param number index The index of the row to fetch
235
+ * @param start OPTIONAL If desired you can specify a column to start at (which starts at 0 by default)
236
+ */
237
+ this.getRow = function (index)
238
+ {
239
+ var row = [];
240
+ var start = arguments[1] || 0;
241
+
242
+ for (var i=start; i<this.numcols; i+=1) {
243
+ row.push(this.data[index][i]);
244
+ }
245
+
246
+ return row;
247
+ };
248
+
249
+
250
+
251
+
252
+ /**
253
+ * Returns a column of the CSV file
254
+ *
255
+ * @param number index The index of the column to fetch
256
+ * @param start OPTIONAL If desired you can specify a row to start at (which starts at 0 by default)
257
+ */
258
+ this.getCol =
259
+ this.getColumn = function (index)
260
+ {
261
+ var col = [];
262
+ var start = arguments[1] || 0;
263
+
264
+ for (var i=start; i<this.numrows; i+=1) {
265
+ col.push(this.data[i][index]);
266
+ }
267
+
268
+ return col;
269
+ };
270
+
271
+
272
+
273
+
274
+
275
+ // Fetch the CSV file
276
+ this.fetch();
277
+ };
@@ -0,0 +1,1304 @@
1
+ // version: 2017-01-02
2
+ /**
3
+ * o--------------------------------------------------------------------------------o
4
+ * | This file is part of the RGraph package - you can learn more at: |
5
+ * | |
6
+ * | http://www.rgraph.net |
7
+ * | |
8
+ * | RGraph is licensed under the Open Source MIT license. That means that it's |
9
+ * | totally free to use! |
10
+ * o--------------------------------------------------------------------------------o
11
+ */
12
+
13
+ /**
14
+ * This is a library of a few functions that make it easier to do
15
+ * effects like fade-ins or eaxpansion.
16
+ */
17
+
18
+ /**
19
+ * Initialise the various objects
20
+ */
21
+ RGraph = window.RGraph || {isRGraph: true};
22
+ RGraph.SVG = RGraph.SVG || {};
23
+ RGraph.SVG.FX = RGraph.SVG.FX || {};
24
+
25
+ // Module pattern
26
+ (function (win, doc, undefined)
27
+ {
28
+ var RG = RGraph,
29
+ ua = navigator.userAgent,
30
+ ma = Math;
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ /**
40
+ * This functions adds the generic effects to thechart object
41
+ *
42
+ * @param object obj The chart object
43
+ */
44
+ RG.SVG.FX.decorate = function (obj)
45
+ {
46
+ for (i in RG.SVG.FX) {
47
+ if (typeof RG.SVG.FX[i] === 'function') {
48
+ obj[i] = RG.SVG.FX[i];
49
+ }
50
+ }
51
+ };
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ /**
61
+ * fadeIn
62
+ *
63
+ * This function simply uses the CSS opacity property - initially set to zero and
64
+ * increasing to 1 over the period of 0.5 second
65
+ */
66
+ RG.SVG.FX.fadein = function ()
67
+ {
68
+ // This function gets added to the chart object - so the this
69
+ // variable is the chart object
70
+ var obj = this,
71
+ opt = arguments[0] || {},
72
+ frames = opt.frames || 90,
73
+ duration = (frames / 60) * 1000,
74
+ frame = 0,
75
+ callback = opt.callback || function () {};
76
+
77
+
78
+ // Initially the opacity should be zero
79
+ obj.svg.style.opacity = 0;
80
+
81
+ // Draw the chart
82
+ RG.SVG.redraw(this.svg);
83
+
84
+ // Now fade the chart in
85
+ for (var i=1; i<=frames; ++i) {
86
+ (function (index)
87
+ {
88
+ setTimeout(function ()
89
+ {
90
+ obj.svg.style.opacity = (index / frames);
91
+
92
+ if (index >= frames) {
93
+ callback(obj);
94
+ }
95
+
96
+ }, (index / frames) * duration);
97
+ })(i)
98
+ }
99
+
100
+
101
+ return this;
102
+ };
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ /**
112
+ * fadeOut
113
+ *
114
+ * This function is a reversal of the above function - fading out instead of in
115
+ */
116
+ RG.SVG.FX.fadeout = function ()
117
+ {
118
+ // This function gets added to the chart object - so the this
119
+ // variable is the chart object
120
+ var obj = this,
121
+ opt = arguments[0] || {},
122
+ frames = opt.frames || 90,
123
+ duration = (frames / 60) * 1000,
124
+ frame = 0,
125
+ callback = opt.callback || function () {};
126
+
127
+ //RG.SVG.redraw()
128
+
129
+ // Now fade the chart out
130
+ for (var i=1; i<=frames; ++i) {
131
+ (function (index)
132
+ {
133
+ setTimeout(function ()
134
+ {
135
+ obj.svg.style.opacity = 1 - (index / frames);
136
+
137
+ if (index >= frames) {
138
+ callback(obj);
139
+ }
140
+ }, (index / frames) * duration);
141
+ })(i)
142
+ }
143
+
144
+ return this;
145
+ };
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ /**
155
+ * fadeSlideIn
156
+ *
157
+ * This function fades the canvas in in a sliding motion
158
+ */
159
+ RG.SVG.FX.fadeslidein = function ()
160
+ {
161
+ // This function gets added to the chart object - so the this
162
+ // variable is the chart object
163
+ var obj = this,
164
+ opt = arguments[0] || {},
165
+ frames = opt.frames || 90,
166
+ frame = 0,
167
+ pc = -20,
168
+ step = (120 - pc) / frames,
169
+ color = opt.color || 'white',
170
+ width = this.container.offsetWidth,
171
+ height = this.container.offsetHeight,
172
+ callback = opt.callback || function () {};
173
+
174
+
175
+ // Draw the chart
176
+ RG.SVG.redraw(this.svg);
177
+
178
+
179
+ // Create the cover
180
+ $('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
181
+ background: 'linear-gradient(135deg, rgba(255,255,255,0) ' + pc + '%, ' + color + ' ' + (pc + 20) + '%)',
182
+ width: width + 'px',
183
+ height: height + 'px',
184
+ top: 0,
185
+ left: 0,
186
+ position: 'absolute'
187
+ }).appendTo($(this.container));
188
+
189
+
190
+ function iterator ()
191
+ {
192
+ if (pc < 120) {
193
+ $('div#rgraph_fadeslide_cover_' + obj.id).css({
194
+ background: 'linear-gradient(135deg, rgba(255,255,255,0) ' + pc + '%, ' + color + ' ' + (pc + 20) + '%)'
195
+ });
196
+ pc += step;
197
+ RG.SVG.FX.update(iterator);
198
+
199
+ } else {
200
+
201
+ $('div#rgraph_fadeslide_cover_' + obj.id).remove();
202
+
203
+ callback(obj);
204
+ }
205
+ }
206
+
207
+ iterator();
208
+
209
+ return this;
210
+ };
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ //
219
+ // fadeSlideOut
220
+ //
221
+ // Fades the canvas out in a sliding motion. This function gets added
222
+ // to the chart object - so the this variable is the chart object
223
+ //
224
+ RG.SVG.FX.fadeslideout = function ()
225
+ {
226
+ var obj = this,
227
+ opt = arguments[0] || {},
228
+ frames = opt.frames || 90,
229
+ frame = 0,
230
+ pc = -20,
231
+ step = (120 - pc) / frames,
232
+ canvasXY = RG.SVG.getSVGXY(obj.svg),
233
+ color = opt.color || 'white',
234
+ width = this.container.offsetWidth,
235
+ height = this.container.offsetHeight,
236
+ callback = opt.callback || function () {};
237
+
238
+
239
+ // Draw the chart
240
+ //RG.SVG.redraw(this.svg);
241
+
242
+ // Create the cover
243
+ $('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
244
+ background: 'linear-gradient(135deg, ' + color + ' ' + pc + '%, rgba(255,255,255,0) ' + (pc + 20) + '%)',
245
+ width: width + 'px',
246
+ height: height + 'px',
247
+ top: 0,
248
+ left: 0,
249
+ position: 'absolute'
250
+ }).appendTo($(obj.svg.parentNode));
251
+
252
+ function iterator ()
253
+ {
254
+ if (pc < 120) {
255
+ $('div#rgraph_fadeslide_cover_' + obj.id).css({
256
+ background: 'linear-gradient(135deg, ' + color + ' ' + pc + '%, rgba(255,255,255,0) ' + (pc + 20) + '%)'
257
+ });
258
+ pc += step;
259
+ RG.SVG.FX.update(iterator);
260
+
261
+ } else {
262
+
263
+ RG.SVG.clear(obj.svg);
264
+
265
+ $('div#rgraph_fadeslide_cover_' + obj.id).remove();
266
+
267
+ callback(obj);
268
+ }
269
+ }
270
+
271
+ iterator();
272
+
273
+ return this;
274
+ };
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ //
284
+ // fadeCircularIn
285
+ //
286
+ // This function uses radial CSS gradients to cover the canvas with a radial fade in effect
287
+ // (from the center outwards)
288
+ //
289
+ RG.SVG.FX.fadecircularinoutwards = function ()
290
+ {
291
+ // This function gets added to the chart object - so the 'this'
292
+ // variable is the chart object
293
+ var obj = this,
294
+ opt = arguments[0] || {},
295
+ frames = opt.frames || 90,
296
+ frame = 1,
297
+ radius = 0,
298
+ svgXY = RG.SVG.getSVGXY(obj.svg),
299
+ color = opt.color || 'white',
300
+ callback = opt.callback || function () {};
301
+
302
+
303
+
304
+
305
+ // Draw the chart
306
+ RG.SVG.redraw(this.svg);
307
+
308
+
309
+
310
+ // Create the cover
311
+ $('<div id="rgraph_fadecircularinoutwards_cover_' + obj.id + '"></div>').css({
312
+ background: 'radial-gradient(rgba(255,255,255,0) 0%, ' + color + ' ' + radius + '%)',
313
+ width: this.container.offsetWidth + 'px',
314
+ height: this.container.offsetHeight + 'px',
315
+ top: 0,
316
+ left: 0,
317
+ position: 'absolute'
318
+ }).appendTo($(obj.svg.parentNode));
319
+
320
+
321
+
322
+
323
+ function iterator ()
324
+ {
325
+ if (frame < frames) {
326
+
327
+ $('div#rgraph_fadecircularinoutwards_cover_' + obj.id).css({
328
+ background: 'radial-gradient(rgba(255,255,255,0) ' + ((frame++ / frames) * 100) + '%, ' + color + ' ' + ((frame++ / frames) * 150) + '%)'
329
+ });
330
+
331
+ RG.SVG.FX.update(iterator);
332
+
333
+ } else {
334
+
335
+ $('div#rgraph_fadecircularinoutwards_cover_' + obj.id).remove();
336
+
337
+ callback(obj);
338
+ }
339
+ }
340
+
341
+ iterator();
342
+
343
+ return this;
344
+ };
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+ //
354
+ // fadecircularoutoutwards
355
+ //
356
+ // This function uses radial CSS gradients to cover the canvas with a radial fade out effect
357
+ // (from the center outwards)
358
+ //
359
+ RG.SVG.FX.fadecircularoutoutwards = function ()
360
+ {
361
+ // This function gets added to the chart object - so the this
362
+ // variable is the chart object
363
+ var obj = this,
364
+ opt = arguments[0] || {},
365
+ frames = opt.frames || 90,
366
+ frame = 0,
367
+ width = this.container.offsetWidth,
368
+ height = this.container.offsetHeight,
369
+ canvasXY = RG.SVG.getSVGXY(obj.svg),
370
+ color = opt.color || 'white',
371
+ callback = opt.callback || function () {};
372
+
373
+
374
+
375
+
376
+
377
+ // Draw the chart
378
+ //RG.SVG.redraw(this.svg);
379
+
380
+
381
+
382
+
383
+
384
+ // Create the cover
385
+ $('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
386
+ background: 'radial-gradient(rgba(255,255,255,0) 0%, transparent 0%)',
387
+ width: width + 'px',
388
+ height: height + 'px',
389
+ top: 0,
390
+ left: 0,
391
+ position: 'absolute'
392
+ }).appendTo($(obj.svg.parentNode));
393
+
394
+
395
+
396
+
397
+ function iterator ()
398
+ {
399
+ if (frame < frames) {
400
+
401
+ $('div#rgraph_fadeslide_cover_' + obj.id).css({
402
+ background: 'radial-gradient(' + color + ' ' + ((frame++ / frames) * 100) + '%, rgba(255,255,255,0) ' + ((frame++ / frames) * 150) + '%)'
403
+ });
404
+ RG.SVG.FX.update(iterator);
405
+
406
+ } else {
407
+
408
+ RG.SVG.clear(obj.svg);
409
+
410
+ $('div#rgraph_fadeslide_cover_' + obj.id).remove();
411
+
412
+ callback(obj);
413
+ }
414
+ }
415
+
416
+ iterator();
417
+
418
+ return this;
419
+ };
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+ //
429
+ // fadeCircularInInwards
430
+ //
431
+ // This function gets added to the chart object - so the 'this'
432
+ // variable is the chart object
433
+ //
434
+ RG.SVG.FX.fadecircularininwards = function ()
435
+ {
436
+ var obj = this,
437
+ opt = arguments[0] || {},
438
+ frames = opt.frames || 90,
439
+ frame = 0,
440
+ radius = ma.max(
441
+ obj.container.offsetWidth,
442
+ obj.container.offsetHeight
443
+ ),
444
+ color = opt.color || 'white',
445
+ callback = opt.callback || function () {};
446
+
447
+
448
+ // Draw the chart
449
+ RG.SVG.redraw(this.svg);
450
+
451
+
452
+
453
+ // Create the cover
454
+ $('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
455
+ background: 'radial-gradient(rgba(255,255,255,0) 100%, rgba(255,255,255,0) 0%)',
456
+ width: this.container.offsetWidth + 'px',
457
+ height: this.container.offsetHeight + 'px',
458
+ top: 0,
459
+ left: 0,
460
+ position: 'absolute'
461
+ }).appendTo($(obj.svg.parentNode));
462
+
463
+ function iterator ()
464
+ {
465
+ if (frame < frames) {
466
+
467
+ $('div#rgraph_fadeslide_cover_' + obj.id).css({
468
+ background: 'radial-gradient(' + color + ' ' + (( (frames - frame++) / frames) * 100) + '%, rgba(255,255,255,0) ' + (( (frames - frame++) / frames) * 120) + '%)'
469
+ });
470
+ RG.SVG.FX.update(iterator);
471
+
472
+ } else {
473
+
474
+ $('div#rgraph_fadeslide_cover_' + obj.id).remove();
475
+
476
+ callback(obj);
477
+ }
478
+ }
479
+
480
+ iterator();
481
+
482
+ return this;
483
+ };
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+ //
493
+ // fadecircularoutinwards
494
+ //
495
+ // This function gets added to the chart object - so the this
496
+ // variable is the chart object
497
+ //
498
+ RG.SVG.FX.fadecircularoutinwards = function ()
499
+ {
500
+ var obj = this,
501
+ opt = arguments[0] || {},
502
+ frames = opt.frames || 90,
503
+ frame = 0,
504
+ radius = ma.max(
505
+ this.container.offsetWidth,
506
+ this.container.offsetHeight
507
+ ),
508
+ color = opt.color || 'white',
509
+ callback = opt.callback || function () {};
510
+
511
+
512
+
513
+ // Draw the chart
514
+ //RG.SVG.redraw(this.svg);
515
+
516
+
517
+
518
+ // Create the cover
519
+ $('<div id="rgraph_fadeslide_cover_' + this.id + '"></div>').css({
520
+ background: 'radial-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0) 0%)',
521
+ width: this.container.offsetWidth + 'px',
522
+ height: this.container.offsetHeight + 'px',
523
+ top: 0,
524
+ left: 0,
525
+ position: 'absolute'
526
+ }).appendTo($(obj.svg.parentNode));
527
+
528
+ function iterator ()
529
+ {
530
+ if (frame < frames) {
531
+
532
+ $('div#rgraph_fadeslide_cover_' + obj.id).css({
533
+ background: 'radial-gradient(rgba(255,255,255,0) ' + (( (frames - frame++) / frames) * 100) + '%, ' + color + ' ' + (( (frames - frame++) / frames) * 120) + '%)'
534
+ });
535
+
536
+ RG.SVG.FX.update(iterator);
537
+
538
+ } else {
539
+
540
+ RG.SVG.clear(obj.svg);
541
+
542
+ $('div#rgraph_fadeslide_cover_' + obj.id).remove();
543
+
544
+ callback(obj);
545
+ }
546
+ }
547
+
548
+ iterator();
549
+
550
+ return this;
551
+ };
552
+
553
+
554
+
555
+
556
+ //
557
+ // Reveal
558
+ //
559
+ // With this effect the chart is slowly revealed from the centre outwards. This
560
+ // function gets added to the chart object - so the 'this' variable is the chart
561
+ // object
562
+ //
563
+ // @param object Options for the effect. You can give frames here
564
+ // @param function An optional callback function
565
+ //
566
+ RG.SVG.FX.reveal = function ()
567
+ {
568
+ var obj = this,
569
+ opt = arguments[0] || {}
570
+ color = opt.color || 'white',
571
+ frames = opt.frames || 90,
572
+ duration = (frames / 60) * 1000,
573
+ callback = opt.callback || function () {}
574
+
575
+ var divs = [
576
+ ['rgraph_reveal_left_' + this.id, 0, 0, this.container.offsetWidth / 2, this.container.offsetHeight],
577
+ ['rgraph_reveal_right_' + this.id,(this.container.offsetWidth / 2),0,(this.container.offsetWidth / 2),this.container.offsetHeight],
578
+ ['rgraph_reveal_top_' + this.id,0,0,this.container.offsetWidth,(this.container.offsetHeight / 2)],
579
+ ['rgraph_reveal_bottom_' + this.id,0,(this.container.offsetHeight / 2),this.container.offsetWidth,(this.container.offsetHeight / 2)]
580
+ ];
581
+
582
+ for (var i=0,len=divs.length; i<len; ++i) {
583
+ var div = doc.createElement('DIV');
584
+ div.id = divs[i][0];
585
+ div.style.left = divs[i][1] + 'px';
586
+ div.style.top = divs[i][2] + 'px';
587
+ div.style.width = divs[i][3] + 'px';
588
+ div.style.height = divs[i][4] + 'px';
589
+ div.style.position = 'absolute';
590
+ div.style.backgroundColor = color;
591
+ this.container.appendChild(div);
592
+ }
593
+
594
+
595
+ // Redraw
596
+ RG.SVG.redraw(obj.svg);
597
+
598
+
599
+ // Animate the shrinking of the DIVs
600
+ jQuery('#rgraph_reveal_left_' + obj.id).animate({width: 0}, duration);
601
+ jQuery('#rgraph_reveal_right_' + obj.id).animate({left: '+=' + (this.container.offsetWidth / 2),width: 0}, duration);
602
+ jQuery('#rgraph_reveal_top_' + obj.id).animate({height: 0}, duration);
603
+ jQuery('#rgraph_reveal_bottom_' + obj.id).animate({top: '+=' + (this.container.offsetHeight / 2),height: 0}, duration);
604
+
605
+ // Remove the DIVs from the DOM 100ms after the animation ends
606
+ setTimeout(function ()
607
+ {
608
+ obj.container.removeChild(doc.getElementById("rgraph_reveal_top_" + obj.id));
609
+ obj.container.removeChild(doc.getElementById("rgraph_reveal_bottom_" + obj.id));
610
+ obj.container.removeChild(doc.getElementById("rgraph_reveal_left_" + obj.id));
611
+ obj.container.removeChild(doc.getElementById("rgraph_reveal_right_" + obj.id));
612
+
613
+ callback(obj);
614
+ }, duration);
615
+
616
+
617
+ return this;
618
+ };
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+ //
628
+ // Conceal
629
+ //
630
+ // This effect is the reverse of the Reveal effect - instead of revealing
631
+ // the canvas it conceals it. Combined with the reveal effect would make
632
+ // for a nice wipe effect.
633
+ //
634
+ // @param object obj The chart object
635
+ ///
636
+ RG.SVG.FX.conceal = function ()
637
+ {
638
+ var obj = this,
639
+ opt = arguments[0] || {},
640
+ frames = opt.frames || 90,
641
+ callback = opt.callback || function () {},
642
+ color = opt.color || 'white',
643
+ duration = (frames / 60) * 1000,
644
+ frame = 0;
645
+
646
+
647
+
648
+ var divs = [
649
+ ['rgraph_conceal_left_' + obj.id, 0, 0, 0, this.container.offsetHeight],
650
+ ['rgraph_conceal_right_' + obj.id,this.container.offsetWidth,0,0,this.container.offsetHeight],
651
+ ['rgraph_conceal_top_' + obj.id,0,0,this.container.offsetWidth,0],
652
+ ['rgraph_conceal_bottom_' + obj.id,0,this.container.offsetHeight,this.container.offsetWidth,0]
653
+ ];
654
+
655
+
656
+
657
+
658
+ for (var i=0,len=divs.length; i<len; ++i) {
659
+ var div = doc.createElement('DIV');
660
+ div.id = divs[i][0];
661
+ div.style.left = divs[i][1] + 'px';
662
+ div.style.top = divs[i][2] + 'px';
663
+ div.style.width = divs[i][3] + 'px';
664
+ div.style.height = divs[i][4] + 'px';
665
+ div.style.position = 'absolute';
666
+ div.style.backgroundColor = color;
667
+ this.container.appendChild(div);
668
+ }
669
+
670
+ jQuery('#rgraph_conceal_left_' + obj.id).animate({width: '+=' + (this.container.offsetWidth / 2)}, duration);
671
+ jQuery('#rgraph_conceal_right_' + obj.id).animate({left: '-=' + (this.container.offsetWidth / 2),width: (this.container.offsetWidth / 2)}, duration);
672
+ jQuery('#rgraph_conceal_top_' + obj.id).animate({height: '+=' + (this.container.offsetHeight / 2)}, duration);
673
+ jQuery('#rgraph_conceal_bottom_' + obj.id).animate({top: '-=' + (this.container.offsetHeight / 2),height: (this.container.offsetHeight / 2)}, duration);
674
+
675
+ // Remove the DIVs from the DOM 100ms after the animation ends
676
+ setTimeout(
677
+ function ()
678
+ {
679
+ obj.container.removeChild(doc.getElementById("rgraph_conceal_top_" + obj.id));
680
+ obj.container.removeChild(doc.getElementById("rgraph_conceal_bottom_" + obj.id));
681
+ obj.container.removeChild(doc.getElementById("rgraph_conceal_left_" + obj.id));
682
+ obj.container.removeChild(doc.getElementById("rgraph_conceal_right_" + obj.id));
683
+
684
+ RG.SVG.clear(obj.svg);
685
+
686
+ callback(obj);
687
+
688
+ },
689
+ duration
690
+ );
691
+
692
+ return this;
693
+ };
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+ //
703
+ // Horizontal Blinds (open)
704
+ //
705
+ // @params object obj The graph object
706
+ //
707
+ RG.SVG.FX.hblindsopen = function ()
708
+ {
709
+ // This function gets added to the chart object - so the this
710
+ // variable is the chart object
711
+ var obj = this,
712
+ opt = arguments[0] || {},
713
+ frames = opt.frames || 90,
714
+ duration = (frames / 60) * 1000,
715
+ frame = 0,
716
+ callback = opt.callback || function () {},
717
+ color = opt.color || 'white',
718
+ height = this.container.offsetHeight / 5;
719
+
720
+ //
721
+ // First draw the chart
722
+ //
723
+ RG.SVG.redraw(this.svg);
724
+
725
+ for (var i=0; i<5; ++i) {
726
+ var div = doc.createElement('DIV');
727
+ div.id = 'rgraph_hblinds_' + i + '_' + obj.id;
728
+ div.style.left = 0;
729
+ div.style.top = ((this.container.offsetHeight * (i / 5))) + 'px';
730
+ div.style.width = this.container.offsetWidth + 'px';
731
+ div.style.height = (this.container.offsetHeight / 5) + 'px';
732
+ div.style.position = 'absolute';
733
+ div.style.backgroundColor = color;
734
+ this.container.appendChild(div);
735
+
736
+ jQuery('#rgraph_hblinds_' + i + '_' + obj.id).animate({height: 0}, duration);
737
+ }
738
+
739
+ setTimeout(function () {this.container.removeChild(doc.getElementById('rgraph_hblinds_0_' + obj.id));}, duration);
740
+ setTimeout(function () {this.container.removeChild(doc.getElementById('rgraph_hblinds_1_' + obj.id));}, duration);
741
+ setTimeout(function () {this.container.removeChild(doc.getElementById('rgraph_hblinds_2_' + obj.id));}, duration);
742
+ setTimeout(function () {this.container.removeChild(doc.getElementById('rgraph_hblinds_3_' + obj.id));}, duration);
743
+ setTimeout(function () {this.container.removeChild(doc.getElementById('rgraph_hblinds_4_' + obj.id));}, duration);
744
+ setTimeout(function () {callback(obj);}, duration);
745
+
746
+ return this;
747
+ };
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+ //
757
+ // Horizontal Blinds (close)
758
+ //
759
+ // This function gets added to the chart object - so the this
760
+ // variable is the chart object
761
+ //
762
+ // @params object obj The graph object
763
+ //
764
+ RG.SVG.FX.hblindsclose = function ()
765
+ {
766
+ var obj = this,
767
+ opt = arguments[0] || {},
768
+ frames = opt.frames || 90,
769
+ duration = (frames / 60) * 1000,
770
+ frame = 0,
771
+ callback = opt.callback || function () {},
772
+ color = opt.color = 'white',
773
+ height = this.container.offsetHeight / 5;
774
+
775
+
776
+
777
+ for (var i=0; i<5; ++i) {
778
+ var div = doc.createElement('DIV');
779
+ div.id = 'rgraph_hblinds_' + i + '_' + obj.id;
780
+ div.style.left = 0;
781
+ div.style.top = (this.container.offsetHeight * (i / 5)) + 'px';
782
+ div.style.width = this.container.offsetWidth + 'px';
783
+ div.style.height = 0;
784
+ div.style.position = 'absolute';
785
+ div.style.backgroundColor = color;
786
+ this.container.appendChild(div);
787
+
788
+ jQuery('#rgraph_hblinds_' + i + '_' + obj.id)
789
+ .animate({
790
+ height: height + 'px'
791
+ }, duration);
792
+ }
793
+
794
+
795
+
796
+ setTimeout(function () {RG.SVG.clear(obj.svg);}, duration + 100);
797
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_hblinds_0_' + obj.id));}, duration + 100);
798
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_hblinds_1_' + obj.id));}, duration + 100);
799
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_hblinds_2_' + obj.id));}, duration + 100);
800
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_hblinds_3_' + obj.id));}, duration + 100);
801
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_hblinds_4_' + obj.id));}, duration + 100);
802
+ setTimeout(function () {callback(obj);}, duration + 100);
803
+ };
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+ //
813
+ // Vertical Blinds (open)
814
+ //
815
+ // @params object obj The graph object
816
+ //
817
+ // This function gets added to the chart object - so the this
818
+ // variable is the chart object
819
+ RG.SVG.FX.vblindsopen = function ()
820
+ {
821
+ var obj = this,
822
+ opt = arguments[0] || {},
823
+ frames = opt.frames || 90,
824
+ duration = (frames / 60) * 1000,
825
+ frame = 0,
826
+ callback = opt.callback || function () {},
827
+ color = opt.color || 'white',
828
+ width = this.container.offsetWidth / 10;
829
+
830
+ //
831
+ // First draw the chart
832
+ //
833
+ RG.SVG.redraw(obj.svg);
834
+
835
+ for (var i=0; i<10; ++i) {
836
+ var div = doc.createElement('DIV');
837
+ div.id = 'rgraph_vblinds_' + i + '_' + obj.id;
838
+ div.style.width = width + 'px';
839
+ div.style.height = this.container.offsetHeight + 'px';
840
+ div.style.left = (this.container.offsetWidth * (i / 10)) + 'px';
841
+ div.style.top = 0;
842
+ div.style.position = 'absolute';
843
+ div.style.backgroundColor = color;
844
+ this.container.appendChild(div);
845
+
846
+ jQuery('#rgraph_vblinds_' + i + '_' + obj.id).animate({width: 0}, duration);
847
+ }
848
+
849
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_0_' + obj.id));}, duration + 100);
850
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_1_' + obj.id));}, duration + 100);
851
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_2_' + obj.id));}, duration + 100);
852
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_3_' + obj.id));}, duration + 100);
853
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_4_' + obj.id));}, duration + 100);
854
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_5_' + obj.id));}, duration + 100);
855
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_6_' + obj.id));}, duration + 100);
856
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_7_' + obj.id));}, duration + 100);
857
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_8_' + obj.id));}, duration + 100);
858
+ setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_9_' + obj.id));}, duration + 100);
859
+
860
+ setTimeout(function () {callback(obj);}, duration + 100);
861
+
862
+ return this;
863
+ };
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+ //
873
+ // Vertical Blinds (close)
874
+ //
875
+ // This function gets added to the chart object - so the this
876
+ // variable is the chart object
877
+ //
878
+ // @params object obj The graph object
879
+ //
880
+ RG.SVG.FX.vblindsclose = function ()
881
+ {
882
+ var obj = this,
883
+ opt = arguments[0] || {},
884
+ frames = opt.frames || 90,
885
+ duration = (frames / 60) * 1000,
886
+ frame = 0,
887
+ callback = opt.callback || function () {},
888
+ color = opt.color || 'white',
889
+ width = this.container.offsetWidth / 10;
890
+
891
+ // Create the blinds
892
+ for (var i=0; i<10; ++i) {
893
+ var div = doc.createElement('DIV');
894
+ div.id = 'rgraph_vblinds_' + i + '_' + obj.id;
895
+ div.style.left = (this.container.offsetWidth * (i / 10)) + 'px';
896
+ div.style.top = 0;
897
+ div.style.width = 0;
898
+ div.style.height = this.container.offsetHeight + 'px';
899
+ div.style.position = 'absolute';
900
+ div.style.backgroundColor = color;
901
+ this.container.appendChild(div);
902
+
903
+ jQuery('#rgraph_vblinds_' + i + '_' + obj.id).animate({width: width}, duration);
904
+ }
905
+
906
+ setTimeout(function () {RG.SVG.clear(obj.svg);}, duration + 100);
907
+
908
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_0_' + obj.id));}, duration + 100);
909
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_1_' + obj.id));}, duration + 100);
910
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_2_' + obj.id));}, duration + 100);
911
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_3_' + obj.id));}, duration + 100);
912
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_4_' + obj.id));}, duration + 100);
913
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_5_' + obj.id));}, duration + 100);
914
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_6_' + obj.id));}, duration + 100);
915
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_7_' + obj.id));}, duration + 100);
916
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_8_' + obj.id));}, duration + 100);
917
+ setTimeout(function () {obj.container.removeChild(doc.getElementById('rgraph_vblinds_9_' + obj.id));}, duration + 100);
918
+
919
+ setTimeout(function () {callback(obj);}, duration + 100);
920
+
921
+ return this;
922
+ };
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+ //
932
+ // Slide in
933
+ //
934
+ // This function is a wipe that can be used when switching the canvas to a
935
+ // new graph
936
+ //
937
+ // This function gets added to the chart object - so the this
938
+ // variable is the chart object
939
+ //
940
+ // @param object obj The graph object
941
+ //
942
+ RG.SVG.FX.slidein = function ()
943
+ {
944
+ var obj = this,
945
+ opt = arguments[0] || {},
946
+ frames = opt.frames || 90,
947
+ duration = (frames / 60) * 1000,
948
+ frame = 0,
949
+ callback = opt.callback || function () {},
950
+ color = opt.color || 'white',
951
+ width = this.container.offsetWidth / 10,
952
+ from = opt.from || 'left';
953
+
954
+ this.container.style.overflow = 'hidden';
955
+
956
+ RG.SVG.redraw(this.svg);
957
+
958
+ this.svg.style.position = 'relative';
959
+
960
+ if (from == 'left') {
961
+ this.svg.style.left = (0 - this.container.offsetWidth) + 'px';
962
+ this.svg.style.top = 0;
963
+ } else if (from == 'top') {
964
+ this.svg.style.left = 0;
965
+ this.svg.style.top = (0 - this.container.offsetHeight) + 'px';
966
+ } else if (from == 'bottom') {
967
+ this.svg.style.left = 0;
968
+ this.svg.style.top = this.container.offsetHeight + 'px';
969
+ } else {
970
+ this.svg.style.left = this.container.offsetWidth + 'px';
971
+ this.svg.style.top = 0;
972
+ }
973
+
974
+ jQuery(this.svg).animate({left:0,top:0}, duration, function ()
975
+ {
976
+ callback(this);
977
+ });
978
+
979
+ return this;
980
+ };
981
+
982
+
983
+
984
+
985
+
986
+
987
+
988
+
989
+ //
990
+ // Slide out
991
+ //
992
+ // This function is a wipe that can be used when switching the canvas to a new graph
993
+ //
994
+ // @param object Optional object containing configuration.
995
+ // @param function Optional callback function
996
+ //
997
+ RG.SVG.FX.slideout = function ()
998
+ {
999
+ // This function gets added to the chart object - so the this
1000
+ // variable is the chart object
1001
+ var opt = arguments[0] || {},
1002
+ frames = opt.frames || 90,
1003
+ color = opt.color || 'white',
1004
+ to = opt.to || 'left',
1005
+ duration = (frames / 60) * 1000,
1006
+ frame = 0,
1007
+ callback = opt.callback || function () {},
1008
+ width = this.container.offetsWidth / 10;
1009
+
1010
+ this.container.style.overflow= 'hidden';
1011
+
1012
+ this.svg.style.position = 'relative';
1013
+ this.svg.style.left = 0;
1014
+ this.svg.style.top = 0;
1015
+
1016
+ if (to == 'left') {
1017
+ jQuery(this.svg).animate({left: (0 - this.container.offsetWidth) + 'px'}, duration, function () {callback(this);});
1018
+ } else if (to == 'top') {
1019
+ jQuery(this.svg).animate({left: 0, top: (0 - this.container.offsetHeight) + 'px'}, duration, function () {callback(this);});
1020
+ } else if (to == 'bottom') {
1021
+ jQuery(this.svg).animate({top: (0 + this.container.offsetHeight) + 'px'}, duration, function () {callback(this);});
1022
+ } else {
1023
+ jQuery(this.svg).animate({left: (0 + this.container.offsetWidth) + 'px'}, duration, function () {callback(this);});
1024
+ }
1025
+
1026
+ return this;
1027
+ };
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+ //
1037
+ // Horizontal Scissors (open)
1038
+ //
1039
+ // This function gets added to the chart object - so the this
1040
+ // variable is the chart object
1041
+ //
1042
+ // @param object Optional array of options
1043
+ // @param function Optional callback function
1044
+ //
1045
+ //
1046
+ RG.SVG.FX.hscissorsopen = function ()
1047
+ {
1048
+ var opt = arguments[0] || {},
1049
+ obj = this,
1050
+ frames = opt.frames || 90,
1051
+ callback = opt.callback || function () {},
1052
+ color = opt.color || 'white',
1053
+ to = opt.to || 'left',
1054
+ frame = 0,
1055
+ duration = (frames / 60) * 1000,
1056
+ width = this.container.offsetWidth / 10,
1057
+ height = this.container.offsetHeight / 5;
1058
+
1059
+
1060
+ //
1061
+ // First draw the chart
1062
+ //
1063
+ RG.SVG.redraw(this.svg);
1064
+
1065
+
1066
+ for (var i=0; i<5; ++i) {
1067
+ var div = doc.getElementById("rgraph_hscissors_" + i + '_' + this.id)
1068
+ if (!div) {
1069
+ var div = doc.createElement('DIV');
1070
+ div.id = 'rgraph_hscissors_' + i + '_' + this.id;
1071
+ div.style.width = this.container.offsetWidth + 'px';
1072
+ div.style.height = (this.container.offsetHeight / 5) + 'px';
1073
+ div.style.left = 0;
1074
+ div.style.top = (this.container.offsetHeight * (i / 5)) + 'px';
1075
+ div.style.position = 'absolute';
1076
+ div.style.backgroundColor = color;
1077
+ this.container.appendChild(div);
1078
+ }
1079
+
1080
+ if (i % 2 == 0) {
1081
+ jQuery('#' + 'rgraph_hscissors_' + i + '_' + this.id).animate({left: this.container.offsetWidth + 'px', width: 0}, duration);
1082
+ } else {
1083
+ jQuery('#' + 'rgraph_hscissors_' + i + '_' + this.id).animate({width: 0}, duration);
1084
+ }
1085
+ }
1086
+
1087
+ setTimeout(function ()
1088
+ {
1089
+ obj.container.removeChild(doc.getElementById('rgraph_hscissors_0_' + obj.id));
1090
+ obj.container.removeChild(doc.getElementById('rgraph_hscissors_1_' + obj.id));
1091
+ obj.container.removeChild(doc.getElementById('rgraph_hscissors_2_' + obj.id));
1092
+ obj.container.removeChild(doc.getElementById('rgraph_hscissors_3_' + obj.id));
1093
+ obj.container.removeChild(doc.getElementById('rgraph_hscissors_4_' + obj.id));
1094
+
1095
+ callback(obj);
1096
+ }, duration);
1097
+
1098
+
1099
+ return this;
1100
+ };
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+ //
1110
+ // Horizontal Scissors (Close)
1111
+ //
1112
+ // This function gets added to the chart object - so the this
1113
+ // variable is the chart object
1114
+ //
1115
+ // @param @object Optional object of options
1116
+ // @param function Optional callback function
1117
+ //
1118
+ //
1119
+ RG.SVG.FX.hscissorsclose = function ()
1120
+ {
1121
+ var obj = this,
1122
+ opt = arguments[0] || {},
1123
+ frames = opt.frames || 60,
1124
+ duration = (frames / 60) * 1000,
1125
+ frame = 0,
1126
+ callback = opt.callback || function () {},
1127
+ color = opt.color || 'white',
1128
+ height = this.container.offsetHeight / 5;
1129
+
1130
+
1131
+ for (var i=0; i<5; ++i) {
1132
+ var div = doc.createElement('DIV');
1133
+ div.id = 'rgraph_hscissors_' + i + '_' + this.id;
1134
+ div.style.width = 0;
1135
+ div.style.height = height + 'px';
1136
+ div.style.left = (i % 2 == 0 ? this.container.offsetWidth : 0) + 'px';
1137
+ div.style.top = (this.container.offsetHeight * (i / 5)) + 'px';
1138
+ div.style.position = 'absolute';
1139
+ div.style.backgroundColor = color;
1140
+ this.container.appendChild(div);
1141
+
1142
+ if (i % 2 == 0) {
1143
+ jQuery('#' + 'rgraph_hscissors_' + i + '_' + this.id).animate({left: 0, width: this.container.offsetWidth + 'px'}, duration);
1144
+ } else {
1145
+ jQuery('#' + 'rgraph_hscissors_' + i + '_' + this.id).animate({width: this.container.offsetWidth + 'px'}, duration);
1146
+ }
1147
+ }
1148
+
1149
+ setTimeout(function ()
1150
+ {
1151
+ RG.SVG.clear(obj.svg);
1152
+ jQuery('#' + 'rgraph_hscissors_' + 0 + '_' + obj.id).remove();
1153
+ jQuery('#' + 'rgraph_hscissors_' + 1 + '_' + obj.id).remove();
1154
+ jQuery('#' + 'rgraph_hscissors_' + 2 + '_' + obj.id).remove();
1155
+ jQuery('#' + 'rgraph_hscissors_' + 3 + '_' + obj.id).remove();
1156
+ jQuery('#' + 'rgraph_hscissors_' + 4 + '_' + obj.id).remove();
1157
+ callback(obj);
1158
+ }, duration);
1159
+
1160
+ return this;
1161
+ };
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+ //
1171
+ // Vertical Scissors (open)
1172
+ //
1173
+ // @param @object Optional An object of options. It can consist of:
1174
+ // o color - The color of the scissors. The default is white
1175
+ // o frames - Number of animation frames in the effect. Default
1176
+ // is 60
1177
+ // o callback - A function that's called when the effect is
1178
+ // finished
1179
+ //
1180
+ RG.SVG.FX.vscissorsopen = function ()
1181
+ {
1182
+ // This function gets added to the chart object - so the this
1183
+ // variable is the chart object
1184
+ var obj = this,
1185
+ opt = arguments[0] || {},
1186
+ frames = opt.frames || 90,
1187
+ duration = (frames / 60) * 1000,
1188
+ frame = 0,
1189
+ callback = opt.callback || function () {},
1190
+ color = opt.color || 'white',
1191
+ width = this.container.offsetWidth / 10;
1192
+
1193
+
1194
+
1195
+ //
1196
+ // First (re)draw the chart
1197
+ //
1198
+ RG.SVG.redraw(this.svg);
1199
+
1200
+
1201
+
1202
+ for (var i=0; i<10; ++i) {
1203
+ var div = doc.getElementById("rgraph_vscissors_" + i + '_' + this.id);
1204
+
1205
+ if (!div) {
1206
+ var div = doc.createElement('DIV');
1207
+ div.id = 'rgraph_vscissors_' + i + '_' + this.id;
1208
+ div.style.width = width + 'px';
1209
+ div.style.height = this.container.offsetHeight + 'px';
1210
+ div.style.left = this.container.offsetWidth * (i / 10) + 'px';
1211
+ div.style.top = 0;
1212
+ div.style.position = 'absolute';
1213
+ div.style.backgroundColor = color;
1214
+ this.container.appendChild(div);
1215
+ }
1216
+
1217
+ if (i % 2 == 0) {
1218
+ jQuery('#' + 'rgraph_vscissors_' + i + '_' + this.id).animate({top: this.container.offsetHeight + 'px', height: 0}, duration);
1219
+ } else {
1220
+ jQuery('#' + 'rgraph_vscissors_' + i + '_' + this.id).animate({height: 0}, duration);
1221
+ }
1222
+ }
1223
+
1224
+ setTimeout(function ()
1225
+ {
1226
+ this.container.removeChild(doc.getElementById('rgraph_vscissors_0' + '_' + this.id));
1227
+ this.container.removeChild(doc.getElementById('rgraph_vscissors_1' + '_' + this.id));
1228
+ this.container.removeChild(doc.getElementById('rgraph_vscissors_2' + '_' + this.id));
1229
+ this.container.removeChild(doc.getElementById('rgraph_vscissors_3' + '_' + this.id));
1230
+ this.container.removeChild(doc.getElementById('rgraph_vscissors_4' + '_' + this.id));
1231
+
1232
+ callback(this);
1233
+
1234
+ }, duration);
1235
+
1236
+ return this;
1237
+ };
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+ //
1247
+ // Vertical Scissors (close)
1248
+ //
1249
+ RG.SVG.FX.vscissorsclose = function ()
1250
+ {
1251
+ // This function gets added to the chart object - so the this
1252
+ // variable is the chart object
1253
+ var obj = this,
1254
+ opt = arguments[0] || {},
1255
+ frames = opt.frames || 90,
1256
+ duration = (frames / 60) * 1000,
1257
+ frame = 0,
1258
+ callback = opt.callback || function () {},
1259
+ color = opt.color || 'white',
1260
+ width = this.container.offsetWidth / 10;
1261
+
1262
+
1263
+ for (var i=0; i<10; ++i) {
1264
+ var div = doc.getElementById("rgraph_vscissors_" + i + '_' + this.id)
1265
+ if (!div) {
1266
+ var div = doc.createElement('DIV');
1267
+ div.id = 'rgraph_vscissors_' + i + '_' + this.id;
1268
+ div.style.width = width + 'px';
1269
+ div.style.height = 0;
1270
+ div.style.left = (width * i) + 'px';
1271
+ div.style.top = (i % 2 == 0 ? this.container.offsetHeight : 0) + 'px';
1272
+ div.style.position = 'absolute';
1273
+ div.style.backgroundColor = color;
1274
+ this.container.appendChild(div);
1275
+ }
1276
+
1277
+ if (i % 2 == 0) {
1278
+ jQuery('#' + 'rgraph_vscissors_' + i + '_' + this.id).animate({top: 0, height: this.container.offsetHeight + 'px'}, duration);
1279
+ } else {
1280
+ jQuery('#' + 'rgraph_vscissors_' + i + '_' + this.id).animate({height: this.container.offsetHeight + 'px'}, duration);
1281
+ }
1282
+ }
1283
+
1284
+ setTimeout(function ()
1285
+ {
1286
+ RG.SVG.clear(obj.svg);
1287
+ for (var i=0; i<10; i++) {
1288
+ jQuery('#rgraph_vscissors_' + i + '_' + obj.id).remove();
1289
+ }
1290
+ callback(obj);
1291
+ }, duration);
1292
+
1293
+ return this;
1294
+ };
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+ // End Module pattern
1304
+ })(window, document);