rgraph-rails 4.67 → 5.00

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/rgraph-rails/version.rb +1 -1
  4. data/license.txt +1 -1
  5. data/vendor/assets/javascripts/RGraph.bar.js +101 -105
  6. data/vendor/assets/javascripts/RGraph.bipolar.js +61 -64
  7. data/vendor/assets/javascripts/RGraph.common.annotate.js +15 -15
  8. data/vendor/assets/javascripts/RGraph.common.context.js +10 -10
  9. data/vendor/assets/javascripts/RGraph.common.core.js +104 -103
  10. data/vendor/assets/javascripts/RGraph.common.csv.js +12 -5
  11. data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -3
  12. data/vendor/assets/javascripts/RGraph.common.dynamic.js +17 -17
  13. data/vendor/assets/javascripts/RGraph.common.effects.js +2 -3
  14. data/vendor/assets/javascripts/RGraph.common.key.js +14 -13
  15. data/vendor/assets/javascripts/RGraph.common.resizing.js +4 -4
  16. data/vendor/assets/javascripts/RGraph.common.tooltips.js +8 -8
  17. data/vendor/assets/javascripts/RGraph.drawing.background.js +8 -7
  18. data/vendor/assets/javascripts/RGraph.drawing.circle.js +6 -5
  19. data/vendor/assets/javascripts/RGraph.drawing.image.js +8 -7
  20. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +6 -5
  21. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +8 -7
  22. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +6 -5
  23. data/vendor/assets/javascripts/RGraph.drawing.poly.js +6 -5
  24. data/vendor/assets/javascripts/RGraph.drawing.rect.js +6 -5
  25. data/vendor/assets/javascripts/RGraph.drawing.text.js +8 -7
  26. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -22
  27. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +22 -22
  28. data/vendor/assets/javascripts/RGraph.fuel.js +20 -19
  29. data/vendor/assets/javascripts/RGraph.funnel.js +19 -18
  30. data/vendor/assets/javascripts/RGraph.gantt.js +45 -40
  31. data/vendor/assets/javascripts/RGraph.gauge.js +30 -26
  32. data/vendor/assets/javascripts/RGraph.hbar.js +79 -82
  33. data/vendor/assets/javascripts/RGraph.hprogress.js +32 -31
  34. data/vendor/assets/javascripts/RGraph.line.js +117 -122
  35. data/vendor/assets/javascripts/RGraph.meter.js +27 -22
  36. data/vendor/assets/javascripts/RGraph.odo.js +26 -29
  37. data/vendor/assets/javascripts/RGraph.pie.js +46 -54
  38. data/vendor/assets/javascripts/RGraph.radar.js +34 -36
  39. data/vendor/assets/javascripts/RGraph.rose.js +43 -37
  40. data/vendor/assets/javascripts/RGraph.rscatter.js +26 -26
  41. data/vendor/assets/javascripts/RGraph.scatter.js +73 -74
  42. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +15 -16
  43. data/vendor/assets/javascripts/RGraph.svg.bar.js +18 -16
  44. data/vendor/assets/javascripts/RGraph.svg.bipolar.js +48 -45
  45. data/vendor/assets/javascripts/RGraph.svg.common.core.js +57 -54
  46. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +10 -2
  47. data/vendor/assets/javascripts/RGraph.svg.common.key.js +5 -5
  48. data/vendor/assets/javascripts/RGraph.svg.funnel.js +8 -7
  49. data/vendor/assets/javascripts/RGraph.svg.gauge.js +13 -11
  50. data/vendor/assets/javascripts/RGraph.svg.hbar.js +24 -21
  51. data/vendor/assets/javascripts/RGraph.svg.line.js +22 -20
  52. data/vendor/assets/javascripts/RGraph.svg.pie.js +10 -9
  53. data/vendor/assets/javascripts/RGraph.svg.radar.js +8 -7
  54. data/vendor/assets/javascripts/RGraph.svg.rose.js +37 -20
  55. data/vendor/assets/javascripts/RGraph.svg.scatter.js +18 -17
  56. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +10 -9
  57. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +16 -14
  58. data/vendor/assets/javascripts/RGraph.thermometer.js +12 -11
  59. data/vendor/assets/javascripts/RGraph.vprogress.js +29 -31
  60. data/vendor/assets/javascripts/RGraph.waterfall.js +44 -38
  61. metadata +3 -4
@@ -1,7 +1,7 @@
1
1
 
2
2
  RGraph=window.RGraph||{isRGraph:true};RGraph.SemiCircularProgress=function(conf)
3
3
  {if(typeof conf==='object'&&typeof conf.id==='string'){var parseConfObjectForOptions=true;}else{var conf={id:arguments[0],min:arguments[1],max:arguments[2],value:arguments[3]}}
4
- this.id=conf.id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.min=RGraph.stringsToNumbers(conf.min);this.max=RGraph.stringsToNumbers(conf.max);this.value=RGraph.stringsToNumbers(conf.value);this.type='semicircularprogress';this.coords=[];this.isRGraph=true;this.currentValue=null;this.uid=RGraph.createUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.properties={'chart.background.color':'rgba(0,0,0,0)','chart.colors':['#0c0'],'chart.linewidth':2,'chart.strokestyle':'#666','chart.gutter.left':25,'chart.gutter.right':25,'chart.gutter.top':25,'chart.gutter.bottom':35,'chart.radius':null,'chart.centerx':null,'chart.centery':null,'chart.width':null,'chart.angles.start':Math.PI,'chart.angles.end':(2*Math.PI),'chart.scale.decimals':0,'chart.scale.point':'.','chart.scale.thousand':',','chart.scale.formatter':null,'chart.scale.round':false,'chart.shadow':false,'chart.shadow.color':'rgba(220,220,220,1)','chart.shadow.blur':2,'chart.shadow.offsetx':2,'chart.shadow.offsety':2,'chart.labels.center':true,'chart.labels.center.font':null,'chart.labels.center.bold':false,'chart.labels.center.italic':false,'chart.labels.center.fade':false,'chart.labels.center.size':40,'chart.labels.center.color':'black','chart.labels.center.valign':'bottom','chart.labels.min.color':null,'chart.labels.min.font':null,'chart.labels.min.bold':false,'chart.labels.min.size':null,'chart.labels.min.italic':false,'chart.labels.min.offset.angle':0,'chart.labels.min.offsetx':0,'chart.labels.min.offsety':0,'chart.labels.max.color':null,'chart.labels.max.font':null,'chart.labels.max.bold':false,'chart.labels.max.size':null,'chart.labels.max.italic':false,'chart.labels.max.offset.angle':0,'chart.labels.max.offsetx':0,'chart.labels.max.offsety':0,'chart.title':'','chart.title.bold':true,'chart.title.italic':false,'chart.title.font':null,'chart.title.size':null,'chart.title.color':'black','chart.text.size':12,'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.contextmenu':null,'chart.units.pre':'','chart.units.post':'','chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.highlight':true,'chart.tooltips.event':'onclick','chart.tooltips.coords.page':true,'chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.annotatable':false,'chart.annotate.color':'black','chart.zoom.factor':1.5,'chart.zoom.fade.in':true,'chart.zoom.fade.out':true,'chart.zoom.hdir':'right','chart.zoom.vdir':'down','chart.zoom.frames':25,'chart.zoom.delay':16.666,'chart.zoom.shadow':true,'chart.zoom.background':true,'chart.zoom.action':'zoom','chart.resizable':false,'chart.resize.handle.adjust':[0,0],'chart.resize.handle.background':null,'chart.adjustable':false,'chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
4
+ this.id=conf.id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.min=RGraph.stringsToNumbers(conf.min);this.max=RGraph.stringsToNumbers(conf.max);this.value=RGraph.stringsToNumbers(conf.value);this.type='semicircularprogress';this.coords=[];this.isRGraph=true;this.currentValue=null;this.uid=RGraph.createUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.propertyNameAliases={};this.properties={'chart.background.color':'rgba(0,0,0,0)','chart.colors':['#0c0'],'chart.linewidth':2,'chart.colors.stroke':'#666','chart.margin.left':25,'chart.margin.right':25,'chart.margin.top':25,'chart.margin.bottom':35,'chart.radius':null,'chart.centerx':null,'chart.centery':null,'chart.width':null,'chart.angles.start':Math.PI,'chart.angles.end':(2*Math.PI),'chart.scale.decimals':0,'chart.scale.point':'.','chart.scale.thousand':',','chart.scale.formatter':null,'chart.scale.round':false,'chart.scale.units.pre':'','chart.scale.units.post':'','chart.shadow':false,'chart.shadow.color':'rgba(220,220,220,1)','chart.shadow.blur':2,'chart.shadow.offsetx':2,'chart.shadow.offsety':2,'chart.labels.center':true,'chart.labels.center.fade':false,'chart.labels.center.size':40,'chart.labels.center.color':null,'chart.labels.center.bold':null,'chart.labels.center.italic':null,'chart.labels.center.font':null,'chart.labels.center.valign':'bottom','chart.labels.min.color':null,'chart.labels.min.font':null,'chart.labels.min.bold':null,'chart.labels.min.size':null,'chart.labels.min.italic':null,'chart.labels.min.offset.angle':0,'chart.labels.min.offsetx':0,'chart.labels.min.offsety':5,'chart.labels.max.color':null,'chart.labels.max.font':null,'chart.labels.max.bold':null,'chart.labels.max.size':null,'chart.labels.max.italic':null,'chart.labels.max.offset.angle':0,'chart.labels.max.offsetx':0,'chart.labels.max.offsety':5,'chart.title':'','chart.title.bold':null,'chart.title.italic':null,'chart.title.font':null,'chart.title.size':null,'chart.title.color':null,'chart.text.size':12,'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.bold':false,'chart.text.italic':false,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.contextmenu':null,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.highlight':true,'chart.tooltips.event':'onclick','chart.tooltips.coords.page':true,'chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.annotatable':false,'chart.annotateble.color':'black','chart.annotateble.linewidth':1,'chart.resizable':false,'chart.resizable.handle.adjust':[0,0],'chart.resizable.handle.background':null,'chart.adjustable':false,'chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
5
5
  if(!this.canvas){alert('[SEMICIRCULARPROGRESS] No canvas support');return;}
6
6
  if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
7
7
  var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
@@ -15,39 +15,38 @@ prop[name.toLowerCase()]=value;return this;};this.get=this.Get=function(name)
15
15
  while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
16
16
  return prop[name.toLowerCase()];};this.draw=this.Draw=function()
17
17
  {RG.fireCustomEvent(this,'onbeforedraw');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
18
- this.currentValue=this.value;this.gutterLeft=prop['chart.gutter.left'];this.gutterRight=prop['chart.gutter.right'];this.gutterTop=prop['chart.gutter.top'];this.gutterBottom=prop['chart.gutter.bottom'];this.radius=ma.min((ca.width-prop['chart.gutter.left']-prop['chart.gutter.right'])/2,ca.height-prop['chart.gutter.top']-prop['chart.gutter.bottom']);this.centerx=((ca.width-this.gutterLeft-this.gutterRight)/2)+this.gutterLeft;this.centery=ca.height-this.gutterBottom;this.width=this.radius/3;if(typeof prop['chart.radius']==='number')this.radius=prop['chart.radius'];if(typeof prop['chart.centerx']==='number')this.centerx=prop['chart.centerx'];if(typeof prop['chart.centery']==='number')this.centery=prop['chart.centery'];if(typeof prop['chart.width']==='number')this.width=prop['chart.width'];this.coords=[];this.coordsText=[];this.drawMeter();this.drawLabels();if(prop['chart.contextmenu']){RG.showContext(this);}
18
+ this.currentValue=this.value;this.marginLeft=prop['chart.margin.left'];this.marginRight=prop['chart.margin.right'];this.marginTop=prop['chart.margin.top'];this.marginBottom=prop['chart.margin.bottom'];this.radius=ma.min((ca.width-prop['chart.margin.left']-prop['chart.margin.right'])/2,ca.height-prop['chart.margin.top']-prop['chart.margin.bottom']);this.centerx=((ca.width-this.marginLeft-this.marginRight)/2)+this.marginLeft;this.centery=ca.height-this.marginBottom;this.width=this.radius/3;if(typeof prop['chart.radius']==='number')this.radius=prop['chart.radius'];if(typeof prop['chart.centerx']==='number')this.centerx=prop['chart.centerx'];if(typeof prop['chart.centery']==='number')this.centery=prop['chart.centery'];if(typeof prop['chart.width']==='number')this.width=prop['chart.width'];this.coords=[];this.coordsText=[];this.drawMeter();this.drawLabels();if(prop['chart.contextmenu']){RG.showContext(this);}
19
19
  RG.installEventListeners(this);if(prop['chart.resizable']){RG.allowResizing(this);}
20
20
  this.allowAdjusting();if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
21
21
  RG.fireCustomEvent(this,'ondraw');return this;};this.drawMeter=this.DrawMeter=function()
22
- {var start=prop['chart.angles.start'],end=prop['chart.angles.end'];this.scale2=RG.getScale2(this,{'max':this.max,'strict':true,'min':this.min,'scale.thousand':prop['chart.scale.thousand'],'scale.point':prop['chart.scale.point'],'scale.decimals':prop['chart.scale.decimals'],'ylabels.count':5,'units.pre':prop['chart.units.pre'],'units.post':prop['chart.units.post']});if(prop['chart.background.color']!=='rgba(0,0,0,0)'){pa2(co,'fs % fr % % % %',prop['chart.background.color'],0,0,ca.width,ca.height);}
23
- pa2(co,'lw % b a % % % % % false a % % % % % true c s % f % sx % sy % sc % sb % f % sx 0 sy 0 sb 0 sc rgba(0,0,0,0) lw 1',prop['chart.linewidth'],this.centerx,this.centery,this.radius,start,end,this.centerx,this.centery,this.radius-this.width,end,start,prop['chart.strokestyle'],typeof prop['chart.colors'][1]!=='undefined'?prop['chart.colors'][1]:prop['chart.colors'][0],prop['chart.shadow.offsetx'],prop['chart.shadow.offsety'],prop['chart.shadow']?prop['chart.shadow.color']:'rgba(0,0,0,0)',prop['chart.shadow.blur'],typeof prop['chart.colors'][1]!=='undefined'?'rgba(0,0,0,0)':'rgba(255,255,255,0.85)');var angle=start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min)));pa2(co,'b a % % % % % false a % % % % % true c f %',this.centerx,this.centery,this.radius,start,angle,this.centerx,this.centery,this.radius-this.width,start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min))),start,prop['chart.colors'][0]);this.coords=[[this.centerx,this.centery,this.radius,start,end,this.width,angle]];};this.drawLabels=this.DrawLabels=function()
24
- {var min=RG.numberFormat(this,this.scale2.min,prop['chart.units.pre'],prop['chart.units.post'])
25
- var max=RG.numberFormat(this,this.scale2.max,prop['chart.units.pre'],prop['chart.units.post'])
26
- if(prop['chart.angles.start']===RGraph.PI){var halign='center';var valign='top';}else if(prop['chart.angles.start']<=RGraph.PI){var halign='left';var valign='center';}else if(prop['chart.angles.start']>=RGraph.PI){var halign='right';var valign='center';}
27
- var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.start']+prop['chart.labels.min.offset.angle'],this.radius-(this.width/2));RG.text2(this,{font:prop['chart.labels.min.font']||prop['chart.text.font'],bold:prop['chart.labels.min.bold']||prop['chart.text.bold'],size:prop['chart.labels.min.size']||prop['chart.text.size'],x:xy[0]+prop['chart.labels.min.offsetx'],y:xy[1]+prop['chart.labels.min.offsety'],valign:valign,halign:halign,text:min,color:prop['chart.labels.min.color']||prop['chart.text.color'],italic:prop['chart.labels.min.italic']});if(prop['chart.angles.end']===RGraph.TWOPI){var halign='center';var valign='top';}else if(prop['chart.angles.end']>=RGraph.TWOPI){var halign='right';var valign='center';}else if(prop['chart.angles.end']<=RGraph.TWOPI){var halign='left';var valign='center';}
28
- var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.end']+prop['chart.labels.max.offset.angle'],this.radius-(this.width/2));RG.text2(this,{font:prop['chart.labels.max.font']||prop['chart.text.font'],bold:prop['chart.labels.max.bold']||prop['chart.text.bold'],size:prop['chart.labels.max.size']||prop['chart.text.size'],x:xy[0]+prop['chart.labels.max.offsetx'],y:xy[1]+prop['chart.labels.max.offsety'],valign:valign,halign:halign,text:max,color:prop['chart.labels.max.color']||prop['chart.text.color'],italic:prop['chart.labels.max.italic']});if(prop['chart.labels.center']){var ret=RG.text2(this,{font:prop['chart.labels.center.font']||prop['chart.text.font'],size:prop['chart.labels.center.size']||50,bold:prop['chart.labels.center.bold'],italic:prop['chart.labels.center.italic'],x:this.centerx,y:this.centery,valign:prop['chart.labels.center.valign'],halign:'center',text:RG.numberFormat(this,this.value.toFixed(prop['chart.scale.decimals']),prop['chart.units.pre'],prop['chart.units.post']),color:prop['chart.labels.center.color']||prop['chart.text.color']});if(prop['chart.labels.center.fade']&&ret.node){ret.node.style.opacity=0;var delay=25,incr=0.1;for(var i=0;i<10;++i){(function(index)
22
+ {var start=prop['chart.angles.start'],end=prop['chart.angles.end'];this.scale2=RG.getScale2(this,{'scale.max':this.max,'scale.strict':true,'scale.min':this.min,'scale.thousand':prop['chart.scale.thousand'],'scale.point':prop['chart.scale.point'],'scale.decimals':prop['chart.scale.decimals'],'scale.labels.count':5,'scale.units.pre':prop['chart.scale.units.pre'],'scale.units.post':prop['chart.scale.units.post']});if(prop['chart.background.color']!=='rgba(0,0,0,0)'){pa2(co,'fs % fr % % % %',prop['chart.background.color'],0,0,ca.width,ca.height);}
23
+ pa2(co,'lw % b a % % % % % false a % % % % % true c s % f % sx % sy % sc % sb % f % sx 0 sy 0 sb 0 sc rgba(0,0,0,0) lw 1',prop['chart.linewidth'],this.centerx,this.centery,this.radius,start,end,this.centerx,this.centery,this.radius-this.width,end,start,prop['chart.colors.stroke'],typeof prop['chart.colors'][1]!=='undefined'?prop['chart.colors'][1]:prop['chart.colors'][0],prop['chart.shadow.offsetx'],prop['chart.shadow.offsety'],prop['chart.shadow']?prop['chart.shadow.color']:'rgba(0,0,0,0)',prop['chart.shadow.blur'],typeof prop['chart.colors'][1]!=='undefined'?'rgba(0,0,0,0)':'rgba(255,255,255,0.85)');var angle=start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min)));pa2(co,'b a % % % % % false a % % % % % true c f %',this.centerx,this.centery,this.radius,start,angle,this.centerx,this.centery,this.radius-this.width,start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min))),start,prop['chart.colors'][0]);this.coords=[[this.centerx,this.centery,this.radius,start,end,this.width,angle]];};this.drawLabels=this.DrawLabels=function()
24
+ {var min=RG.numberFormat({object:this,number:this.scale2.min.toFixed(typeof prop['chart.labels.min.decimals']==='number'?prop['chart.labels.min.decimals']:prop['chart.scale.decimals']),unitspre:typeof prop['chart.labels.min.units.pre']==='string'?prop['chart.labels.min.units.pre']:prop['chart.scale.units.pre'],unitspost:typeof prop['chart.labels.min.units.post']==='string'?prop['chart.labels.min.units.post']:prop['chart.scale.units.post'],point:typeof prop['chart.labels.min.point']==='string'?prop['chart.labels.min.point']:prop['chart.scale.point'],thousand:typeof prop['chart.labels.min.thousand']==='string'?prop['chart.labels.min.thousand']:prop['chart.scale.thousand']});var max=RG.numberFormat({object:this,number:this.scale2.max.toFixed(typeof prop['chart.labels.max.decimals']==='number'?prop['chart.labels.max.decimals']:prop['chart.scale.decimals']),unitspre:typeof prop['chart.labels.max.units.pre']==='string'?prop['chart.labels.max.units.pre']:prop['chart.scale.units.pre'],unitspost:typeof prop['chart.labels.max.units.post']==='string'?prop['chart.labels.max.units.post']:prop['chart.scale.units.post'],point:typeof prop['chart.labels.max.point']==='string'?prop['chart.labels.max.point']:prop['chart.scale.point'],thousand:typeof prop['chart.labels.max.thousand']==='string'?prop['chart.labels.max.thousand']:prop['chart.scale.thousand']});if(prop['chart.angles.start']===RGraph.PI){var halign='center';var valign='top';}else if(prop['chart.angles.start']<=RGraph.PI){var halign='left';var valign='center';}else if(prop['chart.angles.start']>=RGraph.PI){var halign='right';var valign='center';}
25
+ var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.start']+prop['chart.labels.min.offset.angle'],this.radius-(this.width/2));var textConf=RG.getTextConf({object:this,prefix:'chart.labels.min'});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xy[0]+prop['chart.labels.min.offsetx'],y:xy[1]+prop['chart.labels.min.offsety'],valign:valign,halign:halign,text:min});if(prop['chart.angles.end']===RGraph.TWOPI){var halign='center';var valign='top';}else if(prop['chart.angles.end']>=RGraph.TWOPI){var halign='right';var valign='center';}else if(prop['chart.angles.end']<=RGraph.TWOPI){var halign='left';var valign='center';}
26
+ var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.end']+prop['chart.labels.max.offset.angle'],this.radius-(this.width/2));var textConf=RG.getTextConf({object:this,prefix:'chart.labels.max'});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xy[0]+prop['chart.labels.max.offsetx'],y:xy[1]+prop['chart.labels.max.offsety'],valign:valign,halign:halign,text:max});if(prop['chart.labels.center']){var textConf=RG.getTextConf({object:this,prefix:'chart.labels.center'});var ret=RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:this.centerx,y:this.centery,valign:prop['chart.labels.center.valign'],halign:'center',text:RG.numberFormat({object:this,number:this.value.toFixed(typeof prop['chart.labels.center.decimals']==='number'?prop['chart.labels.center.decimals']:prop['chart.scale.decimals']),unitspre:typeof prop['chart.labels.center.units.pre']==='string'?prop['chart.labels.center.units.pre']:prop['chart.scale.units.pre'],unitspost:typeof prop['chart.labels.center.units.post']==='string'?prop['chart.labels.center.units.post']:prop['chart.scale.units.post'],point:typeof prop['chart.labels.center.point']==='string'?prop['chart.labels.center.point']:prop['chart.scale.point'],thousand:typeof prop['chart.labels.center.thousand']==='string'?prop['chart.labels.center.thousand']:prop['chart.scale.thousand']})});if(prop['chart.labels.center.fade']&&ret.node){ret.node.style.opacity=0;var delay=25,incr=0.1;for(var i=0;i<10;++i){(function(index)
29
27
  {setTimeout(function()
30
28
  {ret.node.style.opacity=incr*index;},delay*(index+1));})(i);}}}
31
- RG.drawTitle(this,prop['chart.title'],this.gutterTop,null,prop['chart.title.size']);};this.getShape=function(e)
29
+ RG.drawTitle(this,prop['chart.title'],this.marginTop,null,prop['chart.title.size']);};this.getShape=function(e)
32
30
  {var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1]
33
31
  pa2(co,'b a % % % % % false a % % % % % true',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],this.coords[0][6],this.coords[0][0],this.coords[0][1],this.coords[0][2]-this.coords[0][5],this.coords[0][6],this.coords[0][3]);if(co.isPointInPath(mouseX,mouseY)){return{object:this,0:this,x:this.coords[0][0],1:this.coords[0][0],y:this.coords[0][1],2:this.coords[0][1],radius:this.coords[0][2],3:this.coords[0][2],width:this.coords[0][5],4:this.coords[0][5],start:this.coords[0][3],5:this.coords[0][3],end:this.coords[0][6],6:this.coords[0][6],index:0,tooltip:!RG.isNull(prop['chart.tooltips'])?prop['chart.tooltips'][0]:null};}};this.getValue=function(e)
34
32
  {var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1],angle=RG.getAngleByXY(this.centerx,this.centery,mouseX,mouseY);if(angle&&mouseX>=this.centerx&&mouseY>this.centery){angle+=RGraph.TWOPI;}
35
33
  if(angle<prop['chart.angles.start']&&mouseX>this.centerx){angle=prop['chart.angles.end'];}
36
34
  if(angle<prop['chart.angles.start']){angle=prop['chart.angles.start'];}
37
35
  var value=(((angle-prop['chart.angles.start'])/(prop['chart.angles.end']-prop['chart.angles.start']))*(this.max-this.min))+this.min;value=ma.max(value,this.min);value=ma.min(value,this.max);return value;};this.highlight=this.Highlight=function(shape)
38
- {if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{pa2(co,'lw 5 b a % % % % % false a % % % % % true c s % f % lw 1',shape.x,shape.y,shape.radius,shape.start,shape.end,shape.x,shape.y,shape.radius-shape.width,shape.end,shape.start,prop['chart.highlight.stroke'],prop['chart.highlight.fill']);}};this.getObjectByXY=function(e)
36
+ {if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{pa2(co,'lw 5 b a % % % % % false a % % % % % true c f % s % lw 1',shape.x,shape.y,shape.radius,shape.start,shape.end,shape.x,shape.y,shape.radius-shape.width,shape.end,shape.start,prop['chart.highlight.fill'],prop['chart.highlight.stroke']);}};this.getObjectByXY=function(e)
39
37
  {var mouseXY=RG.getMouseXY(e);pa2(co,'b a % % % % % false',this.centerx,this.centery,this.radius,prop['chart.angles.start'],prop['chart.angles.end']);pa2(co,'a % % % % % true',this.centerx,this.centery,this.radius-this.width,prop['chart.angles.end'],prop['chart.angles.start']);return co.isPointInPath(mouseXY[0],mouseXY[1])?this:null;};this.allowAdjusting=this.AllowAdjusting=function(){};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
