rgraph-rails 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +0 -1
- data/README.md +3 -3
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +239 -3764
- data/vendor/assets/javascripts/RGraph.bipolar.js +115 -1986
- data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -399
- data/vendor/assets/javascripts/RGraph.common.context.js +30 -600
- data/vendor/assets/javascripts/RGraph.common.core.js +403 -5187
- data/vendor/assets/javascripts/RGraph.common.csv.js +19 -275
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -454
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +84 -1189
- data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1548
- data/vendor/assets/javascripts/RGraph.common.key.js +54 -755
- data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -567
- data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -356
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -614
- data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -223
- data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
- data/vendor/assets/javascripts/RGraph.drawing.background.js +35 -620
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +35 -576
- data/vendor/assets/javascripts/RGraph.drawing.image.js +52 -807
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +41 -717
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +37 -668
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +36 -563
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +40 -608
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +35 -597
- data/vendor/assets/javascripts/RGraph.drawing.text.js +34 -642
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -809
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
- data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
- data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
- data/vendor/assets/javascripts/RGraph.gantt.js +75 -1241
- data/vendor/assets/javascripts/RGraph.gauge.js +87 -1397
- data/vendor/assets/javascripts/RGraph.hbar.js +143 -2376
- data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1397
- data/vendor/assets/javascripts/RGraph.line.js +241 -4162
- data/vendor/assets/javascripts/RGraph.meter.js +74 -1278
- metadata +3 -30
- data/vendor/assets/images/bg.png +0 -0
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/meter-image-sd-needle.png +0 -0
- data/vendor/assets/images/meter-image-sd.png +0 -0
- data/vendor/assets/images/meter-sketch-needle.png +0 -0
- data/vendor/assets/images/meter-sketch.png +0 -0
- data/vendor/assets/images/odometer-background.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/images/title.png +0 -0
- data/vendor/assets/images/twitter-large.png +0 -0
- data/vendor/assets/javascripts/RGraph.modaldialog.js +0 -301
- data/vendor/assets/javascripts/RGraph.odo.js +0 -1265
- data/vendor/assets/javascripts/RGraph.pie.js +0 -2272
- data/vendor/assets/javascripts/RGraph.radar.js +0 -1847
- data/vendor/assets/javascripts/RGraph.rose.js +0 -1877
- data/vendor/assets/javascripts/RGraph.rscatter.js +0 -1425
- data/vendor/assets/javascripts/RGraph.scatter.js +0 -2970
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +0 -1015
- data/vendor/assets/javascripts/RGraph.thermometer.js +0 -1129
- data/vendor/assets/javascripts/RGraph.vprogress.js +0 -1452
- data/vendor/assets/javascripts/RGraph.waterfall.js +0 -1252
- data/vendor/assets/javascripts/financial-data.js +0 -1067
- data/vendor/assets/stylesheets/ModalDialog.css +0 -90
- data/vendor/assets/stylesheets/animations.css +0 -3347
- data/vendor/assets/stylesheets/website.css +0 -446
@@ -1,1549 +1,91 @@
|
|
1
|
-
// version: 2016-06-04
|
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 dual licensed under the Open Source GPL (General Public License) |
|
9
|
-
* | v2.0 license and a commercial license which means that you're not bound by |
|
10
|
-
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
|
-
* | you can read about it here: |
|
12
|
-
* | |
|
13
|
-
* | http://www.rgraph.net/license |
|
14
|
-
* o--------------------------------------------------------------------------------o
|
15
|
-
*/
|
16
1
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
(function (
|
31
|
-
{
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
/**
|
111
|
-
* fadeIn
|
112
|
-
*
|
113
|
-
* This function simply uses the CSS opacity property - initially set to zero and
|
114
|
-
* increasing to 1 over the period of 0.5 second
|
115
|
-
*/
|
116
|
-
RG.Effects.Common.fadeIn = 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
|
-
var opt = arguments[0] || {};
|
122
|
-
var frames = opt.frames || 30;
|
123
|
-
var duration = (frames / 60) * 1000;
|
124
|
-
var frame = 0;
|
125
|
-
var callback = arguments[1] || function () {};
|
126
|
-
|
127
|
-
|
128
|
-
// Initially the opacity should be zero
|
129
|
-
obj.canvas.style.opacity = 0;
|
130
|
-
|
131
|
-
// Draw the chart
|
132
|
-
RG.redrawCanvas(obj.canvas);
|
133
|
-
|
134
|
-
// Now fade the chart in
|
135
|
-
for (var i=1; i<=frames; ++i) {
|
136
|
-
(function (index)
|
137
|
-
{
|
138
|
-
setTimeout(function ()
|
139
|
-
{
|
140
|
-
obj.canvas.style.opacity = (index / frames);
|
141
|
-
}, (index / frames) * duration);
|
142
|
-
})(i)
|
143
|
-
}
|
144
|
-
|
145
|
-
setTimeout(function () {callback(obj);}, duration);
|
146
|
-
|
147
|
-
|
148
|
-
return obj;
|
149
|
-
};
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
/**
|
155
|
-
* fadeOut
|
156
|
-
*
|
157
|
-
* This function is a reversal of the above function - fading out instead of in
|
158
|
-
*/
|
159
|
-
RG.Effects.Common.fadeOut = 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
|
-
var opt = arguments[0] || {};
|
165
|
-
var frames = opt.frames || 30;
|
166
|
-
var duration = (frames / 60) * 1000;
|
167
|
-
var frame = 0;
|
168
|
-
var callback = arguments[1] || function () {};
|
169
|
-
|
170
|
-
|
171
|
-
// Now fade the chart in
|
172
|
-
for (var i=1; i<=frames; ++i) {
|
173
|
-
(function (index)
|
174
|
-
{
|
175
|
-
setTimeout(function ()
|
176
|
-
{
|
177
|
-
obj.canvas.style.opacity = 1 - (index / frames);
|
178
|
-
}, (index / frames) * duration);
|
179
|
-
})(i)
|
180
|
-
}
|
181
|
-
|
182
|
-
setTimeout(function () {callback(obj);}, duration);
|
183
|
-
|
184
|
-
return this;
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Callback
|
188
|
-
*/
|
189
|
-
callback(obj);
|
190
|
-
};
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
/**
|
196
|
-
* fadeSlideIn
|
197
|
-
*
|
198
|
-
* This function fades the canvas in in a sliding motion
|
199
|
-
*/
|
200
|
-
RG.Effects.Common.fadeSlideIn = function ()
|
201
|
-
{
|
202
|
-
// This function gets added to the chart object - so the this
|
203
|
-
// variable is the chart object
|
204
|
-
var obj = this,
|
205
|
-
opt = arguments[0] || {},
|
206
|
-
frames = opt.frames || 30,
|
207
|
-
frame = 0,
|
208
|
-
pc = -20,
|
209
|
-
step = (120 - pc) / frames,
|
210
|
-
canvasXY = RG.getCanvasXY(obj.canvas),
|
211
|
-
color = opt.color || 'white',
|
212
|
-
callback = arguments[1] || function () {};
|
213
|
-
|
214
|
-
|
215
|
-
// Draw the chart
|
216
|
-
RG.redrawCanvas(obj.canvas);
|
217
|
-
|
218
|
-
|
219
|
-
// Create the cover
|
220
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
221
|
-
background: 'linear-gradient(135deg, rgba(255,255,255,0) ' + pc + '%, ' + color + ' ' + (pc + 20) + '%)',
|
222
|
-
width:obj.canvas.width + 'px',
|
223
|
-
height: obj.canvas.height + 'px',
|
224
|
-
top: canvasXY[1] + 'px',
|
225
|
-
left: canvasXY[0] + 'px',
|
226
|
-
position: 'absolute'
|
227
|
-
}).appendTo($(obj.canvas.parentNode));
|
228
|
-
|
229
|
-
function iterator ()
|
230
|
-
{
|
231
|
-
if (pc < 120) {
|
232
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
233
|
-
background: 'linear-gradient(135deg, rgba(255,255,255,0) ' + pc + '%, ' + color + ' ' + (pc + 20) + '%)'
|
234
|
-
});
|
235
|
-
pc += step;
|
236
|
-
RG.Effects.updateCanvas(iterator);
|
237
|
-
|
238
|
-
} else {
|
239
|
-
|
240
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
241
|
-
|
242
|
-
callback(obj);
|
243
|
-
}
|
244
|
-
}
|
245
|
-
|
246
|
-
iterator();
|
247
|
-
};
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
/**
|
253
|
-
* fadeSlideOut
|
254
|
-
*
|
255
|
-
Fades the canvas out in a sliding motion
|
256
|
-
*/
|
257
|
-
RG.Effects.Common.fadeSlideOut = function ()
|
258
|
-
{
|
259
|
-
// This function gets added to the chart object - so the this
|
260
|
-
// variable is the chart object
|
261
|
-
var obj = this;
|
262
|
-
var opt = arguments[0] || {};
|
263
|
-
var frames = opt.frames || 30;
|
264
|
-
var frame = 0;
|
265
|
-
var pc = -20;
|
266
|
-
var step = (120 - pc) / frames;
|
267
|
-
var canvasXY = RG.getCanvasXY(obj.canvas);
|
268
|
-
var color = opt.color || 'white';
|
269
|
-
var callback = arguments[1] || function () {};
|
270
|
-
|
271
|
-
|
272
|
-
// Draw the chart
|
273
|
-
RG.redrawCanvas(obj.canvas);
|
274
|
-
|
275
|
-
// Create the cover
|
276
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
277
|
-
background: 'linear-gradient(135deg, ' + color + ' ' + pc + '%, rgba(255,255,255,0) ' + (pc + 20) + '%)',
|
278
|
-
width:obj.canvas.width + 'px',
|
279
|
-
height: obj.canvas.height + 'px',
|
280
|
-
top: canvasXY[1] + 'px',
|
281
|
-
left: canvasXY[0] + 'px',
|
282
|
-
position: 'absolute'
|
283
|
-
}).appendTo($(obj.canvas.parentNode));
|
284
|
-
|
285
|
-
function iterator ()
|
286
|
-
{
|
287
|
-
if (pc < 120) {
|
288
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
289
|
-
background: 'linear-gradient(135deg, ' + color + ' ' + pc + '%, rgba(255,255,255,0) ' + (pc + 20) + '%)'
|
290
|
-
});
|
291
|
-
pc += step;
|
292
|
-
RG.Effects.updateCanvas(iterator);
|
293
|
-
|
294
|
-
} else {
|
295
|
-
|
296
|
-
RG.clear(obj.canvas, obj.get('clearto'))
|
297
|
-
|
298
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
299
|
-
|
300
|
-
callback(obj);
|
301
|
-
}
|
302
|
-
}
|
303
|
-
|
304
|
-
iterator();
|
305
|
-
};
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
/**
|
312
|
-
* fadeCircularIn
|
313
|
-
*
|
314
|
-
* This function uses radial CSS gradients to cover the canvas with a radial fade in effect
|
315
|
-
* (from the center outwards)
|
316
|
-
*/
|
317
|
-
RG.Effects.Common.fadeCircularInOutwards = function ()
|
318
|
-
{
|
319
|
-
// This function gets added to the chart object - so the this
|
320
|
-
// variable is the chart object
|
321
|
-
var obj = this;
|
322
|
-
var opt = arguments[0] || {};
|
323
|
-
var frames = opt.frames || 120;
|
324
|
-
var frame = 0;
|
325
|
-
var radius = 0;
|
326
|
-
var canvasXY = RG.getCanvasXY(obj.canvas);
|
327
|
-
var color = opt.color || 'white';
|
328
|
-
var callback = arguments[1] || function () {};
|
329
|
-
|
330
|
-
|
331
|
-
// Draw the chart
|
332
|
-
RG.redrawCanvas(obj.canvas);
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
// Create the cover
|
337
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
338
|
-
background: 'radial-gradient(rgba(255,255,255,0) 0%, white ' + radius + '%)',
|
339
|
-
width:obj.canvas.width + 'px',
|
340
|
-
height: obj.canvas.height + 'px',
|
341
|
-
top: canvasXY[1],
|
342
|
-
left: canvasXY[0],
|
343
|
-
position: 'absolute'
|
344
|
-
}).appendTo($(obj.canvas.parentNode));
|
345
|
-
|
346
|
-
function iterator ()
|
347
|
-
{
|
348
|
-
if (frame < frames) {
|
349
|
-
|
350
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
351
|
-
background: 'radial-gradient(rgba(255,255,255,0) ' + ((frame++ / frames) * 100) + '%, ' + color + ' ' + ((frame++ / frames) * 150) + '%)'
|
352
|
-
});
|
353
|
-
|
354
|
-
RG.Effects.updateCanvas(iterator);
|
355
|
-
|
356
|
-
} else {
|
357
|
-
|
358
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
359
|
-
|
360
|
-
callback(obj);
|
361
|
-
}
|
362
|
-
}
|
363
|
-
|
364
|
-
iterator();
|
365
|
-
};
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
/**
|
371
|
-
* fadeCircularOut
|
372
|
-
*
|
373
|
-
* This function uses radial CSS gradients to cover the canvas with a radial fade out effect
|
374
|
-
* (from the center outwards)
|
375
|
-
*/
|
376
|
-
RG.Effects.Common.fadeCircularOutOutwards = function ()
|
377
|
-
{
|
378
|
-
// This function gets added to the chart object - so the this
|
379
|
-
// variable is the chart object
|
380
|
-
var obj = this;
|
381
|
-
var opt = arguments[0] || {};
|
382
|
-
var frames = opt.frames || 120;
|
383
|
-
var frame = 0;
|
384
|
-
var canvasXY = RG.getCanvasXY(obj.canvas);
|
385
|
-
var color = opt.color || 'white';
|
386
|
-
var callback = arguments[1] || function () {};
|
387
|
-
|
388
|
-
|
389
|
-
// Draw the chart
|
390
|
-
RG.redrawCanvas(obj.canvas);
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
// Create the cover
|
395
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
396
|
-
background: 'radial-gradient(rgba(255,255,255,0) 0%, white 0%)',
|
397
|
-
width:obj.canvas.width + 'px',
|
398
|
-
height: obj.canvas.height + 'px',
|
399
|
-
top: canvasXY[1],
|
400
|
-
left: canvasXY[0],
|
401
|
-
position: 'absolute'
|
402
|
-
}).appendTo($(obj.canvas.parentNode));
|
403
|
-
|
404
|
-
function iterator ()
|
405
|
-
{
|
406
|
-
if (frame < frames) {
|
407
|
-
|
408
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
409
|
-
background: 'radial-gradient(' + color + ' ' + ((frame++ / frames) * 100) + '%, rgba(255,255,255,0) ' + ((frame++ / frames) * 150) + '%)'
|
410
|
-
});
|
411
|
-
RG.Effects.updateCanvas(iterator);
|
412
|
-
|
413
|
-
} else {
|
414
|
-
|
415
|
-
RG.clear(obj.canvas, color);
|
416
|
-
|
417
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
418
|
-
|
419
|
-
callback(obj);
|
420
|
-
}
|
421
|
-
}
|
422
|
-
|
423
|
-
iterator();
|
424
|
-
};
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
/**
|
430
|
-
* fadeCircularInInwards
|
431
|
-
*/
|
432
|
-
RG.Effects.Common.fadeCircularInInwards = function ()
|
433
|
-
{
|
434
|
-
// This function gets added to the chart object - so the this
|
435
|
-
// variable is the chart object
|
436
|
-
var obj = this;
|
437
|
-
var opt = arguments[0] || {};
|
438
|
-
var frames = opt.frames || 120;
|
439
|
-
var frame = 0;
|
440
|
-
var radius = ma.max(obj.canvas.width, obj.canvas.height);
|
441
|
-
var canvasXY = RG.getCanvasXY(obj.canvas);
|
442
|
-
var color = opt.color || 'white';
|
443
|
-
var callback = arguments[1] || function () {};
|
444
|
-
|
445
|
-
|
446
|
-
// Draw the chart
|
447
|
-
RG.redrawCanvas(obj.canvas);
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
// Create the cover
|
452
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
453
|
-
background: 'radial-gradient(rgba(255,255,255,0) 100%, rgba(255,255,255,0) 0%)',
|
454
|
-
width:obj.canvas.width + 'px',
|
455
|
-
height: obj.canvas.height + 'px',
|
456
|
-
top: canvasXY[1] + 'px',
|
457
|
-
left: canvasXY[0] + 'px',
|
458
|
-
position: 'absolute'
|
459
|
-
}).appendTo($(obj.canvas.parentNode));
|
460
|
-
|
461
|
-
function iterator ()
|
462
|
-
{
|
463
|
-
if (frame < frames) {
|
464
|
-
|
465
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
466
|
-
background: 'radial-gradient(' + color + ' ' + (( (frames - frame++) / frames) * 100) + '%, rgba(255,255,255,0) ' + (( (frames - frame++) / frames) * 120) + '%)'
|
467
|
-
});
|
468
|
-
RG.Effects.updateCanvas(iterator);
|
469
|
-
|
470
|
-
} else {
|
471
|
-
|
472
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
473
|
-
|
474
|
-
callback(obj);
|
475
|
-
}
|
476
|
-
}
|
477
|
-
|
478
|
-
iterator();
|
479
|
-
};
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
/**
|
485
|
-
* fadeCircularOutReverse
|
486
|
-
*/
|
487
|
-
RG.Effects.Common.fadeCircularOutInwards = function ()
|
488
|
-
{
|
489
|
-
// This function gets added to the chart object - so the this
|
490
|
-
// variable is the chart object
|
491
|
-
var obj = this;
|
492
|
-
var opt = arguments[0] || {};
|
493
|
-
var frames = opt.frames || 120;
|
494
|
-
var frame = 0;
|
495
|
-
var radius = ma.max(obj.canvas.width, obj.canvas.height);
|
496
|
-
var canvasXY = RG.getCanvasXY(obj.canvas);
|
497
|
-
var color = opt.color || 'white';
|
498
|
-
var callback = arguments[1] || function () {};
|
499
|
-
|
500
|
-
|
501
|
-
// Draw the chart
|
502
|
-
RG.redrawCanvas(obj.canvas);
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
// Create the cover
|
507
|
-
$('<div id="rgraph_fadeslide_cover_' + obj.id + '"></div>').css({
|
508
|
-
background: 'radial-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0) 0%)',
|
509
|
-
width:obj.canvas.width + 'px',
|
510
|
-
height: obj.canvas.height + 'px',
|
511
|
-
top: canvasXY[1],
|
512
|
-
left: canvasXY[0],
|
513
|
-
position: 'absolute'
|
514
|
-
}).appendTo($(obj.canvas.parentNode));
|
515
|
-
|
516
|
-
function iterator ()
|
517
|
-
{
|
518
|
-
if (frame < frames) {
|
519
|
-
|
520
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
521
|
-
background: 'radial-gradient(rgba(255,255,255,0) ' + (( (frames - frame++) / frames) * 100) + '%, ' + color + ' ' + (( (frames - frame++) / frames) * 120) + '%)'
|
522
|
-
});
|
523
|
-
RG.Effects.updateCanvas(iterator);
|
524
|
-
|
525
|
-
} else {
|
526
|
-
|
527
|
-
RG.clear(obj.canvas);
|
528
|
-
|
529
|
-
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
530
|
-
|
531
|
-
callback(obj);
|
532
|
-
}
|
533
|
-
}
|
534
|
-
|
535
|
-
iterator();
|
536
|
-
};
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
/**
|
542
|
-
* Expand
|
543
|
-
*
|
544
|
-
* This effect is like the tooltip effect of the same name. I starts in the middle
|
545
|
-
* and expands out to full size.
|
546
|
-
*
|
547
|
-
* @param object obj The graph object
|
548
|
-
*/
|
549
|
-
RG.Effects.Common.expand = function ()
|
550
|
-
{
|
551
|
-
// This function gets added to the chart object - so the this
|
552
|
-
// variable is the chart object
|
553
|
-
var obj = this;
|
554
|
-
var opt = arguments[0] || {};
|
555
|
-
var bounce = typeof opt.bounce === 'boolean' ? opt.bounce : true;
|
556
|
-
var frames = opt.frames || 60;
|
557
|
-
var duration = (frames / 60) * 1000;
|
558
|
-
var callback = arguments[1] || function () {};
|
559
|
-
|
560
|
-
if (!this.canvas.rgraph_wrapper) {
|
561
|
-
var div = RG.Effects.wrap(this.canvas);
|
562
|
-
this.canvas.rgraph_wrapper = div;
|
563
|
-
} else {
|
564
|
-
div = this.canvas.rgraph_wrapper;
|
565
|
-
}
|
566
|
-
|
567
|
-
div.style.position = 'relative';
|
568
|
-
//this.canvas.style.position = 'relative'; // absolute should work here too - but doesn't in Chrome
|
569
|
-
this.canvas.style.top = (this.canvas.height / 2) + 'px';
|
570
|
-
this.canvas.style.left = (this.canvas.width / 2) + 'px';
|
571
|
-
|
572
|
-
this.canvas.style.width = 0;
|
573
|
-
this.canvas.style.height = 0;
|
574
|
-
|
575
|
-
this.canvas.style.opacity = 0;
|
576
|
-
|
577
|
-
|
578
|
-
RG.clear(this.canvas);
|
579
|
-
RG.redrawCanvas(this.canvas);
|
580
|
-
|
581
|
-
if (bounce) {
|
582
|
-
|
583
|
-
jQuery('#' + obj.id).animate({opacity: 1, width: (obj.canvas.width * 1.2) + 'px', height: (obj.canvas.height * 1.2) + 'px', left: (obj.canvas.width * -0.1) + 'px', top: (obj.canvas.height * -0.1) + 'px'}, duration * 0.5, function ()
|
584
|
-
{
|
585
|
-
jQuery('#' + obj.id).animate({width: (obj.canvas.width * 0.9) + 'px', height: (obj.canvas.height * 0.9) + 'px', top: (obj.canvas.height * 0.05) + 'px', left: (obj.canvas.width * 0.05) + 'px'}, duration * 0.25, function ()
|
586
|
-
{
|
587
|
-
jQuery('#' + obj.id).animate({width: obj.canvas.width + 'px', height: obj.canvas.height + 'px', top: 0, left: 0}, duration * 0.25, function () {callback(obj);});
|
588
|
-
});
|
589
|
-
});
|
590
|
-
|
591
|
-
} else {
|
592
|
-
|
593
|
-
jQuery(obj.canvas).animate({
|
594
|
-
opacity: 1,
|
595
|
-
width: obj.canvas.width + 'px',
|
596
|
-
height: obj.canvas.height + 'px',
|
597
|
-
left: 0,
|
598
|
-
top: 0
|
599
|
-
}, duration, function () {callback(obj);})
|
600
|
-
}
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
return this;
|
605
|
-
};
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
/**
|
611
|
-
* Contract
|
612
|
-
*
|
613
|
-
* This effect is a good one to use with the Expand effect to make a transition
|
614
|
-
*
|
615
|
-
* @param object You can specify frames here: {frames: 120}
|
616
|
-
* @param function Optional callback to run when the effect is done.
|
617
|
-
*/
|
618
|
-
RG.Effects.Common.contract = function ()
|
619
|
-
{
|
620
|
-
// This function gets added to the chart object - so the this
|
621
|
-
// variable is the chart object
|
622
|
-
var obj = this;
|
623
|
-
var opt = arguments[0] || {};
|
624
|
-
var frames = opt.frames || 60;
|
625
|
-
var duration = (frames / 60) * 1000;
|
626
|
-
var callback = arguments[1] || function () {};
|
627
|
-
|
628
|
-
if (!obj.canvas.rgraph_wrapper) {
|
629
|
-
var div = RG.Effects.wrap(obj.canvas);
|
630
|
-
obj.canvas.rgraph_wrapper = div;
|
631
|
-
} else {
|
632
|
-
div = obj.canvas.rgraph_wrapper;
|
633
|
-
}
|
634
|
-
|
635
|
-
|
636
|
-
div.style.position = 'relative';
|
637
|
-
//canvas.style.position = 'absolute'; // Chrome bug...?
|
638
|
-
obj.canvas.style.top = 0;
|
639
|
-
obj.canvas.style.left = 0;
|
640
|
-
|
641
|
-
if (opt.bounce !== false) {
|
642
|
-
jQuery('#' + obj.id).animate({
|
643
|
-
width: (obj.canvas.width * 1.2) + 'px',
|
644
|
-
height: (obj.canvas.height * 1.2) + 'px',
|
645
|
-
left: (obj.canvas.width * -0.1) + 'px',
|
646
|
-
top: (obj.canvas.height * -0.1) + 'px'
|
647
|
-
}, duration * 0.25, function ()
|
648
|
-
{
|
649
|
-
jQuery('#' + obj.id).animate({
|
650
|
-
opacity: 0,
|
651
|
-
width: 0,
|
652
|
-
height: 0,
|
653
|
-
left: (obj.canvas.width * 0.5) + 'px',
|
654
|
-
top: (obj.canvas.height * 0.5) + 'px'
|
655
|
-
}, duration * 0.75, function () {callback(obj);});
|
656
|
-
});
|
657
|
-
} else {
|
658
|
-
jQuery('#' + obj.id).animate({
|
659
|
-
opacity: 0,
|
660
|
-
width: 0,
|
661
|
-
height: 0,
|
662
|
-
left: (obj.canvas.width * 0.5) + 'px',
|
663
|
-
top: (obj.canvas.height * 0.5) + 'px'
|
664
|
-
}, duration * 0.75, function () {callback(obj);});
|
665
|
-
}
|
666
|
-
|
667
|
-
|
668
|
-
return this;
|
669
|
-
};
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
/**
|
675
|
-
* Reveal
|
676
|
-
*
|
677
|
-
* This effect issmilar to the Expand effect - the canvas is slowly revealed from
|
678
|
-
* the centre outwards
|
679
|
-
*
|
680
|
-
* @param object Options for the effect. You can give frames here
|
681
|
-
* @param function An optional callback function
|
682
|
-
*/
|
683
|
-
RG.Effects.Common.reveal = function ()
|
684
|
-
{
|
685
|
-
// This function gets added to the chart object - so the this
|
686
|
-
// variable is the chart object
|
687
|
-
var obj = this;
|
688
|
-
var opt = arguments[0] || {};
|
689
|
-
var frames = opt.frames || 60;
|
690
|
-
var duration = (frames / 60) * 1000;
|
691
|
-
var callback = arguments[1] || function () {};
|
692
|
-
var xy = RG.getCanvasXY(obj.canvas);
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
var divs = [
|
698
|
-
['rgraph_reveal_left_' + obj.id, xy[0], xy[1], obj.canvas.width / 2, obj.canvas.height],
|
699
|
-
['rgraph_reveal_right_' + obj.id,(xy[0] + (obj.canvas.width / 2)),xy[1],(obj.canvas.width / 2),obj.canvas.height],
|
700
|
-
['rgraph_reveal_top_' + obj.id,xy[0],xy[1],obj.canvas.width,(obj.canvas.height / 2)],
|
701
|
-
['rgraph_reveal_bottom_' + obj.id,xy[0],(xy[1] + (obj.canvas.height / 2)),obj.canvas.width,(obj.canvas.height / 2)]
|
702
|
-
];
|
703
|
-
|
704
|
-
for (var i=0,len=divs.length; i<len; ++i) {
|
705
|
-
var div = document.createElement('DIV');
|
706
|
-
div.id = divs[i][0];
|
707
|
-
div.style.width = divs[i][3]+ 'px';
|
708
|
-
div.style.height = divs[i][4] + 'px';
|
709
|
-
div.style.left = divs[i][1] + 'px';
|
710
|
-
div.style.top = divs[i][2] + 'px';
|
711
|
-
div.style.position = 'absolute';
|
712
|
-
div.style.backgroundColor = opt && typeof opt.color === 'string' ? opt.color : 'white';
|
713
|
-
document.body.appendChild(div);
|
714
|
-
}
|
715
|
-
|
716
|
-
|
717
|
-
// Clear the canvas and redraw it
|
718
|
-
RG.clear(obj.canvas);
|
719
|
-
RG.redrawCanvas(obj.canvas);
|
720
|
-
|
721
|
-
|
722
|
-
// Animate the shrinking of the DIVs
|
723
|
-
jQuery('#rgraph_reveal_left_' + obj.id).animate({width: 0}, duration);
|
724
|
-
jQuery('#rgraph_reveal_right_' + obj.id).animate({left: '+=' + (obj.canvas.width / 2),width: 0}, duration);
|
725
|
-
jQuery('#rgraph_reveal_top_' + obj.id).animate({height: 0}, duration);
|
726
|
-
jQuery('#rgraph_reveal_bottom_' + obj.id).animate({top: '+=' + (obj.canvas.height / 2),height: 0}, duration);
|
727
|
-
|
728
|
-
// Remove the DIVs from the DOM 100ms after the animation ends
|
729
|
-
setTimeout(function ()
|
730
|
-
{
|
731
|
-
doc.body.removeChild(doc.getElementById("rgraph_reveal_top_" + obj.id));
|
732
|
-
doc.body.removeChild(doc.getElementById("rgraph_reveal_bottom_" + obj.id));
|
733
|
-
doc.body.removeChild(doc.getElementById("rgraph_reveal_left_" + obj.id));
|
734
|
-
doc.body.removeChild(doc.getElementById("rgraph_reveal_right_" + obj.id));
|
735
|
-
|
736
|
-
callback(obj);
|
737
|
-
}, duration);
|
738
|
-
|
739
|
-
|
740
|
-
return this;
|
741
|
-
};
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
/**
|
747
|
-
* RevealCircular
|
748
|
-
*
|
749
|
-
* This effect is smilar to the Reveal effect - the canvas is slowly revealed from
|
750
|
-
* the centre outwards using a circular shape
|
751
|
-
*
|
752
|
-
* @param object An object of options - eg {frames: 30}
|
753
|
-
* @param function An optional callback function that runs when the effect is finished
|
754
|
-
*/
|
755
|
-
RG.Effects.Common.revealCircular =
|
756
|
-
RG.Effects.Common.revealcircular = function ()
|
757
|
-
{
|
758
|
-
// This function gets added to the chart object - so the this
|
759
|
-
// variable is the chart object
|
760
|
-
var obj = this;
|
761
|
-
var opt = arguments[0] || {};
|
762
|
-
var frames = opt.frames || 30;
|
763
|
-
var frame = 0;
|
764
|
-
var callback = arguments[1] || function () {};
|
765
|
-
var currentRadius = 0
|
766
|
-
var centerx = obj.canvas.width / 2;
|
767
|
-
var centery = obj.canvas.height / 2;
|
768
|
-
var targetRadius = ma.max(obj.canvas.height, obj.canvas.width);
|
769
|
-
var step = targetRadius / frames;
|
770
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'transparent';
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
/**
|
776
|
-
* This is the iterator function which gradually increases the radius of the clip circle
|
777
|
-
*/
|
778
|
-
function iterator ()
|
779
|
-
{
|
780
|
-
// Begin by clearing the canvas
|
781
|
-
RG.clear(obj.canvas, color);
|
782
|
-
|
783
|
-
obj.context.save();
|
784
|
-
// First draw the circle and clip to it
|
785
|
-
obj.context.beginPath();
|
786
|
-
obj.context.arc(centerx, centery, currentRadius, 0, RG.TWOPI, false);
|
787
|
-
obj.context.clip();
|
788
|
-
|
789
|
-
// Clear the canvas to a white color
|
790
|
-
if (opt.background) {
|
791
|
-
RG.clear(obj.canvas, opt.background);
|
792
|
-
}
|
793
|
-
|
794
|
-
// Now draw the chart
|
795
|
-
obj.draw();
|
796
|
-
obj.context.restore();
|
797
|
-
|
798
|
-
|
799
|
-
// Increment the radius
|
800
|
-
if (currentRadius < targetRadius) {
|
801
|
-
currentRadius += step;
|
802
|
-
RG.Effects.updateCanvas(iterator);
|
803
|
-
|
804
|
-
} else {
|
805
|
-
callback(obj);
|
806
|
-
}
|
807
|
-
}
|
808
|
-
|
809
|
-
iterator();
|
810
|
-
|
811
|
-
return this;
|
812
|
-
};
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
/**
|
818
|
-
* Conceal
|
819
|
-
*
|
820
|
-
* This effect is the reverse of the Reveal effect - instead of revealing the canvas it
|
821
|
-
* conceals it. Combined with the reveal effect would make for a nice wipe effect.
|
822
|
-
*
|
823
|
-
* @param object obj The chart object
|
824
|
-
*/
|
825
|
-
RG.Effects.Common.conceal = function ()
|
826
|
-
{
|
827
|
-
// This function gets added to the chart object - so the this
|
828
|
-
// variable is the chart object
|
829
|
-
var obj = this;
|
830
|
-
var opt = arguments[0] || {};
|
831
|
-
var frames = opt.frames || 60;
|
832
|
-
var duration = (frames / 60) * 1000;
|
833
|
-
var frame = 0;
|
834
|
-
var callback = arguments[1] || function () {};
|
835
|
-
var xy = RG.getCanvasXY(obj.canvas);
|
836
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
var divs = [
|
841
|
-
['rgraph_conceal_left_' + obj.id, xy[0], xy[1], 0, obj.canvas.height],
|
842
|
-
['rgraph_conceal_right_' + obj.id,(xy[0] + obj.canvas.width),xy[1],0,obj.canvas.height],
|
843
|
-
['rgraph_conceal_top_' + obj.id,xy[0],xy[1],obj.canvas.width,0],
|
844
|
-
['rgraph_conceal_bottom_' + obj.id,xy[0],(xy[1] + obj.canvas.height),obj.canvas.width,0]
|
845
|
-
];
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
for (var i=0,len=divs.length; i<len; ++i) {
|
851
|
-
var div = doc.createElement('DIV');
|
852
|
-
div.id = divs[i][0];
|
853
|
-
div.style.width = divs[i][3]+ 'px';
|
854
|
-
div.style.height = divs[i][4] + 'px';
|
855
|
-
div.style.left = divs[i][1] + 'px';
|
856
|
-
div.style.top = divs[i][2] + 'px';
|
857
|
-
div.style.position = 'absolute';
|
858
|
-
div.style.backgroundColor = color;
|
859
|
-
doc.body.appendChild(div);
|
860
|
-
}
|
861
|
-
|
862
|
-
|
863
|
-
jQuery('#rgraph_conceal_left_' + obj.id).animate({width: '+=' + (obj.canvas.width / 2)}, duration);
|
864
|
-
jQuery('#rgraph_conceal_right_' + obj.id).animate({left: '-=' + (obj.canvas.width / 2),width: (obj.canvas.width / 2)}, duration);
|
865
|
-
jQuery('#rgraph_conceal_top_' + obj.id).animate({height: '+=' + (obj.canvas.height / 2)}, duration);
|
866
|
-
jQuery('#rgraph_conceal_bottom_' + obj.id).animate({top: '-=' + (obj.canvas.height / 2),height: (obj.canvas.height / 2)}, duration);
|
867
|
-
|
868
|
-
// Remove the DIVs from the DOM 100ms after the animation ends
|
869
|
-
setTimeout(
|
870
|
-
function ()
|
871
|
-
{
|
872
|
-
doc.body.removeChild(doc.getElementById("rgraph_conceal_top_" + obj.id));
|
873
|
-
doc.body.removeChild(doc.getElementById("rgraph_conceal_bottom_" + obj.id));
|
874
|
-
doc.body.removeChild(doc.getElementById("rgraph_conceal_left_" + obj.id));
|
875
|
-
doc.body.removeChild(doc.getElementById("rgraph_conceal_right_" + obj.id));
|
876
|
-
|
877
|
-
RG.clear(obj.canvas);
|
878
|
-
|
879
|
-
callback(obj);
|
880
|
-
|
881
|
-
}, duration);
|
882
|
-
|
883
|
-
return this;
|
884
|
-
};
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
/**
|
890
|
-
* Horizontal Blinds (open)
|
891
|
-
*
|
892
|
-
* @params object obj The graph object
|
893
|
-
*/
|
894
|
-
RG.Effects.Common.hBlindsOpen =
|
895
|
-
RG.Effects.Common.hblindsOpen = function ()
|
896
|
-
{
|
897
|
-
// This function gets added to the chart object - so the this
|
898
|
-
// variable is the chart object
|
899
|
-
var obj = this;
|
900
|
-
var opt = arguments[0] || {};
|
901
|
-
var frames = opt.frames || 60;
|
902
|
-
var duration = (frames / 60) * 1000;
|
903
|
-
var frame = 0;
|
904
|
-
var callback = arguments[1] || function () {};
|
905
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
906
|
-
var xy = RG.getCanvasXY(this.canvas);
|
907
|
-
var height = this.canvas.height / 5;
|
908
|
-
|
909
|
-
/**
|
910
|
-
* First draw the chart
|
911
|
-
*/
|
912
|
-
RG.clear(this.canvas);
|
913
|
-
RG.redrawCanvas(this.canvas);
|
914
|
-
|
915
|
-
for (var i=0; i<5; ++i) {
|
916
|
-
var div = doc.createElement('DIV');
|
917
|
-
div.id = 'rgraph_hblinds_' + i + '_' + obj.id;
|
918
|
-
div.style.width = this.canvas.width + 'px';
|
919
|
-
div.style.height = height + 'px';
|
920
|
-
div.style.left = xy[0] + 'px';
|
921
|
-
div.style.top = (xy[1] + (this.canvas.height * (i / 5))) + 'px';
|
922
|
-
div.style.position = 'absolute';
|
923
|
-
div.style.backgroundColor = color;
|
924
|
-
document.body.appendChild(div);
|
925
|
-
|
926
|
-
jQuery('#rgraph_hblinds_' + i + '_' + obj.id).animate({height: 0}, duration);
|
927
|
-
}
|
928
|
-
|
929
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_0_' + obj.id));}, duration);
|
930
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_1_' + obj.id));}, duration);
|
931
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_2_' + obj.id));}, duration);
|
932
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_3_' + obj.id));}, duration);
|
933
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_4_' + obj.id));}, duration);
|
934
|
-
setTimeout(function () {callback(obj);}, duration);
|
935
|
-
|
936
|
-
return this;
|
937
|
-
};
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
/**
|
943
|
-
* Horizontal Blinds (close)
|
944
|
-
*
|
945
|
-
* @params object obj The graph object
|
946
|
-
*/
|
947
|
-
RG.Effects.Common.hBlindsClose =
|
948
|
-
RG.Effects.Common.hblindsclose = function ()
|
949
|
-
{
|
950
|
-
// This function gets added to the chart object - so the this
|
951
|
-
// variable is the chart object
|
952
|
-
var obj = this;
|
953
|
-
var opt = arguments[0] || {};
|
954
|
-
var frames = opt.frames || 60;
|
955
|
-
var duration = (frames / 60) * 1000;
|
956
|
-
var frame = 0;
|
957
|
-
var callback = arguments[1] || function () {};
|
958
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
959
|
-
var xy = RG.getCanvasXY(this.canvas);
|
960
|
-
var height = this.canvas.height / 5;
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
for (var i=0; i<5; ++i) {
|
965
|
-
var div = doc.createElement('DIV');
|
966
|
-
div.id = 'rgraph_hblinds_' + i + '_' + obj.id;
|
967
|
-
div.style.width = this.canvas.width + 'px';
|
968
|
-
div.style.height = 0;
|
969
|
-
div.style.left = xy[0] + 'px';
|
970
|
-
div.style.top = (xy[1] + (this.canvas.height * (i / 5))) + 'px';
|
971
|
-
div.style.position = 'absolute';
|
972
|
-
div.style.backgroundColor = color;
|
973
|
-
doc.body.appendChild(div);
|
974
|
-
|
975
|
-
jQuery('#rgraph_hblinds_' + i + '_' + obj.id).animate({height: height + 'px'}, duration);
|
976
|
-
}
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
setTimeout(function () {RG.clear(obj.canvas);}, duration + 100);
|
981
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_0_' + obj.id));}, duration + 100);
|
982
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_1_' + obj.id));}, duration + 100);
|
983
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_2_' + obj.id));}, duration + 100);
|
984
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_3_' + obj.id));}, duration + 100);
|
985
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_hblinds_4_' + obj.id));}, duration + 100);
|
986
|
-
setTimeout(function () {callback(obj);}, duration + 100);
|
987
|
-
};
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
/**
|
993
|
-
* Vertical Blinds (open)
|
994
|
-
*
|
995
|
-
* @params object obj The graph object
|
996
|
-
*/
|
997
|
-
RG.Effects.Common.vBlindsOpen =
|
998
|
-
RG.Effects.Common.vblindsopen = function ()
|
999
|
-
{
|
1000
|
-
// This function gets added to the chart object - so the this
|
1001
|
-
// variable is the chart object
|
1002
|
-
var obj = this;
|
1003
|
-
var opt = arguments[0] || {};
|
1004
|
-
var frames = opt.frames || 60;
|
1005
|
-
var duration = (frames / 60) * 1000;
|
1006
|
-
var frame = 0;
|
1007
|
-
var callback = arguments[1] || function () {};
|
1008
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1009
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1010
|
-
var width = this.canvas.width / 10;
|
1011
|
-
|
1012
|
-
/**
|
1013
|
-
* First draw the chart
|
1014
|
-
*/
|
1015
|
-
//RG.clear(obj.canvas);
|
1016
|
-
RG.redrawCanvas(obj.canvas);
|
1017
|
-
|
1018
|
-
for (var i=0; i<10; ++i) {
|
1019
|
-
var div = doc.createElement('DIV');
|
1020
|
-
div.id = 'rgraph_vblinds_' + i + '_' + obj.id;
|
1021
|
-
div.style.width = width + 'px';
|
1022
|
-
div.style.height = this.canvas.height + 'px';
|
1023
|
-
div.style.left = (xy[0] + (this.canvas.width * (i / 10))) + 'px';
|
1024
|
-
div.style.top = (xy[1]) + 'px';
|
1025
|
-
div.style.position = 'absolute';
|
1026
|
-
div.style.backgroundColor = color;
|
1027
|
-
doc.body.appendChild(div);
|
1028
|
-
|
1029
|
-
jQuery('#rgraph_vblinds_' + i + '_' + obj.id).animate({width: 0}, duration);
|
1030
|
-
}
|
1031
|
-
|
1032
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_0_' + obj.id));}, duration + 100);
|
1033
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_1_' + obj.id));}, duration + 100);
|
1034
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_2_' + obj.id));}, duration + 100);
|
1035
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_3_' + obj.id));}, duration + 100);
|
1036
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_4_' + obj.id));}, duration + 100);
|
1037
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_5_' + obj.id));}, duration + 100);
|
1038
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_6_' + obj.id));}, duration + 100);
|
1039
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_7_' + obj.id));}, duration + 100);
|
1040
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_8_' + obj.id));}, duration + 100);
|
1041
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_9_' + obj.id));}, duration + 100);
|
1042
|
-
|
1043
|
-
setTimeout(function () {callback(obj);}, duration + 100);
|
1044
|
-
|
1045
|
-
return this;
|
1046
|
-
};
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
/**
|
1052
|
-
* Vertical Blinds (close)
|
1053
|
-
*
|
1054
|
-
* @params object obj The graph object
|
1055
|
-
*/
|
1056
|
-
RG.Effects.Common.vblindsclose =
|
1057
|
-
RG.Effects.Common.vBlindsClose = function ()
|
1058
|
-
{
|
1059
|
-
// This function gets added to the chart object - so the this
|
1060
|
-
// variable is the chart object
|
1061
|
-
var obj = this;
|
1062
|
-
var opt = arguments[0] || {};
|
1063
|
-
var frames = opt.frames || 60;
|
1064
|
-
var duration = (frames / 60) * 1000;
|
1065
|
-
var frame = 0;
|
1066
|
-
var callback = arguments[1] || function () {};
|
1067
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1068
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1069
|
-
var width = this.canvas.width / 10;
|
1070
|
-
|
1071
|
-
// Don't draw the chart
|
1072
|
-
|
1073
|
-
// Create the blinds
|
1074
|
-
for (var i=0; i<10; ++i) {
|
1075
|
-
var div = doc.createElement('DIV');
|
1076
|
-
div.id = 'rgraph_vblinds_' + i + '_' + obj.id;
|
1077
|
-
div.style.width = 0;
|
1078
|
-
div.style.height = this.canvas.height + 'px';
|
1079
|
-
div.style.left = (xy[0] + (this.canvas.width * (i / 10))) + 'px';
|
1080
|
-
div.style.top = (xy[1]) + 'px';
|
1081
|
-
div.style.position = 'absolute';
|
1082
|
-
div.style.backgroundColor = color;
|
1083
|
-
doc.body.appendChild(div);
|
1084
|
-
|
1085
|
-
jQuery('#rgraph_vblinds_' + i + '_' + obj.id).animate({width: width}, duration);
|
1086
|
-
}
|
1087
|
-
|
1088
|
-
setTimeout(function () {RG.clear(obj.canvas);}, duration + 100);
|
1089
|
-
|
1090
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_0_' + obj.id));}, duration + 100);
|
1091
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_1_' + obj.id));}, duration + 100);
|
1092
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_2_' + obj.id));}, duration + 100);
|
1093
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_3_' + obj.id));}, duration + 100);
|
1094
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_4_' + obj.id));}, duration + 100);
|
1095
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_5_' + obj.id));}, duration + 100);
|
1096
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_6_' + obj.id));}, duration + 100);
|
1097
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_7_' + obj.id));}, duration + 100);
|
1098
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_8_' + obj.id));}, duration + 100);
|
1099
|
-
setTimeout(function () {doc.body.removeChild(doc.getElementById('rgraph_vblinds_9_' + obj.id));}, duration + 100);
|
1100
|
-
|
1101
|
-
setTimeout(function () {callback(obj);}, duration + 100);
|
1102
|
-
|
1103
|
-
return this;
|
1104
|
-
};
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
/**
|
1110
|
-
* Slide in
|
1111
|
-
*
|
1112
|
-
* This function is a wipe that can be used when switching the canvas to a new graph
|
1113
|
-
*
|
1114
|
-
* @param object obj The graph object
|
1115
|
-
*/
|
1116
|
-
RG.Effects.Common.slideIn = function ()
|
1117
|
-
{
|
1118
|
-
// This function gets added to the chart object - so the this
|
1119
|
-
// variable is the chart object
|
1120
|
-
var obj = this;
|
1121
|
-
var opt = arguments[0] || {};
|
1122
|
-
var frames = opt.frames || 60;
|
1123
|
-
var duration = (frames / 60) * 1000;
|
1124
|
-
var frame = 0;
|
1125
|
-
var callback = arguments[1] || function () {};
|
1126
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1127
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1128
|
-
var width = this.canvas.width / 10;
|
1129
|
-
var div = RG.Effects.wrap(obj.canvas);
|
1130
|
-
var from = opt.from || 'left';
|
1131
|
-
|
1132
|
-
div.style.overflow = 'hidden';
|
1133
|
-
|
1134
|
-
RG.clear(obj.canvas);
|
1135
|
-
RG.redrawCanvas(obj.canvas);
|
1136
|
-
|
1137
|
-
|
1138
|
-
canvas.style.position = 'relative';
|
1139
|
-
|
1140
|
-
if (from == 'left') {
|
1141
|
-
obj.canvas.style.left = (0 - div.offsetWidth) + 'px';
|
1142
|
-
obj.canvas.style.top = 0;
|
1143
|
-
} else if (from == 'top') {
|
1144
|
-
obj.canvas.style.left = 0;
|
1145
|
-
obj.canvas.style.top = (0 - div.offsetHeight) + 'px';
|
1146
|
-
} else if (from == 'bottom') {
|
1147
|
-
obj.canvas.style.left = 0;
|
1148
|
-
obj.canvas.style.top = div.offsetHeight + 'px';
|
1149
|
-
} else {
|
1150
|
-
obj.canvas.style.left = div.offsetWidth + 'px';
|
1151
|
-
obj.canvas.style.top = 0;
|
1152
|
-
}
|
1153
|
-
|
1154
|
-
jQuery('#' + obj.id).animate({left:0,top:0}, duration, function ()
|
1155
|
-
{
|
1156
|
-
callback(obj);
|
1157
|
-
});
|
1158
|
-
|
1159
|
-
return this;
|
1160
|
-
};
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
/**
|
1166
|
-
* Slide out
|
1167
|
-
*
|
1168
|
-
* This function is a wipe that can be used when switching the canvas to a new graph
|
1169
|
-
*
|
1170
|
-
* @param object Optional object containing configuration.
|
1171
|
-
* @param function Optional callback function
|
1172
|
-
*/
|
1173
|
-
RG.Effects.Common.slideOut = function ()
|
1174
|
-
{
|
1175
|
-
// This function gets added to the chart object - so the this
|
1176
|
-
// variable is the chart object
|
1177
|
-
var obj = this;
|
1178
|
-
var opt = arguments[0] || {};
|
1179
|
-
var frames = opt.frames || 60;
|
1180
|
-
var duration = (frames / 60) * 1000;
|
1181
|
-
var frame = 0;
|
1182
|
-
var callback = arguments[1] || function () {};
|
1183
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1184
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1185
|
-
var width = this.canvas.width / 10;
|
1186
|
-
var div = RG.Effects.wrap(obj.canvas);
|
1187
|
-
var to = opt.to || 'left';
|
1188
|
-
|
1189
|
-
div.style.overflow= 'hidden';
|
1190
|
-
|
1191
|
-
obj.canvas.style.position = 'relative';
|
1192
|
-
obj.canvas.style.left = 0;
|
1193
|
-
obj.canvas.style.top = 0;
|
1194
|
-
|
1195
|
-
if (to == 'left') {
|
1196
|
-
jQuery('#' + obj.id).animate({left: (0 - obj.canvas.width) + 'px'}, duration, function () {callback(obj);});
|
1197
|
-
} else if (to == 'top') {
|
1198
|
-
jQuery('#' + obj.id).animate({left: 0, top: (0 - div.offsetHeight) + 'px'}, duration, function () {callback(obj);});
|
1199
|
-
} else if (to == 'bottom') {
|
1200
|
-
jQuery('#' + obj.id).animate({top: (0 + div.offsetHeight) + 'px'}, duration, function () {callback(obj);});
|
1201
|
-
} else {
|
1202
|
-
jQuery('#' + obj.id).animate({left: (0 + obj.canvas.width) + 'px'}, duration, function () {callback(obj);});
|
1203
|
-
}
|
1204
|
-
|
1205
|
-
return this;
|
1206
|
-
};
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
/**
|
1212
|
-
* Horizontal Scissors (open)
|
1213
|
-
*
|
1214
|
-
* @param @object Optional array of options
|
1215
|
-
* @param function Optional callback function
|
1216
|
-
*
|
1217
|
-
*/
|
1218
|
-
RG.Effects.Common.hscissorsopen =
|
1219
|
-
RG.Effects.Common.hScissorsOpen = function ()
|
1220
|
-
{
|
1221
|
-
// This function gets added to the chart object - so the this
|
1222
|
-
// variable is the chart object
|
1223
|
-
var obj = this;
|
1224
|
-
var opt = arguments[0] || {};
|
1225
|
-
var frames = opt.frames || 60;
|
1226
|
-
var duration = (frames / 60) * 1000;
|
1227
|
-
var frame = 0;
|
1228
|
-
var callback = arguments[1] || function () {};
|
1229
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1230
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1231
|
-
var width = this.canvas.width / 10;
|
1232
|
-
var to = opt.to || 'left';
|
1233
|
-
var height = obj.canvas.height / 5;
|
1234
|
-
|
1235
|
-
/**
|
1236
|
-
* First draw the chart
|
1237
|
-
*/
|
1238
|
-
RG.clear(obj.canvas);
|
1239
|
-
RG.redrawCanvas(obj.canvas);
|
1240
|
-
|
1241
|
-
for (var i=0; i<5; ++i) {
|
1242
|
-
var div = doc.getElementById("rgraph_hscissors_" + i + '_' + obj.id)
|
1243
|
-
if (!div) {
|
1244
|
-
var div = doc.createElement('DIV');
|
1245
|
-
div.id = 'rgraph_hscissors_' + i + '_' + obj.id;
|
1246
|
-
div.style.width = obj.canvas.width + 'px';
|
1247
|
-
div.style.height = height + 'px';
|
1248
|
-
div.style.left = xy[0] + 'px';
|
1249
|
-
div.style.top = (xy[1] + (obj.canvas.height * (i / 5))) + 'px';
|
1250
|
-
div.style.position = 'absolute';
|
1251
|
-
div.style.backgroundColor = color;
|
1252
|
-
doc.body.appendChild(div);
|
1253
|
-
}
|
1254
|
-
|
1255
|
-
if (i % 2 == 0) {
|
1256
|
-
jQuery('#' + 'rgraph_hscissors_' + i + '_' + obj.id).animate({left: xy[0] + obj.canvas.width + 'px', width: 0}, duration);
|
1257
|
-
} else {
|
1258
|
-
jQuery('#' + 'rgraph_hscissors_' + i + '_' + obj.id).animate({width: 0}, duration);
|
1259
|
-
}
|
1260
|
-
}
|
1261
|
-
|
1262
|
-
setTimeout(function ()
|
1263
|
-
{
|
1264
|
-
doc.body.removeChild(doc.getElementById('rgraph_hscissors_0_' + obj.id));
|
1265
|
-
doc.body.removeChild(doc.getElementById('rgraph_hscissors_1_' + obj.id));
|
1266
|
-
doc.body.removeChild(doc.getElementById('rgraph_hscissors_2_' + obj.id));
|
1267
|
-
doc.body.removeChild(doc.getElementById('rgraph_hscissors_3_' + obj.id));
|
1268
|
-
doc.body.removeChild(doc.getElementById('rgraph_hscissors_4_' + obj.id));
|
1269
|
-
|
1270
|
-
callback(obj);
|
1271
|
-
}, duration);
|
1272
|
-
|
1273
|
-
|
1274
|
-
return this;
|
1275
|
-
};
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
/**
|
1281
|
-
* Horizontal Scissors (Close)
|
1282
|
-
*
|
1283
|
-
* @param @object Optional object of options
|
1284
|
-
* @param function Optional callback function
|
1285
|
-
*
|
1286
|
-
*/
|
1287
|
-
RG.Effects.Common.hScissorsClose =
|
1288
|
-
RG.Effects.Common.hscissorsclose = function ()
|
1289
|
-
{
|
1290
|
-
// This function gets added to the chart object - so the this
|
1291
|
-
// variable is the chart object
|
1292
|
-
var obj = this;
|
1293
|
-
var opt = arguments[0] || {};
|
1294
|
-
var frames = opt.frames || 60;
|
1295
|
-
var duration = (frames / 60) * 1000;
|
1296
|
-
var frame = 0;
|
1297
|
-
var callback = arguments[1] || function () {};
|
1298
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1299
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1300
|
-
var height = obj.canvas.height / 5;
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
/**
|
1305
|
-
* First draw the chart
|
1306
|
-
*/
|
1307
|
-
//RG.clear(obj.canvas);
|
1308
|
-
RG.redrawCanvas(obj.canvas);
|
1309
|
-
|
1310
|
-
for (var i=0; i<5; ++i) {
|
1311
|
-
var div = doc.createElement('DIV');
|
1312
|
-
div.id = 'rgraph_hscissors_' + i + '_' + obj.id;
|
1313
|
-
div.style.width = 0;
|
1314
|
-
div.style.height = height + 'px';
|
1315
|
-
div.style.left = (i % 2 == 0 ? xy[0] + obj.canvas.width : xy[0]) + 'px';
|
1316
|
-
div.style.top = (xy[1] + (obj.canvas.height * (i / 5))) + 'px';
|
1317
|
-
div.style.position = 'absolute';
|
1318
|
-
div.style.backgroundColor = color;
|
1319
|
-
doc.body.appendChild(div);
|
1320
|
-
|
1321
|
-
if (i % 2 == 0) {
|
1322
|
-
jQuery('#' + 'rgraph_hscissors_' + i + '_' + obj.id).animate({left: xy[0] + 'px', width: obj.canvas.width + 'px'}, duration);
|
1323
|
-
} else {
|
1324
|
-
jQuery('#' + 'rgraph_hscissors_' + i + '_' + obj.id).animate({width: obj.canvas.width + 'px'}, duration);
|
1325
|
-
}
|
1326
|
-
}
|
1327
|
-
|
1328
|
-
setTimeout(function ()
|
1329
|
-
{
|
1330
|
-
RGraph.clear(obj.canvas);
|
1331
|
-
jQuery('#' + 'rgraph_hscissors_' + 0 + '_' + obj.id).remove();
|
1332
|
-
jQuery('#' + 'rgraph_hscissors_' + 1 + '_' + obj.id).remove();
|
1333
|
-
jQuery('#' + 'rgraph_hscissors_' + 2 + '_' + obj.id).remove();
|
1334
|
-
jQuery('#' + 'rgraph_hscissors_' + 3 + '_' + obj.id).remove();
|
1335
|
-
jQuery('#' + 'rgraph_hscissors_' + 4 + '_' + obj.id).remove();
|
1336
|
-
callback(obj);
|
1337
|
-
}, duration);
|
1338
|
-
|
1339
|
-
return this;
|
1340
|
-
};
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
/**
|
1346
|
-
* Vertical Scissors (open)
|
1347
|
-
*
|
1348
|
-
* @param @object Optional object of options
|
1349
|
-
* @param function Optional callback function
|
1350
|
-
*
|
1351
|
-
*/
|
1352
|
-
RG.Effects.Common.vScissorsOpen =
|
1353
|
-
RG.Effects.Common.vscissorsopen = function ()
|
1354
|
-
{
|
1355
|
-
// This function gets added to the chart object - so the this
|
1356
|
-
// variable is the chart object
|
1357
|
-
var obj = this;
|
1358
|
-
var opt = arguments[0] || {};
|
1359
|
-
var frames = opt.frames || 60;
|
1360
|
-
var duration = (frames / 60) * 1000;
|
1361
|
-
var frame = 0;
|
1362
|
-
var callback = arguments[1] || function () {};
|
1363
|
-
var xy = RG.getCanvasXY(obj.canvas);
|
1364
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1365
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1366
|
-
var width = this.canvas.width / 10;
|
1367
|
-
|
1368
|
-
/**
|
1369
|
-
* First draw the chart
|
1370
|
-
*/
|
1371
|
-
//RG.clear(obj.canvas);
|
1372
|
-
RG.redrawCanvas(obj.canvas);
|
1373
|
-
|
1374
|
-
for (var i=0; i<10; ++i) {
|
1375
|
-
var div = doc.getElementById("rgraph_vscissors_" + i + '_' + obj.id);
|
1376
|
-
|
1377
|
-
if (!div) {
|
1378
|
-
var div = doc.createElement('DIV');
|
1379
|
-
div.id = 'rgraph_vscissors_' + i + '_' + obj.id;
|
1380
|
-
div.style.width = width + 'px';
|
1381
|
-
div.style.height = obj.canvas.height + 'px';
|
1382
|
-
div.style.left = xy[0] + (obj.canvas.width * (i / 10)) + 'px';
|
1383
|
-
div.style.top = xy[1] + 'px';
|
1384
|
-
div.style.position = 'absolute';
|
1385
|
-
div.style.backgroundColor = color;
|
1386
|
-
doc.body.appendChild(div);
|
1387
|
-
}
|
1388
|
-
|
1389
|
-
if (i % 2 == 0) {
|
1390
|
-
jQuery('#' + 'rgraph_vscissors_' + i + '_' + obj.id).animate({top: xy[1] + obj.canvas.height + 'px', height: 0}, duration);
|
1391
|
-
} else {
|
1392
|
-
jQuery('#' + 'rgraph_vscissors_' + i + '_' + obj.id).animate({height: 0}, duration);
|
1393
|
-
}
|
1394
|
-
}
|
1395
|
-
|
1396
|
-
setTimeout(function ()
|
1397
|
-
{
|
1398
|
-
doc.body.removeChild(doc.getElementById('rgraph_vscissors_0' + '_' + obj.id));
|
1399
|
-
doc.body.removeChild(doc.getElementById('rgraph_vscissors_1' + '_' + obj.id));
|
1400
|
-
doc.body.removeChild(doc.getElementById('rgraph_vscissors_2' + '_' + obj.id));
|
1401
|
-
doc.body.removeChild(doc.getElementById('rgraph_vscissors_3' + '_' + obj.id));
|
1402
|
-
doc.body.removeChild(doc.getElementById('rgraph_vscissors_4' + '_' + obj.id));
|
1403
|
-
|
1404
|
-
callback(obj);
|
1405
|
-
|
1406
|
-
}, duration);
|
1407
|
-
|
1408
|
-
return this;
|
1409
|
-
};
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
/**
|
1415
|
-
* Vertical Scissors (close)
|
1416
|
-
*
|
1417
|
-
* @param object obj The graph object
|
1418
|
-
* @param @object An array of options
|
1419
|
-
* @param function Optional callback function
|
1420
|
-
*
|
1421
|
-
*/
|
1422
|
-
RG.Effects.Common.vscissorsclose =
|
1423
|
-
RG.Effects.Common.vScissorsClose = function ()
|
1424
|
-
{
|
1425
|
-
// This function gets added to the chart object - so the this
|
1426
|
-
// variable is the chart object
|
1427
|
-
var obj = this;
|
1428
|
-
var opt = arguments[0] || {};
|
1429
|
-
var frames = opt.frames || 60;
|
1430
|
-
var duration = (frames / 60) * 1000;
|
1431
|
-
var frame = 0;
|
1432
|
-
var callback = arguments[1] || function () {};
|
1433
|
-
var xy = RG.getCanvasXY(obj.canvas);
|
1434
|
-
var color = opt.background || opt.color || opt.backgroundColor || 'white';
|
1435
|
-
var xy = RG.getCanvasXY(this.canvas);
|
1436
|
-
var width = this.canvas.width / 10;
|
1437
|
-
|
1438
|
-
/**
|
1439
|
-
* First draw the chart
|
1440
|
-
*/
|
1441
|
-
//RG.clear(obj.canvas);
|
1442
|
-
RG.redrawCanvas(obj.canvas);
|
1443
|
-
|
1444
|
-
for (var i=0; i<10; ++i) {
|
1445
|
-
var div = doc.getElementById("rgraph_vscissors_" + i + '_' + obj.id)
|
1446
|
-
if (!div) {
|
1447
|
-
var div = doc.createElement('DIV');
|
1448
|
-
div.id = 'rgraph_vscissors_' + i + '_' + obj.id;
|
1449
|
-
div.style.width = width + 'px';
|
1450
|
-
div.style.height = 0;
|
1451
|
-
div.style.left = xy[0] + (width * i) + 'px';
|
1452
|
-
div.style.top = (i % 2 == 0 ? xy[1] + obj.canvas.height : xy[1]) + 'px';
|
1453
|
-
div.style.position = 'absolute';
|
1454
|
-
div.style.backgroundColor = color;
|
1455
|
-
doc.body.appendChild(div);
|
1456
|
-
}
|
1457
|
-
|
1458
|
-
if (i % 2 == 0) {
|
1459
|
-
jQuery('#' + 'rgraph_vscissors_' + i + '_' + obj.id).animate({top: xy[1] + 'px', height: obj.canvas.height + 'px'}, duration);
|
1460
|
-
} else {
|
1461
|
-
jQuery('#' + 'rgraph_vscissors_' + i + '_' + obj.id).animate({height: obj.canvas.height + 'px'}, duration);
|
1462
|
-
}
|
1463
|
-
}
|
1464
|
-
|
1465
|
-
setTimeout(function ()
|
1466
|
-
{
|
1467
|
-
RG.clear(obj.canvas);
|
1468
|
-
for (var i=0; i<10; i++) {
|
1469
|
-
jQuery('#rgraph_vscissors_' + i + '_' + obj.id).remove();
|
1470
|
-
}
|
1471
|
-
callback(obj);
|
1472
|
-
}, duration);
|
1473
|
-
|
1474
|
-
return this;
|
1475
|
-
};
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
/**
|
1481
|
-
* The Animate function. Similar to the jQuery Animate() function - simply pass it a
|
1482
|
-
* map of the properties and their target values, and this function will animate
|
1483
|
-
* them to get to those values.
|
1484
|
-
*
|
1485
|
-
* @param object map A map (an associative array) of the properties and their target values.
|
1486
|
-
* @param An optional function which will be called when the animation is complete
|
1487
|
-
*/
|
1488
|
-
RG.Effects.Common.animate = function (map)
|
1489
|
-
{
|
1490
|
-
var obj = this;
|
1491
|
-
obj.draw();
|
1492
|
-
|
1493
|
-
var totalFrames = (map && map['frames']) ? map['frames'] : 30;
|
1494
|
-
var currentFrame = new Array();
|
1495
|
-
var originalValues = new Array();
|
1496
|
-
var diffs = new Array();
|
1497
|
-
var steps = new Array();
|
1498
|
-
var callback = arguments[1]
|
1499
|
-
|
1500
|
-
function iterator ()
|
1501
|
-
{
|
1502
|
-
var id = [obj.id + '_' + obj.type];
|
1503
|
-
|
1504
|
-
// Initialise the arrays
|
1505
|
-
if (!currentFrame[id]) {
|
1506
|
-
currentFrame[id] = totalFrames;
|
1507
|
-
originalValues[id] = {};
|
1508
|
-
diffs[id] = {};
|
1509
|
-
steps[id] = {};
|
1510
|
-
}
|
1511
|
-
|
1512
|
-
for (var i in map) {
|
1513
|
-
if (typeof map[i] === 'string' || typeof map[i] === 'number') {
|
1514
|
-
|
1515
|
-
// If this the first frame, record the proginal value
|
1516
|
-
if (currentFrame[id] == totalFrames) {
|
1517
|
-
originalValues[id][i] = obj.get(i);
|
1518
|
-
diffs[id][i] = map[i] - originalValues[id][i];
|
1519
|
-
steps[id][i] = diffs[id][i] / totalFrames;
|
1520
|
-
}
|
1521
|
-
|
1522
|
-
obj.set(i, obj.get(i) + steps[id][i]);
|
1523
|
-
|
1524
|
-
RG.clear(obj.canvas);
|
1525
|
-
obj.draw();
|
1526
|
-
}
|
1527
|
-
}
|
1528
|
-
|
1529
|
-
// If the current frame number is above zero, run the animation iterator again
|
1530
|
-
if (--currentFrame[id] > 0) {
|
1531
|
-
RG.Effects.updateCanvas(iterator);
|
1532
|
-
|
1533
|
-
// Optional callback
|
1534
|
-
} else {
|
1535
|
-
|
1536
|
-
if (typeof callback === 'function') {
|
1537
|
-
callback(obj);
|
1538
|
-
}
|
1539
|
-
}
|
1540
|
-
}
|
1541
|
-
|
1542
|
-
iterator();
|
1543
|
-
}
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
// End Module pattern
|
1549
|
-
})(window, document);
|
2
|
+
RGraph=window.RGraph||{isRGraph:true};RGraph.Effects=RGraph.Effects||{};RGraph.Effects.Common={};(function(win,doc,undefined)
|
3
|
+
{var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.Effects.decorate=function(obj)
|
4
|
+
{for(i in RG.Effects.Common){if(typeof RG.Effects.Common[i]==='function'){obj[i]=RG.Effects.Common[i];}}};RG.Effects.replaceCanvasWithDIV=RG.Effects.ReplaceCanvasWithDIV=RG.Effects.wrap=function(canvas)
|
5
|
+
{if(!canvas.rgraph_wrapper){var div=$('<div></div>').css({width:canvas.width+'px',height:canvas.height+'px',cssFloat:canvas.style.cssFloat,left:canvas.style.left,top:canvas.style.top,display:'inline-block'}).get(0);canvas.parentNode.insertBefore(div,canvas);canvas.parentNode.removeChild(canvas);div.appendChild(canvas);canvas.style.position='relative';canvas.style.left=(div.offsetWidth/2)+'px';canvas.style.top=(div.offsetHeight/2)+'px';canvas.style.cssFloat='';canvas.rgraph_wrapper=div;}
|
6
|
+
var div=canvas.rgraph_wrapper;return div;};RG.Effects.Common.fadeIn=function()
|
7
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};obj.canvas.style.opacity=0;RG.redrawCanvas(obj.canvas);for(var i=1;i<=frames;++i){(function(index)
|
8
|
+
{setTimeout(function()
|
9
|
+
{obj.canvas.style.opacity=(index/frames);if(index>=frames){callback(obj);}},(index/frames)*duration);})(i)}
|
10
|
+
return obj;};RG.Effects.Common.fadeOut=function()
|
11
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};for(var i=1;i<=frames;++i){(function(index)
|
12
|
+
{setTimeout(function()
|
13
|
+
{obj.canvas.style.opacity=1-(index/frames);if(index>=frames){callback(obj);}},(index/frames)*duration);})(i)}
|
14
|
+
return this;};RG.Effects.Common.fadeSlideIn=function()
|
15
|
+
{var obj=this,opt=arguments[0]||{},frames=opt.frames||30,frame=0,pc=-20,step=(120-pc)/frames,canvasXY=RG.getCanvasXY(obj.canvas),color=opt.color||'white',callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'linear-gradient(135deg, rgba(255,255,255,0) '+pc+'%, '+color+' '+(pc+20)+'%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1]+'px',left:canvasXY[0]+'px',position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
16
|
+
{if(pc<120){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'linear-gradient(135deg, rgba(255,255,255,0) '+pc+'%, '+color+' '+(pc+20)+'%)'});pc+=step;RG.Effects.updateCanvas(iterator);}else{$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
17
|
+
iterator();};RG.Effects.Common.fadeSlideOut=function()
|
18
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var frame=0;var pc=-20;var step=(120-pc)/frames;var canvasXY=RG.getCanvasXY(obj.canvas);var color=opt.color||'white';var callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'linear-gradient(135deg, '+color+' '+pc+'%, rgba(255,255,255,0) '+(pc+20)+'%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1]+'px',left:canvasXY[0]+'px',position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
19
|
+
{if(pc<120){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'linear-gradient(135deg, '+color+' '+pc+'%, rgba(255,255,255,0) '+(pc+20)+'%)'});pc+=step;RG.Effects.updateCanvas(iterator);}else{RG.clear(obj.canvas,obj.get('clearto'))
|
20
|
+
$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
21
|
+
iterator();};RG.Effects.Common.fadeCircularInOutwards=function()
|
22
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||120;var frame=0;var radius=0;var canvasXY=RG.getCanvasXY(obj.canvas);var color=opt.color||'white';var callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'radial-gradient(rgba(255,255,255,0) 0%, white '+radius+'%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1],left:canvasXY[0],position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
23
|
+
{if(frame<frames){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'radial-gradient(rgba(255,255,255,0) '+((frame++/ frames) * 100) + '%, ' + color + ' ' + ((frame++ /frames)*150)+'%)'});RG.Effects.updateCanvas(iterator);}else{$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
24
|
+
iterator();};RG.Effects.Common.fadeCircularOutOutwards=function()
|
25
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||120;var frame=0;var canvasXY=RG.getCanvasXY(obj.canvas);var color=opt.color||'white';var callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'radial-gradient(rgba(255,255,255,0) 0%, white 0%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1],left:canvasXY[0],position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
26
|
+
{if(frame<frames){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'radial-gradient('+color+' '+((frame++/ frames) * 100) + '%, rgba(255,255,255,0) ' + ((frame++ /frames)*150)+'%)'});RG.Effects.updateCanvas(iterator);}else{RG.clear(obj.canvas,color);$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
27
|
+
iterator();};RG.Effects.Common.fadeCircularInInwards=function()
|
28
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||120;var frame=0;var radius=ma.max(obj.canvas.width,obj.canvas.height);var canvasXY=RG.getCanvasXY(obj.canvas);var color=opt.color||'white';var callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'radial-gradient(rgba(255,255,255,0) 100%, rgba(255,255,255,0) 0%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1]+'px',left:canvasXY[0]+'px',position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
29
|
+
{if(frame<frames){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'radial-gradient('+color+' '+(((frames-frame++)/frames)*100)+'%, rgba(255,255,255,0) '+(((frames-frame++)/frames)*120)+'%)'});RG.Effects.updateCanvas(iterator);}else{$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
30
|
+
iterator();};RG.Effects.Common.fadeCircularOutInwards=function()
|
31
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||120;var frame=0;var radius=ma.max(obj.canvas.width,obj.canvas.height);var canvasXY=RG.getCanvasXY(obj.canvas);var color=opt.color||'white';var callback=arguments[1]||function(){};RG.redrawCanvas(obj.canvas);$('<div id="rgraph_fadeslide_cover_'+obj.id+'"></div>').css({background:'radial-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0) 0%)',width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:canvasXY[1],left:canvasXY[0],position:'absolute'}).appendTo($(obj.canvas.parentNode));function iterator()
|
32
|
+
{if(frame<frames){$('div#rgraph_fadeslide_cover_'+obj.id).css({background:'radial-gradient(rgba(255,255,255,0) '+(((frames-frame++)/frames)*100)+'%, '+color+' '+(((frames-frame++)/frames)*120)+'%)'});RG.Effects.updateCanvas(iterator);}else{RG.clear(obj.canvas);$('div#rgraph_fadeslide_cover_'+obj.id).remove();callback(obj);}}
|
33
|
+
iterator();};RG.Effects.Common.expand=function()
|
34
|
+
{var obj=this;var opt=arguments[0]||{};var bounce=typeof opt.bounce==='boolean'?opt.bounce:true;var frames=opt.frames||60;var duration=(frames/60)*1000;var callback=arguments[1]||function(){};if(!this.canvas.rgraph_wrapper){var div=RG.Effects.wrap(this.canvas);this.canvas.rgraph_wrapper=div;}else{div=this.canvas.rgraph_wrapper;}
|
35
|
+
div.style.position='relative';this.canvas.style.top=(this.canvas.height/2)+'px';this.canvas.style.left=(this.canvas.width/2)+'px';this.canvas.style.width=0;this.canvas.style.height=0;this.canvas.style.opacity=0;RG.clear(this.canvas);RG.redrawCanvas(this.canvas);if(bounce){jQuery('#'+obj.id).animate({opacity:1,width:(obj.canvas.width*1.2)+'px',height:(obj.canvas.height*1.2)+'px',left:(obj.canvas.width* -0.1)+'px',top:(obj.canvas.height* -0.1)+'px'},duration*0.5,function()
|
36
|
+
{jQuery('#'+obj.id).animate({width:(obj.canvas.width*0.9)+'px',height:(obj.canvas.height*0.9)+'px',top:(obj.canvas.height*0.05)+'px',left:(obj.canvas.width*0.05)+'px'},duration*0.25,function()
|
37
|
+
{jQuery('#'+obj.id).animate({width:obj.canvas.width+'px',height:obj.canvas.height+'px',top:0,left:0},duration*0.25,function(){callback(obj);});});});}else{jQuery(obj.canvas).animate({opacity:1,width:obj.canvas.width+'px',height:obj.canvas.height+'px',left:0,top:0},duration,function(){callback(obj);})}
|
38
|
+
return this;};RG.Effects.Common.contract=function()
|
39
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var callback=arguments[1]||function(){};if(!obj.canvas.rgraph_wrapper){var div=RG.Effects.wrap(obj.canvas);obj.canvas.rgraph_wrapper=div;}else{div=obj.canvas.rgraph_wrapper;}
|
40
|
+
div.style.position='relative';obj.canvas.style.top=0;obj.canvas.style.left=0;if(opt.bounce!==false){jQuery('#'+obj.id).animate({width:(obj.canvas.width*1.2)+'px',height:(obj.canvas.height*1.2)+'px',left:(obj.canvas.width* -0.1)+'px',top:(obj.canvas.height* -0.1)+'px'},duration*0.25,function()
|
41
|
+
{jQuery('#'+obj.id).animate({opacity:0,width:0,height:0,left:(obj.canvas.width*0.5)+'px',top:(obj.canvas.height*0.5)+'px'},duration*0.75,function(){callback(obj);});});}else{jQuery('#'+obj.id).animate({opacity:0,width:0,height:0,left:(obj.canvas.width*0.5)+'px',top:(obj.canvas.height*0.5)+'px'},duration*0.75,function(){callback(obj);});}
|
42
|
+
return this;};RG.Effects.Common.reveal=function()
|
43
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var callback=arguments[1]||function(){};var xy=RG.getCanvasXY(obj.canvas);var divs=[['rgraph_reveal_left_'+obj.id,xy[0],xy[1],obj.canvas.width/2,obj.canvas.height],['rgraph_reveal_right_'+obj.id,(xy[0]+(obj.canvas.width/2)),xy[1],(obj.canvas.width/2),obj.canvas.height],['rgraph_reveal_top_'+obj.id,xy[0],xy[1],obj.canvas.width,(obj.canvas.height/2)],['rgraph_reveal_bottom_'+obj.id,xy[0],(xy[1]+(obj.canvas.height/2)),obj.canvas.width,(obj.canvas.height/2)]];for(var i=0,len=divs.length;i<len;++i){var div=document.createElement('DIV');div.id=divs[i][0];div.style.width=divs[i][3]+'px';div.style.height=divs[i][4]+'px';div.style.left=divs[i][1]+'px';div.style.top=divs[i][2]+'px';div.style.position='absolute';div.style.backgroundColor=opt&&typeof opt.color==='string'?opt.color:'white';document.body.appendChild(div);}
|
44
|
+
RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);jQuery('#rgraph_reveal_left_'+obj.id).animate({width:0},duration);jQuery('#rgraph_reveal_right_'+obj.id).animate({left:'+='+(obj.canvas.width/2),width:0},duration);jQuery('#rgraph_reveal_top_'+obj.id).animate({height:0},duration);jQuery('#rgraph_reveal_bottom_'+obj.id).animate({top:'+='+(obj.canvas.height/2),height:0},duration);setTimeout(function()
|
45
|
+
{doc.body.removeChild(doc.getElementById("rgraph_reveal_top_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_reveal_bottom_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_reveal_left_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_reveal_right_"+obj.id));callback(obj);},duration);return this;};RG.Effects.Common.revealCircular=RG.Effects.Common.revealcircular=function()
|
46
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var frame=0;var callback=arguments[1]||function(){};var currentRadius=0
|
47
|
+
var centerx=obj.canvas.width/2;var centery=obj.canvas.height/2;var targetRadius=ma.max(obj.canvas.height,obj.canvas.width);var step=targetRadius/frames;var color=opt.background||opt.color||opt.backgroundColor||'transparent';function iterator()
|
48
|
+
{RG.clear(obj.canvas,color);obj.context.save();obj.context.beginPath();obj.context.arc(centerx,centery,currentRadius,0,RG.TWOPI,false);obj.context.clip();if(opt.background){RG.clear(obj.canvas,opt.background);}
|
49
|
+
obj.draw();obj.context.restore();if(currentRadius<targetRadius){currentRadius+=step;RG.Effects.updateCanvas(iterator);}else{callback(obj);}}
|
50
|
+
iterator();return this;};RG.Effects.Common.conceal=function()
|
51
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var xy=RG.getCanvasXY(obj.canvas);var color=opt.background||opt.color||opt.backgroundColor||'white';var divs=[['rgraph_conceal_left_'+obj.id,xy[0],xy[1],0,obj.canvas.height],['rgraph_conceal_right_'+obj.id,(xy[0]+obj.canvas.width),xy[1],0,obj.canvas.height],['rgraph_conceal_top_'+obj.id,xy[0],xy[1],obj.canvas.width,0],['rgraph_conceal_bottom_'+obj.id,xy[0],(xy[1]+obj.canvas.height),obj.canvas.width,0]];for(var i=0,len=divs.length;i<len;++i){var div=doc.createElement('DIV');div.id=divs[i][0];div.style.width=divs[i][3]+'px';div.style.height=divs[i][4]+'px';div.style.left=divs[i][1]+'px';div.style.top=divs[i][2]+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);}
|
52
|
+
jQuery('#rgraph_conceal_left_'+obj.id).animate({width:'+='+(obj.canvas.width/2)},duration);jQuery('#rgraph_conceal_right_'+obj.id).animate({left:'-='+(obj.canvas.width/2),width:(obj.canvas.width/2)},duration);jQuery('#rgraph_conceal_top_'+obj.id).animate({height:'+='+(obj.canvas.height/2)},duration);jQuery('#rgraph_conceal_bottom_'+obj.id).animate({top:'-='+(obj.canvas.height/2),height:(obj.canvas.height/2)},duration);setTimeout(function()
|
53
|
+
{doc.body.removeChild(doc.getElementById("rgraph_conceal_top_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_conceal_bottom_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_conceal_left_"+obj.id));doc.body.removeChild(doc.getElementById("rgraph_conceal_right_"+obj.id));RG.clear(obj.canvas);callback(obj);},duration);return this;};RG.Effects.Common.hBlindsOpen=RG.Effects.Common.hblindsOpen=function()
|
54
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var height=this.canvas.height/5;RG.clear(this.canvas);RG.redrawCanvas(this.canvas);for(var i=0;i<5;++i){var div=doc.createElement('DIV');div.id='rgraph_hblinds_'+i+'_'+obj.id;div.style.width=this.canvas.width+'px';div.style.height=height+'px';div.style.left=xy[0]+'px';div.style.top=(xy[1]+(this.canvas.height*(i/5)))+'px';div.style.position='absolute';div.style.backgroundColor=color;document.body.appendChild(div);jQuery('#rgraph_hblinds_'+i+'_'+obj.id).animate({height:0},duration);}
|
55
|
+
setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_0_'+obj.id));},duration);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_1_'+obj.id));},duration);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_2_'+obj.id));},duration);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_3_'+obj.id));},duration);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_4_'+obj.id));},duration);setTimeout(function(){callback(obj);},duration);return this;};RG.Effects.Common.hBlindsClose=RG.Effects.Common.hblindsclose=function()
|
56
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var height=this.canvas.height/5;for(var i=0;i<5;++i){var div=doc.createElement('DIV');div.id='rgraph_hblinds_'+i+'_'+obj.id;div.style.width=this.canvas.width+'px';div.style.height=0;div.style.left=xy[0]+'px';div.style.top=(xy[1]+(this.canvas.height*(i/5)))+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);jQuery('#rgraph_hblinds_'+i+'_'+obj.id).animate({height:height+'px'},duration);}
|
57
|
+
setTimeout(function(){RG.clear(obj.canvas);},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_0_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_1_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_2_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_3_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_hblinds_4_'+obj.id));},duration+100);setTimeout(function(){callback(obj);},duration+100);};RG.Effects.Common.vBlindsOpen=RG.Effects.Common.vblindsopen=function()
|
58
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;RG.redrawCanvas(obj.canvas);for(var i=0;i<10;++i){var div=doc.createElement('DIV');div.id='rgraph_vblinds_'+i+'_'+obj.id;div.style.width=width+'px';div.style.height=this.canvas.height+'px';div.style.left=(xy[0]+(this.canvas.width*(i/10)))+'px';div.style.top=(xy[1])+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);jQuery('#rgraph_vblinds_'+i+'_'+obj.id).animate({width:0},duration);}
|
59
|
+
setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_0_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_1_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_2_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_3_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_4_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_5_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_6_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_7_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_8_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_9_'+obj.id));},duration+100);setTimeout(function(){callback(obj);},duration+100);return this;};RG.Effects.Common.vblindsclose=RG.Effects.Common.vBlindsClose=function()
|
60
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;for(var i=0;i<10;++i){var div=doc.createElement('DIV');div.id='rgraph_vblinds_'+i+'_'+obj.id;div.style.width=0;div.style.height=this.canvas.height+'px';div.style.left=(xy[0]+(this.canvas.width*(i/10)))+'px';div.style.top=(xy[1])+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);jQuery('#rgraph_vblinds_'+i+'_'+obj.id).animate({width:width},duration);}
|
61
|
+
setTimeout(function(){RG.clear(obj.canvas);},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_0_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_1_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_2_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_3_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_4_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_5_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_6_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_7_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_8_'+obj.id));},duration+100);setTimeout(function(){doc.body.removeChild(doc.getElementById('rgraph_vblinds_9_'+obj.id));},duration+100);setTimeout(function(){callback(obj);},duration+100);return this;};RG.Effects.Common.slideIn=function()
|
62
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;var div=RG.Effects.wrap(obj.canvas);var from=opt.from||'left';div.style.overflow='hidden';RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);canvas.style.position='relative';if(from=='left'){obj.canvas.style.left=(0-div.offsetWidth)+'px';obj.canvas.style.top=0;}else if(from=='top'){obj.canvas.style.left=0;obj.canvas.style.top=(0-div.offsetHeight)+'px';}else if(from=='bottom'){obj.canvas.style.left=0;obj.canvas.style.top=div.offsetHeight+'px';}else{obj.canvas.style.left=div.offsetWidth+'px';obj.canvas.style.top=0;}
|
63
|
+
jQuery('#'+obj.id).animate({left:0,top:0},duration,function()
|
64
|
+
{callback(obj);});return this;};RG.Effects.Common.slideOut=function()
|
65
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;var div=RG.Effects.wrap(obj.canvas);var to=opt.to||'left';div.style.overflow='hidden';obj.canvas.style.position='relative';obj.canvas.style.left=0;obj.canvas.style.top=0;if(to=='left'){jQuery('#'+obj.id).animate({left:(0-obj.canvas.width)+'px'},duration,function(){callback(obj);});}else if(to=='top'){jQuery('#'+obj.id).animate({left:0,top:(0-div.offsetHeight)+'px'},duration,function(){callback(obj);});}else if(to=='bottom'){jQuery('#'+obj.id).animate({top:(0+div.offsetHeight)+'px'},duration,function(){callback(obj);});}else{jQuery('#'+obj.id).animate({left:(0+obj.canvas.width)+'px'},duration,function(){callback(obj);});}
|
66
|
+
return this;};RG.Effects.Common.hscissorsopen=RG.Effects.Common.hScissorsOpen=function()
|
67
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;var to=opt.to||'left';var height=obj.canvas.height/5;RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);for(var i=0;i<5;++i){var div=doc.getElementById("rgraph_hscissors_"+i+'_'+obj.id)
|
68
|
+
if(!div){var div=doc.createElement('DIV');div.id='rgraph_hscissors_'+i+'_'+obj.id;div.style.width=obj.canvas.width+'px';div.style.height=height+'px';div.style.left=xy[0]+'px';div.style.top=(xy[1]+(obj.canvas.height*(i/5)))+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);}
|
69
|
+
if(i%2==0){jQuery('#'+'rgraph_hscissors_'+i+'_'+obj.id).animate({left:xy[0]+obj.canvas.width+'px',width:0},duration);}else{jQuery('#'+'rgraph_hscissors_'+i+'_'+obj.id).animate({width:0},duration);}}
|
70
|
+
setTimeout(function()
|
71
|
+
{doc.body.removeChild(doc.getElementById('rgraph_hscissors_0_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_hscissors_1_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_hscissors_2_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_hscissors_3_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_hscissors_4_'+obj.id));callback(obj);},duration);return this;};RG.Effects.Common.hScissorsClose=RG.Effects.Common.hscissorsclose=function()
|
72
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var height=obj.canvas.height/5;RG.redrawCanvas(obj.canvas);for(var i=0;i<5;++i){var div=doc.createElement('DIV');div.id='rgraph_hscissors_'+i+'_'+obj.id;div.style.width=0;div.style.height=height+'px';div.style.left=(i%2==0?xy[0]+obj.canvas.width:xy[0])+'px';div.style.top=(xy[1]+(obj.canvas.height*(i/5)))+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);if(i%2==0){jQuery('#'+'rgraph_hscissors_'+i+'_'+obj.id).animate({left:xy[0]+'px',width:obj.canvas.width+'px'},duration);}else{jQuery('#'+'rgraph_hscissors_'+i+'_'+obj.id).animate({width:obj.canvas.width+'px'},duration);}}
|
73
|
+
setTimeout(function()
|
74
|
+
{RGraph.clear(obj.canvas);jQuery('#'+'rgraph_hscissors_'+0+'_'+obj.id).remove();jQuery('#'+'rgraph_hscissors_'+1+'_'+obj.id).remove();jQuery('#'+'rgraph_hscissors_'+2+'_'+obj.id).remove();jQuery('#'+'rgraph_hscissors_'+3+'_'+obj.id).remove();jQuery('#'+'rgraph_hscissors_'+4+'_'+obj.id).remove();callback(obj);},duration);return this;};RG.Effects.Common.vScissorsOpen=RG.Effects.Common.vscissorsopen=function()
|
75
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var xy=RG.getCanvasXY(obj.canvas);var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;RG.redrawCanvas(obj.canvas);for(var i=0;i<10;++i){var div=doc.getElementById("rgraph_vscissors_"+i+'_'+obj.id);if(!div){var div=doc.createElement('DIV');div.id='rgraph_vscissors_'+i+'_'+obj.id;div.style.width=width+'px';div.style.height=obj.canvas.height+'px';div.style.left=xy[0]+(obj.canvas.width*(i/10))+'px';div.style.top=xy[1]+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);}
|
76
|
+
if(i%2==0){jQuery('#'+'rgraph_vscissors_'+i+'_'+obj.id).animate({top:xy[1]+obj.canvas.height+'px',height:0},duration);}else{jQuery('#'+'rgraph_vscissors_'+i+'_'+obj.id).animate({height:0},duration);}}
|
77
|
+
setTimeout(function()
|
78
|
+
{doc.body.removeChild(doc.getElementById('rgraph_vscissors_0'+'_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_vscissors_1'+'_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_vscissors_2'+'_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_vscissors_3'+'_'+obj.id));doc.body.removeChild(doc.getElementById('rgraph_vscissors_4'+'_'+obj.id));callback(obj);},duration);return this;};RG.Effects.Common.vscissorsclose=RG.Effects.Common.vScissorsClose=function()
|
79
|
+
{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||60;var duration=(frames/60)*1000;var frame=0;var callback=arguments[1]||function(){};var xy=RG.getCanvasXY(obj.canvas);var color=opt.background||opt.color||opt.backgroundColor||'white';var xy=RG.getCanvasXY(this.canvas);var width=this.canvas.width/10;RG.redrawCanvas(obj.canvas);for(var i=0;i<10;++i){var div=doc.getElementById("rgraph_vscissors_"+i+'_'+obj.id)
|
80
|
+
if(!div){var div=doc.createElement('DIV');div.id='rgraph_vscissors_'+i+'_'+obj.id;div.style.width=width+'px';div.style.height=0;div.style.left=xy[0]+(width*i)+'px';div.style.top=(i%2==0?xy[1]+obj.canvas.height:xy[1])+'px';div.style.position='absolute';div.style.backgroundColor=color;doc.body.appendChild(div);}
|
81
|
+
if(i%2==0){jQuery('#'+'rgraph_vscissors_'+i+'_'+obj.id).animate({top:xy[1]+'px',height:obj.canvas.height+'px'},duration);}else{jQuery('#'+'rgraph_vscissors_'+i+'_'+obj.id).animate({height:obj.canvas.height+'px'},duration);}}
|
82
|
+
setTimeout(function()
|
83
|
+
{RG.clear(obj.canvas);for(var i=0;i<10;i++){jQuery('#rgraph_vscissors_'+i+'_'+obj.id).remove();}
|
84
|
+
callback(obj);},duration);return this;};RG.Effects.Common.animate=function(map)
|
85
|
+
{var obj=this;obj.draw();var totalFrames=(map&&map['frames'])?map['frames']:30;var currentFrame=new Array();var originalValues=new Array();var diffs=new Array();var steps=new Array();var callback=arguments[1]
|
86
|
+
function iterator()
|
87
|
+
{var id=[obj.id+'_'+obj.type];if(!currentFrame[id]){currentFrame[id]=totalFrames;originalValues[id]={};diffs[id]={};steps[id]={};}
|
88
|
+
for(var i in map){if(typeof map[i]==='string'||typeof map[i]==='number'){if(currentFrame[id]==totalFrames){originalValues[id][i]=obj.get(i);diffs[id][i]=map[i]-originalValues[id][i];steps[id][i]=diffs[id][i]/totalFrames;}
|
89
|
+
obj.set(i,obj.get(i)+steps[id][i]);RG.clear(obj.canvas);obj.draw();}}
|
90
|
+
if(--currentFrame[id]>0){RG.Effects.updateCanvas(iterator);}else{if(typeof callback==='function'){callback(obj);}}}
|
91
|
+
iterator();}})(window,document);
|