rgraph-rails 5.00 → 6.14

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