40
- {if(prop['chart.adjustable']&&RG.Registry.Get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){var value=this.getValue(e);if(typeof value==='number'){RG.fireCustomEvent(this,'onadjust');this.value=Number(value.toFixed(prop['chart.scale.decimals']));RG.redrawCanvas(this.canvas);}}};this.getAngle=function(value)
38
+ {if(prop['chart.adjustable']&&RG.Registry.get('chart.adjusting')&&RG.Registry.get('chart.adjusting').uid==this.uid){var value=this.getValue(e);if(typeof value==='number'){RG.fireCustomEvent(this,'onadjust');this.value=Number(value.toFixed(prop['chart.scale.decimals']));RG.redrawCanvas(this.canvas);}}};this.getAngle=function(value)
41
39
  {if(value>this.max||value<this.min){return null;}
42
40
  var angle=(value/this.max)*(prop['chart.angles.end']-prop['chart.angles.start'])
43
41
  angle+=prop['chart.angles.start'];return angle;};this.overChartArea=function(e)
44
42
  {var mouseXY=RGraph.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1]
45
43
  pa2(co,'b a % % % % % false a % % % % % true',this.coords[0][0],this.coords[0][1],this.coords[0][2],prop['chart.angles.start'],prop['chart.angles.end'],this.coords[0][0],this.coords[0][1],this.coords[0][2]-this.coords[0][5],prop['chart.angles.end'],prop['chart.angles.start']);return co.isPointInPath(mouseX,mouseY);};this.parseColors=function()
46
- {if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);}
47
- prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.colors'][1]=this.parseSingleColorForGradient(prop['chart.colors'][1]);prop['chart.strokestyle']=this.parseSingleColorForGradient(prop['chart.strokestyle']);prop['chart.background.color']=this.parseSingleColorForGradient(prop['chart.background.color']);};this.reset=function()
44
+ {if(this.original_colors.length===0){this.original_colors['chart.background.color']=RG.arrayClone(prop['chart.background.color']);this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);}
45
+ prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.colors'][1]=this.parseSingleColorForGradient(prop['chart.colors'][1]);prop['chart.colors.stroke']=this.parseSingleColorForGradient(prop['chart.colors.stroke']);prop['chart.background.color']=this.parseSingleColorForGradient(prop['chart.background.color']);};this.reset=function()
48
46
  {};this.parseSingleColorForGradient=function(color)
49
47
  {if(!color||typeof color!='string'){return color;}
50
- if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(prop['chart.gutter.left'],0,ca.width-prop['chart.gutter.right'],0);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}
48
+ if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
49
+ var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(prop['chart.margin.left'],0,ca.width-prop['chart.margin.right'],0);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}
51
50
  return grad?grad:color;}
52
51
  return grad?grad:color;};this.on=function(type,func)
53
52
  {if(type.substr(0,2)!=='on'){type='on'+type;}
@@ -58,4 +57,4 @@ return this;};this.exec=function(func)
58
57
  {var obj=this,initial_value=this.currentValue,opt=arguments[0]||{},numFrames=opt.frames||30,frame=0,callback=arguments[1]||function(){},diff=this.value-Number(this.currentValue),increment=diff/numFrames
59
58
  function iterator()
60
59
  {frame++;if(frame<=numFrames){obj.value=initial_value+(increment*frame);RG.clear(ca);RG.redrawCanvas(ca);RG.Effects.updateCanvas(iterator);}else{callback();}}
61
- iterator();return this;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
60
+ iterator();return this;};RG.register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
@@ -2,33 +2,35 @@
2
2
  RGraph=window.RGraph||{isRGraph:true};RGraph.SVG=RGraph.SVG||{};(function(win,doc,undefined)
3
3
  {var RG=RGraph,ua=navigator.userAgent,ma=Math,win=window,doc=document;RG.SVG.Bar=function(conf)
4
4
  {this.set=function(name,value)
5
- {if(arguments.length===1&&typeof name==='object'){for(i in arguments[0]){if(typeof i==='string'){var ret=RG.SVG.commonSetter({object:this,name:i,value:arguments[0][i]});name=ret.name;value=ret.value;this.set(name,value);}}}else{var ret=RG.SVG.commonSetter({object:this,name:name,value:value});name=ret.name;value=ret.value;this.properties[name]=value;if(name==='colors'){this.originalColors=RG.SVG.arrayClone(value);this.colorsParsed=false;}}
6
- return this;};this.id=conf.id;this.uid=RG.SVG.createUID();this.container=document.getElementById(this.id);this.layers={};this.svg=RG.SVG.createSVG({object:this,container:this.container});this.isRGraph=true;this.data=conf.data;this.type='bar';this.coords=[];this.coords2=[];this.stackedBackfaces=[];this.originalColors={};this.gradientCounter=1;RG.SVG.OR.add(this);this.container.style.display='inline-block';this.properties={gutterLeft:35,gutterRight:35,gutterTop:35,gutterBottom:35,variant:null,variant3dOffsetx:10,variant3dOffsety:5,backgroundColor:null,backgroundImage:null,backgroundImageAspect:'none',backgroundImageStretch:true,backgroundImageOpacity:null,backgroundImageX:null,backgroundImageY:null,backgroundImageW:null,backgroundImageH:null,backgroundGrid:true,backgroundGridColor:'#ddd',backgroundGridLinewidth:1,backgroundGridHlines:true,backgroundGridHlinesCount:null,backgroundGridVlines:true,backgroundGridVlinesCount:null,backgroundGridBorder:true,backgroundGridDashed:false,backgroundGridDotted:false,backgroundGridDashArray:null,colors:['red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black','red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black'],colorsSequential:false,strokestyle:'rgba(0,0,0,0)',errorbars:null,hmargin:3,hmarginGrouped:2,yaxis:true,yaxisTickmarks:true,yaxisTickmarksLength:3,yaxisColor:'black',yaxisScale:true,yaxisLabels:null,yaxisLabelsOffsetx:0,yaxisLabelsOffsety:0,yaxisLabelsCount:5,yaxisUnitsPre:'',yaxisUnitsPost:'',yaxisStrict:false,yaxisDecimals:0,yaxisPoint:'.',yaxisThousand:',',yaxisRound:false,yaxisMax:null,yaxisMin:0,yaxisFormatter:null,xaxis:true,xaxisTickmarks:true,xaxisTickmarksLength:5,xaxisLabels:null,xaxisLabelsPosition:'section',xaxisLabelsPositionSectionTickmarksCount:null,xaxisColor:'black',xaxisLabelsOffsetx:0,xaxisLabelsOffsety:0,labelsAbove:false,labelsAboveFont:null,labelsAboveSize:null,labelsAboveBold:null,labelsAboveItalic:null,labelsAboveColor:null,labelsAboveBackground:null,labelsAboveBackgroundPadding:0,labelsAboveUnitsPre:null,labelsAboveUnitsPost:null,labelsAbovePoint:null,labelsAboveThousand:null,labelsAboveFormatter:null,labelsAboveDecimals:null,labelsAboveOffsetx:0,labelsAboveOffsety:0,labelsAboveHalign:'center',labelsAboveValign:'bottom',labelsAboveSpecific:null,textColor:'black',textFont:'sans-serif',textSize:12,textBold:false,textItalic:false,linewidth:1,grouping:'grouped',tooltips:null,tooltipsOverride:null,tooltipsEffect:'fade',tooltipsCssClass:'RGraph_tooltip',tooltipsEvent:'click',highlightStroke:'rgba(0,0,0,0)',highlightFill:'rgba(255,255,255,0.7)',highlightLinewidth:1,title:'',titleSize:16,titleX:null,titleY:null,titleHalign:'center',titleValign:null,titleColor:'black',titleFont:null,titleBold:false,titleItalic:false,titleSubtitle:null,titleSubtitleSize:10,titleSubtitleX:null,titleSubtitleY:null,titleSubtitleHalign:'center',titleSubtitleValign:null,titleSubtitleColor:'#aaa',titleSubtitleFont:null,titleSubtitleBold:false,titleSubtitleItalic:false,shadow:false,shadowOffsetx:2,shadowOffsety:2,shadowBlur:2,shadowOpacity:0.25,errorbars:null,errorbarsColor:'black',errorbarsLinewidth:1,errorbarsCapwidth:10,key:null,keyColors:null,keyOffsetx:0,keyOffsety:0,keyTextOffsetx:0,keyTextOffsety:-1,keyTextSize:null,keyTextBold:null,keyTextItalic:null,keyTextFont:null};RG.SVG.getGlobals(this);if(RG.SVG.FX&&typeof RG.SVG.FX.decorate==='function'){RG.SVG.FX.decorate(this);}
5
+ {if(arguments.length===1&&typeof name==='object'){for(i in arguments[0]){if(typeof i==='string'){name=ret.name;value=ret.value;this.set(name,value);}}}else{var ret=RG.SVG.commonSetter({object:this,name:name,value:value});name=ret.name;value=ret.value;this.properties[name]=value;if(name==='colors'){this.originalColors=RG.SVG.arrayClone(value);this.colorsParsed=false;}}
6
+ return this;};this.get=function(name)
7
+ {return this.properties[name];};this.id=conf.id;this.uid=RG.SVG.createUID();this.container=document.getElementById(this.id);this.layers={};this.svg=RG.SVG.createSVG({object:this,container:this.container});this.isRGraph=true;this.data=conf.data;this.type='bar';this.coords=[];this.coords2=[];this.stackedBackfaces=[];this.originalColors={};this.gradientCounter=1;this.propertyNameAliases={};RG.SVG.OR.add(this);this.container.style.display='inline-block';this.properties={marginLeft:35,marginRight:35,marginTop:35,marginBottom:35,variant:null,variant3dOffsetx:10,variant3dOffsety:5,backgroundColor:null,backgroundImage:null,backgroundImageAspect:'none',backgroundImageStretch:true,backgroundImageOpacity:null,backgroundImageX:null,backgroundImageY:null,backgroundImageW:null,backgroundImageH:null,backgroundGrid:true,backgroundGridColor:'#ddd',backgroundGridLinewidth:1,backgroundGridHlines:true,backgroundGridHlinesCount:null,backgroundGridVlines:true,backgroundGridVlinesCount:null,backgroundGridBorder:true,backgroundGridDashed:false,backgroundGridDotted:false,backgroundGridDashArray:null,colors:['red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black','red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black'],colorsSequential:false,colorsStroke:'rgba(0,0,0,0)',errorbars:null,hmargin:3,hmarginGrouped:2,hmarginLeft:0,hmarginRight:0,yaxis:true,yaxisTickmarks:true,yaxisTickmarksLength:3,yaxisColor:'black',yaxisScale:true,yaxisLabels:null,yaxisLabelsFont:null,yaxisLabelsSize:null,yaxisLabelsColor:null,yaxisLabelsBold:null,yaxisLabelsItalic:null,yaxisLabelsOffsetx:0,yaxisLabelsOffsety:0,yaxisLabelsCount:5,yaxisScaleUnitsPre:'',yaxisScaleUnitsPost:'',yaxisScaleStrict:false,yaxisScaleDecimals:0,yaxisScalePoint:'.',yaxisScaleThousand:',',yaxisScaleRound:false,yaxisScaleMax:null,yaxisScaleMin:0,yaxisScaleFormatter:null,xaxis:true,xaxisTickmarks:true,xaxisTickmarksLength:5,xaxisLabels:null,xaxisLabelsFont:null,xaxisLabelsSize:null,xaxisLabelsColor:null,xaxisLabelsBold:null,xaxisLabelsItalic:null,xaxisLabelsPosition:'section',xaxisLabelsPositionSectionTickmarksCount:null,xaxisLabelsOffsetx:0,xaxisLabelsOffsety:0,xaxisColor:'black',labelsAbove:false,labelsAboveFont:null,labelsAboveSize:null,labelsAboveBold:null,labelsAboveItalic:null,labelsAboveColor:null,labelsAboveBackground:null,labelsAboveBackgroundPadding:0,labelsAboveUnitsPre:null,labelsAboveUnitsPost:null,labelsAbovePoint:null,labelsAboveThousand:null,labelsAboveFormatter:null,labelsAboveDecimals:null,labelsAboveOffsetx:0,labelsAboveOffsety:0,labelsAboveHalign:'center',labelsAboveValign:'bottom',labelsAboveSpecific:null,textColor:'black',textFont:'Arial, Verdana, sans-serif',textSize:12,textBold:false,textItalic:false,linewidth:1,grouping:'grouped',tooltips:null,tooltipsOverride:null,tooltipsEffect:'fade',tooltipsCssClass:'RGraph_tooltip',tooltipsEvent:'click',highlightStroke:'rgba(0,0,0,0)',highlightFill:'rgba(255,255,255,0.7)',highlightLinewidth:1,title:'',titleX:null,titleY:null,titleHalign:'center',titleValign:null,titleSize:null,titleColor:null,titleFont:null,titleBold:null,titleItalic:null,titleSubtitle:null,titleSubtitleX:null,titleSubtitleY:null,titleSubtitleHalign:'center',titleSubtitleValign:null,titleSubtitleSize:null,titleSubtitleColor:'#aaa',titleSubtitleFont:null,titleSubtitleBold:null,titleSubtitleItalic:null,shadow:false,shadowOffsetx:2,shadowOffsety:2,shadowBlur:2,shadowOpacity:0.25,errorbars:null,errorbarsColor:'black',errorbarsLinewidth:1,errorbarsCapwidth:10,key:null,keyColors:null,keyOffsetx:0,keyOffsety:0,keyLabelsOffsetx:0,keyLabelsOffsety:-1,keyLabelsColor:null,keyLabelsSize:null,keyLabelsBold:null,keyLabelsItalic:null,keyLabelsFont:null};RG.SVG.getGlobals(this);if(RG.SVG.FX&&typeof RG.SVG.FX.decorate==='function'){RG.SVG.FX.decorate(this);}
7
8
  var prop=this.properties;this.draw=function()
8
9
  {RG.SVG.fireCustomEvent(this,'onbeforedraw');this.width=Number(this.svg.getAttribute('width'));this.height=Number(this.svg.getAttribute('height'));if(prop.variant!=='3d'){prop.variant3dOffsetx=0;prop.variant3dOffsety=0;}else{this.svg.all.setAttribute('transform','skewY(5)');}
9
- RG.SVG.createDefs(this);this.coords=[];this.coords2=[];this.graphWidth=this.width-prop.gutterLeft-prop.gutterRight;this.graphHeight=this.height-prop.gutterTop-prop.gutterBottom;RG.SVG.resetColorsToOriginalValues({object:this});this.parseColors();var values=[];for(var i=0,max=0;i<this.data.length;++i){if(prop.errorbars&&typeof prop.errorbars[i]==='number'){var errorbar=prop.errorbars[i];}else if(prop.errorbars&&typeof prop.errorbars[i]==='object'&&typeof prop.errorbars[i].max==='number'){var errorbar=prop.errorbars[i].max;}else{var errorbar=0;}
10
+ RG.SVG.createDefs(this);this.coords=[];this.coords2=[];this.graphWidth=this.width-prop.marginLeft-prop.marginRight;this.graphHeight=this.height-prop.marginTop-prop.marginBottom;this.data_seq=RG.SVG.arrayLinearize(this.data);if(prop.errorbars){for(var i=0;i<this.data_seq.length;++i){if(typeof prop.errorbars[i]==='undefined'||RG.SVG.isNull(prop.errorbars[i])){prop.errorbars[i]={max:null,min:null};}else if(typeof prop.errorbars[i]==='number'){prop.errorbars[i]={min:prop.errorbars[i],max:prop.errorbars[i]};}else if(typeof prop.errorbars[i]==='object'&&typeof prop.errorbars[i].max==='undefined'){prop.errorbars[i].max=null;}else if(typeof prop.errorbars[i]==='object'&&typeof prop.errorbars[i].min==='undefined'){prop.errorbars[i].min=null;}}}
11
+ RG.SVG.resetColorsToOriginalValues({object:this});this.parseColors();var values=[];for(var i=0,max=0;i<this.data.length;++i){if(prop.errorbars&&typeof prop.errorbars[i]==='number'){var errorbar=prop.errorbars[i];}else if(prop.errorbars&&typeof prop.errorbars[i]==='object'&&typeof prop.errorbars[i].max==='number'){var errorbar=prop.errorbars[i].max;}else{var errorbar=0;}
10
12
  if(typeof this.data[i]==='number'){values.push(this.data[i]+errorbar);}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='grouped'){values.push(RG.SVG.arrayMax(this.data[i])+errorbar);}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='stacked'){values.push(RG.SVG.arraySum(this.data[i])+errorbar);}}
11
- var max=RG.SVG.arrayMax(values);if(typeof prop.yaxisMax==='number'){max=prop.yaxisMax;}
12
- if(prop.yaxisMin==='mirror'||prop.yaxisMin==='middle'||prop.yaxisMin==='center'){var mirrorScale=true;prop.yaxisMin=0;}
13
- this.scale=RG.SVG.getScale({object:this,numlabels:prop.yaxisLabelsCount,unitsPre:prop.yaxisUnitsPre,unitsPost:prop.yaxisUnitsPost,max:max,min:prop.yaxisMin,point:prop.yaxisPoint,round:prop.yaxisRound,thousand:prop.yaxisThousand,decimals:prop.yaxisDecimals,strict:typeof prop.yaxisMax==='number',formatter:prop.yaxisFormatter});if(mirrorScale){this.scale=RG.SVG.getScale({object:this,numlabels:prop.yaxisLabelsCount,unitsPre:prop.yaxisUnitsPre,unitsPost:prop.yaxisUnitsPost,max:this.scale.max,min:this.scale.max* -1,point:prop.yaxisPoint,round:false,thousand:prop.yaxisThousand,decimals:prop.yaxisDecimals,strict:typeof prop.yaxisMax==='number',formatter:prop.yaxisFormatter});}
14
- this.max=this.scale.max;this.min=this.scale.min;prop.yaxisMax=this.scale.max;prop.yaxisMin=this.scale.min;RG.SVG.drawBackground(this);if(prop.variant==='3d'){RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(prop.gutterLeft,prop.gutterTop,prop.gutterLeft+prop.variant3dOffsetx,prop.gutterTop-prop.variant3dOffsety,prop.gutterLeft+prop.variant3dOffsetx,this.height-prop.gutterBottom-prop.variant3dOffsety,prop.gutterLeft,this.height-prop.gutterBottom,prop.gutterLeft,prop.gutterTop),fill:'#ddd',stroke:'#ccc'}});this.threed_xaxis_group=RG.SVG.create({svg:this.svg,type:'g',parent:this.svg.all,attr:{className:'rgraph_3d_bar_xaxis_negative'}});RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(prop.gutterLeft,this.getYCoord(0),prop.gutterLeft+prop.variant3dOffsetx,this.getYCoord(0)-prop.variant3dOffsety,this.width-prop.gutterRight+prop.variant3dOffsetx,this.getYCoord(0)-prop.variant3dOffsety,this.width-prop.gutterRight,this.getYCoord(0),prop.gutterLeft,this.getYCoord(0)),fill:'#ddd',stroke:'#ccc'}});}
13
+ var max=RG.SVG.arrayMax(values);if(typeof prop.yaxisScaleMax==='number'){max=prop.yaxisScaleMax;}
14
+ if(prop.yaxisScaleMin==='mirror'||prop.yaxisScaleMin==='middle'||prop.yaxisScaleMin==='center'){this.mirrorScale=true;var mirrorScale=true;prop.yaxisScaleMin=0;}
15
+ this.scale=RG.SVG.getScale({object:this,numlabels:prop.yaxisLabelsCount,unitsPre:prop.yaxisScaleUnitsPre,unitsPost:prop.yaxisScaleUnitsPost,max:max,min:prop.yaxisScaleMin,point:prop.yaxisScalePoint,round:prop.yaxisScaleRound,thousand:prop.yaxisScaleThousand,decimals:prop.yaxisScaleDecimals,strict:typeof prop.yaxisScaleMax==='number',formatter:prop.yaxisScaleFormatter});if(mirrorScale){this.scale=RG.SVG.getScale({object:this,numlabels:prop.yaxisLabelsCount,unitsPre:prop.yaxisScaleUnitsPre,unitsPost:prop.yaxisScaleUnitsPost,max:this.scale.max,min:this.scale.max* -1,point:prop.yaxisScalePoint,round:false,thousand:prop.yaxisScaleThousand,decimals:prop.yaxisScaleDecimals,strict:typeof prop.yaxisScaleMax==='number',formatter:prop.yaxisScaleFormatter});}
16
+ this.max=this.scale.max;this.min=this.scale.min;RG.SVG.drawBackground(this);if(prop.variant==='3d'){RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(prop.marginLeft,prop.marginTop,prop.marginLeft+prop.variant3dOffsetx,prop.marginTop-prop.variant3dOffsety,prop.marginLeft+prop.variant3dOffsetx,this.height-prop.marginBottom-prop.variant3dOffsety,prop.marginLeft,this.height-prop.marginBottom,prop.marginLeft,prop.marginTop),fill:'#ddd',stroke:'#ccc'}});this.threed_xaxis_group=RG.SVG.create({svg:this.svg,type:'g',parent:this.svg.all,attr:{className:'rgraph_3d_bar_xaxis_negative'}});RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(prop.marginLeft,this.getYCoord(0),prop.marginLeft+prop.variant3dOffsetx,this.getYCoord(0)-prop.variant3dOffsety,this.width-prop.marginRight+prop.variant3dOffsetx,this.getYCoord(0)-prop.variant3dOffsety,this.width-prop.marginRight,this.getYCoord(0),prop.marginLeft,this.getYCoord(0)),fill:'#ddd',stroke:'#ccc'}});}
15
17
  this.drawBars();RG.SVG.drawXAxis(this);RG.SVG.drawYAxis(this);this.drawLabelsAbove();if(typeof prop.key!==null&&RG.SVG.drawKey){RG.SVG.drawKey(this);}else if(!RGraph.SVG.isNull(prop.key)){alert('The drawKey() function does not exist - have you forgotten to include the key library?');}
16
- RG.SVG.attribution(this);RG.SVG.fireCustomEvent(this,'ondraw');return this;};this.drawBars=function()
18
+ RG.SVG.fireCustomEvent(this,'ondraw');return this;};this.drawBars=function()
17
19
  {var y=this.getYCoord(0);if(prop.shadow){RG.SVG.setShadow({object:this,offsetx:prop.shadowOffsetx,offsety:prop.shadowOffsety,blur:prop.shadowBlur,opacity:prop.shadowOpacity,id:'dropShadow'});}
18
- for(var i=0,sequentialIndex=0;i<this.data.length;++i,++sequentialIndex){if(typeof this.data[i]==='number'){var outerSegment=this.graphWidth/this.data.length,height=(ma.abs(this.data[i])-ma.abs(this.scale.min))/(ma.abs(this.scale.max)-ma.abs(this.scale.min))*this.graphHeight,width=(this.graphWidth/this.data.length)-prop.hmargin-prop.hmargin,x=prop.gutterLeft+prop.hmargin+(outerSegment*i);if(this.scale.min>=0&&this.scale.max>0){y=this.getYCoord(this.scale.min)-height;}else if(this.scale.min<0&&this.scale.max>0){height=(ma.abs(this.data[i])/(this.scale.max-this.scale.min))*this.graphHeight;y=this.getYCoord(0)-height;if(this.data[i]<0){y=this.getYCoord(0);}}else if(this.scale.min<0&&this.scale.max<0){height=(ma.abs(this.data[i])-ma.abs(this.scale.max))/(ma.abs(this.scale.min)-ma.abs(this.scale.max))*this.graphHeight;y=prop.gutterTop;}
19
- var rect=RG.SVG.create({svg:this.svg,type:'rect',parent:prop.variant==='3d'&&this.data[i]<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.strokestyle,fill:prop.colorsSequential?(prop.colors[sequentialIndex]?prop.colors[sequentialIndex]:prop.colors[prop.colors.length-1]):prop.colors[0],x:x,y:y,width:width<0?0:width,height:height,'stroke-width':prop.linewidth,'data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltip':(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips.length)?prop.tooltips[i]:'','data-index':i,'data-sequential-index':sequentialIndex,'data-value':this.data[i],filter:prop.shadow?'url(#dropShadow)':''}});this.drawErrorbar({object:this,element:rect,index:i,value:this.data[i],type:'normal'});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[0]){this.coords2[0]=[];}
20
+ for(var i=0,sequentialIndex=0;i<this.data.length;++i,++sequentialIndex){if(typeof this.data[i]==='number'){var outerSegment=(this.graphWidth-prop.hmarginLeft-prop.hmarginRight)/this.data.length,height=(ma.abs(this.data[i])-ma.abs(this.scale.min))/(ma.abs(this.scale.max)-ma.abs(this.scale.min))*this.graphHeight,width=((this.graphWidth-prop.hmarginLeft-prop.hmarginRight)/this.data.length)-prop.hmargin-prop.hmargin,x=prop.marginLeft+prop.hmargin+prop.hmarginLeft+(outerSegment*i);if(this.scale.min>=0&&this.scale.max>0){y=this.getYCoord(this.scale.min)-height;}else if(this.scale.min<0&&this.scale.max>0){height=(ma.abs(this.data[i])/(this.scale.max-this.scale.min))*this.graphHeight;y=this.getYCoord(0)-height;if(this.data[i]<0){y=this.getYCoord(0);}}else if(this.scale.min<0&&this.scale.max<0){height=(ma.abs(this.data[i])-ma.abs(this.scale.max))/(ma.abs(this.scale.min)-ma.abs(this.scale.max))*this.graphHeight;y=prop.marginTop;}
21
+ var rect=RG.SVG.create({svg:this.svg,type:'rect',parent:prop.variant==='3d'&&this.data[i]<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.colorsStroke,fill:prop.colorsSequential?(prop.colors[sequentialIndex]?prop.colors[sequentialIndex]:prop.colors[prop.colors.length-1]):prop.colors[0],x:x,y:y,width:width<0?0:width,height:height,'stroke-width':prop.linewidth,'data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltip':(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips.length)?prop.tooltips[i]:'','data-index':i,'data-sequential-index':sequentialIndex,'data-value':this.data[i],filter:prop.shadow?'url(#dropShadow)':''}});this.drawErrorbar({object:this,element:rect,index:i,value:this.data[i],type:'normal'});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[0]){this.coords2[0]=[];}
20
22
  this.coords2[0].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(prop.variant==='3d'){this.drawTop3dFace({rect:rect,value:this.data[i]});this.drawSide3dFace({rect:rect,value:this.data[i]});}
21
23
  if(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips[sequentialIndex]){var obj=this;(function(idx,seq)
22
24
  {rect.addEventListener(prop.tooltipsEvent.replace(/^on/,''),function(e)
23
25
  {obj.removeHighlight();RG.SVG.tooltip({object:obj,index:idx,group:null,sequentialIndex:seq,text:prop.tooltips[seq],event:e});obj.highlight(e.target);},false);rect.addEventListener('mousemove',function(e)
24
- {e.target.style.cursor='pointer'},false);})(i,sequentialIndex);}}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='grouped'){var outerSegment=(this.graphWidth/this.data.length),innerSegment=outerSegment-(2*prop.hmargin);for(var j=0;j<this.data[i].length;++j,++sequentialIndex){var width=((innerSegment-((this.data[i].length-1)*prop.hmarginGrouped))/this.data[i].length),x=(outerSegment*i)+prop.hmargin+prop.gutterLeft+(j*width)+((j-1)*prop.hmarginGrouped);x=prop.gutterLeft+(outerSegment*i)+(width*j)+prop.hmargin+(j*prop.hmarginGrouped);if(this.scale.min===0&&this.scale.max>this.scale.min){var height=((this.data[i][j]-this.scale.min)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(0)-height;}else if(this.scale.max<=0&&this.scale.min<this.scale.max){var height=((this.data[i][j]-this.scale.max)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(this.scale.max);height=ma.abs(height);}else if(this.scale.max>0&&this.scale.min<0){var height=(ma.abs(this.data[i][j])/(this.scale.max-this.scale.min))*this.graphHeight,y=this.data[i][j]<0?this.getYCoord(0):this.getYCoord(this.data[i][j]);}else if(this.scale.min>0&&this.scale.max>this.scale.min){var height=(ma.abs(this.data[i][j]-this.scale.min)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(this.scale.min)-height;}
26
+ {e.target.style.cursor='pointer'},false);})(i,sequentialIndex);}}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='grouped'){var outerSegment=((this.graphWidth-prop.hmarginLeft-prop.hmarginRight)/this.data.length),innerSegment=outerSegment-(2*prop.hmargin);for(var j=0;j<this.data[i].length;++j,++sequentialIndex){var width=((innerSegment-((this.data[i].length-1)*prop.hmarginGrouped))/this.data[i].length),x=(outerSegment*i)+prop.hmargin+prop.marginLeft+prop.hmarginLeft+(j*width)+((j-1)*prop.hmarginGrouped);x=prop.marginLeft+prop.hmarginLeft+(outerSegment*i)+(width*j)+prop.hmargin+(j*prop.hmarginGrouped);if(this.scale.min===0&&this.scale.max>this.scale.min){var height=((this.data[i][j]-this.scale.min)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(0)-height;}else if(this.scale.max<=0&&this.scale.min<this.scale.max){var height=((this.data[i][j]-this.scale.max)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(this.scale.max);height=ma.abs(height);}else if(this.scale.max>0&&this.scale.min<0){var height=(ma.abs(this.data[i][j])/(this.scale.max-this.scale.min))*this.graphHeight,y=this.data[i][j]<0?this.getYCoord(0):this.getYCoord(this.data[i][j]);}else if(this.scale.min>0&&this.scale.max>this.scale.min){var height=(ma.abs(this.data[i][j]-this.scale.min)/(this.scale.max-this.scale.min))*this.graphHeight,y=this.getYCoord(this.scale.min)-height;}
25
27
  var rect=RG.SVG.create({svg:this.svg,parent:prop.variant==='3d'&&this.data[i][j]<0?this.threed_xaxis_group:this.svg.all,type:'rect',attr:{stroke:prop['strokestyle'],fill:(prop.colorsSequential&&prop.colors[sequentialIndex])?prop.colors[sequentialIndex]:prop.colors[j],x:x,y:y,width:width,height:height,'stroke-width':prop.linewidth,'data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-index':i,'data-subindex':j,'data-sequential-index':sequentialIndex,'data-tooltip':(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips.length)?prop.tooltips[sequentialIndex]:'','data-value':this.data[i][j],filter:prop.shadow?'url(#dropShadow)':''}});this.drawErrorbar({object:this,element:rect,index:sequentialIndex,value:this.data[i][j],type:'grouped'});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
26
28
  this.coords2[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(prop.variant==='3d'){this.drawTop3dFace({rect:rect,value:this.data[i][j]});this.drawSide3dFace({rect:rect,value:this.data[i][j]});}
27
29
  if(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips[sequentialIndex]){var obj=this;(function(idx,seq)
28
30
  {obj.removeHighlight();var indexes=RG.SVG.sequentialIndexToGrouped(seq,obj.data);rect.addEventListener(prop.tooltipsEvent.replace(/^on/,''),function(e)
29
31
  {RG.SVG.tooltip({object:obj,group:idx,index:indexes[1],sequentialIndex:seq,text:prop.tooltips[seq],event:e});obj.highlight(e.target);},false);rect.addEventListener('mousemove',function(e)
30
32
  {e.target.style.cursor='pointer'},false);})(i,sequentialIndex);}}
31
- --sequentialIndex;}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='stacked'){var section=(this.graphWidth/this.data.length);var y=this.getYCoord(0);for(var j=0;j<this.data[i].length;++j,++sequentialIndex){var height=(this.data[i][j]/(this.max-this.min))*this.graphHeight,width=section-(2*prop.hmargin),x=prop.gutterLeft+(i*section)+prop.hmargin,y=y-height;if(j===0&&prop.shadow){var fullHeight=(RG.SVG.arraySum(this.data[i])/(this.max-this.min))*this.graphHeight;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'white',x:x,y:this.height-prop.gutterBottom-fullHeight,width:width,height:fullHeight,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfaces[i]=rect;}
33
+ --sequentialIndex;}else if(RG.SVG.isArray(this.data[i])&&prop.grouping==='stacked'){var section=((this.graphWidth-prop.hmarginLeft-prop.hmarginRight)/this.data.length);var y=this.getYCoord(0);for(var j=0;j<this.data[i].length;++j,++sequentialIndex){var height=(this.data[i][j]/(this.max-this.min))*this.graphHeight,width=section-(2*prop.hmargin),x=prop.marginLeft+prop.hmarginLeft+(i*section)+prop.hmargin,y=y-height;if(j===0&&prop.shadow){var fullHeight=(RG.SVG.arraySum(this.data[i])/(this.max-this.min))*this.graphHeight;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'white',x:x,y:this.height-prop.marginBottom-fullHeight,width:width,height:fullHeight,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfaces[i]=rect;}
32
34
  var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{stroke:prop['strokestyle'],fill:prop.colorsSequential?(prop.colors[sequentialIndex]?prop.colors[sequentialIndex]:prop.colors[prop.colors.length-1]):prop.colors[j],x:x,y:y,width:width,height:height,'stroke-width':prop.linewidth,'data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-index':i,'data-subindex':j,'data-sequential-index':sequentialIndex,'data-tooltip':(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips.length)?prop.tooltips[sequentialIndex]:'','data-value':this.data[i][j]}});if(j===(this.data[i].length-1)){this.drawErrorbar({object:this,element:rect,index:i,value:this.data[i][j],type:'stacked'});}
33
35
  this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
34
36
  this.coords2[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(prop.variant==='3d'){this.drawTop3dFace({rect:rect,value:this.data[i][j]});this.drawSide3dFace({rect:rect,value:this.data[i][j]});}
@@ -39,7 +41,7 @@ if(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips[sequentialIndex]){var obj=this;(
39
41
  --sequentialIndex;}}};this.getYCoord=function(value)
40
42
  {if(value>this.scale.max){return null;}
41
43
  var y,xaxispos=prop.xaxispos;if(value<this.scale.min){return null;}
42
- y=((value-this.scale.min)/(this.scale.max-this.scale.min));y*=(this.height-prop.gutterTop-prop.gutterBottom);y=this.height-prop.gutterBottom-y;return y;};this.highlight=function(rect)
44
+ y=((value-this.scale.min)/(this.scale.max-this.scale.min));y*=(this.height-prop.marginTop-prop.marginBottom);y=this.height-prop.marginBottom-y;return y;};this.highlight=function(rect)
43
45
  {var x=rect.getAttribute('x'),y=rect.getAttribute('y'),width=rect.getAttribute('width'),height=rect.getAttribute('height');var highlight=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{stroke:prop.highlightStroke,fill:prop.highlightFill,x:x,y:y,width:width,height:height,'stroke-width':prop.highlightLinewidth},style:{pointerEvents:'none'}});if(prop.tooltipsEvent==='mousemove'){}
44
46
  RG.SVG.REG.set('highlight',highlight);};this.parseColors=function()
45
47
  {if(!Object.keys(this.originalColors).length){this.originalColors={colors:RG.SVG.arrayClone(prop.colors),backgroundGridColor:RG.SVG.arrayClone(prop.backgroundGridColor),highlightFill:RG.SVG.arrayClone(prop.highlightFill),backgroundColor:RG.SVG.arrayClone(prop.backgroundColor)}}
@@ -54,8 +56,8 @@ RG.SVG.addCustomEventListener(this,type,func);return this;};this.exec=function(f
54
56
  {func(this);return this;};this.removeHighlight=function()
55
57
  {var highlight=RG.SVG.REG.get('highlight');if(highlight&&highlight.parentNode){highlight.parentNode.removeChild(highlight);}
56
58
  RG.SVG.REG.set('highlight',null);};this.drawTop3dFace=function(opt)
57
- {var rect=opt.rect,arr=[parseInt(rect.getAttribute('fill')),'rgba(255,255,255,0.7)'],x=parseInt(rect.getAttribute('x')),y=parseInt(rect.getAttribute('y')),w=parseInt(rect.getAttribute('width')),h=parseInt(rect.getAttribute('height')),value=parseFloat(rect.getAttribute('data-value'));rect.rgraph_3d_top_face=[];for(var i=0;i<2;++i){var color=(i===0?rect.getAttribute('fill'):'rgba(255,255,255,0.7)');var face=RG.SVG.create({svg:this.svg,type:'path',parent:prop.variant==='3d'&&opt.value<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.strokestyle,fill:color,'stroke-width':prop.linewidth,d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(x,y,x+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w,y)}});rect.rgraph_3d_top_face[i]=face}};this.drawSide3dFace=function(opt)
58
- {var rect=opt.rect,arr=[parseInt(rect.getAttribute('fill')),'rgba(0,0,0,0.3)'],x=parseInt(rect.getAttribute('x')),y=parseInt(rect.getAttribute('y')),w=parseInt(rect.getAttribute('width')),h=parseInt(rect.getAttribute('height'));rect.rgraph_3d_side_face=[];for(var i=0;i<2;++i){var color=(i===0?rect.getAttribute('fill'):'rgba(0,0,0,0.3)');var face=RG.SVG.create({svg:this.svg,type:'path',parent:prop.variant==='3d'&&opt.value<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.strokestyle,fill:color,'stroke-width':prop.linewidth,d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(x+w,y,x+w+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w+prop.variant3dOffsetx,y+h-prop.variant3dOffsety,x+w,y+h)}});rect.rgraph_3d_side_face[i]=face}};this.drawErrorbar=function(opt)
59
+ {var rect=opt.rect,arr=[parseInt(rect.getAttribute('fill')),'rgba(255,255,255,0.7)'],x=parseInt(rect.getAttribute('x')),y=parseInt(rect.getAttribute('y')),w=parseInt(rect.getAttribute('width')),h=parseInt(rect.getAttribute('height')),value=parseFloat(rect.getAttribute('data-value'));rect.rgraph_3d_top_face=[];for(var i=0;i<2;++i){var color=(i===0?rect.getAttribute('fill'):'rgba(255,255,255,0.7)');var face=RG.SVG.create({svg:this.svg,type:'path',parent:prop.variant==='3d'&&opt.value<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.colorsStroke,fill:color,'stroke-width':prop.linewidth,d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(x,y,x+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w,y)}});rect.rgraph_3d_top_face[i]=face}};this.drawSide3dFace=function(opt)
60
+ {var rect=opt.rect,arr=[parseInt(rect.getAttribute('fill')),'rgba(0,0,0,0.3)'],x=parseInt(rect.getAttribute('x')),y=parseInt(rect.getAttribute('y')),w=parseInt(rect.getAttribute('width')),h=parseInt(rect.getAttribute('height'));rect.rgraph_3d_side_face=[];for(var i=0;i<2;++i){var color=(i===0?rect.getAttribute('fill'):'rgba(0,0,0,0.3)');var face=RG.SVG.create({svg:this.svg,type:'path',parent:prop.variant==='3d'&&opt.value<0?this.threed_xaxis_group:this.svg.all,attr:{stroke:prop.colorsStroke,fill:color,'stroke-width':prop.linewidth,d:'M {1} {2} L {3} {4} L {5} {6} L {7} {8}'.format(x+w,y,x+w+prop.variant3dOffsetx,y-prop.variant3dOffsety,x+w+prop.variant3dOffsetx,y+h-prop.variant3dOffsety,x+w,y+h)}});rect.rgraph_3d_side_face[i]=face}};this.drawErrorbar=function(opt)
59
61
  {var prop=this.properties,index=opt.index,datapoint=opt.value,linewidth=RG.SVG.getErrorbarsLinewidth({object:this,index:index}),color=RG.SVG.getErrorbarsColor({object:this,index:index}),capwidth=RG.SVG.getErrorbarsCapWidth({object:this,index:index}),element=opt.element,type=opt.type;var max=RG.SVG.getErrorbarsMaxValue({object:this,index:index});var min=RG.SVG.getErrorbarsMinValue({object:this,index:index});if(!max&&!min){return;}
60
62
  if(type==='stacked'){datapoint=RG.SVG.arraySum(this.data[index]);}
61
63
  if(datapoint>=0){var x1=parseFloat(element.getAttribute('x'))+(parseFloat(element.getAttribute('width'))/2);var errorbarLine=RG.SVG.create({svg:this.svg,type:'line',parent:this.svg.all,attr:{x1:x1,y1:parseFloat(element.getAttribute('y')),x2:x1,y2:this.getYCoord(parseFloat(datapoint+max)),stroke:color,'stroke-width':linewidth}});var errorbarCap=RG.SVG.create({svg:this.svg,type:'line',parent:this.svg.all,attr:{x1:parseFloat(errorbarLine.getAttribute('x1'))-(capwidth/2),y1:errorbarLine.getAttribute('y2'),x2:parseFloat(errorbarLine.getAttribute('x1'))+(capwidth/2),y2:errorbarLine.getAttribute('y2'),stroke:color,'stroke-width':linewidth}});if(typeof min==='number'){var errorbarLine=RG.SVG.create({svg:this.svg,type:'line',parent:this.svg.all,attr:{x1:x1,y1:parseFloat(element.getAttribute('y')),x2:x1,y2:this.getYCoord(parseFloat(datapoint-min)),stroke:color,'stroke-width':linewidth}});var errorbarCap=RG.SVG.create({svg:this.svg,type:'line',parent:this.svg.all,attr:{x1:parseFloat(errorbarLine.getAttribute('x1'))-(capwidth/2),y1:errorbarLine.getAttribute('y2'),x2:parseFloat(errorbarLine.getAttribute('x1'))+(capwidth/2),y2:errorbarLine.getAttribute('y2'),stroke:color,'stroke-width':linewidth}});}}else if(datapoint<0){var x1=parseFloat(element.getAttribute('x'))+(parseFloat(element.getAttribute('width'))/2),y1=parseFloat(element.getAttribute('y'))+parseFloat(element.getAttribute('height')),y2=this.getYCoord(parseFloat(datapoint-ma.abs(max)))
@@ -64,7 +66,7 @@ var errorbarLine=RG.SVG.create({svg:this.svg,type:'line',parent:this.svg.all,att
64
66
  {for(var i=0,seq=0,len=obj.coords.length;i<len;++i,++seq){var multiplier=(frame/frames)*RG.SVG.FX.getEasingMultiplier(frames,frame)*RG.SVG.FX.getEasingMultiplier(frames,frame);if(typeof data[i]==='number'){height=ma.abs(obj.getYCoord(data[i])-obj.getYCoord(0));obj.data[i]=data[i]*multiplier;height=multiplier*height;obj.coords[seq].element.setAttribute('height',height);obj.coords[seq].element.setAttribute('y',data[i]<0?obj.getYCoord(0):obj.getYCoord(0)-height);if(prop.variant==='3d'){if(obj.coords[i].element.rgraph_3d_side_face[0].parentNode)obj.coords[i].element.rgraph_3d_side_face[0].parentNode.removeChild(obj.coords[i].element.rgraph_3d_side_face[0]);if(obj.coords[i].element.rgraph_3d_side_face[1].parentNode)obj.coords[i].element.rgraph_3d_side_face[1].parentNode.removeChild(obj.coords[i].element.rgraph_3d_side_face[1]);if(obj.coords[i].element.rgraph_3d_top_face[0].parentNode)obj.coords[i].element.rgraph_3d_top_face[0].parentNode.removeChild(obj.coords[i].element.rgraph_3d_top_face[0]);if(obj.coords[i].element.rgraph_3d_top_face[1].parentNode)obj.coords[i].element.rgraph_3d_top_face[1].parentNode.removeChild(obj.coords[i].element.rgraph_3d_top_face[1]);obj.drawSide3dFace({rect:obj.coords[i].element});if(prop.grouping==='grouped'){obj.drawTop3dFace({rect:obj.coords[i].element});}
65
67
  if(obj.coords[i].element.parentNode){var parent=obj.coords[i].element.parentNode;var node=parent.removeChild(obj.coords[i].element);parent.appendChild(node);}}}else if(typeof data[i]==='object'){var accumulativeHeight=0;for(var j=0,len2=data[i].length;j<len2;++j,++seq){height=ma.abs(obj.getYCoord(data[i][j])-obj.getYCoord(0));height=multiplier*height;obj.data[i][j]=data[i][j]*multiplier;height=ma.round(height);obj.coords[seq].element.setAttribute('height',height);obj.coords[seq].element.setAttribute('y',data[i][j]<0?(obj.getYCoord(0)+accumulativeHeight):(obj.getYCoord(0)-height-accumulativeHeight));if(prop.variant==='3d'){if(obj.coords[seq].element.rgraph_3d_side_face[0].parentNode)obj.coords[seq].element.rgraph_3d_side_face[0].parentNode.removeChild(obj.coords[seq].element.rgraph_3d_side_face[0]);if(obj.coords[seq].element.rgraph_3d_side_face[1].parentNode)obj.coords[seq].element.rgraph_3d_side_face[1].parentNode.removeChild(obj.coords[seq].element.rgraph_3d_side_face[1]);if(obj.coords[seq].element.rgraph_3d_top_face[0].parentNode)obj.coords[seq].element.rgraph_3d_top_face[0].parentNode.removeChild(obj.coords[seq].element.rgraph_3d_top_face[0]);if(obj.coords[seq].element.rgraph_3d_top_face[1].parentNode)obj.coords[seq].element.rgraph_3d_top_face[1].parentNode.removeChild(obj.coords[seq].element.rgraph_3d_top_face[1]);obj.drawSide3dFace({rect:obj.coords[seq].element});obj.drawTop3dFace({rect:obj.coords[seq].element});if(obj.coords[seq].element.parentNode){var parent=obj.coords[seq].element.parentNode;var node=parent.removeChild(obj.coords[seq].element);parent.appendChild(node);}}
66
68
  accumulativeHeight+=(prop.grouping==='stacked'?height:0);}
67
- if(obj.stackedBackfaces[i]){obj.stackedBackfaces[i].setAttribute('height',accumulativeHeight);obj.stackedBackfaces[i].setAttribute('y',obj.height-prop.gutterBottom-accumulativeHeight);}
69
+ if(obj.stackedBackfaces[i]){obj.stackedBackfaces[i].setAttribute('height',accumulativeHeight);obj.stackedBackfaces[i].setAttribute('y',obj.height-prop.marginBottom-accumulativeHeight);}
68
70
  --seq;}}
69
71
  if(frame++<frames){RG.SVG.FX.update(iterate);}else if(opt.callback){(opt.callback)(obj);}};iterate();return this;};this.wave=function()
70
72
  {this.draw();var obj=this,opt=arguments[0]||{};opt.frames=opt.frames||60;opt.startFrames=[];opt.counters=[];var framesperbar=opt.frames/3,frame=-1,callback=opt.callback||function(){};for(var i=0,len=this.coords.length;i<len;i+=1){opt.startFrames[i]=((opt.frames/2)/(obj.coords.length-1))*i;opt.counters[i]=0;this.coords[i].element.setAttribute('height',0);if(this.coords[i].element.rgraph_3d_side_face){var parent=this.coords[i].element.rgraph_3d_side_face[0].parentNode;parent.removeChild(this.coords[i].element.rgraph_3d_side_face[0]);parent.removeChild(this.coords[i].element.rgraph_3d_side_face[1]);parent.removeChild(this.coords[i].element.rgraph_3d_top_face[0]);parent.removeChild(this.coords[i].element.rgraph_3d_top_face[1]);}}
@@ -2,45 +2,46 @@
2
2
  RGraph=window.RGraph||{isRGraph:true};RGraph.SVG=RGraph.SVG||{};(function(win,doc,undefined)
3
3
  {var RG=RGraph,ua=navigator.userAgent,ma=Math,win=window,doc=document;RG.SVG.Bipolar=function(conf)
4
4
  {this.set=function(name,value)
5
- {if(arguments.length===1&&typeof name==='object'){for(i in arguments[0]){if(typeof i==='string'){var ret=RG.SVG.commonSetter({object:this,name:i,value:arguments[0][i]});name=ret.name;value=ret.value;this.set(name,value);}}}else{var ret=RG.SVG.commonSetter({object:this,name:name,value:value});name=ret.name;value=ret.value;this.properties[name]=value;if(name==='colors'){this.originalColors=RG.SVG.arrayClone(value);this.colorsParsed=false;}}
6
- return this;};this.id=conf.id;this.uid=RG.SVG.createUID();this.container=document.getElementById(this.id);this.layers={};this.svg=RG.SVG.createSVG({object:this,container:this.container});this.isRGraph=true;this.data=[conf.left,conf.right];this.left=conf.left;this.right=conf.right;this.type='bipolar';this.coords=[];this.coordsLeft=[];this.coordsRight=[];this.coords2=[];this.coords2Left=[];this.coords2Right=[];this.stackedBackfacesLeft=[];this.stackedBackfacesRight=[];this.originalColors={};this.gradientCounter=1;this.sequentialIndex=0;RG.SVG.OR.add(this);this.container.style.display='inline-block';this.properties={gutterLeft:35,gutterRight:35,gutterTop:35,gutterBottom:35,gutterCenter:null,backgroundColor:null,backgroundGrid:true,backgroundGridColor:'#ddd',backgroundGridLinewidth:1,backgroundGridHlines:true,backgroundGridHlinesCount:null,backgroundGridVlines:true,backgroundGridVlinesCount:null,backgroundGridBorder:true,backgroundGridDashed:false,backgroundGridDotted:false,backgroundGridDashArray:null,xaxis:true,xaxisLinewidth:1,xaxisTickmarks:true,xaxisTickmarksLength:5,xaxisLabelsCount:5,xaxisLabelsPositionEdgeTickmarksCount:5,xaxisColor:'black',xaxisLabelsOffsetx:0,xaxisLabelsOffsety:0,xaxisUnitsPre:'',xaxisUnitsPost:'',xaxisStrict:false,xaxisDecimals:0,xaxisPoint:'.',xaxisThousand:',',xaxisRound:false,xaxisMax:null,xaxisMin:0,xaxisFormatter:null,xaxisTextFont:null,xaxisTextSize:null,xaxisTextBold:null,xaxisTextItalic:null,xaxisTextColor:null,yaxis:true,yaxisTickmarks:true,yaxisTickmarksLength:5,yaxisColor:'black',yaxisScale:false,yaxisLabels:null,yaxisLabelsOffsetx:0,yaxisLabelsOffsety:0,yaxisTextFont:null,yaxisTextSize:null,yaxisTextBold:null,yaxisTextItalic:null,yaxisTextColor:null,colors:['red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black','red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black'],colorsSequential:false,strokestyle:'rgba(0,0,0,0)',vmargin:3,vmarginGrouped:2,labelsAbove:false,labelsAboveFont:null,labelsAboveSize:null,labelsAboveBold:null,labelsAboveItalic:null,labelsAboveColor:null,labelsAboveBackground:null,labelsAboveBackgroundPadding:0,labelsAboveUnitsPre:null,labelsAboveUnitsPost:null,labelsAbovePoint:null,labelsAboveThousand:null,labelsAboveFormatter:null,labelsAboveDecimals:null,labelsAboveOffsetx:0,labelsAboveOffsety:0,labelsAboveSpecific:null,textColor:'black',textFont:'sans-serif',textSize:12,textBold:false,textItalic:false,linewidth:1,grouping:'grouped',tooltips:null,tooltipsOverride:null,tooltipsEffect:'fade',tooltipsCssClass:'RGraph_tooltip',tooltipsEvent:'click',highlightStroke:'rgba(0,0,0,0)',highlightFill:'rgba(255,255,255,0.7)',highlightLinewidth:1,title:'',titleSize:16,titleX:null,titleY:null,titleHalign:'center',titleValign:null,titleColor:'black',titleFont:null,titleBold:false,titleItalic:false,titleSubtitle:null,titleSubtitleSize:10,titleSubtitleX:null,titleSubtitleY:null,titleSubtitleHalign:'center',titleSubtitleValign:null,titleSubtitleColor:'#aaa',titleSubtitleFont:null,titleSubtitleBold:false,titleSubtitleItalic:false,shadow:false,shadowOffsetx:2,shadowOffsety:2,shadowBlur:2,shadowOpacity:0.25,key:null,keyColors:null,keyOffsetx:0,keyOffsety:0,keyTextOffsetx:0,keyTextOffsety:-1,keyTextSize:null,keyTextBold:null,keyTextItalic:null,keyTextFont:null};RG.SVG.getGlobals(this);if(RG.SVG.FX&&typeof RG.SVG.FX.decorate==='function'){RG.SVG.FX.decorate(this);}
5
+ {if(arguments.length===1&&typeof name==='object'){for(i in arguments[0]){if(typeof i==='string'){name=ret.name;value=ret.value;this.set(name,value);}}}else{var ret=RG.SVG.commonSetter({object:this,name:name,value:value});name=ret.name;value=ret.value;this.properties[name]=value;if(name==='colors'){this.originalColors=RG.SVG.arrayClone(value);this.colorsParsed=false;}}
6
+ return this;};this.get=function(name)
7
+ {return this.properties[name];};this.id=conf.id;this.uid=RG.SVG.createUID();this.container=document.getElementById(this.id);this.layers={};this.svg=RG.SVG.createSVG({object:this,container:this.container});this.isRGraph=true;this.data=[conf.left,conf.right];this.left=conf.left;this.right=conf.right;this.type='bipolar';this.coords=[];this.coordsLeft=[];this.coordsRight=[];this.coords2=[];this.coords2Left=[];this.coords2Right=[];this.stackedBackfacesLeft=[];this.stackedBackfacesRight=[];this.originalColors={};this.gradientCounter=1;this.sequentialIndex=0;this.propertyNameAliases={};RG.SVG.OR.add(this);this.container.style.display='inline-block';this.properties={marginLeft:35,marginRight:35,marginTop:35,marginBottom:35,marginCenter:null,backgroundColor:null,backgroundGrid:true,backgroundGridColor:'#ddd',backgroundGridLinewidth:1,backgroundGridHlines:true,backgroundGridHlinesCount:null,backgroundGridVlines:true,backgroundGridVlinesCount:null,backgroundGridBorder:true,backgroundGridDashed:false,backgroundGridDotted:false,backgroundGridDashArray:null,xaxis:true,xaxisLinewidth:1,xaxisTickmarks:true,xaxisTickmarksLength:5,xaxisLabelsCount:5,xaxisLabelsPositionEdgeTickmarksCount:5,xaxisColor:'black',xaxisLabelsOffsetx:0,xaxisLabelsOffsety:0,xaxisLabelsFont:null,xaxisLabelsSize:null,xaxisLabelsBold:null,xaxisLabelsItalic:null,xaxisLabelsColor:null,xaxisScaleUnitsPre:'',xaxisScaleUnitsPost:'',xaxisScaleStrict:false,xaxisScaleDecimals:0,xaxisScalePoint:'.',xaxisScaleThousand:',',xaxisScaleRound:false,xaxisScaleMax:null,xaxisScaleMin:0,xaxisScaleFormatter:null,yaxis:true,yaxisTickmarks:true,yaxisTickmarksLength:5,yaxisColor:'black',yaxisScale:false,yaxisLabels:null,yaxisLabelsOffsetx:0,yaxisLabelsOffsety:0,yaxisLabelsFont:null,yaxisLabelsSize:null,yaxisLabelsBold:null,yaxisLabelsItalic:null,yaxisLabelsColor:null,colors:['red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black','red','#0f0','#00f','#ff0','#0ff','#0f0','pink','orange','gray','black'],colorsSequential:false,colorsStroke:'rgba(0,0,0,0)',vmargin:3,vmarginGrouped:2,labelsAbove:false,labelsAboveFont:null,labelsAboveSize:null,labelsAboveBold:null,labelsAboveItalic:null,labelsAboveColor:null,labelsAboveBackground:null,labelsAboveBackgroundPadding:0,labelsAboveUnitsPre:null,labelsAboveUnitsPost:null,labelsAbovePoint:null,labelsAboveThousand:null,labelsAboveFormatter:null,labelsAboveDecimals:null,labelsAboveOffsetx:0,labelsAboveOffsety:0,labelsAboveSpecific:null,textColor:'black',textFont:'Arial, Verdana, sans-serif',textSize:12,textBold:false,textItalic:false,linewidth:1,grouping:'grouped',tooltips:null,tooltipsOverride:null,tooltipsEffect:'fade',tooltipsCssClass:'RGraph_tooltip',tooltipsEvent:'click',highlightStroke:'rgba(0,0,0,0)',highlightFill:'rgba(255,255,255,0.7)',highlightLinewidth:1,title:'',titleX:null,titleY:null,titleHalign:'center',titleValign:null,titleSize:null,titleColor:null,titleFont:null,titleBold:null,titleItalic:null,titleSubtitle:null,titleSubtitleX:null,titleSubtitleY:null,titleSubtitleHalign:'center',titleSubtitleValign:null,titleSubtitleColor:'#aaa',titleSubtitleSize:null,titleSubtitleFont:null,titleSubtitleBold:null,titleSubtitleItalic:null,shadow:false,shadowOffsetx:2,shadowOffsety:2,shadowBlur:2,shadowOpacity:0.25,key:null,keyColors:null,keyOffsetx:0,keyOffsety:0,keyLabelsOffsetx:0,keyLabelsOffsety:-1,keyLabelsSize:null,keyLabelsBold:null,keyLabelsItalic:null,keyLabelsFont:null,keyLabelsColor:null};RG.SVG.getGlobals(this);if(RG.SVG.FX&&typeof RG.SVG.FX.decorate==='function'){RG.SVG.FX.decorate(this);}
7
8
  var prop=this.properties;this.draw=function()
8
- {RG.SVG.fireCustomEvent(this,'onbeforedraw');this.width=Number(this.svg.getAttribute('width'));this.height=Number(this.svg.getAttribute('height'));RG.SVG.createDefs(this);if(typeof prop.gutterCenter!=='number'){prop.gutterCenter=this.getGutterCenter();}
9
- this.coords=[];this.coordsLeft=[];this.coordsRight=[];this.coords2=[];this.coords2Left=[];this.coords2Right=[];this.graphWidth=(this.width-prop.gutterLeft-prop.gutterRight-prop.gutterCenter)/2;this.graphHeight=this.height-prop.gutterTop-prop.gutterBottom;RG.SVG.resetColorsToOriginalValues({object:this});this.parseColors();var values=[];for(var i=0;i<2;++i){for(var j=0,max=0;j<this.data[i].length;++j){if(typeof this.data[i][j]==='number'){values.push(this.data[i][j]);}else if(RG.SVG.isArray(this.data[i][j])&&prop.grouping==='grouped'){values.push(RG.SVG.arrayMax(this.data[i][j]));}else if(RG.SVG.isArray(this.data[i][j])&&prop.grouping==='stacked'){values.push(RG.SVG.arraySum(this.data[i][j]));}}}
10
- var max=RG.SVG.arrayMax(values);if(typeof prop.xaxisMax==='number'){max=prop.xaxisMax;}
11
- this.scale=RG.SVG.getScale({object:this,numlabels:prop.xaxisLabelsCount,unitsPre:prop.xaxisUnitsPre,unitsPost:prop.xaxisUnitsPost,max:max,min:prop.xaxisMin,point:prop.xaxisPoint,round:prop.xaxisRound,thousand:prop.xaxisThousand,decimals:prop.xaxisDecimals,strict:typeof prop.xaxisMax==='number',formatter:prop.xaxisFormatter});this.max=this.scale.max;this.min=this.scale.min;prop.yaxisMax=this.scale.max;prop.yaxisMin=this.scale.min;this.drawBackground(this);this.drawTitle();this.drawBars();this.drawAxes();this.drawLabels()
9
+ {RG.SVG.fireCustomEvent(this,'onbeforedraw');this.width=Number(this.svg.getAttribute('width'));this.height=Number(this.svg.getAttribute('height'));RG.SVG.createDefs(this);if(typeof prop.marginCenter!=='number'){prop.marginCenter=this.getMarginCenter();}
10
+ this.coords=[];this.coordsLeft=[];this.coordsRight=[];this.coords2=[];this.coords2Left=[];this.coords2Right=[];this.graphWidth=(this.width-prop.marginLeft-prop.marginRight-prop.marginCenter)/2;this.graphHeight=this.height-prop.marginTop-prop.marginBottom;RG.SVG.resetColorsToOriginalValues({object:this});this.parseColors();var values=[];for(var i=0;i<2;++i){for(var j=0,max=0;j<this.data[i].length;++j){if(typeof this.data[i][j]==='number'){values.push(this.data[i][j]);}else if(RG.SVG.isArray(this.data[i][j])&&prop.grouping==='grouped'){values.push(RG.SVG.arrayMax(this.data[i][j]));}else if(RG.SVG.isArray(this.data[i][j])&&prop.grouping==='stacked'){values.push(RG.SVG.arraySum(this.data[i][j]));}}}
11
+ var max=RG.SVG.arrayMax(values);if(typeof prop.xaxisScaleMax==='number'){max=prop.xaxisScaleMax;}
12
+ this.scale=RG.SVG.getScale({object:this,numlabels:prop.xaxisLabelsCount,unitsPre:prop.xaxisScaleUnitsPre,unitsPost:prop.xaxisScaleUnitsPost,max:max,min:prop.xaxisScaleMin,point:prop.xaxisScalePoint,round:prop.xaxisScaleRound,thousand:prop.xaxisScaleThousand,decimals:prop.xaxisScaleDecimals,strict:typeof prop.xaxisScaleMax==='number',formatter:prop.xaxisScaleFormatter});this.max=this.scale.max;this.min=this.scale.min;prop.yaxisScaleMax=this.scale.max;prop.yaxisScaleMin=this.scale.min;this.drawBackground(this);this.drawTitle();this.drawBars();this.drawAxes();this.drawLabels()
12
13
  this.drawLabelsAbove();if(typeof prop.key!==null&&RG.SVG.drawKey){RG.SVG.drawKey(this);}else if(!RG.SVG.isNull(prop.key)){alert('The drawKey() function does not exist - have you forgotten to include the key library?');}
13
14
  RG.SVG.fireCustomEvent(this,'ondraw');return this;};this.drawBackground=function()
14
- {var originalGutterRight=prop.gutterRight,originalGutterLeft=prop.gutterLeft;prop.gutterRight=this.width-(prop.gutterLeft+this.graphWidth);if(RG.SVG.isNull(prop.backgroundGridHlinesCount)){var resetToNull=true;prop.backgroundGridHlinesCount=this.left.length;}
15
- var properties=['','Aspect','Opacity','Stretch','X','Y','W','H',];for(i in properties){if(typeof properties[i]==='string'){prop['backgroundImage'+properties[i]]=prop['backgroundImageLeft'+properties[i]];}}
15
+ {var originalMarginRight=prop.marginRight,originalMarginLeft=prop.marginLeft;prop.marginRight=this.width-(prop.marginLeft+this.graphWidth);if(RG.SVG.isNull(prop.backgroundGridHlinesCount)){var resetToNull=true;prop.backgroundGridHlinesCount=this.left.length;}
16
+ var properties=['','Aspect','Opacity','Stretch','X','Y','W','H',];for(i in properties){if(typeof properties[i]==='string'){prop['backgroundImage'+String(properties[i])]=prop['backgroundImageLeft'+properties[i]];}}
16
17
  RG.SVG.drawBackground(this);if(resetToNull){prop.backgroundGridHlinesCount=null;}
17
- prop.gutterRight=originalGutterRight;prop.gutterLeft=this.width-(prop.gutterRight+this.graphWidth);if(RG.SVG.isNull(prop.backgroundGridHlinesCount)){prop.backgroundGridHlinesCount=this.right.length;}
18
+ prop.marginRight=originalMarginRight;prop.marginLeft=this.width-(prop.marginRight+this.graphWidth);if(RG.SVG.isNull(prop.backgroundGridHlinesCount)){prop.backgroundGridHlinesCount=this.right.length;}
18
19
  var properties=['','Aspect','Opacity','Stretch','X','Y','W','H',];for(i in properties){if(typeof properties[i]==='string'){prop['backgroundImage'+properties[i]]=prop['backgroundImageRight'+properties[i]];}}
19
- RG.SVG.drawBackground(this);prop.gutterLeft=originalGutterLeft;prop.gutterRight=originalGutterRight;};this.drawAxes=function()
20
- {if(prop.xaxis){RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.gutterLeft,this.height-prop.gutterBottom,prop.gutterLeft+this.graphWidth,this.height-prop.gutterBottom),'stroke-width':prop.xaxisLinewidth,stroke:prop.xaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges'}});RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(this.width-prop.gutterRight,this.height-prop.gutterBottom,this.width-prop.gutterRight-this.graphWidth,this.height-prop.gutterBottom),'stroke-width':prop.xaxisLinewidth,stroke:prop.xaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges'}});if(prop.xaxisTickmarks){var startY=this.height-prop.gutterBottom,endY=this.height-prop.gutterBottom+prop.xaxisTickmarksLength;for(var i=0;i<prop.xaxisLabelsPositionEdgeTickmarksCount;++i){var x=prop.gutterLeft+(i*(this.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
21
- if(!prop.yaxis){var x=prop.gutterLeft+this.graphWidth;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
22
- for(var i=0;i<prop.xaxisLabelsPositionEdgeTickmarksCount;++i){var x=prop.gutterLeft+prop.gutterCenter+this.graphWidth+((i+1)*(this.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
23
- if(!prop.yaxis){var x=prop.gutterLeft+this.graphWidth+prop.gutterCenter;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}}}
24
- if(prop.yaxis){RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.gutterLeft+this.graphWidth,this.height-prop.gutterBottom,prop.gutterLeft+this.graphWidth,prop.gutterTop),'stroke-width':prop.yaxisLinewidth,stroke:prop.yaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges','stroke-linecap':'square'}});RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.gutterLeft+this.graphWidth+prop.gutterCenter,this.height-prop.gutterBottom,prop.gutterLeft+this.graphWidth+prop.gutterCenter,prop.gutterTop),'stroke-width':prop.yaxisLinewidth,stroke:prop.yaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges','stroke-linecap':'square'}});if(prop.yaxisTickmarks){var startX=prop.gutterLeft+this.graphWidth,endX=prop.gutterLeft+this.graphWidth+prop.yaxisTickmarksLength,numticks=this.left.length;for(var i=0;i<numticks;++i){var y=prop.gutterTop+(i*(this.graphHeight/numticks));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
25
- if(!prop.xaxis){var y=prop.gutterTop+this.graphHeight;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
26
- var startX=prop.gutterLeft+this.graphWidth+prop.gutterCenter,endX=prop.gutterLeft+this.graphWidth+prop.gutterCenter-prop.yaxisTickmarksLength,numticks=this.right.length;for(var i=0;i<numticks;++i){var y=prop.gutterTop+(i*(this.graphHeight/numticks));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
27
- if(!prop.xaxis){var y=prop.gutterTop+this.graphHeight;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}}}};this.drawLabels=function()
20
+ RG.SVG.drawBackground(this);prop.marginLeft=originalMarginLeft;prop.marginRight=originalMarginRight;};this.drawAxes=function()
21
+ {if(prop.xaxis){RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.marginLeft,this.height-prop.marginBottom,prop.marginLeft+this.graphWidth,this.height-prop.marginBottom),'stroke-width':prop.xaxisLinewidth,stroke:prop.xaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges'}});RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(this.width-prop.marginRight,this.height-prop.marginBottom,this.width-prop.marginRight-this.graphWidth,this.height-prop.marginBottom),'stroke-width':prop.xaxisLinewidth,stroke:prop.xaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges'}});if(prop.xaxisTickmarks){var startY=this.height-prop.marginBottom,endY=this.height-prop.marginBottom+prop.xaxisTickmarksLength;for(var i=0;i<prop.xaxisLabelsPositionEdgeTickmarksCount;++i){var x=prop.marginLeft+(i*(this.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
22
+ if(!prop.yaxis){var x=prop.marginLeft+this.graphWidth;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
23
+ for(var i=0;i<prop.xaxisLabelsPositionEdgeTickmarksCount;++i){var x=prop.marginLeft+prop.marginCenter+this.graphWidth+((i+1)*(this.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}
24
+ if(!prop.yaxis){var x=prop.marginLeft+this.graphWidth+prop.marginCenter;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':prop.xaxisLinewidth,'shape-rendering':"crispEdges"}});}}}
25
+ if(prop.yaxis){RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.marginLeft+this.graphWidth,this.height-prop.marginBottom,prop.marginLeft+this.graphWidth,prop.marginTop),'stroke-width':prop.yaxisLinewidth,stroke:prop.yaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges','stroke-linecap':'square'}});RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(prop.marginLeft+this.graphWidth+prop.marginCenter,this.height-prop.marginBottom,prop.marginLeft+this.graphWidth+prop.marginCenter,prop.marginTop),'stroke-width':prop.yaxisLinewidth,stroke:prop.yaxisColor,fill:'rgba(0,0,0,0)','shape-rendering':'crispEdges','stroke-linecap':'square'}});if(prop.yaxisTickmarks){var startX=prop.marginLeft+this.graphWidth,endX=prop.marginLeft+this.graphWidth+prop.yaxisTickmarksLength,numticks=this.left.length;for(var i=0;i<numticks;++i){var y=prop.marginTop+(i*(this.graphHeight/numticks));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
26
+ if(!prop.xaxis){var y=prop.marginTop+this.graphHeight;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
27
+ var startX=prop.marginLeft+this.graphWidth+prop.marginCenter,endX=prop.marginLeft+this.graphWidth+prop.marginCenter-prop.yaxisTickmarksLength,numticks=this.right.length;for(var i=0;i<numticks;++i){var y=prop.marginTop+(i*(this.graphHeight/numticks));RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}
28
+ if(!prop.xaxis){var y=prop.marginTop+this.graphHeight;RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX+0.001,y,endX,y),stroke:prop.yaxisColor,'stroke-width':prop.yaxisLinewidth,'shape-rendering':"crispEdges"}});}}}};this.drawLabels=function()
28
29
  {var numlabels=prop.yaxisLabels?prop.yaxisLabels.length:5
29
- for(var i=0;i<numlabels;++i){var segment=this.graphHeight/numlabels,y=prop.gutterTop+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety,x=prop.gutterLeft+this.graphWidth+(prop.gutterCenter/2)+prop.yaxisLabelsOffsetx;var text=RG.SVG.text({object:this,parent:this.svg.all,text:prop.yaxisLabels&&prop.yaxisLabels[i]?prop.yaxisLabels[i]:'',x:x,y:y,halign:'center',valign:'center',tag:'labels.yaxis',font:prop.yaxisTextFont||prop.textFont,size:prop.yaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:!RG.SVG.isNull(prop.yaxisTextBold)?prop.yaxisTextBold:prop.textBold,italic:!RG.SVG.isNull(prop.yaxisTextItalic)?prop.yaxisTextItalic:prop.textItalic,color:prop.yaxisTextColor||prop.textColor});}
30
- var segment=this.graphWidth/prop.xaxisLabelsCount;for(var i=0;i<this.scale.labels.length;++i){RG.SVG.text({object:this,parent:this.svg.all,text:this.scale.labels[i],x:prop.gutterLeft+this.graphWidth-(segment*(i+1))+prop.xaxisLabelsOffsetx,y:this.height-prop.gutterBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:typeof prop.xaxisTextBold==='boolean'?prop.xaxisTextBold:prop.textBold,italic:typeof prop.xaxisTextItalic==='boolean'?prop.xaxisTextItalic:prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}
31
- var y=this.height-prop.gutterBottom+10,str=(prop.xaxisUnitsPre+prop.xaxisMin.toFixed(prop.xaxisDecimals).replace(/\./,prop.xaxisPoint)+prop.xaxisUnitsPost);var text=RG.SVG.text({object:this,parent:this.svg.all,text:str,x:prop.gutterLeft+this.graphWidth+prop.xaxisLabelsOffsetx,y:y+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:typeof prop.xaxisTextBold==='boolean'?prop.xaxisTextBold:prop.textBold,italic:typeof prop.xaxisTextItalic==='boolean'?prop.xaxisTextItalic:prop.textItalic,color:prop.xaxisTextColor||prop.textColor});for(var i=0;i<this.scale.labels.length;++i){RG.SVG.text({object:this,parent:this.svg.all,text:this.scale.labels[i],x:prop.gutterLeft+this.graphWidth+prop.gutterCenter+(segment*(i+1))+prop.xaxisLabelsOffsetx,y:this.height-prop.gutterBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:typeof prop.xaxisTextBold==='boolean'?prop.xaxisTextBold:prop.textBold,italic:typeof prop.xaxisTextItalic==='boolean'?prop.xaxisTextItalic:prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}
32
- var text=RG.SVG.text({object:this,parent:this.svg.all,text:prop.xaxisUnitsPre+prop.xaxisMin.toFixed(prop.xaxisDecimals).replace(/\./,prop.xaxisPoint)+prop.xaxisUnitsPost,x:prop.gutterLeft+this.graphWidth+prop.gutterCenter+prop.xaxisLabelsOffsetx,y:this.height-prop.gutterBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:typeof prop.xaxisTextBold==='boolean'?prop.xaxisTextBold:prop.textBold,italic:typeof prop.xaxisTextItalic==='boolean'?prop.xaxisTextItalic:prop.textItalic,color:prop.xaxisTextColor||prop.textColor});};this.drawBars=function()
30
+ for(var i=0;i<numlabels;++i){var segment=this.graphHeight/numlabels,y=prop.marginTop+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety,x=prop.marginLeft+this.graphWidth+(prop.marginCenter/2)+prop.yaxisLabelsOffsetx;var text=RG.SVG.text({object:this,parent:this.svg.all,text:prop.yaxisLabels&&prop.yaxisLabels[i]?prop.yaxisLabels[i]:'',x:x,y:y,halign:'center',valign:'center',tag:'labels.yaxis',font:prop.yaxisLabelsFont||prop.textFont,size:typeof prop.yaxisLabelsSize==='number'?prop.yaxisLabelsSize:prop.textSize,bold:typeof prop.yaxisLabelsBold==='boolean'?prop.yaxisLabelsBold:prop.textBold,italic:typeof prop.yaxisLabelsItalic==='boolean'?prop.yaxisLabelsItalic:prop.textItalic,color:prop.yaxisLabelsColor||prop.textColor});}
31
+ var segment=this.graphWidth/prop.xaxisLabelsCount;for(var i=0;i<this.scale.labels.length;++i){RG.SVG.text({object:this,parent:this.svg.all,text:this.scale.labels[i],x:prop.marginLeft+this.graphWidth-(segment*(i+1))+prop.xaxisLabelsOffsetx,y:this.height-prop.marginBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}
32
+ var y=this.height-prop.marginBottom+10,str=(prop.xaxisScaleUnitsPre+prop.xaxisScaleMin.toFixed(prop.xaxisScaleDecimals).replace(/\./,prop.xaxisScalePoint)+prop.xaxisScaleUnitsPost);var text=RG.SVG.text({object:this,parent:this.svg.all,text:str,x:prop.marginLeft+this.graphWidth+prop.xaxisLabelsOffsetx,y:y+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});for(var i=0;i<this.scale.labels.length;++i){RG.SVG.text({object:this,parent:this.svg.all,text:this.scale.labels[i],x:prop.marginLeft+this.graphWidth+prop.marginCenter+(segment*(i+1))+prop.xaxisLabelsOffsetx,y:this.height-prop.marginBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}
33
+ var text=RG.SVG.text({object:this,parent:this.svg.all,text:prop.xaxisScaleUnitsPre+prop.xaxisScaleMin.toFixed(prop.xaxisScaleDecimals).replace(/\./,prop.xaxisScalePoint)+prop.xaxisScaleUnitsPost,x:prop.marginLeft+this.graphWidth+prop.marginCenter+prop.xaxisLabelsOffsetx,y:this.height-prop.marginBottom+10+prop.xaxisLabelsOffsety,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});};this.drawBars=function()
33
34
  {if(prop.shadow){RG.SVG.setShadow({object:this,offsetx:prop.shadowOffsetx,offsety:prop.shadowOffsety,blur:prop.shadowBlur,opacity:prop.shadowOpacity,id:'dropShadow'});}
34
- for(var i=0;i<this.left.length;++i){if(typeof this.left[i]==='number'){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.gutterTop+((this.graphHeight/this.left.length)*i)+prop.vmargin,width=this.getWidth(this.left[i]),x=prop.gutterLeft+this.graphWidth-width,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[0],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}else if(RG.SVG.isArray(this.left[i])&&prop.grouping==='stacked'){var accWidth=0;for(var j=0;j<this.left[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.gutterTop+((this.graphHeight/this.left.length)*i)+prop.vmargin,width=this.getWidth(this.left[i][j]),accWidth=accWidth+width,x=prop.gutterLeft+this.graphWidth-accWidth,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;if(j===0&&prop.shadow){var shadowBackfaceX=prop.gutterLeft+this.graphWidth-this.getWidth(RG.SVG.arraySum(this.left[i])),shadowBackfaceWidth=this.getWidth(RG.SVG.arraySum(this.left[i]));var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'#eee',x:shadowBackfaceX,y:y,width:shadowBackfaceWidth,height:height,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfacesLeft[i]=rect;}
35
- var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i][j]}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
35
+ for(var i=0;i<this.left.length;++i){if(typeof this.left[i]==='number'){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.marginTop+((this.graphHeight/this.left.length)*i)+prop.vmargin,width=this.getWidth(this.left[i]),x=prop.marginLeft+this.graphWidth-width,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[0],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}else if(RG.SVG.isArray(this.left[i])&&prop.grouping==='stacked'){var accWidth=0;for(var j=0;j<this.left[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.marginTop+((this.graphHeight/this.left.length)*i)+prop.vmargin,width=this.getWidth(this.left[i][j]),accWidth=accWidth+width,x=prop.marginLeft+this.graphWidth-accWidth,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;if(j===0&&prop.shadow){var shadowBackfaceX=prop.marginLeft+this.graphWidth-this.getWidth(RG.SVG.arraySum(this.left[i])),shadowBackfaceWidth=this.getWidth(RG.SVG.arraySum(this.left[i]));var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'#eee',x:shadowBackfaceX,y:y,width:shadowBackfaceWidth,height:height,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfacesLeft[i]=rect;}
36
+ var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i][j]}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
36
37
  if(!this.coords2Left[i]){this.coords2Left[i]=[];}
37
- this.coords2[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Left[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}else if(RG.SVG.isArray(this.left[i])&&prop.grouping==='grouped'){for(var j=0;j<this.left[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],height=((this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin-(prop.vmarginGrouped*(this.left[i].length-1)))/this.left[i].length,y=prop.gutterTop+((this.graphHeight/this.left.length)*i)+prop.vmargin+(height*j)+(j*prop.vmarginGrouped),width=this.getWidth(this.left[i][j]),x=prop.gutterLeft+this.graphWidth-width;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i][j],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
38
+ this.coords2[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Left[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}else if(RG.SVG.isArray(this.left[i])&&prop.grouping==='grouped'){for(var j=0;j<this.left[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],height=((this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin-(prop.vmarginGrouped*(this.left[i].length-1)))/this.left[i].length,y=prop.marginTop+((this.graphHeight/this.left.length)*i)+prop.vmargin+(height*j)+(j*prop.vmarginGrouped),width=this.getWidth(this.left[i][j]),x=prop.marginLeft+this.graphWidth-width;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.left[i][j],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsLeft.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i]){this.coords2[i]=[];}
38
39
  if(!this.coords2Left[i]){this.coords2Left[i]=[];}
39
40
  this.coords2[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Left[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}}
40
- for(var i=0;i<this.right.length;++i){if(typeof this.right[i]==='number'){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.gutterTop+((this.graphHeight/this.right.length)*i)+prop.vmargin,width=this.getWidth(this.right[i]),x=prop.gutterLeft+this.graphWidth+prop.gutterCenter,height=(this.graphHeight/this.right.length)-prop.vmargin-prop.vmargin;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[0],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}else if(RG.SVG.isArray(this.right[i])&&prop.grouping==='stacked'){var accWidth=0;for(var j=0;j<this.right[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.gutterTop+((this.graphHeight/this.right.length)*i)+prop.vmargin,width=this.getWidth(this.right[i][j]),x=prop.gutterLeft+this.graphWidth+prop.gutterCenter+accWidth,accWidth=accWidth+width,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;if(j===0&&prop.shadow){var shadowBackfaceX=prop.gutterLeft+this.graphWidth+prop.gutterCenter,shadowBackfaceWidth=this.getWidth(RG.SVG.arraySum(this.right[i]));var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'#eee',x:shadowBackfaceX,y:y,width:shadowBackfaceWidth,height:height,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfacesRight[i]=rect;}
41
- var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i][j]}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i+this.left.length]){this.coords2[i+this.left.length]=[];}
41
+ for(var i=0;i<this.right.length;++i){if(typeof this.right[i]==='number'){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.marginTop+((this.graphHeight/this.right.length)*i)+prop.vmargin,width=this.getWidth(this.right[i]),x=prop.marginLeft+this.graphWidth+prop.marginCenter,height=(this.graphHeight/this.right.length)-prop.vmargin-prop.vmargin;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[0],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}else if(RG.SVG.isArray(this.right[i])&&prop.grouping==='stacked'){var accWidth=0;for(var j=0;j<this.right[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],y=prop.marginTop+((this.graphHeight/this.right.length)*i)+prop.vmargin,width=this.getWidth(this.right[i][j]),x=prop.marginLeft+this.graphWidth+prop.marginCenter+accWidth,accWidth=accWidth+width,height=(this.graphHeight/this.left.length)-prop.vmargin-prop.vmargin;if(j===0&&prop.shadow){var shadowBackfaceX=prop.marginLeft+this.graphWidth+prop.marginCenter,shadowBackfaceWidth=this.getWidth(RG.SVG.arraySum(this.right[i]));var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{fill:'#eee',x:shadowBackfaceX,y:y,width:shadowBackfaceWidth,height:height,'stroke-width':0,'data-index':i,filter:'url(#dropShadow)'}});this.stackedBackfacesRight[i]=rect;}
42
+ var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i][j]}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i+this.left.length]){this.coords2[i+this.left.length]=[];}
42
43
  if(!this.coords2Right[i]){this.coords2Right[i]=[];}
43
- this.coords2[i+this.left.length].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Right[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}else if(RG.SVG.isArray(this.right[i])&&prop.grouping==='grouped'){for(var j=0;j<this.right[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],height=((this.graphHeight/this.right.length)-prop.vmargin-prop.vmargin-(prop.vmarginGrouped*(this.right[i].length-1)))/this.right[i].length,y=prop.gutterTop+((this.graphHeight/this.right.length)*i)+prop.vmargin+(height*j)+(j*prop.vmarginGrouped),width=this.getWidth(this.right[i][j]),x=prop.gutterLeft+this.graphWidth+prop.gutterCenter;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.strokestyle,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i][j],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i+this.left.length]){this.coords2[i+this.left.length]=[];}
44
+ this.coords2[i+this.left.length].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Right[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}else if(RG.SVG.isArray(this.right[i])&&prop.grouping==='grouped'){for(var j=0;j<this.right[i].length;++j){var color=prop.colors[this.sequentialIndex],tooltip=RG.SVG.isNull(prop.tooltips)?null:prop.tooltips[this.sequentialIndex],height=((this.graphHeight/this.right.length)-prop.vmargin-prop.vmargin-(prop.vmarginGrouped*(this.right[i].length-1)))/this.right[i].length,y=prop.marginTop+((this.graphHeight/this.right.length)*i)+prop.vmargin+(height*j)+(j*prop.vmarginGrouped),width=this.getWidth(this.right[i][j]),x=prop.marginLeft+this.graphWidth+prop.marginCenter;var rect=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{x:x,y:y,width:width,height:height,fill:prop.colorsSequential?prop.colors[this.sequentialIndex]:prop.colors[j],stroke:prop.colorsStroke,'stroke-width':prop.linewidth,'shape-rendering':'crispEdges','data-original-x':x,'data-original-y':y,'data-original-width':width,'data-original-height':height,'data-tooltop':(tooltip||''),'data-index':i,'data-subindex':j,'data-sequential-index':this.sequentialIndex,'data-value':this.right[i][j],filter:prop.shadow?'url(#dropShadow)':''}});this.coords.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coordsRight.push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});if(!this.coords2[i+this.left.length]){this.coords2[i+this.left.length]=[];}
44
45
  if(!this.coords2Right[i]){this.coords2Right[i]=[];}
45
46
  this.coords2[i+this.left.length].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.coords2Right[i].push({object:this,element:rect,x:parseFloat(rect.getAttribute('x')),y:parseFloat(rect.getAttribute('y')),width:parseFloat(rect.getAttribute('width')),height:parseFloat(rect.getAttribute('height'))});this.installTooltipsEventListeners({rect:rect,index:i,sequentialIndex:this.sequentialIndex});this.sequentialIndex++;}}}};this.installTooltipsEventListeners=function(opt)
46
47
  {var obj=this;if(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips[this.sequentialIndex]){(function(idx,seq)
@@ -51,32 +52,34 @@ this.coords2[i+this.left.length].push({object:this,element:rect,x:parseFloat(rec
51
52
  return x1-x2;};this.getLeftXCoord=function(value)
52
53
  {var width;if(value>this.scale.max){return null;}
53
54
  if(value<this.scale.min){return null;}
54
- width=((value-this.scale.min)/(this.scale.max-this.scale.min));width*=this.graphWidth;var x=prop.gutterLeft+this.graphWidth-width;return x;};this.getRightXCoord=function(value)
55
+ width=((value-this.scale.min)/(this.scale.max-this.scale.min));width*=this.graphWidth;var x=prop.marginLeft+this.graphWidth-width;return x;};this.getRightXCoord=function(value)
55
56
  {var width;if(value>this.scale.max){return null;}
56
57
  if(value<this.scale.min){return null;}
57
- width=((value-this.scale.min)/(this.scale.max-this.scale.min));width*=this.graphWidth;var x=prop.gutterLeft+this.graphWidth+prop.gutterCenter+width;return x;};this.highlight=function(rect)
58
+ width=((value-this.scale.min)/(this.scale.max-this.scale.min));width*=this.graphWidth;var x=prop.marginLeft+this.graphWidth+prop.marginCenter+width;return x;};this.highlight=function(rect)
58
59
  {var x=parseInt(rect.getAttribute('x')),y=parseInt(rect.getAttribute('y')),width=parseInt(rect.getAttribute('width')),height=parseInt(rect.getAttribute('height'));var highlight=RG.SVG.create({svg:this.svg,parent:this.svg.all,type:'rect',attr:{stroke:prop.highlightStroke,fill:prop.highlightFill,x:x-1,y:y-1,width:width+2,height:height+2},style:{pointerEvents:'none'}});RG.SVG.REG.set('highlight',highlight);};this.parseColors=function()
59
60
  {if(!Object.keys(this.originalColors).length){this.originalColors={colors:RG.SVG.arrayClone(prop.colors),backgroundGridColor:RG.SVG.arrayClone(prop.backgroundGridColor),highlightFill:RG.SVG.arrayClone(prop.highlightFill),backgroundColor:RG.SVG.arrayClone(prop.backgroundColor)}}
60
61
  var colors=prop.colors;if(colors){for(var i=0;i<colors.length;++i){colors[i]=RG.SVG.parseColorLinear({object:this,color:colors[i],direction:'horizontal'});}}
61
62
  prop.backgroundGridColor=RG.SVG.parseColorLinear({object:this,color:prop.backgroundGridColor,direction:'horizontal'});prop.highlightFill=RG.SVG.parseColorLinear({object:this,color:prop.highlightFill,direction:'horizontal'});prop.backgroundColor=RG.SVG.parseColorLinear({object:this,color:prop.backgroundColor,direction:'horizontal'});};this.drawLabelsAbove=function()
62
- {if(prop.labelsAbove){for(var dataset=0,seq=0;dataset<this.data.length;++dataset,++seq){for(var i=0;i<this.data[dataset].length;++i,++seq){var value=this.data[dataset][i],halign=dataset===0?'right':'left',valign='center',hoffset=dataset===0?-10:10;if(typeof value==='number'){var x=parseInt(this.coords[seq].element.getAttribute('x'))+hoffset+prop.labelsAboveOffsetx,height=parseInt(this.coords[seq].element.getAttribute('height')),y=parseInt(this.coords[seq].element.getAttribute('y'))+(height/2)+prop.labelsAboveOffsety,width=parseInt(this.coords[seq].element.getAttribute('width'));if(dataset===1){x+=width;}
63
- var str=RG.SVG.numberFormat({object:this,num:value.toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=parseStr(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
64
- RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:prop.labelsAboveSize||prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});}else if(typeof value==='object'&&prop.grouping==='stacked'){for(var k=0,sum=0,width=0;k<this.coords2[i].length;++k){sum+=parseFloat(this.coords2[i][k].element.getAttribute('data-value'));}
65
- var len=this.coords2[i].length;if(dataset===0){var x=parseFloat(this.coords2[i][len-1].x)+hoffset,height=parseFloat(this.coords2[i][len-1].height),y=parseFloat(this.coords2[i][0].y)+(height/2);}else{var x=parseFloat(this.coords2[this.data[0].length+i][0].x)+hoffset+prop.labelsAboveOffsetx,height=parseFloat(this.coords2[i][len-1].height),y=parseFloat(this.coords2[i][0].y)+(height/2)+prop.labelsAboveOffsety;for(var j=0;j<this.coords2Right[i].length;++j){x+=this.coords2Right[i][j].width;}}
66
- var str=RG.SVG.numberFormat({object:this,num:sum.toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=parseStr(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
67
- RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:prop.labelsAboveSize||prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});}else if(typeof value==='object'&&prop.grouping==='grouped'){for(var k=0;k<value.length;++k){val=value[k];var x=parseInt(this.coords[seq].element.getAttribute('x'))+hoffset+prop.labelsAboveOffsetx,height=parseInt(this.coords[seq].element.getAttribute('height')),y=parseInt(this.coords[seq].element.getAttribute('y'))+(height/2)+prop.labelsAboveOffsety,width=parseInt(this.coords[seq].element.getAttribute('width'));if(dataset===1){x+=width;}
68
- var str=RG.SVG.numberFormat({object:this,num:parseFloat(val).toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=parseStr(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
69
- RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:prop.labelsAboveSize||prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});seq++;}
70
- seq--;}}
63
+ {if(prop.labelsAbove){for(var dataset=0,seq=0;dataset<this.data.length;++dataset,++seq){for(var i=0;i<this.data[dataset].length;++i,++seq){var value=this.data[dataset][i],halign=dataset===0?'right':'left',valign='center',hoffset=dataset===0?-10:10;if(typeof value==='number'){if(this.coords[seq]){var x=parseInt(this.coords[seq].element.getAttribute('x'))+hoffset+prop.labelsAboveOffsetx;var height=parseInt(this.coords[seq].element.getAttribute('height'));var y=parseInt(this.coords[seq].element.getAttribute('y'))+(height/2)+prop.labelsAboveOffsety;var width=parseInt(this.coords[seq].element.getAttribute('width'));if(dataset===1){x+=width;}
64
+ var str=RG.SVG.numberFormat({object:this,num:value.toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=String(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
65
+ RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:typeof prop.labelsAboveSize==='number'?prop.labelsAboveSize:prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});}}else if(!RG.SVG.isNull(value)&&typeof value==='object'&&prop.grouping==='stacked'){for(var k=0,sum=0,width=0;k<this.coords2[seq].length;++k){sum+=parseFloat(this.coords2[seq][k].element.getAttribute('data-value'));}
66
+ var len=this.coords2[seq].length;if(dataset===0){var x=parseFloat(this.coords2[seq][len-1].x)+hoffset,height=parseFloat(this.coords2[seq][len-1].height),y=parseFloat(this.coords2[seq][0].y)+(height/2);}else{var x=parseFloat(this.coords2[this.data[0].length+i][0].x)+hoffset+prop.labelsAboveOffsetx,height=parseFloat(this.coords2[seq][len-1].height),y=parseFloat(this.coords2[seq][0].y)+(height/2)+prop.labelsAboveOffsety;for(var j=0;j<this.coords2Right[i].length;++j){x+=this.coords2Right[i][j].width;}}
67
+ var str=RG.SVG.numberFormat({object:this,num:sum.toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=String(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
68
+ RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:typeof prop.labelsAboveSize==='number'?prop.labelsAboveSize:prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});}else if(!RG.SVG.isNull(value)&&typeof value==='object'&&prop.grouping==='grouped'){for(var k=0;k<value.length;++k){val=value[k];if(typeof val!=='number'){val='';}
69
+ var x=parseInt(this.coords[seq].element.getAttribute('x'))+hoffset+prop.labelsAboveOffsetx,height=parseInt(this.coords[seq].element.getAttribute('height')),y=parseInt(this.coords[seq].element.getAttribute('y'))+(height/2)+prop.labelsAboveOffsety,width=parseInt(this.coords[seq].element.getAttribute('width'));if(dataset===1){x+=width;}
70
+ var str=RG.SVG.numberFormat({object:this,num:parseFloat(val).toFixed(prop.labelsAboveDecimals),prepend:typeof prop.labelsAboveUnitsPre==='string'?prop.labelsAboveUnitsPre:null,append:typeof prop.labelsAboveUnitsPost==='string'?prop.labelsAboveUnitsPost:null,point:typeof prop.labelsAbovePoint==='string'?prop.labelsAbovePoint:null,thousand:typeof prop.labelsAboveThousand==='string'?prop.labelsAboveThousand:null,formatter:typeof prop.labelsAboveFormatter==='function'?prop.labelsAboveFormatter:null});if(val===0||RG.SVG.isNull(val)||val===''){str='';}
71
+ if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&(typeof prop.labelsAboveSpecific[seq]==='string'||typeof prop.labelsAboveSpecific[seq]==='number')){str=String(prop.labelsAboveSpecific[seq]);}else if(prop.labelsAboveSpecific&&prop.labelsAboveSpecific.length&&typeof prop.labelsAboveSpecific[seq]!=='string'&&typeof prop.labelsAboveSpecific[seq]!=='number'){continue;}
72
+ RG.SVG.text({object:this,parent:this.svg.all,text:str,x:x,y:y,halign:halign,valign:valign,tag:'labels.above',font:prop.labelsAboveFont||prop.textFont,size:typeof prop.labelsAboveSize==='number'?prop.labelsAboveSize:prop.textSize,bold:typeof prop.labelsAboveBold==='boolean'?prop.labelsAboveBold:prop.textBold,italic:typeof prop.labelsAboveItalic==='boolean'?prop.labelsAboveItalic:prop.textItalic,color:prop.labelsAboveColor||prop.textColor,background:prop.labelsAboveBackground,padding:prop.labelsAboveBackgroundPadding});seq++;}
73
+ seq--;}else if(RG.SVG.isNull(value)){--seq;}}
71
74
  --seq;}}};this.on=function(type,func)
72
75
  {if(type.substr(0,2)!=='on'){type='on'+type;}
73
76
  RG.SVG.addCustomEventListener(this,type,func);return this;};this.exec=function(func)
74
77
  {func(this);return this;};this.removeHighlight=function()
75
78
  {var highlight=RG.SVG.REG.get('highlight');if(highlight&&highlight.parentNode){highlight.parentNode.removeChild(highlight);}
76
- RG.SVG.REG.set('highlight',null);};this.getGutterCenter=function()
77
- {var bold=typeof prop.yaxisTextBold==='boolean'?prop.yaxisTextBold:prop.textBold,font=typeof prop.yaxisTextFont==='string'?prop.yaxisTextFont:prop.textFont,size=typeof prop.yaxisTextSize==='number'?prop.yaxisTextSize:prop.textSize,width=0;if(prop.yaxisLabels){for(var i=0,len=prop.yaxisLabels.length;i<len;++i){width=ma.max(width,RG.SVG.measureText({text:prop.yaxisLabels[i],bold:bold,font:font,size:size})[0]);}}else{var width=50;}
79
+ RG.SVG.REG.set('highlight',null);};this.getMarginCenter=this.getGutterCenter=function()
80
+ {var bold=typeof prop.yaxisLabelsBold==='boolean'?prop.yaxisLabelsBold:prop.textBold,font=typeof prop.yaxisLabelsFont==='string'?prop.yaxisLabelsFont:prop.textFont,size=typeof prop.yaxisLabelsSize==='number'?prop.yaxisLabelsSize:prop.textSize,width=0;if(prop.yaxisLabels){for(var i=0,len=prop.yaxisLabels.length;i<len;++i){width=ma.max(width,RG.SVG.measureText({text:prop.yaxisLabels[i],bold:bold,font:font,size:size})[0]);}}else{var width=50;}
78
81
  return width+15;};this.drawTitle=function()
79
- {if(RG.SVG.isNull(prop.titleX)){prop.titleX=((this.width-prop.gutterLeft-prop.gutterRight)/2)+prop.gutterLeft;}
82
+ {if(RG.SVG.isNull(prop.titleX)){prop.titleX=((this.width-prop.marginLeft-prop.marginRight)/2)+prop.marginLeft;}
80
83
  RG.SVG.drawTitle(this);};this.grow=function()
81
84
  {var opt=arguments[0]||{},frames=opt.frames||30,frame=0,obj=this,left=RG.SVG.arrayClone(this.left),right=RG.SVG.arrayClone(this.right),seq=0;this.draw();var iterate=function()
82
85
  {for(var i=0,seq=0,len=obj.coordsLeft.length;i<len;++i,++seq){var multiplier=(frame/frames)*RG.SVG.FX.getEasingMultiplier(frames,frame)*RG.SVG.FX.getEasingMultiplier(frames,frame);if(typeof left[i]==='number'){width=ma.abs(obj.getLeftXCoord(left[i])-obj.getLeftXCoord(0));left[i]=obj.left[i]*multiplier;obj.coordsLeft[i].element.setAttribute('width',width);obj.coords[seq].element.setAttribute('x',obj.getLeftXCoord(0)-width);}else if(typeof left[i]==='object'&&prop.grouping==='stacked'){var accumulativeWidth=0;for(var j=0,len2=left[i].length;j<len2;++j,++seq){width=ma.abs(obj.getLeftXCoord(left[i][j])-obj.getLeftXCoord(0));left[i][j]=obj.left[i][j]*multiplier;obj.coords[seq].element.setAttribute('width',width);obj.coords[seq].element.setAttribute('x',obj.getLeftXCoord(0)-width-accumulativeWidth);accumulativeWidth+=(prop.grouping==='stacked'?width:0);}
@@ -90,14 +93,14 @@ if(obj.stackedBackfacesRight[i]){obj.stackedBackfacesRight[i].setAttribute('widt
90
93
  if(frame++<=frames){RG.SVG.FX.update(iterate);}else if(opt.callback){(opt.callback)(obj);}};iterate();return this;};this.wave=function()
91
94
  {var obj=this,opt=arguments[0]||{},frames=opt.frames||120,startFrames_left=[],startFrames_right=[],counters_left=[],counters_right=[];var framesperbar=frames/3,frame_left=-1,frame_right=-1,callback=arguments[1]||function(){},original_left=RG.SVG.arrayClone(this.left),original_right=RG.SVG.arrayClone(this.right);for(var i=0,len=this.left.length,seq=0;i<len;i+=1,++seq){startFrames_left[seq]=((frames/3)/(RG.SVG.arrayLinearize(this.left).length-1))*i;startFrames_right[seq]=((frames/3)/(RG.SVG.arrayLinearize(this.right).length-1))*i;counters_left[seq]=0;counters_right[seq]=0;if(RG.SVG.isArray(this.left[i])){for(var j=0;j<this.left[i].length;++j,seq++){startFrames_left[seq]=((frames/3)/(RG.SVG.arrayLinearize(this.left).length-1))*seq;startFrames_right[seq]=((frames/3)/(RG.SVG.arrayLinearize(this.right).length-1))*seq;counters_left[seq]=0;counters_right[seq]=0;}
92
95
  --seq;}}
93
- this.draw();for(var i=0,len=this.left.length;i<len;i+=1){if(typeof this.left[i]==='number'){this.left[i]=0;this.right[i]=0;this.coordsLeft[i].element.setAttribute('width',0);this.coordsRight[i].element.setAttribute('width',0);}else if(typeof this.left[i]==='object'&&!RG.SVG.isNull(this.left[i])){for(var j=0;j<this.left[i].length;++j){this.left[i][j]=0;this.right[i][j]=0;this.coords2Left[i][j].element.setAttribute('width',0);this.coords2Right[i][j].element.setAttribute('width',0);}}}
96
+ this.draw();for(var i=0,len=this.left.length;i<len;i+=1){if(typeof this.left[i]==='number'){this.left[i]=0;this.right[i]=0;if(this.coordsLeft[i]&&this.coordsLeft[i].element)this.coordsLeft[i].element.setAttribute('width',0);if(this.coordsRight[i]&&this.coordsRight[i].element)this.coordsRight[i].element.setAttribute('width',0);}else if(typeof this.left[i]==='object'&&!RG.SVG.isNull(this.left[i])){for(var j=0;j<this.left[i].length;++j){this.left[i][j]=0;this.right[i][j]=0;this.coords2Left[i][j].element.setAttribute('width',0);this.coords2Right[i][j].element.setAttribute('width',0);}}}
94
97
  function iteratorLeft()
95
- {++frame_left;for(var i=0,len=obj.left.length,seq=0;i<len;i+=1,seq+=1){if(frame_left>=startFrames_left[seq]){var isNull=RG.SVG.isNull(obj.left[i]);if(typeof obj.left[i]==='number'){obj.left[i]=ma.min(ma.abs(original_left[i]),ma.abs(original_left[i]*((counters_left[i]++)/framesperbar)));var rect_left=obj.coords[i].element;rect_left.setAttribute('width',parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i]/rect_left.getAttribute('data-value')));rect_left.setAttribute('x',obj.properties.gutterLeft+obj.graphWidth-(parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i]/rect_left.getAttribute('data-value'))));}else if(RG.SVG.isArray(obj.left[i])){for(var j=0,accWidth=0;j<obj.left[i].length;++j,++seq){obj.left[i][j]=ma.min(ma.abs(original_left[i][j]),ma.abs(original_left[i][j]*((counters_left[seq]++)/framesperbar)));var rect_left=obj.coords[seq].element;rect_left.setAttribute('width',parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i][j]/rect_left.getAttribute('data-value')));rect_left.setAttribute('x',obj.properties.gutterLeft+obj.graphWidth-(parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i][j]/rect_left.getAttribute('data-value')))-accWidth);if(obj.properties.grouping==='stacked'){accWidth+=parseFloat(rect_left.getAttribute('width'));}}
98
+ {++frame_left;for(var i=0,len=obj.left.length,seq=0;i<len;i+=1,seq+=1){if(frame_left>=startFrames_left[seq]){var isNull=RG.SVG.isNull(obj.left[i]);if(typeof obj.left[i]==='number'){obj.left[i]=ma.min(ma.abs(original_left[i]),ma.abs(original_left[i]*((counters_left[i]++)/framesperbar)));var rect_left=obj.coords[i].element;rect_left.setAttribute('width',parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i]/rect_left.getAttribute('data-value')));rect_left.setAttribute('x',obj.properties.marginLeft+obj.graphWidth-(parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i]/rect_left.getAttribute('data-value'))));}else if(RG.SVG.isArray(obj.left[i])){for(var j=0,accWidth=0;j<obj.left[i].length;++j,++seq){obj.left[i][j]=ma.min(ma.abs(original_left[i][j]),ma.abs(original_left[i][j]*((counters_left[seq]++)/framesperbar)));var rect_left=obj.coords[seq].element;rect_left.setAttribute('width',parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i][j]/rect_left.getAttribute('data-value')));rect_left.setAttribute('x',obj.properties.marginLeft+obj.graphWidth-(parseFloat(rect_left.getAttribute('data-original-width'))*(obj.left[i][j]/rect_left.getAttribute('data-value')))-accWidth);if(obj.properties.grouping==='stacked'){accWidth+=parseFloat(rect_left.getAttribute('width'));}}
96
99
  seq--;}
97
100
  if(isNull){obj.left[i]=null;}}else{obj.left[i]=typeof obj.left[i]==='object'&&obj.left[i]?RG.SVG.arrayPad([],obj.left[i].length,0):(RG.SVG.isNull(obj.left[i])?null:0);}}
98
101
  if(frame_left<=frames){RG.SVG.FX.update(iteratorLeft);}}
99
102
  function iteratorRight()
100
- {++frame_right;for(var i=0,len=obj.right.length,seq=0;i<len;i+=1,seq+=1){if(frame_right>=startFrames_right[seq]){var isNull=RG.SVG.isNull(obj.right[i]);if(typeof obj.right[i]==='number'){obj.right[i]=ma.min(ma.abs(original_right[i]),ma.abs(original_right[i]*((counters_right[i]++)/framesperbar)));var rect_right=obj.coords[i+obj.left.length].element;rect_right.setAttribute('width',parseFloat(rect_right.getAttribute('data-original-width'))*(obj.right[i]/rect_right.getAttribute('data-value')));rect_right.setAttribute('x',obj.properties.gutterLeft+obj.graphWidth+prop.gutterCenter);}else if(RG.SVG.isArray(obj.right[i])){for(var j=0,accWidth=0;j<obj.right[i].length;++j,++seq){obj.right[i][j]=ma.min(ma.abs(original_right[i][j]),ma.abs(original_right[i][j]*((counters_right[seq]++)/framesperbar)));var rect_right=obj.coordsRight[seq].element;rect_right.setAttribute('width',parseFloat(rect_right.getAttribute('data-original-width'))*(obj.right[i][j]/rect_right.getAttribute('data-value')));rect_right.setAttribute('x',obj.properties.gutterLeft+obj.graphWidth+prop.gutterCenter+accWidth);if(obj.properties.grouping==='stacked'){accWidth+=parseFloat(rect_right.getAttribute('width'));}}
103
+ {++frame_right;for(var i=0,len=obj.right.length,seq=0;i<len;i+=1,seq+=1){if(frame_right>=startFrames_right[seq]){var isNull=RG.SVG.isNull(obj.right[i]);if(typeof obj.right[i]==='number'){obj.right[i]=ma.min(ma.abs(original_right[i]),ma.abs(original_right[i]*((counters_right[i]++)/framesperbar)));var rect_right=obj.coords[i+obj.left.length].element;rect_right.setAttribute('width',parseFloat(rect_right.getAttribute('data-original-width'))*(obj.right[i]/rect_right.getAttribute('data-value')));rect_right.setAttribute('x',obj.properties.marginLeft+obj.graphWidth+prop.marginCenter);}else if(RG.SVG.isArray(obj.right[i])){for(var j=0,accWidth=0;j<obj.right[i].length;++j,++seq){obj.right[i][j]=ma.min(ma.abs(original_right[i][j]),ma.abs(original_right[i][j]*((counters_right[seq]++)/framesperbar)));var rect_right=obj.coordsRight[seq].element;rect_right.setAttribute('width',parseFloat(rect_right.getAttribute('data-original-width'))*(obj.right[i][j]/rect_right.getAttribute('data-value')));rect_right.setAttribute('x',obj.properties.marginLeft+obj.graphWidth+prop.marginCenter+accWidth);if(obj.properties.grouping==='stacked'){accWidth+=parseFloat(rect_right.getAttribute('width'));}}
101
104
  seq--;}
102
105
  if(isNull){obj.right[i]=null;}}else{obj.right[i]=typeof obj.right[i]==='object'&&obj.right[i]?RG.SVG.arrayPad([],obj.right[i].length,0):(RG.SVG.isNull(obj.right[i])?null:0);}}
103
106
  if(frame_right<=frames){RG.SVG.FX.update(iteratorRight);}else{}}
@@ -1,6 +1,6 @@
1
1
 
2
2
  RGraph=window.RGraph||{isRGraph:true,isRGraphSVG:true};RGraph.SVG=RGraph.SVG||{};RGraph.SVG.FX=RGraph.SVG.FX||{};(function(win,doc,undefined)
3
- {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.SVG.REG={store:[]};RG.SVG.OR={objects:[]};RG.SVG.TRIG={};RG.SVG.TRIG.HALFPI=ma.PI*.4999;RG.SVG.TRIG.PI=RG.SVG.TRIG.HALFPI*2;RG.SVG.TRIG.TWOPI=RG.SVG.TRIG.PI*2;RG.SVG.ISIE=ua.indexOf('rident')>0;RG.SVG.ISFF=ua.indexOf('irefox')>0;RG.SVG.events=[];RG.SVG.GLOBALS={};RG.SVG.ISFF=ua.indexOf('Firefox')!=-1;RG.SVG.ISOPERA=ua.indexOf('Opera')!=-1;RG.SVG.ISCHROME=ua.indexOf('Chrome')!=-1;RG.SVG.ISSAFARI=ua.indexOf('Safari')!=-1&&!RG.ISCHROME;RG.SVG.ISWEBKIT=ua.indexOf('WebKit')!=-1;RG.SVG.ISIE=ua.indexOf('Trident')>0||navigator.userAgent.indexOf('MSIE')>0;RG.SVG.ISIE6=ua.indexOf('MSIE 6')>0;RG.SVG.ISIE7=ua.indexOf('MSIE 7')>0;RG.SVG.ISIE8=ua.indexOf('MSIE 8')>0;RG.SVG.ISIE9=ua.indexOf('MSIE 9')>0;RG.SVG.ISIE10=ua.indexOf('MSIE 10')>0;RG.SVG.ISIE11UP=ua.indexOf('MSIE')==-1&&ua.indexOf('Trident')>0;RG.SVG.ISIE10UP=RG.SVG.ISIE10||RG.SVG.ISIE11UP;RG.SVG.ISIE9UP=RG.SVG.ISIE9||RG.SVG.ISIE10UP;RG.SVG.createSVG=function(opt)
3
+ {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.SVG.REG={store:[]};RG.SVG.OR={objects:[]};RG.SVG.TRIG={};RG.SVG.TRIG.HALFPI=ma.PI*.4999;RG.SVG.TRIG.PI=RG.SVG.TRIG.HALFPI*2;RG.SVG.TRIG.TWOPI=RG.SVG.TRIG.PI*2;RG.SVG.ISIE=ua.indexOf('rident')>0;RG.SVG.ISFF=ua.indexOf('irefox')>0;RG.SVG.events=[];RG.SVG.GLOBALS={};RG.SVG.ISFF=ua.indexOf('Firefox')!=-1;RG.SVG.ISOPERA=ua.indexOf('Opera')!=-1;RG.SVG.ISCHROME=ua.indexOf('Chrome')!=-1;RG.SVG.ISSAFARI=ua.indexOf('Safari')!=-1&&!RG.SVG.ISCHROME;RG.SVG.ISWEBKIT=ua.indexOf('WebKit')!=-1;RG.SVG.ISIE=ua.indexOf('Trident')>0||navigator.userAgent.indexOf('MSIE')>0;RG.SVG.ISIE6=ua.indexOf('MSIE 6')>0;RG.SVG.ISIE7=ua.indexOf('MSIE 7')>0;RG.SVG.ISIE8=ua.indexOf('MSIE 8')>0;RG.SVG.ISIE9=ua.indexOf('MSIE 9')>0;RG.SVG.ISIE10=ua.indexOf('MSIE 10')>0;RG.SVG.ISIE11UP=ua.indexOf('MSIE')==-1&&ua.indexOf('Trident')>0;RG.SVG.ISIE10UP=RG.SVG.ISIE10||RG.SVG.ISIE11UP;RG.SVG.ISIE9UP=RG.SVG.ISIE9||RG.SVG.ISIE10UP;RG.SVG.createSVG=function(opt)
4
4
  {var container=opt.container,obj=opt.object;if(container.__svg__){return container.__svg__;}
5
5
  var svg=doc.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute('style','top: 0; left: 0; position: absolute');svg.setAttribute('width',container.offsetWidth);svg.setAttribute('height',container.offsetHeight);svg.setAttribute('version','1.1');svg.setAttributeNS("http://www.w3.org/2000/xmlns/",'xmlns','http://www.w3.org/2000/svg');svg.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");svg.__object__=obj;svg.__container__=container;container.appendChild(svg);container.__svg__=svg;container.__object__=obj;var style=getComputedStyle(container);if(style.position!=='absolute'&&style.position!=='fixed'&&style.position!=='sticky'){container.style.position='relative';}
6
6
  var numLayers=10;for(var i=1;i<=numLayers;++i){var group=RG.SVG.create({svg:svg,type:'g',attr:{className:'background'+i}});obj.layers['background'+i]=group;svg['background'+i]=group;}
@@ -8,55 +8,56 @@ var group=RG.SVG.create({svg:svg,type:'g',attr:{className:'all-elements'}});cont
8
8
  {if(!obj.svg.defs){var defs=RG.SVG.create({svg:obj.svg,type:'defs'});obj.svg.defs=defs;}
9
9
  return defs;};RG.SVG.create=function(opt)
10
10
  {var ns="http://www.w3.org/2000/svg",tag=doc.createElementNS(ns,opt.type);for(var o in opt.attr){if(typeof o==='string'){var name=o;if(o==='className'){name='class';}
11
- if((opt.type==='a'||opt.type==='image')&&o==='xlink:href'){tag.setAttributeNS('http://www.w3.org/1999/xlink',o,String(opt.attr[o]));}else{tag.setAttribute(name,String(opt.attr[o]));}}}
11
+ if((opt.type==='a'||opt.type==='image')&&o==='xlink:href'){tag.setAttributeNS('http://www.w3.org/1999/xlink',o,String(opt.attr[o]));}else{if(RG.SVG.isNull(opt.attr[o])){opt.attr[o]='';}
12
+ tag.setAttribute(name,String(opt.attr[o]));}}}
12
13
  for(var o in opt.style){if(typeof o==='string'){tag.style[o]=String(opt.style[o]);}}
13
14
  if(opt.parent){opt.parent.appendChild(tag);}else{opt.svg.appendChild(tag);}
14
15
  return tag;};RG.SVG.getMouseXY=function(e)
15
16
  {if(!e.target){return;}
16
17
  var el=e.target,offsetX=0,offsetY=0,x,y;if(typeof el.offsetParent!=='undefined'){do{offsetX+=el.offsetLeft;offsetY+=el.offsetTop;}while((el=el.offsetParent));}
17
18
  x=e.pageX;y=e.pageY;x-=(2*(parseInt(document.body.style.borderLeftWidth)||0));y-=(2*(parseInt(document.body.style.borderTopWidth)||0));return[x,y];};RG.SVG.drawXAxis=function(obj)
18
- {var prop=obj.properties;if(prop.xaxis){var y=obj.type==='hbar'?obj.height-prop.gutterBottom:obj.getYCoord(obj.scale.min<0&&obj.scale.max<0?obj.scale.max:(obj.scale.min>0&&obj.scale.max>0?obj.scale.min:0));var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.gutterLeft,y,obj.width-prop.gutterRight,y),fill:prop.xaxisColor,stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':'crispEdges','stroke-linecap':'square'}});if(obj.type==='hbar'){var width=obj.graphWidth/obj.data.length,x=prop.gutterLeft,startY=(obj.height-prop.gutterBottom),endY=(obj.height-prop.gutterBottom)+prop.xaxisTickmarksLength;}else{var width=obj.graphWidth/obj.data.length,x=prop.gutterLeft,startY=obj.getYCoord(0)-(prop.yaxisMin<0?prop.xaxisTickmarksLength:0),endY=obj.getYCoord(0)+prop.xaxisTickmarksLength;if(obj.scale.min<0&&obj.scale.max<=0){startY=prop.gutterTop;endY=prop.gutterTop-prop.xaxisTickmarksLength;}
19
+ {var prop=obj.properties;if(prop.xaxis){var y=obj.type==='hbar'?obj.height-prop.marginBottom:obj.getYCoord(obj.scale.min<0&&obj.scale.max<0?obj.scale.max:(obj.scale.min>0&&obj.scale.max>0?obj.scale.min:0));var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.marginLeft,y,obj.width-prop.marginRight,y),fill:prop.xaxisColor,stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':'crispEdges','stroke-linecap':'square'}});if(obj.type==='hbar'){var width=obj.graphWidth/obj.data.length,x=prop.marginLeft,startY=(obj.height-prop.marginBottom),endY=(obj.height-prop.marginBottom)+prop.xaxisTickmarksLength;}else{var width=obj.graphWidth/obj.data.length,x=prop.marginLeft,startY=obj.getYCoord(0)-(prop.yaxisScaleMin<0?prop.xaxisTickmarksLength:0),endY=obj.getYCoord(0)+prop.xaxisTickmarksLength;if(obj.scale.min<0&&obj.scale.max<=0){startY=prop.marginTop;endY=prop.marginTop-prop.xaxisTickmarksLength;}
19
20
  if(obj.scale.min>0&&obj.scale.max>0){startY=obj.getYCoord(obj.scale.min);endY=obj.getYCoord(obj.scale.min)+prop.xaxisTickmarksLength;}}
20
- if(prop.xaxisTickmarks){if(prop.xaxisScale){for(var i=0;i<(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'?prop.xaxisLabelsPositionEdgeTickmarksCount:(obj.scale.numlabels+(prop.yaxis&&prop.xaxisMin===0?0:1)));++i){if(obj.type==='hbar'){var dataPoints=obj.data.length;}
21
- x=prop.gutterLeft+((i+(prop.yaxis&&prop.xaxisMin===0?1:0))*(obj.graphWidth/obj.scale.numlabels));if(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'){dataPoints=prop.xaxisLabelsPositionEdgeTickmarksCount;var gap=(obj.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount);x=(gap*i)+prop.gutterLeft+gap;}
21
+ if(prop.xaxisTickmarks){if(prop.xaxisScale){for(var i=0;i<(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'?prop.xaxisLabelsPositionEdgeTickmarksCount:(obj.scale.numlabels+(prop.yaxis&&prop.xaxisScaleMin===0?0:1)));++i){if(obj.type==='hbar'){var dataPoints=obj.data.length;}
22
+ x=prop.marginLeft+((i+(prop.yaxis&&prop.xaxisScaleMin===0?1:0))*(obj.graphWidth/obj.scale.numlabels));if(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'){dataPoints=prop.xaxisLabelsPositionEdgeTickmarksCount;var gap=(obj.graphWidth/prop.xaxisLabelsPositionEdgeTickmarksCount);x=(gap*i)+prop.marginLeft+gap;}
22
23
  RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}else{if(prop.xaxisLabelsPosition==='section'){if(obj.type==='bar'||obj.type==='waterfall'){var dataPoints=obj.data.length;}else if(obj.type==='line'){var dataPoints=obj.data[0].length;}else if(obj.type==='scatter'){var dataPoints=prop.xaxisLabels?prop.xaxisLabels.length:10;}
23
24
  if(typeof prop.xaxisLabelsPositionSectionTickmarksCount==='number'){dataPoints=prop.xaxisLabelsPositionSectionTickmarksCount;}
24
- for(var i=0;i<dataPoints;++i){x=prop.gutterLeft+((i+1)*(obj.graphWidth/dataPoints));RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}else if(prop.xaxisLabelsPosition==='edge'){if(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'){var len=prop.xaxisLabelsPositionEdgeTickmarksCount;}else{var len=obj.data&&obj.data[0]&&obj.data[0].length?obj.data[0].length:0;}
25
- for(var i=0;i<len;++i){var gap=((obj.graphWidth)/(len-1)),x=prop.gutterLeft+((i+1)*gap);RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}
26
- if(prop.yaxis===false){RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.gutterLeft+0.001,startY,prop.gutterLeft,endY),stroke:obj.properties.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges",parent:obj.svg.all,}});}}}
27
- if(prop.xaxisScale){if(obj.type==='scatter'){obj.xscale=RG.SVG.getScale({object:obj,numlabels:prop.xaxisLabelsCount,unitsPre:prop.xaxisUnitsPre,unitsPost:prop.xaxisUnitsPost,max:prop.xaxisMax,min:prop.xaxisMin,point:prop.xaxisPoint,round:prop.xaxisRound,thousand:prop.xaxisThousand,decimals:prop.xaxisDecimals,strict:typeof prop.xaxisMax==='number',formatter:prop.xaxisFormatter});var segment=obj.graphWidth/prop.xaxisLabelsCount
28
- for(var i=0;i<obj.xscale.labels.length;++i){var x=prop.gutterLeft+(segment*i)+segment+prop.xaxisLabelsOffsetx;var y=(obj.height-prop.gutterBottom)+(prop.xaxis?prop.xaxisTickmarksLength+6:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.xscale.labels[i],x:x,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.xaxisTextBold||prop.textBold,italic:prop.xaxisTextItalic||prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}
29
- if(prop.xaxisLabelsCount>0){var y=obj.height-prop.gutterBottom+prop.xaxisLabelsOffsety+(prop.xaxis?prop.xaxisTickmarksLength+6:10),str=RG.SVG.numberFormat({object:obj,num:prop.xaxisMin.toFixed(prop.xaxisDecimals),prepend:prop.xaxisUnitsPre,append:prop.xaxisUnitsPost,point:prop.xaxisPoint,thousand:prop.xaxisThousand,formatter:prop.xaxisFormatter});var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.xaxisFormatter==='function'?(prop.xaxisFormatter)(this,prop.xaxisMin):str,x:prop.gutterLeft+prop.xaxisLabelsOffsetx,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.xaxisTextBold||prop.textBold,italic:prop.xaxisTextItalic||prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}}else{var segment=obj.graphWidth/prop.xaxisLabelsCount,scale=obj.scale;for(var i=0;i<scale.labels.length;++i){var x=prop.gutterLeft+(segment*i)+segment+prop.xaxisLabelsOffsetx;var y=(obj.height-prop.gutterBottom)+(prop.xaxis?prop.xaxisTickmarksLength+6:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.scale.labels[i],x:x,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.xaxisTextBold||prop.textBold,italic:prop.xaxisTextItalic||prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}
30
- if(prop.xaxisLabelsCount>0){var y=obj.height-prop.gutterBottom+prop.xaxisLabelsOffsety+(prop.xaxis?prop.xaxisTickmarksLength+6:10),str=RG.SVG.numberFormat({object:obj,num:prop.xaxisMin.toFixed(prop.xaxisDecimals),prepend:prop.xaxisUnitsPre,append:prop.xaxisUnitsPost,point:prop.xaxisPoint,thousand:prop.xaxisThousand,formatter:prop.xaxisFormatter});var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.xaxisFormatter==='function'?(prop.xaxisFormatter)(this,prop.xaxisMin):str,x:prop.gutterLeft+prop.xaxisLabelsOffsetx,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisTextFont||prop.textFont,size:prop.xaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.xaxisTextBold||prop.textBold,italic:prop.xaxisTextItalic||prop.textItalic,color:prop.xaxisTextColor||prop.textColor});}}}else{if(typeof prop.xaxisLabels==='object'&&!RG.SVG.isNull(prop.xaxisLabels)){var angle=prop.xaxisTextAngle;if(prop.xaxisLabelsPosition==='section'){var segment=(obj.width-prop.gutterLeft-prop.gutterRight)/prop.xaxisLabels.length;for(var i=0;i<prop.xaxisLabels.length;++i){var x=prop.gutterLeft+(segment/2)+(i*segment);if(obj.scale.max<=0&&obj.scale.min<obj.scale.max){var y=prop.gutterTop-(RG.SVG.ISFF?5:10)-(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;var valign='bottom';}else{var y=obj.height-prop.gutterBottom+(RG.SVG.ISFF?5:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;var valign='top';}
31
- RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.xaxisLabels[i],x:x+prop.xaxisLabelsOffsetx,y:y,valign:(typeof angle==='number'&&angle)?'center':valign,halign:(typeof angle==='number'&&angle)?'right':'center',angle:angle,tag:'labels.xaxis',size:prop.xaxisTextSize||prop.textSize,italic:prop.xaxisTextItalic||prop.textItalic,font:prop.xaxisTextFont||prop.textFont,bold:prop.xaxisTextBold||prop.textBold,color:prop.xaxisTextColor||prop.textColor});}}else if(prop.xaxisLabelsPosition==='edge'){if(obj.type==='line'){var hmargin=prop.hmargin;}else{var hmargin=0;}
32
- var segment=(obj.graphWidth-hmargin-hmargin)/(prop.xaxisLabels.length-1);for(var i=0;i<prop.xaxisLabels.length;++i){var x=prop.gutterLeft+(i*segment)+hmargin;if(obj.scale.max<=0&&obj.scale.min<0){valign='bottom';y=prop.gutterTop-(RG.SVG.ISFF?5:10)-(prop.xaxisTickmarksLength-5)-(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety}else{valign='top';y=obj.height-prop.gutterBottom+(RG.SVG.ISFF?5:10)+(prop.xaxisTickmarksLength-5)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;}
33
- RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.xaxisLabels[i],x:x+prop.xaxisLabelsOffsetx,y:y,valign:(typeof angle==='number'&&angle)?'center':valign,halign:(typeof angle==='number'&&angle)?'right':'center',angle:angle,tag:'labels.xaxis',size:prop.xaxisTextSize||prop.textSize,italic:prop.xaxisTextItalic||prop.textItalic,font:prop.xaxisTextFont||prop.textFont,bold:prop.xaxisTextBold||prop.textBold,color:prop.xaxisTextColor||prop.textColor});}}}}};RG.SVG.drawYAxis=function(obj)
34
- {var prop=obj.properties;if(prop.yaxis){if(obj.type==='hbar'){var x=obj.getXCoord(prop.xaxisMin>0?prop.xaxisMin:0);if(prop.xaxisMin<0&&prop.xaxisMax<=0){x=obj.getXCoord(prop.xaxisMax);}}else{var x=prop.gutterLeft;}
35
- var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x,prop.gutterTop,x,obj.height-prop.gutterBottom),stroke:prop.yaxisColor,fill:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges",'stroke-linecap':'square'}});if(obj.type==='hbar'){var height=(obj.graphHeight-prop.vmarginTop-prop.vmarginBottom)/prop.yaxisLabels.length,y=prop.gutterTop+prop.vmarginTop,len=prop.yaxisLabels.length,startX=obj.getXCoord(0)+(prop.xaxisMin<0?prop.yaxisTickmarksLength:0),endX=obj.getXCoord(0)-prop.yaxisTickmarksLength;if(prop.xaxisMin<0&&prop.xaxisMax<=0){startX=obj.getXCoord(prop.xaxisMax);endX=obj.getXCoord(prop.xaxisMax)+5;}
25
+ for(var i=0;i<dataPoints;++i){x=prop.marginLeft+(prop.hmarginLeft||0)+((i+1)*((obj.graphWidth-(prop.hmarginLeft||0)-(prop.hmarginRight||0))/dataPoints));RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}else if(prop.xaxisLabelsPosition==='edge'){if(typeof prop.xaxisLabelsPositionEdgeTickmarksCount==='number'){var len=prop.xaxisLabelsPositionEdgeTickmarksCount;}else{var len=obj.data&&obj.data[0]&&obj.data[0].length?obj.data[0].length:0;}
26
+ for(var i=0;i<len;++i){var gap=((obj.graphWidth)/(len-1)),x=prop.marginLeft+((i+1)*gap);RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x+0.001,startY,x,endY),stroke:prop.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}
27
+ if(prop.yaxis===false||(prop.hmarginLeft||0)>0){RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.marginLeft+(prop.hmarginLeft||0)+0.001,startY,prop.marginLeft+(prop.hmarginLeft||0),endY),stroke:obj.properties.xaxisColor,'stroke-width':typeof prop.xaxisLinewidth==='number'?prop.xaxisLinewidth:1,'shape-rendering':"crispEdges",parent:obj.svg.all,}});}}}
28
+ if(prop.xaxisScale){if(obj.type==='scatter'){obj.xscale=RG.SVG.getScale({object:obj,numlabels:prop.xaxisLabelsCount,unitsPre:prop.xaxisScaleUnitsPre,unitsPost:prop.xaxisScaleUnitsPost,max:prop.xaxisScaleMax,min:prop.xaxisScaleMin,point:prop.xaxisScalePoint,round:prop.xaxisScaleRound,thousand:prop.xaxisScaleThousand,decimals:prop.xaxisScaleDecimals,strict:typeof prop.xaxisScaleMax==='number',formatter:prop.xaxisScaleFormatter});var segment=obj.graphWidth/prop.xaxisLabelsCount
29
+ for(var i=0;i<obj.xscale.labels.length;++i){var x=prop.marginLeft+(segment*i)+segment+prop.xaxisLabelsOffsetx;var y=(obj.height-prop.marginBottom)+(prop.xaxis?prop.xaxisTickmarksLength+6:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.xscale.labels[i],x:x,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}
30
+ if(prop.xaxisLabelsCount>0){var y=obj.height-prop.marginBottom+prop.xaxisLabelsOffsety+(prop.xaxis?prop.xaxisTickmarksLength+6:10),str=RG.SVG.numberFormat({object:obj,num:prop.xaxisScaleMin.toFixed(prop.xaxisScaleDecimals),prepend:prop.xaxisScaleUnitsPre,append:prop.xaxisScaleUnitsPost,point:prop.xaxisScalePoint,thousand:prop.xaxisScaleThousand,formatter:prop.xaxisScaleFormatter});var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.xaxisScaleFormatter==='function'?(prop.xaxisScaleFormatter)(this,prop.xaxisScaleMin):str,x:prop.marginLeft+prop.xaxisLabelsOffsetx,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='number'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}}else{var segment=obj.graphWidth/prop.xaxisLabelsCount,scale=obj.scale;for(var i=0;i<scale.labels.length;++i){var x=prop.marginLeft+(segment*i)+segment+prop.xaxisLabelsOffsetx;var y=(obj.height-prop.marginBottom)+(prop.xaxis?prop.xaxisTickmarksLength+6:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.scale.labels[i],x:x,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}
31
+ if(prop.xaxisLabelsCount>0){var y=obj.height-prop.marginBottom+prop.xaxisLabelsOffsety+(prop.xaxis?prop.xaxisTickmarksLength+6:10),str=RG.SVG.numberFormat({object:obj,num:prop.xaxisScaleMin.toFixed(prop.xaxisScaleDecimals),prepend:prop.xaxisScaleUnitsPre,append:prop.xaxisScaleUnitsPost,point:prop.xaxisScalePoint,thousand:prop.xaxisScaleThousand,formatter:prop.xaxisScaleFormatter});var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.xaxisScaleFormatter==='function'?(prop.xaxisScaleFormatter)(this,prop.xaxisScaleMin):str,x:prop.marginLeft+prop.xaxisLabelsOffsetx,y:y,halign:'center',valign:'top',tag:'labels.xaxis',font:prop.xaxisLabelsFont||prop.textFont,size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,color:prop.xaxisLabelsColor||prop.textColor});}}}else{if(typeof prop.xaxisLabels==='object'&&!RG.SVG.isNull(prop.xaxisLabels)){var angle=prop.xaxisLabelsAngle;if(prop.xaxisLabelsPosition==='section'){var segment=(obj.width-prop.marginLeft-prop.marginRight-(prop.hmarginLeft||0)-(prop.hmarginRight||0))/prop.xaxisLabels.length;for(var i=0;i<prop.xaxisLabels.length;++i){var x=prop.marginLeft+(prop.hmarginLeft||0)+(segment/2)+(i*segment);if(obj.scale.max<=0&&obj.scale.min<obj.scale.max){var y=prop.marginTop-(RG.SVG.ISFF?5:10)-(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;var valign='bottom';}else{var y=obj.height-prop.marginBottom+(RG.SVG.ISFF?5:10)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;var valign='top';}
32
+ RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.xaxisLabels[i],x:x+prop.xaxisLabelsOffsetx,y:y,valign:(typeof angle==='number'&&angle)?'center':valign,halign:(typeof angle==='number'&&angle)?'right':'center',angle:angle,tag:'labels.xaxis',size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,font:prop.xaxisLabelsFont||prop.textFont,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,color:prop.xaxisLabelsColor||prop.textColor});}}else if(prop.xaxisLabelsPosition==='edge'){if(obj.type==='line'){var hmargin=prop.hmargin;}else{var hmargin=0;}
33
+ var segment=(obj.graphWidth-hmargin-hmargin)/(prop.xaxisLabels.length-1);for(var i=0;i<prop.xaxisLabels.length;++i){var x=prop.marginLeft+(i*segment)+hmargin;if(obj.scale.max<=0&&obj.scale.min<0){valign='bottom';y=prop.marginTop-(RG.SVG.ISFF?5:10)-(prop.xaxisTickmarksLength-5)-(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety}else{valign='top';y=obj.height-prop.marginBottom+(RG.SVG.ISFF?5:10)+(prop.xaxisTickmarksLength-5)+(prop.xaxisLinewidth||1)+prop.xaxisLabelsOffsety;}
34
+ RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.xaxisLabels[i],x:x+prop.xaxisLabelsOffsetx,y:y,valign:(typeof angle==='number'&&angle)?'center':valign,halign:(typeof angle==='number'&&angle)?'right':'center',angle:angle,tag:'labels.xaxis',size:typeof prop.xaxisLabelsSize==='number'?prop.xaxisLabelsSize:prop.textSize,italic:typeof prop.xaxisLabelsItalic==='boolean'?prop.xaxisLabelsItalic:prop.textItalic,font:prop.xaxisLabelsFont||prop.textFont,bold:typeof prop.xaxisLabelsBold==='boolean'?prop.xaxisLabelsBold:prop.textBold,color:prop.xaxisLabelsColor||prop.textColor});}}}}};RG.SVG.drawYAxis=function(obj)
35
+ {var prop=obj.properties;if(prop.yaxis){if(obj.type==='hbar'){var x=obj.getXCoord(prop.xaxisScaleMin>0?prop.xaxisScaleMin:0);if(prop.xaxisScaleMin<0&&prop.xaxisScaleMax<=0){x=obj.getXCoord(prop.xaxisScaleMax);}}else{var x=prop.marginLeft;}
36
+ var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(x,prop.marginTop,x,obj.height-prop.marginBottom),stroke:prop.yaxisColor,fill:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges",'stroke-linecap':'square'}});if(obj.type==='hbar'){var height=(obj.graphHeight-prop.vmarginTop-prop.vmarginBottom)/prop.yaxisLabels.length,y=prop.marginTop+prop.vmarginTop,len=prop.yaxisLabels.length,startX=obj.getXCoord(0)+(prop.xaxisScaleMin<0?prop.yaxisTickmarksLength:0),endX=obj.getXCoord(0)-prop.yaxisTickmarksLength;if(prop.xaxisScaleMin<0&&prop.xaxisScaleMax<=0){startX=obj.getXCoord(prop.xaxisScaleMax);endX=obj.getXCoord(prop.xaxisScaleMax)+5;}
36
37
  if(typeof prop.yaxisLabelsPositionSectionTickmarksCount==='number'){len=prop.yaxisLabelsPositionSectionTickmarksCount;height=(obj.graphHeight-prop.vmarginTop-prop.vmarginBottom)/len;}
37
38
  if(prop.yaxisTickmarks){for(var i=0;i<len;++i){var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX,y,endX,y+0.001),stroke:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});y+=height;}
38
- if(prop.xaxis===false){if(obj.type==='hbar'&&prop.xaxisMin<=0&&prop.xaxisMax<0){var startX=obj.getXCoord(prop.xaxisMax);var endX=obj.getXCoord(prop.xaxisMax)+prop.yaxisTickmarksLength;}else{var startX=obj.getXCoord(0)-prop.yaxisTickmarksLength;var endX=obj.getXCoord(0)+(prop.xaxisMin<0?prop.yaxisTickmarksLength:0);}
39
- var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX,ma.round(obj.height-prop.gutterBottom-parseFloat(prop.vmarginBottom)),endX,ma.round(obj.height-prop.gutterBottom-parseFloat(prop.vmarginBottom))),stroke:obj.properties.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}else{var height=obj.graphHeight/prop.yaxisLabelsCount,y=prop.gutterTop,len=prop.yaxisLabelsCount,startX=prop.gutterLeft,endX=prop.gutterLeft-prop.yaxisTickmarksLength;if(typeof prop.yaxisLabelsPositionEdgeTickmarksCount==='number'){len=prop.yaxisLabelsPositionEdgeTickmarksCount;height=obj.graphHeight/len;}
39
+ if(prop.xaxis===false){if(obj.type==='hbar'&&prop.xaxisScaleMin<=0&&prop.xaxisScaleMax<0){var startX=obj.getXCoord(prop.xaxisScaleMax);var endX=obj.getXCoord(prop.xaxisScaleMax)+prop.yaxisTickmarksLength;}else{var startX=obj.getXCoord(0)-prop.yaxisTickmarksLength;var endX=obj.getXCoord(0)+(prop.xaxisScaleMin<0?prop.yaxisTickmarksLength:0);}
40
+ var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX,ma.round(obj.height-prop.marginBottom-parseFloat(prop.vmarginBottom)),endX,ma.round(obj.height-prop.marginBottom-parseFloat(prop.vmarginBottom))),stroke:obj.properties.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}else{var height=obj.graphHeight/prop.yaxisLabelsCount,y=prop.marginTop,len=prop.yaxisLabelsCount,startX=prop.marginLeft,endX=prop.marginLeft-prop.yaxisTickmarksLength;if(typeof prop.yaxisLabelsPositionEdgeTickmarksCount==='number'){len=prop.yaxisLabelsPositionEdgeTickmarksCount;height=obj.graphHeight/len;}
40
41
  if(prop.yaxisTickmarks){for(var i=0;i<len;++i){var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(startX,y,endX,y),stroke:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});y+=height;}
41
- if((prop.yaxisMin!==0||prop.xaxis===false)&&!(obj.scale.min>0&&obj.scale.max>0)){var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.gutterLeft-prop.yaxisTickmarksLength,obj.height-prop.gutterBottom,prop.gutterLeft,obj.height-prop.gutterBottom-0.001),stroke:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}}
42
- if(prop.yaxisScale){var segment=(obj.height-prop.gutterTop-prop.gutterBottom)/prop.yaxisLabelsCount;for(var i=0;i<obj.scale.labels.length;++i){var y=obj.height-prop.gutterBottom-(segment*i)-segment;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.scale.labels[i],x:prop.gutterLeft-7-(prop.yaxis?(prop.yaxisTickmarksLength-3):0)+prop.yaxisLabelsOffsetx,y:y+prop.yaxisLabelsOffsety,halign:prop.yaxisLabelsHalign||'right',valign:prop.yaxisLabelsValign||'center',tag:'labels.yaxis',font:prop.yaxisTextFont||prop.textFont,size:prop.yaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.yaxisTextBold||prop.textBold,italic:prop.yaxisTextItalic||prop.textItalic,color:prop.yaxisTextColor||prop.textColor});}
43
- var y=obj.height-prop.gutterBottom,str=(prop.yaxisUnitsPre+prop.yaxisMin.toFixed(prop.yaxisDecimals).replace(/\./,prop.yaxisPoint)+prop.yaxisUnitsPost);var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.yaxisFormatter==='function'?(prop.yaxisFormatter)(this,prop.yaxisMin):str,x:prop.gutterLeft-7-(prop.yaxis?(prop.yaxisTickmarksLength-3):0)+prop.yaxisLabelsOffsetx,y:y+prop.yaxisLabelsOffsety,halign:'right',valign:'center',tag:'labels.yaxis',font:prop.yaxisTextFont||prop.textFont,size:prop.yaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:prop.yaxisTextBold||prop.textBold,italic:prop.yaxisTextItalic||prop.textItalic,color:prop.yaxisTextColor||prop.textColor});}else if(prop.yaxisLabels&&prop.yaxisLabels.length){for(var i=0;i<prop.yaxisLabels.length;++i){var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/prop.yaxisLabels.length,y=prop.gutterTop+(prop.vmarginTop||0)+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety,x=prop.gutterLeft-7-(prop.yaxisLinewidth||1)+prop.yaxisLabelsOffsetx,halign='right';if(obj.type==='hbar'&&obj.scale.min<obj.scale.max&&obj.scale.max<=0){halign='left';x=obj.width-prop.gutterRight+7+prop.yaxisLabelsOffsetx;}else if(obj.type==='hbar'&&!prop.yaxisLabelsSpecific){var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/(prop.yaxisLabels.length);y=prop.gutterTop+(prop.vmarginTop||0)+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety;}else{var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/(prop.yaxisLabels.length-1);y=obj.height-prop.gutterBottom-(segment*i)+prop.yaxisLabelsOffsety;}
44
- var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.yaxisLabels[i]?prop.yaxisLabels[i]:'',x:x,y:y,halign:halign,valign:'center',tag:'labels.yaxis',font:prop.yaxisTextFont||prop.textFont,size:prop.yaxisTextSize||(typeof prop.textSize==='number'?prop.textSize+'pt':prop.textSize),bold:typeof prop.yaxisTextBold==='boolean'?prop.yaxisTextBold:prop.textBold,italic:typeof prop.yaxisTextItalic==='boolean'?prop.yaxisTextItalic:prop.textItalic,color:prop.yaxisTextColor||prop.textColor});}}};RG.SVG.drawBackground=function(obj)
45
- {var prop=obj.properties;if(typeof prop.variant3dOffsetx!=='number')prop.variant3dOffsetx=0;if(typeof prop.variant3dOffsety!=='number')prop.variant3dOffsety=0;if(prop.backgroundColor){RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'rect',attr:{x:-1+prop.variant3dOffsetx+prop.gutterLeft,y:-1-prop.variant3dOffsety+prop.gutterTop,width:parseFloat(obj.svg.getAttribute('width'))+2-prop.gutterLeft-prop.gutterRight,height:parseFloat(obj.svg.getAttribute('height'))+2-prop.gutterTop-prop.gutterBottom,fill:prop.backgroundColor}});}
46
- if(prop.backgroundImage){var attr={'xlink:href':prop.backgroundImage,preserveAspectRatio:prop.backgroundImageAspect||'none',x:prop.gutterLeft,y:prop.gutterTop};if(prop.backgroundImageStretch){attr.x=prop.gutterLeft+prop.variant3dOffsetx;attr.y=prop.gutterTop+prop.variant3dOffsety;attr.width=obj.width-prop.gutterLeft-prop.gutterRight;attr.height=obj.height-prop.gutterTop-prop.gutterBottom;}else{if(typeof prop.backgroundImageX==='number'){attr.x=prop.backgroundImageX+prop.variant3dOffsetx;}else{attr.x=prop.gutterLeft+prop.variant3dOffsetx;}
47
- if(typeof prop.backgroundImageY==='number'){attr.y=prop.backgroundImageY+prop.variant3dOffsety;}else{attr.y=prop.gutterTop+prop.variant3dOffsety;}
42
+ if((prop.yaxisScaleMin!==0||prop.xaxis===false||obj.mirrorScale)&&!(obj.scale.min>0&&obj.scale.max>0)){var axis=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{d:'M{1} {2} L{3} {4}'.format(prop.marginLeft-prop.yaxisTickmarksLength,obj.height-prop.marginBottom,prop.marginLeft,obj.height-prop.marginBottom-0.001),stroke:prop.yaxisColor,'stroke-width':typeof prop.yaxisLinewidth==='number'?prop.yaxisLinewidth:1,'shape-rendering':"crispEdges"}});}}}}
43
+ if(prop.yaxisScale){var segment=(obj.height-prop.marginTop-prop.marginBottom)/prop.yaxisLabelsCount;for(var i=0;i<obj.scale.labels.length;++i){var y=obj.height-prop.marginBottom-(segment*i)-segment;RG.SVG.text({object:obj,parent:obj.svg.all,text:obj.scale.labels[i],x:prop.marginLeft-7-(prop.yaxis?(prop.yaxisTickmarksLength-3):0)+prop.yaxisLabelsOffsetx,y:y+prop.yaxisLabelsOffsety,halign:prop.yaxisLabelsHalign||'right',valign:prop.yaxisLabelsValign||'center',tag:'labels.yaxis',font:prop.yaxisLabelsFont||prop.textFont,size:typeof prop.yaxisLabelsSize==='number'?prop.yaxisLabelsSize:prop.textSize,bold:typeof prop.yaxisLabelsBold==='boolean'?prop.yaxisLabelsBold:prop.textBold,italic:typeof prop.yaxisLabelsItalic==='boolean'?prop.yaxisLabelsItalic:prop.textItalic,color:prop.yaxisLabelsColor||prop.textColor});}
44
+ var y=obj.height-prop.marginBottom,str=(prop.yaxisScaleUnitsPre+obj.scale.min.toFixed(prop.yaxisScaleDecimals).replace(/\./,prop.yaxisScalePoint)+prop.yaxisScaleUnitsPost);var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:typeof prop.yaxisScaleFormatter==='function'?(prop.yaxisScaleFormatter)(this,prop.yaxisScaleMin):str,x:prop.marginLeft-7-(prop.yaxis?(prop.yaxisTickmarksLength-3):0)+prop.yaxisLabelsOffsetx,y:y+prop.yaxisLabelsOffsety,halign:'right',valign:'center',tag:'labels.yaxis',font:prop.yaxisLabelsFont||prop.textFont,size:typeof prop.yaxisLabelsSize==='number'?prop.yaxisLabelsSize:prop.textSize,bold:typeof prop.yaxisLabelsBold==='boolean'?prop.yaxisLabelsBold:prop.textBold,italic:typeof prop.yaxisLabelsItalic==='boolean'?prop.yaxisLabelsItalic:prop.textItalic,color:prop.yaxisLabelsColor||prop.textColor});}else if(prop.yaxisLabels&&prop.yaxisLabels.length){for(var i=0;i<prop.yaxisLabels.length;++i){var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/prop.yaxisLabels.length,y=prop.marginTop+(prop.vmarginTop||0)+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety,x=prop.marginLeft-7-(prop.yaxisLinewidth||1)+prop.yaxisLabelsOffsetx,halign='right';if(obj.type==='hbar'&&obj.scale.min<obj.scale.max&&obj.scale.max<=0){halign='left';x=obj.width-prop.marginRight+7+prop.yaxisLabelsOffsetx;}else if(obj.type==='hbar'&&!prop.yaxisLabelsSpecific){var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/(prop.yaxisLabels.length);y=prop.marginTop+(prop.vmarginTop||0)+(segment*i)+(segment/2)+prop.yaxisLabelsOffsety;}else{var segment=(obj.graphHeight-(prop.vmarginTop||0)-(prop.vmarginBottom||0))/(prop.yaxisLabels.length-1);y=obj.height-prop.marginBottom-(segment*i)+prop.yaxisLabelsOffsety;}
45
+ var text=RG.SVG.text({object:obj,parent:obj.svg.all,text:prop.yaxisLabels[i]?prop.yaxisLabels[i]:'',x:x,y:y,halign:halign,valign:'center',tag:'labels.yaxis',font:prop.yaxisLabelsFont||prop.textFont,size:typeof prop.yaxisLabelsSize==='number'?prop.yaxisLabelsSize:prop.textSize,bold:typeof prop.yaxisLabelsBold==='boolean'?prop.yaxisLabelsBold:prop.textBold,italic:typeof prop.yaxisLabelsItalic==='boolean'?prop.yaxisLabelsItalic:prop.textItalic,color:prop.yaxisLabelsColor||prop.textColor});}}};RG.SVG.drawBackground=function(obj)
46
+ {var prop=obj.properties;if(typeof prop.variant3dOffsetx!=='number')prop.variant3dOffsetx=0;if(typeof prop.variant3dOffsety!=='number')prop.variant3dOffsety=0;if(prop.backgroundColor){RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'rect',attr:{x:-1+prop.variant3dOffsetx+prop.marginLeft,y:-1-prop.variant3dOffsety+prop.marginTop,width:parseFloat(obj.svg.getAttribute('width'))+2-prop.marginLeft-prop.marginRight,height:parseFloat(obj.svg.getAttribute('height'))+2-prop.marginTop-prop.marginBottom,fill:prop.backgroundColor}});}
47
+ if(prop.backgroundImage){var attr={'xlink:href':prop.backgroundImage,preserveAspectRatio:prop.backgroundImageAspect||'none',x:prop.marginLeft,y:prop.marginTop};if(prop.backgroundImageStretch){attr.x=prop.marginLeft+prop.variant3dOffsetx;attr.y=prop.marginTop+prop.variant3dOffsety;attr.width=obj.width-prop.marginLeft-prop.marginRight;attr.height=obj.height-prop.marginTop-prop.marginBottom;}else{if(typeof prop.backgroundImageX==='number'){attr.x=prop.backgroundImageX+prop.variant3dOffsetx;}else{attr.x=prop.marginLeft+prop.variant3dOffsetx;}
48
+ if(typeof prop.backgroundImageY==='number'){attr.y=prop.backgroundImageY+prop.variant3dOffsety;}else{attr.y=prop.marginTop+prop.variant3dOffsety;}
48
49
  if(typeof prop.backgroundImageW==='number'){attr.width=prop.backgroundImageW;}
49
50
  if(typeof prop.backgroundImageH==='number'){attr.height=prop.backgroundImageH;}}
50
51
  if(prop.variant==='3d'){attr.x+=prop.variant3dOffsetx;attr.y-=prop.variant3dOffsety;}
51
52
  var img=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'image',attr:attr,style:{opacity:typeof prop.backgroundImageOpacity==='number'?prop.backgroundImageOpacity:1}});if(!prop.backgroundImageStretch){var img2=new Image();img2.src=prop.backgroundImage;img2.onload=function()
52
- {img.setAttribute('width',typeof prop.backgroundImageW==='number'?prop.backgroundImageW:img2.width);img.setAttribute('height',typeof prop.backgroundImageH==='number'?prop.backgroundImageH:img2.height);};}}
53
+ {if(prop.backgroundImageW==='number')img.setAttribute('width',prop.backgroundImageW);if(prop.backgroundImageH==='number')img.setAttribute('height',prop.backgroundImageH);};}}
53
54
  if(prop.backgroundGrid){var parts=[];if(prop.backgroundGridHlines){if(typeof prop.backgroundGridHlinesCount==='number'){var count=prop.backgroundGridHlinesCount;}else if(obj.type==='hbar'||obj.type==='bipolar'){if(typeof prop.yaxisLabels==='object'&&!RG.SVG.isNull(prop.yaxisLabels)&&prop.yaxisLabels.length){var count=prop.yaxisLabels.length;}else if(obj.type==='hbar'){var count=obj.data.length;}else if(obj.type==='bipolar'){var count=obj.left.length;}}else{var count=prop.yaxisLabelsCount||5;}
54
- for(var i=0;i<=count;++i){parts.push('M{1} {2} L{3} {4}'.format(prop.gutterLeft+prop.variant3dOffsetx,prop.gutterTop+(obj.graphHeight/count)*i-prop.variant3dOffsety,obj.width-prop.gutterRight+prop.variant3dOffsetx,prop.gutterTop+(obj.graphHeight/count)*i-prop.variant3dOffsety));}
55
- parts.push('M{1} {2} L{3} {4}'.format(prop.gutterLeft+prop.variant3dOffsetx,obj.height-prop.gutterBottom-prop.variant3dOffsety,obj.width-prop.gutterRight+prop.variant3dOffsetx,obj.height-prop.gutterBottom-prop.variant3dOffsety));}
56
- if(prop.backgroundGridVlines){if(obj.type==='line'&&RG.SVG.isArray(obj.data[0])){var len=obj.data[0].length;}else if(obj.type==='hbar'){var len=prop.xaxisLabelsCount||10;}else if(obj.type==='bipolar'){var len=prop.xaxisLabelsCount||10;}else if(obj.type==='scatter'){var len=(prop.xaxisLabels&&prop.xaxisLabels.length)||10;}else if(obj.type==='waterfall'){var len=obj.data[0].length;}else{var len=obj.data.length;}
55
+ for(var i=0;i<=count;++i){parts.push('M{1} {2} L{3} {4}'.format(prop.marginLeft+prop.variant3dOffsetx,prop.marginTop+(obj.graphHeight/count)*i-prop.variant3dOffsety,obj.width-prop.marginRight+prop.variant3dOffsetx,prop.marginTop+(obj.graphHeight/count)*i-prop.variant3dOffsety));}
56
+ parts.push('M{1} {2} L{3} {4}'.format(prop.marginLeft+prop.variant3dOffsetx,obj.height-prop.marginBottom-prop.variant3dOffsety,obj.width-prop.marginRight+prop.variant3dOffsetx,obj.height-prop.marginBottom-prop.variant3dOffsety));}
57
+ if(prop.backgroundGridVlines){if(obj.type==='line'&&RG.SVG.isArray(obj.data[0])){var len=obj.data[0].length;}else if(obj.type==='hbar'){var len=prop.xaxisLabelsCount||10;}else if(obj.type==='bipolar'){var len=prop.xaxisLabelsCount||10;}else if(obj.type==='scatter'){var len=(prop.xaxisLabels&&prop.xaxisLabels.length)||10;}else if(obj.type==='waterfall'){var len=obj.data.length;}else{var len=obj.data.length;}
57
58
  var count=typeof prop.backgroundGridVlinesCount==='number'?prop.backgroundGridVlinesCount:len;if(prop.xaxisLabelsPosition==='edge'){count--;}
58
- for(var i=0;i<=count;++i){parts.push('M{1} {2} L{3} {4}'.format(prop.gutterLeft+((obj.graphWidth/count)*i)+prop.variant3dOffsetx,prop.gutterTop-prop.variant3dOffsety,prop.gutterLeft+((obj.graphWidth/count)*i)+prop.variant3dOffsetx,obj.height-prop.gutterBottom-prop.variant3dOffsety));}}
59
- if(prop.backgroundGridBorder){parts.push('M{1} {2} L{3} {4} L{5} {6} L{7} {8} z'.format(prop.gutterLeft+prop.variant3dOffsetx,prop.gutterTop-prop.variant3dOffsety,obj.width-prop.gutterRight+prop.variant3dOffsetx,prop.gutterTop-prop.variant3dOffsety,obj.width-prop.gutterRight+prop.variant3dOffsetx,obj.height-prop.gutterBottom-prop.variant3dOffsety,prop.gutterLeft+prop.variant3dOffsetx,obj.height-prop.gutterBottom-prop.variant3dOffsety));}
59
+ for(var i=0;i<=count;++i){parts.push('M{1} {2} L{3} {4}'.format(prop.marginLeft+((obj.graphWidth/count)*i)+prop.variant3dOffsetx,prop.marginTop-prop.variant3dOffsety,prop.marginLeft+((obj.graphWidth/count)*i)+prop.variant3dOffsetx,obj.height-prop.marginBottom-prop.variant3dOffsety));}}
60
+ if(prop.backgroundGridBorder){parts.push('M{1} {2} L{3} {4} L{5} {6} L{7} {8} z'.format(prop.marginLeft+prop.variant3dOffsetx,prop.marginTop-prop.variant3dOffsety,obj.width-prop.marginRight+prop.variant3dOffsetx,prop.marginTop-prop.variant3dOffsety,obj.width-prop.marginRight+prop.variant3dOffsetx,obj.height-prop.marginBottom-prop.variant3dOffsety,prop.marginLeft+prop.variant3dOffsetx,obj.height-prop.marginBottom-prop.variant3dOffsety));}
60
61
  var dasharray;if(prop.backgroundGridDashed){dasharray=[3,5];}else if(prop.backgroundGridDotted){dasharray=[1,3];}else if(prop.backgroundGridDashArray){dasharray=prop.backgroundGridDashArray;}else{dasharray='';}
61
62
  var grid=RG.SVG.create({svg:obj.svg,parent:obj.svg.all,type:'path',attr:{className:'rgraph_background_grid',d:parts.join(' '),stroke:prop.backgroundGridColor,fill:'rgba(0,0,0,0)','stroke-width':prop.backgroundGridLinewidth,'shape-rendering':"crispEdges",'stroke-dasharray':dasharray},style:{pointerEvents:'none'}});}
62
63
  if(obj.type!=='bipolar'){RG.SVG.drawTitle(obj);}};RG.SVG.isNull=function(arg)
@@ -64,7 +65,7 @@ if(obj.type!=='bipolar'){RG.SVG.drawTitle(obj);}};RG.SVG.isNull=function(arg)
64
65
  return false;};RG.SVG.getScale=function(opt)
65
66
  {var obj=opt.object,prop=obj.properties,numlabels=opt.numlabels,unitsPre=opt.unitsPre,unitsPost=opt.unitsPost,max=Number(opt.max),min=Number(opt.min),strict=opt.strict,decimals=Number(opt.decimals),point=opt.point,thousand=opt.thousand,originalMax=max,round=opt.round,scale={max:1,labels:[],values:[]},formatter=opt.formatter;if(max===0&&min===0){var max=1;for(var i=0;i<numlabels;++i){var label=((((max-min)/numlabels)*(i+1))+min).toFixed(decimals);scale.labels.push(unitsPre+label+unitsPost);scale.values.push(parseFloat(label))}}else if(max<=1&&!strict){var arr=[1,0.5,0.10,0.05,0.010,0.005,0.0010,0.0005,0.00010,0.00005,0.000010,0.000005,0.0000010,0.0000005,0.00000010,0.00000005,0.000000010,0.000000005,0.0000000010,0.0000000005,0.00000000010,0.00000000005,0.000000000010,0.000000000005,0.0000000000010,0.0000000000005],vals=[];for(var i=0;i<arr.length;++i){if(max>arr[i]){i--;break;}}
66
67
  scale.max=arr[i]
67
- scale.labels=[];scale.values=[];for(var j=0;j<numlabels;++j){var value=((((arr[i]-min)/numlabels)*(j+1))+min).toFixed(decimals);scale.values.push(value);scale.labels.push(RG.SVG.numberFormat({object:obj,num:value,prepend:unitsPre,append:unitsPost,point:prop.yaxisPoint,thousand:prop.yaxisThousand,formatter:formatter}));}}else if(!strict){max=ma.ceil(max);var interval=ma.pow(10,ma.max(1,Number(String(Number(max)-Number(min)).length-1)));var topValue=interval;while(topValue<max){topValue+=(interval/2);}
68
+ scale.labels=[];scale.values=[];for(var j=0;j<numlabels;++j){var value=((((arr[i]-min)/numlabels)*(j+1))+min).toFixed(decimals);scale.values.push(value);scale.labels.push(RG.SVG.numberFormat({object:obj,num:value,prepend:unitsPre,append:unitsPost,point:prop.yaxisScalePoint,thousand:prop.yaxisScaleThousand,formatter:formatter}));}}else if(!strict){max=ma.ceil(max);var interval=ma.pow(10,ma.max(1,Number(String(Number(max)-Number(min)).length-1)));var topValue=interval;while(topValue<max){topValue+=(interval/2);}
68
69
  if(Number(originalMax)>Number(topValue)){topValue+=(interval/2);}
69
70
  if(max<=10){topValue=(Number(originalMax)<=5?5:10);}
70
71
  if(obj&&typeof(round)=='boolean'&&round){topValue=10*interval;}
@@ -128,7 +129,7 @@ if(decimal.length){output=output+decimal_seperator+decimal;decimal='';RegExp.$1=
128
129
  if(decimals_trim){output=output.replace(/0+$/,'');output=output.replace(/\.$/,'');}
129
130
  if(output.charAt(0)=='-'){output=output.replace(/-/,'');prepend='-'+prepend;}
130
131
  return prepend+output+append;};RG.SVG.text=function(opt)
131
- {var obj=opt.object,parent=opt.parent||opt.object.svg.all,size=typeof opt.size==='number'?opt.size+'pt':(typeof opt.size==='string'?opt.size.replace(/pt$/,''):12)+'pt',bold=opt.bold?'bold':'normal',font=opt.font?opt.font:'sans-serif',italic=opt.italic?'italic':'normal',halign=opt.halign,valign=opt.valign,str=opt.text,x=opt.x,y=opt.y,color=opt.color?opt.color:'black',background=opt.background||null,backgroundRounded=opt.backgroundRounded||null,padding=opt.padding||0,link=opt.link||'',linkTarget=opt.linkTarget||'_blank',events=(opt.events===false?false:true),angle=opt.angle;if(typeof str==='number'){str=String(str);}
132
+ {var obj=opt.object,parent=opt.parent||opt.object.svg.all,size=typeof opt.size==='number'?opt.size+'pt':(typeof opt.size==='string'?opt.size.replace(/pt$/,''):12)+'pt',bold=opt.bold?'bold':'normal',font=opt.font?opt.font:'sans-serif',italic=opt.italic?'italic':'normal',halign=opt.halign,valign=opt.valign,str=opt.text,x=opt.x,y=opt.y,color=opt.color?opt.color:'black',background=opt.background||null,backgroundRounded=opt.backgroundRounded||0,padding=opt.padding||0,link=opt.link||'',linkTarget=opt.linkTarget||'_blank',events=(opt.events===false?false:true),angle=opt.angle;if(typeof str==='number'){str=String(str);}
132
133
  if(RG.SVG.isNull(str)){str='';}
133
134
  if(str&&str.substr(0,2)=='\r\n'||str.substr(0,1)==='\n'){str="\u00A0"+str;}
134
135
  if(halign==='right'){halign='end';}else if(halign==='center'||halign==='middle'){halign='middle';}else{halign='start';}
@@ -145,10 +146,11 @@ text.parentNode.insertBefore(rect,text);}
145
146
  if(RG.SVG.ISIE&&(valign==='hanging')&&text){text.setAttribute('y',y+(text.scrollHeight/2));}else if(RG.SVG.ISIE&&valign==='middle'){text.setAttribute('y',y+(text.scrollHeight/3));}
146
147
  if(RG.SVG.ISFF&&text){Y=y+(text.scrollHeight/3);}
147
148
  return text;};RG.SVG.text.find=function(opt)
148
- {if(typeof opt.object==='object'&&opt.object.isRGraph){var svg=opt.object.svg;}else if(typeof opt.svg==='object'&&opt.svg.all){var svg=opt.svg;}
149
+ {if(typeof opt.object==='object'&&opt.object.isRGraph){var svg=opt.object.svg;}else if(typeof opt.svg==='object'&&opt.svg.all){var svg=opt.svg;opt.object=svg.__object__;}
149
150
  var nodes=svg.getElementsByTagName('text');var found=[];for(var i=0,len=nodes.length;i<len;++i){var text=false,tag=false;if(typeof opt.text==='string'&&nodes[i].innerHTML===opt.text){text=true;}else if(typeof opt.text==='object'&&nodes[i].innerHTML.match(opt.text)){text=true;}else if(typeof opt.text==='undefined'){text=true;}
150
151
  if(typeof opt.tag==='string'&&nodes[i].getAttribute('tag')===opt.tag){tag=true;}else if(typeof opt.tag==='object'&&nodes[i].getAttribute('tag').match(opt.tag)){tag=true;}else if(typeof opt.tag==='undefined'){tag=true;}
151
152
  if(text===true&&tag===true){found.push(nodes[i])}}
153
+ if(typeof opt.callback==='function'){(opt.callback)({nodes:found,object:opt.object});}
152
154
  return found;};RG.SVG.createUID=function()
153
155
  {return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c)
154
156
  {var r=ma.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};RG.SVG.isFixed=function(svg)
@@ -170,7 +172,10 @@ grouped_index++;if(grouped_index>=data[group].length){group++;grouped_index=0;}}
170
172
  return[group,grouped_index];};RG.SVG.groupedIndexToSequential=function(opt)
171
173
  {var dataset=opt.dataset,index=opt.index,obj=opt.object;for(var i=0,seq=0;i<=dataset;++i){for(var j=0;j<obj.data[dataset].length;++j){if(i===dataset&&j===index){return seq;}
172
174
  seq++;}}
173
- return seq;};RG.SVG.TRIG.toCartesian=function(options)
175
+ return seq;};RG.SVG.arrayLinearize=function()
176
+ {var arr=[],args=arguments
177
+ for(var i=0,len=args.length;i<len;++i){if(typeof args[i]==='object'&&args[i]){for(var j=0,len2=args[i].length;j<len2;++j){var sub=RG.SVG.arrayLinearize(args[i][j]);for(var k=0,len3=sub.length;k<len3;++k){arr.push(sub[k]);}}}else{arr.push(args[i]);}}
178
+ return arr;};RG.SVG.TRIG.toCartesian=function(options)
174
179
  {return{x:options.cx+(options.r*ma.cos(options.angle)),y:options.cy+(options.r*ma.sin(options.angle))};};RG.SVG.TRIG.getHypLength=function(opt)
175
180
  {var h=Math.abs(opt.x2-opt.x1)
176
181
  v=Math.abs(opt.y2-opt.y1),r=Math.sqrt((h*h)
@@ -185,24 +190,20 @@ if(options.array===true){return d;}else{return d.join(" ");}};RG.SVG.TRIG.getArc
185
190
  {options.start-=1.57;options.end-=1.57;var start=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.start});var end=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.end});var diff=ma.abs(options.end-options.start);var largeArc='0';var sweep='0';if(!options.anticlockwise){if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='1';}else{largeArc='0';sweep='1';}}else{if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='0';}else{largeArc='0';sweep='0';}}
186
191
  if(typeof options.lineto==='boolean'&&options.lineto===false){var d=["M",start.x,start.y,"A",options.r,options.r,0,largeArc,sweep,end.x,end.y];}else{var d=["M",options.cx,options.cy,"L",start.x,start.y,"A",options.r,options.r,0,largeArc,sweep,end.x,end.y];}
187
192
  if(options.array===true){return d;}else{return d.join(" ");}};RG.SVG.TRIG.getArcPath3=function(options)
188
- {options.start-=(ma.PI/2);options.end-=(ma.PI/2);var start=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.start});var end=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.end});var diff=ma.abs(options.end-options.start);var largeArc='0';var sweep='0';if(!options.anticlockwise){if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='1';}else{largeArc='0';sweep='1';}}else{if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='0';}else{largeArc='0';sweep='0';}}
193
+ {options.cx=Number(options.cx);options.cy=Number(options.cy);options.radius=Number(options.radius);options.start=Number(options.start);options.end=Number(options.end);options.start-=(ma.PI/2);options.end-=(ma.PI/2);var start=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.start});var end=RG.SVG.TRIG.toCartesian({cx:options.cx,cy:options.cy,r:options.r,angle:options.end});var diff=ma.abs(options.end-options.start);var largeArc='0';var sweep='0';if(!options.anticlockwise){if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='1';}else{largeArc='0';sweep='1';}}else{if(diff>RG.SVG.TRIG.PI){largeArc='1';sweep='0';}else{largeArc='0';sweep='0';}}
189
194
  if(typeof options.lineto==='boolean'&&options.lineto===false){var d=["M",start.x,start.y,"A",options.r,options.r,0,largeArc,sweep,end.x,end.y];}else{var d=["L",start.x,start.y,"A",options.r,options.r,0,largeArc,sweep,end.x,end.y];}
190
195
  if(options.array===true){return d;}else{return d.join(" ");}};RG.SVG.TRIG.getRadiusEndPoint=function(opt)
191
196
  {if(arguments.length===1){var angle=opt.angle,r=opt.r;}else if(arguments.length===4){var angle=arguments[0],r=arguments[1];}
192
197
  var x=ma.cos(angle)*r,y=ma.sin(angle)*r;return[x,y];};RG.SVG.drawTitle=function(obj)
193
- {var prop=obj.properties,valign='bottom',originalTitleX=prop.titleX,originalTitleY=prop.titleY,originalTitleSubtitleX=prop.titleSubtitleX,originalTitleSubtitleY=prop.titleSubtitleY;if(typeof originalTitleX==='string')originalTitleX.replace(/^\+/,'');if(typeof originalTitleY==='string')originalTitleY.replace(/^\+/,'');if(typeof originalTitleSubtitleX==='string')originalTitleSubtitleX.replace(/^\+/,'');if(typeof originalTitleSubtitleY==='string')originalTitleSubtitleY.replace(/^\+/,'');if(obj.type==='pie'){if(RG.SVG.isNull(prop.titleX)){prop.titleX=obj.centerx;prop.titleSubtitleX=obj.centerx;}
194
- if(RG.SVG.isNull(prop.titleY)){prop.titleY=obj.centery-obj.radius-10;}}
195
- if(obj.scale&&obj.scale.max<=0&&obj.scale.min<0&&typeof prop.titleY!=='number'&&obj.type!=='hbar'){prop.titleY=obj.height-prop.gutterBottom+10;var positionBottom=true;valign='top';}else if(typeof prop.titleY!=='number'){var positionBottom=false;prop.titleY=prop.gutterTop-10;valign='bottom';if(!RG.SVG.isNull(prop.key)){prop.titleY-=(2*(prop.keyTextSize||prop.textSize));}}
196
- if(prop.titleSubtitle&&typeof prop.titleSubtitleY!=='number'&&!positionBottom){prop.titleY=prop.titleY-(prop.titleSubtitleSize*1.5);}
197
- prop.titleSubTitleSize=prop.titleSubTitleSize||prop.textSize;prop.titleSubtitleY=prop.titleSubtitleY||prop.titleY+18;if(positionBottom&&typeof prop.titleSubtitleY!=='number'){prop.titleSubtitleY=prop.titleY+26;}
198
- if(prop.title){var x=typeof prop.titleX==='number'?prop.titleX+(prop.variant3dOffsetx||0):prop.gutterLeft+(obj.graphWidth/2)+(prop.variant3dOffsetx||0);var y=prop.titleY+(prop.variant3dOffsety||0);if(typeof originalTitleX==='string'){x+=parseFloat(originalTitleX);}
199
- if(typeof originalTitleY==='string'){y+=parseFloat(originalTitleY);}
200
- RG.SVG.text({object:obj,svg:obj.svg,parent:obj.svg.all,tag:'title',text:prop.title.toString(),size:prop.titleSize||(prop.textSize+4)||16,x:x,y:y,halign:prop.titleHalign||'center',valign:prop.titleValign||valign,color:prop.titleColor||prop.textColor||'black',bold:prop.titleBold||false,italic:prop.titleItalic||false,font:prop.titleFont||prop.textFont||'Arial'});}
201
- if(typeof prop.title==='string'&&typeof prop.titleSubtitle==='string'){y+=(prop.titleSubtitleSize*1.5);if(typeof originalTitleSubtitleX==='number'){x=originalTitleSubtitleX;}
202
- if(typeof originalTitleSubtitleY==='number'){y=originalTitleSubtitleY;}
203
- if(typeof originalTitleSubtitleX==='string'){x+=parseFloat(originalTitleSubtitleX);}
204
- if(typeof originalTitleSubtitleY==='string'){y+=parseFloat(originalTitleSubtitleY);}
205
- RG.SVG.text({object:obj,svg:obj.svg,parent:obj.svg.all,tag:'subtitle',text:prop.titleSubtitle,size:prop.titleSubtitleSize,x:x,y:y,halign:prop.titleSubtitleHalign||'center',valign:prop.titleSubtitleValign||valign,color:prop.titleSubtitleColor||prop.textColor||'#aaa',bold:prop.titleSubtitleBold||false,italic:prop.titleSubtitleItalic||false,font:prop.titleSubtitleFont||prop.textFont||'Arial'});}};RG.SVG.trim=function(str)
198
+ {var prop=obj.properties;var x=((obj.width-prop.marginLeft-prop.marginRight)/2)+prop.marginLeft,y=prop.marginTop-10,valign='bottom';if(!RG.SVG.isNull(obj.properties.key)){y-=20;}
199
+ if(typeof obj.properties.yaxisScaleMax==='number'&&obj.properties.yaxisScaleMax<=0&&obj.properties.yaxisScaleMin<obj.properties.yaxisScaleMax){valign='top';y=obj.height-obj.properties.marginBottom+10;}
200
+ if(typeof prop.titleX==='number'){x=prop.titleX;}
201
+ if(typeof prop.titleY==='number'){y=prop.titleY;}
202
+ if(typeof prop.titleOffsetx==='number'){x+=prop.titleOffsetx;}
203
+ if(typeof prop.titleOffsety==='number'){y+=prop.titleOffsety;}
204
+ if(typeof prop.titleSubtitle==='string'||typeof prop.titleSubtitle==='number'){var titleSubtitleDim=RG.SVG.measureText({bold:prop.titleSubtitleBold,italic:prop.titleSubtitleItalic,size:prop.titleSubtitleSize,font:prop.titleSubtitleFont,text:'Mg'});y-=titleSubtitleDim[1];}
205
+ if(prop.title){RG.SVG.text({object:obj,svg:obj.svg,parent:obj.svg.all,tag:'title',text:prop.title.toString(),x:x,y:y,halign:prop.titleHalign||'center',valign:valign,color:prop.titleColor||prop.textColor,size:typeof prop.titleSize==='number'?prop.titleSize:prop.textSize+4,bold:typeof prop.titleBold==='boolean'?prop.titleBold:prop.textBold,italic:typeof prop.titleItalic==='boolean'?prop.titleItalic:prop.textItalic,font:prop.titleFont||prop.textFont});}
206
+ if((typeof prop.title==='string'||typeof prop.title==='number')&&(typeof prop.titleSubtitle==='string'||typeof prop.titleSubtitle==='number')){RG.SVG.text({object:obj,svg:obj.svg,parent:obj.svg.all,tag:'subtitle',text:prop.titleSubtitle,x:x,y:y+5,halign:prop.titleHalign||'center',valign:'top',size:typeof prop.titleSubtitleSize==='number'?prop.titleSubtitleSize:prop.textSize-2,color:prop.titleSubtitleColor||prop.textColor,bold:typeof prop.titleSubtitleBold==='boolean'?prop.titleSubtitleBold:prop.textBold,italic:typeof prop.titleSubtitleItalic==='boolean'?prop.titleSubtitleItalic:prop.textItalic,font:prop.titleSubtitleFont||prop.textFont});}};RG.SVG.trim=function(str)
206
207
  {return RG.SVG.ltrim(RG.SVG.rtrim(str));};RG.SVG.ltrim=function(str)
207
208
  {return String(str).replace(/^(\s|\0)+/,'');};RG.SVG.rtrim=function(str)
208
209
  {return String(str).replace(/(\s|\0)+$/,'');};RG.SVG.parseColorLinear=function(opt)
@@ -251,10 +252,10 @@ el=el.offsetParent;}while(el&&el.tagName&&el.tagName.toLowerCase()!='body');var
251
252
  return[x+paddingLeft+borderLeft,y+paddingTop+borderTop];};RG.SVG.FX.update=function(func)
252
253
  {win.requestAnimationFrame=win.requestAnimationFrame||win.webkitRequestAnimationFrame||win.msRequestAnimationFrame||win.mozRequestAnimationFrame||(function(func){setTimeout(func,16.666);});win.requestAnimationFrame(func);};RG.SVG.FX.getEasingMultiplier=function(frames,frame)
253
254
  {var multiplier=ma.pow(ma.sin((frame/frames)*RG.SVG.TRIG.HALFPI),3);return multiplier;};RG.SVG.measureText=function(opt)
254
- {var text=opt.text||'',bold=opt.bold||false,font=opt.font||'Arial',size=opt.size||10,str=text+':'+bold+':'+font+':'+size;if(typeof RG.SVG.measuretext_cache==='undefined'){RG.SVG.measuretext_cache=[];}
255
+ {var text=opt.text||'',bold=opt.bold||false,italic=opt.italic||false,font=opt.font||'sans-serif',size=opt.size||12,str=text+':'+italic+':'+bold+':'+font+':'+size;if(typeof RG.SVG.measuretext_cache==='undefined'){RG.SVG.measuretext_cache=[];}
255
256
  if(typeof RG.SVG.measuretext_cache=='object'&&RG.SVG.measuretext_cache[str]){return RG.SVG.measuretext_cache[str];}
256
257
  if(!RG.SVG.measuretext_cache['text-span']){var span=document.createElement('SPAN');span.style.position='absolute';span.style.padding=0;span.style.display='inline';span.style.top='-200px';span.style.left='-200px';span.style.lineHeight='1em';document.body.appendChild(span);RG.SVG.measuretext_cache['text-span']=span;}else if(RG.SVG.measuretext_cache['text-span']){var span=RG.SVG.measuretext_cache['text-span'];}
257
- span.innerHTML=text.replace(/\r?\n/g,'<br />');span.style.fontFamily=font;span.style.fontWeight=bold?'bold':'normal';span.style.fontSize=String(size).replace(/pt$/,'')+'pt';var sizes=[span.offsetWidth,span.offsetHeight];RG.SVG.measuretext_cache[str]=sizes;return sizes;};RG.SVG.stringsToNumbers=function(str)
258
+ span.innerHTML=text.replace(/\r?\n/g,'<br />');span.style.fontFamily=font;span.style.fontWeight=bold?'bold':'normal';span.style.fontStyle=italic?'italic':'normal';span.style.fontSize=String(size).replace(/pt$/,'')+'pt';var sizes=[span.offsetWidth,span.offsetHeight];RG.SVG.measuretext_cache[str]=sizes;return sizes;};RG.SVG.stringsToNumbers=function(str)
258
259
  {var sep=arguments[1]||',';if(typeof str==='number'){return str;}
259
260
  if(typeof str==='string'){if(str.indexOf(sep)!=-1){str=str.split(sep);}else{str=parseFloat(str);}}
260
261
  if(typeof str==='object'){for(var i=0,len=str.length;i<len;i+=1){str[i]=parseFloat(str[i]);}}
@@ -269,7 +270,7 @@ return arr;};RG.SVG.commonSetter=function(opt)
269
270
  return{name:name,value:value};};RG.SVG.log=function(opt)
270
271
  {var num=opt.num,base=opt.base;return ma.log(num)/(base?ma.log(base):1);};RG.SVG.donut=function(opt)
271
272
  {var arcPath1=RG.SVG.TRIG.getArcPath3({cx:opt.cx,cy:opt.cy,r:opt.outerRadius,start:0,end:RG.SVG.TRIG.TWOPI,anticlockwise:false,lineto:false});var arcPath2=RG.SVG.TRIG.getArcPath3({cx:opt.cx,cy:opt.cy,r:opt.innerRadius,start:RG.SVG.TRIG.TWOPI,end:0,anticlockwise:true,lineto:false});var path=RG.SVG.create({svg:opt.svg,type:'path',attr:{d:arcPath1+arcPath2,stroke:opt.stroke,fill:opt.fill}});return path;};RG.SVG.getGlobals=function(obj)
272
- {var prop=obj.properties;for(i in RG.SVG.GLOBALS){if(typeof i==='string'){prop[i]=RG.SVG.arrayClone(RG.SVG.GLOBALS[i]);}}};RG.SVG.link=function(opt)
273
+ {var prop=obj.properties;for(i in RG.SVG.GLOBALS){if(typeof i==='string'){obj.set(i,RG.SVG.arrayClone(RG.SVG.GLOBALS[i]));}}};RG.SVG.link=function(opt)
273
274
  {var a=RGraph.SVG.create({svg:bar.svg,type:'a',parent:bar.svg.all,attr:{'xlink:href':href,target:target}});var text=RGraph.SVG.create({svg:bar.svg,type:'text',parent:a,attr:{x:x,y:y,fill:fill}});text.innerHTML=text;};RG.SVG.getErrorbarsMaxValue=function(opt)
274
275
  {var obj=opt.object,prop=obj.properties,index=opt.index;if(typeof prop.errorbars==='object'&&!RG.SVG.isNull(prop.errorbars)&&typeof prop.errorbars[index]==='number'){var value=prop.errorbars[index];}else if(typeof prop.errorbars==='object'&&!RG.SVG.isNull(prop.errorbars)&&typeof prop.errorbars[index]==='object'&&!RG.SVG.isNull(prop.errorbars[index])&&typeof prop.errorbars[index].max==='number'){var value=prop.errorbars[index].max;}else{var value=0;}
275
276
  return value;};RG.SVG.getErrorbarsMinValue=function(opt)
@@ -282,7 +283,9 @@ if(typeof prop.errorbars==='object'&&!RG.SVG.isNull(prop.errorbars)&&typeof prop
282
283
  return linewidth;};RG.SVG.getErrorbarsCapWidth=function(opt)
283
284
  {var obj=opt.object,prop=obj.properties,index=opt.index;var capwidth=prop.errorbarsCapwidth||10
284
285
  if(typeof prop.errorbars==='object'&&!RG.SVG.isNull(prop.errorbars)&&typeof prop.errorbars[index]==='object'&&!RG.SVG.isNull(prop.errorbars[index])&&typeof prop.errorbars[index].capwidth==='number'){capwidth=prop.errorbars[index].capwidth;}
285
- return capwidth;};if(typeof RG.SVG.tooltip!=='function'){RG.SVG.tooltip=function()
286
+ return capwidth;};RG.SVG.propertyNameAlias=function(opt)
287
+ {var obj=opt.object;if(typeof obj.propertyNameAliases[opt.name]==='string'){return{name:obj.propertyNameAliases[opt.name],value:opt.value};}else if(typeof obj.propertyNameAliases[opt.name]==='function'){var tmp=(obj.propertyNameAliases[opt.name])(opt);return{name:tmp.name,value:tmp.value};}
288
+ return{name:opt.name,value:opt.value};};if(typeof RG.SVG.tooltip!=='function'){RG.SVG.tooltip=function()
286
289
  {$a('The tooltip library has not been included!');};}})(window,document);window.$p=function(obj)
287
290
  {var indent=(arguments[2]?arguments[2]:' ');var str='';var counter=typeof arguments[3]=='number'?arguments[3]:0;if(counter>=5){return'';}
288
291
  switch(typeof obj){case'string':str+=obj+' ('+(typeof obj)+', '+obj.length+')';break;case'number':str+=obj+' ('+(typeof obj)+')';break;case'boolean':str+=obj+' ('+(typeof obj)+')';break;case'function':str+='function () {}';break;case'undefined':str+='undefined';break;case'null':str+='null';break;case'object':if(RGraph.SVG.isNull(obj)){str+=indent+'null\n';}else{str+=indent+'Object {'+'\n'