rgraph-rails 5.00 → 6.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish-geml.yaml +46 -0
  3. data/.gitignore +1 -0
  4. data/README.md +4 -5
  5. data/lib/rgraph-rails/version.rb +1 -1
  6. data/rgraph-rails.gemspec +4 -4
  7. data/vendor/assets/javascripts/RGraph.activity.js +1691 -0
  8. data/vendor/assets/javascripts/RGraph.bar.js +4253 -236
  9. data/vendor/assets/javascripts/RGraph.bipolar.js +3958 -162
  10. data/vendor/assets/javascripts/RGraph.common.annotate.js +414 -35
  11. data/vendor/assets/javascripts/RGraph.common.context.js +635 -30
  12. data/vendor/assets/javascripts/RGraph.common.core.js +10485 -419
  13. data/vendor/assets/javascripts/RGraph.common.csv.js +508 -27
  14. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1693 -90
  15. data/vendor/assets/javascripts/RGraph.common.effects.js +1629 -89
  16. data/vendor/assets/javascripts/RGraph.common.key.js +1003 -53
  17. data/vendor/assets/javascripts/RGraph.common.moment.js +5670 -0
  18. data/vendor/assets/javascripts/RGraph.common.sheets.js +541 -31
  19. data/vendor/assets/javascripts/RGraph.common.sheets.php +351 -0
  20. data/vendor/assets/javascripts/RGraph.common.starburst.js +382 -0
  21. data/vendor/assets/javascripts/RGraph.common.table.js +386 -0
  22. data/vendor/assets/javascripts/RGraph.common.tooltips.js +1433 -32
  23. data/vendor/assets/javascripts/RGraph.drawing.background.js +660 -35
  24. data/vendor/assets/javascripts/RGraph.drawing.circle.js +618 -34
  25. data/vendor/assets/javascripts/RGraph.drawing.image.js +857 -52
  26. data/vendor/assets/javascripts/RGraph.drawing.line.js +712 -0
  27. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +760 -38
  28. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +740 -37
  29. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +573 -36
  30. data/vendor/assets/javascripts/RGraph.drawing.poly.js +667 -36
  31. data/vendor/assets/javascripts/RGraph.drawing.rect.js +638 -34
  32. data/vendor/assets/javascripts/RGraph.drawing.text.js +672 -37
  33. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +653 -52
  34. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +714 -51
  35. data/vendor/assets/javascripts/RGraph.fuel.js +1149 -59
  36. data/vendor/assets/javascripts/RGraph.funnel.js +1277 -56
  37. data/vendor/assets/javascripts/RGraph.gantt.js +1646 -82
  38. data/vendor/assets/javascripts/RGraph.gauge.js +1773 -89
  39. data/vendor/assets/javascripts/RGraph.hbar.js +3869 -159
  40. data/vendor/assets/javascripts/RGraph.horseshoe.js +970 -0
  41. data/vendor/assets/javascripts/RGraph.hprogress.js +1829 -81
  42. data/vendor/assets/javascripts/RGraph.line.js +5293 -244
  43. data/vendor/assets/javascripts/RGraph.meter.js +1570 -77
  44. data/vendor/assets/javascripts/RGraph.modaldialog.js +300 -19
  45. data/vendor/assets/javascripts/RGraph.odo.js +1553 -68
  46. data/vendor/assets/javascripts/RGraph.pie.js +3273 -129
  47. data/vendor/assets/javascripts/RGraph.radar.js +2333 -108
  48. data/vendor/assets/javascripts/RGraph.rose.js +2685 -114
  49. data/vendor/assets/javascripts/RGraph.rscatter.js +1920 -80
  50. data/vendor/assets/javascripts/RGraph.scatter.js +4215 -171
  51. data/vendor/assets/javascripts/RGraph.segmented.js +1006 -0
  52. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1980 -59
  53. data/vendor/assets/javascripts/RGraph.svg.activity.js +1696 -0
  54. data/vendor/assets/javascripts/RGraph.svg.bar.js +2575 -77
  55. data/vendor/assets/javascripts/RGraph.svg.bipolar.js +3533 -106
  56. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +240 -21
  57. data/vendor/assets/javascripts/RGraph.svg.common.core.js +7105 -299
  58. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +408 -28
  59. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1291 -68
  60. data/vendor/assets/javascripts/RGraph.svg.common.key.js +451 -20
  61. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +543 -31
  62. data/vendor/assets/javascripts/RGraph.svg.common.table.js +391 -0
  63. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +1072 -23
  64. data/vendor/assets/javascripts/RGraph.svg.funnel.js +1151 -32
  65. data/vendor/assets/javascripts/RGraph.svg.gauge.js +1429 -34
  66. data/vendor/assets/javascripts/RGraph.svg.hbar.js +2692 -65
  67. data/vendor/assets/javascripts/RGraph.svg.horseshoe.js +969 -0
  68. data/vendor/assets/javascripts/RGraph.svg.line.js +2855 -86
  69. data/vendor/assets/javascripts/RGraph.svg.pie.js +1630 -58
  70. data/vendor/assets/javascripts/RGraph.svg.radar.js +1772 -58
  71. data/vendor/assets/javascripts/RGraph.svg.rose.js +2419 -83
  72. data/vendor/assets/javascripts/RGraph.svg.scatter.js +2280 -65
  73. data/vendor/assets/javascripts/RGraph.svg.segmented.js +930 -0
  74. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +1612 -29
  75. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1525 -50
  76. data/vendor/assets/javascripts/RGraph.thermometer.js +1411 -64
  77. data/vendor/assets/javascripts/RGraph.vprogress.js +1915 -81
  78. data/vendor/assets/javascripts/RGraph.waterfall.js +1896 -89
  79. data/vendor/assets/javascripts/financial-data.js +1067 -0
  80. metadata +37 -16
  81. data/.travis.yml +0 -11
  82. data/vendor/assets/javascripts/RGraph.common.deprecated.js +0 -35
  83. data/vendor/assets/javascripts/RGraph.common.resizing.js +0 -38
  84. data/vendor/assets/javascripts/RGraph.common.zoom.js +0 -15
  85. data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
@@ -1,30 +1,1613 @@
1
+ 'version:2023-09-16 (6.14)';
2
+ //
3
+ // o--------------------------------------------------------------------------------o
4
+ // | This file is part of the RGraph package - you can learn more at: |
5
+ // | |
6
+ // | https://www.rgraph.net |
7
+ // | |
8
+ // | RGraph is licensed under the Open Source MIT license. That means that it's |
9
+ // | totally free to use and there are no restrictions on what you can do with it! |
10
+ // o--------------------------------------------------------------------------------o
1
11
 
2
- RGraph=window.RGraph||{isRGraph:true};RGraph.SVG=RGraph.SVG||{};(function(win,doc,undefined)
3
- {var RG=RGraph,ua=navigator.userAgent,ma=Math,win=window,doc=document;RG.SVG.SemiCircularProgress=function(conf)
4
- {this.set=function(name,value)
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.min=RG.SVG.stringsToNumbers(conf.min);this.max=RG.SVG.stringsToNumbers(conf.max);this.value=RG.SVG.stringsToNumbers(conf.value);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.width=Number(this.svg.getAttribute('width'));this.height=Number(this.svg.getAttribute('height'));this.data=conf.data;this.type='semicircularprogress';this.colorsParsed=false;this.originalColors={};this.gradientCounter=1;this.nodes={};this.shadowNodes=[];if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.propertyNameAliases={};RG.SVG.OR.add(this);this.container.style.display='inline-block';this.properties={centerx:null,centery:null,radius:null,width:60,marginLeft:35,marginRight:35,marginTop:35,marginBottom:35,backgroundStrokeLinewidth:0.25,backgroundStroke:'gray',backgroundFill:'Gradient(white:#aaa)',backgroundFillOpacity:0.25,colors:['#0c0'],colorsStroke:'#666',textColor:'black',textFont:'Arial, Verdana, sans-serif',textSize:12,textBold:false,textItalic:false,scaleUnitsPre:'',scaleUnitsPost:'',scalePoint:'.',scaleThousand:',',scaleDecimals:0,scaleFormatter:null,labelsMin:true,labelsMinSpecific:null,labelsMinPoint:null,labelsMinThousand:null,labelsMinFormatter:null,labelsMinFont:null,labelsMinSize:null,labelsMinBold:null,labelsMinItalic:null,labelsMinColor:null,labelsMinDecimals:null,labelsMinUnitsPre:null,labelsMinUnitsPost:null,labelsMax:true,labelsMaxSpecific:null,labelsMaxPoint:null,labelsMaxThousand:null,labelsMaxFormatter:null,labelsMaxFont:null,labelsMaxSize:null,labelsMaxBold:null,labelsMaxItalic:null,labelsMaxColor:null,labelsMaxDecimals:null,labelsMaxUnitsPre:null,labelsMaxUnitsPost:null,labelsCenter:true,labelsCenterSpecific:null,labelsCenterPoint:null,labelsCenterThousand:null,labelsCenterFormatter:null,labelsCenterFont:null,labelsCenterSize:40,labelsCenterBold:true,labelsCenterItalic:null,labelsCenterColor:null,labelsCenterDecimals:null,labelsCenterUnitsPre:null,labelsCenterUnitsPost:null,linewidth:0,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,titleFont:null,titleSize:null,titleColor: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};RG.SVG.getGlobals(this);if(RG.SVG.FX&&typeof RG.SVG.FX.decorate==='function'){RG.SVG.FX.decorate(this);}
8
- var prop=this.properties;this.draw=function()
9
- {RG.SVG.fireCustomEvent(this,'onbeforedraw');this.nodes={};this.width=Number(this.svg.getAttribute('width'));this.height=Number(this.svg.getAttribute('height'));RG.SVG.createDefs(this);this.graphWidth=this.width-prop.marginLeft-prop.marginRight;this.graphHeight=this.height-prop.marginTop-prop.marginBottom;this.centerx=(this.graphWidth/2)+prop.marginLeft;this.centery=this.height-prop.marginBottom;this.radius=ma.min(this.graphWidth/2,this.graphHeight);this.centerx=typeof prop.centerx==='number'?prop.centerx:this.centerx;this.centery=typeof prop.centery==='number'?prop.centery:this.centery;this.radius=typeof prop.radius==='number'?prop.radius:this.radius;if(typeof prop.radius==='string'&&prop.radius.match(/^\+|-\d+$/))this.radius+=parseFloat(prop.radius);if(typeof prop.centerx==='string'&&prop.centerx.match(/^\+|-\d+$/))this.centerx+=parseFloat(prop.centerx);if(typeof prop.centery==='string'&&prop.centery.match(/^\+|-\d+$/))this.centery+=parseFloat(prop.centery);this.progressWidth=prop.width||(this.radius/3);RG.SVG.resetColorsToOriginalValues({object:this});this.parseColors();this.path=this.drawMeter();RG.SVG.drawTitle(this);this.drawLabels();RG.SVG.attribution(this);if(!RG.SVG.isNull(prop.tooltips)&&prop.tooltips[0]){var obj=this;this.path.addEventListener(prop.tooltipsEvent,function(e)
10
- {obj.removeHighlight();RG.SVG.tooltip({object:obj,index:0,group:null,sequentialIndex:0,text:prop.tooltips[0],event:e});obj.highlight(e.target);},false);this.path.addEventListener('mousemove',function(e)
11
- {e.target.style.cursor='pointer'},false);}
12
- var obj=this;doc.body.addEventListener('mousedown',function(e)
13
- {obj.removeHighlight();},false);RG.SVG.fireCustomEvent(this,'ondraw');return this;};this.drawMeter=function()
14
- {var path=RG.SVG.TRIG.getArcPath({cx:this.centerx,cy:this.centery,r:this.radius,start:RG.SVG.TRIG.PI+RG.SVG.TRIG.HALFPI,end:RG.SVG.TRIG.HALFPI,anticlockwise:false});var path2=RG.SVG.TRIG.getArcPath({cx:this.centerx,cy:this.centery,r:this.radius-this.progressWidth,end:RG.SVG.TRIG.PI+RG.SVG.TRIG.HALFPI,start:RG.SVG.TRIG.HALFPI,anticlockwise:true,moveto:false});var background=RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:path+" L "+(this.centerx+this.radius-this.progressWidth)+" "+this.centery+path2+" L "+(this.centerx-this.radius)+" "+this.centery,fill:prop.backgroundFill||prop.colors[0],'stroke-width':0,'fill-opacity':prop.backgroundFillOpacity}});this.nodes.background=background;var angle=((this.value-this.min)/(this.max-this.min))*RG.SVG.TRIG.PI;angle-=RG.SVG.TRIG.HALFPI;var path=RG.SVG.TRIG.getArcPath({cx:this.centerx,cy:this.centery,r:this.radius,start:RG.SVG.TRIG.PI+RG.SVG.TRIG.HALFPI,end:angle,anticlockwise:false});var path2=RG.SVG.TRIG.getArcPath({cx:this.centerx,cy:this.centery,r:this.radius-this.progressWidth,start:angle,end:angle,anticlockwise:false,array:true});var path3=RG.SVG.TRIG.getArcPath({cx:this.centerx,cy:this.centery,r:this.radius-this.progressWidth,start:angle,end:RG.SVG.TRIG.PI+RG.SVG.TRIG.HALFPI,anticlockwise:true,moveto:false});var group=RG.SVG.create({svg:this.svg,type:'g',parent:this.svg.all,attr:{id:'indicator-bar-group'}});var path=RG.SVG.create({svg:this.svg,type:'path',parent:group,attr:{d:path+" L{1} {2} ".format(path2[1],path2[2])+path3+' z',fill:prop.colors[0],stroke:'black','stroke-width':prop.linewidth}});this.nodes.barGroup=group;this.nodes.bar=path;var backgroundStroke=RG.SVG.create({svg:this.svg,type:'path',parent:this.svg.all,attr:{d:this.nodes.background.getAttribute('d'),stroke:prop.backgroundStroke,fill:'rgba(0,0,0,0)','stroke-width':prop.backgroundStrokeLinewidth,'stroke-linecap':'square'},style:{pointerEvents:'none'}});this.nodes.backgroundStroke=backgroundStroke;return path;};this.drawLabels=function()
15
- {if(prop.labelsMin){var min=RG.SVG.numberFormat({object:this,num:this.min.toFixed(typeof prop.labelsMinDecimals==='number'?prop.labelsMinDecimals:prop.scaleDecimals),prepend:typeof prop.labelsMinUnitsPre==='string'?prop.labelsMinUnitsPre:prop.scaleUnitsPre,append:typeof prop.labelsMinUnitsPost==='string'?prop.labelsMinUnitsPost:prop.scaleUnitsPost,point:typeof prop.labelsMinPoint==='string'?prop.labelsMinPoint:prop.scalePoint,thousand:typeof prop.labelsMinThousand==='string'?prop.labelsMinThousand:prop.scaleThousand,formatter:typeof prop.labelsMinFormatter==='function'?prop.labelsMinFormatter:prop.scaleFormatter});var text=RG.SVG.text({object:this,parent:this.svg.all,tag:'labels.min',text:typeof prop.labelsMinSpecific==='string'?prop.labelsMinSpecific:min,x:this.centerx-this.radius+(this.progressWidth/2),y:this.centery+5+prop.backgroundStrokeLinewidth,valign:'top',halign:'center',font:prop.labelsMinFont||prop.textFont,size:typeof prop.labelsMinSize==='number'?prop.labelsMinSize:prop.textSize,bold:typeof prop.labelsMinBold==='boolean'?prop.labelsMinBold:prop.textBold,italic:typeof prop.labelsMinItalic==='boolean'?prop.labelsMinItalic:prop.textItalic,color:prop.labelsMinColor||prop.textColor});this.nodes.labelsMin=text;}
16
- if(prop.labelsMax){var max=RG.SVG.numberFormat({object:this,num:this.max.toFixed(typeof prop.labelsMaxDecimals==='number'?prop.labelsMaxDecimals:prop.scaleDecimals),prepend:typeof prop.labelsMaxUnitsPre==='string'?prop.labelsMaxUnitsPre:prop.scaleUnitsPre,append:typeof prop.labelsMaxUnitsPost==='string'?prop.labelsMaxUnitsPost:prop.scaleUnitsPost,point:typeof prop.labelsMaxPoint==='string'?prop.labelsMaxPoint:prop.scalePoint,thousand:typeof prop.labelsMaxThousand==='string'?prop.labelsMaxThousand:prop.scaleThousand,formatter:typeof prop.labelsMaxFormatter==='function'?prop.labelsMaxFormatter:prop.scaleFormatter});var text=RG.SVG.text({object:this,parent:this.svg.all,tag:'labels.max',text:typeof prop.labelsMaxSpecific==='string'?prop.labelsMaxSpecific:max,x:this.centerx+this.radius-(this.progressWidth/2),y:this.centery+5+prop.backgroundStrokeLinewidth,valign:'top',halign:'center',font:prop.labelsMaxFont||prop.textFont,size:typeof prop.labelsMaxSize==='number'?prop.labelsMaxSize:prop.textSize,bold:typeof prop.labelsMaxBold==='boolean'?prop.labelsMaxBold:prop.textBold,italic:typeof prop.labelsMaxItalic==='boolean'?prop.labelsMaxItalic:prop.textItalic,color:prop.labelsMaxColor||prop.textColor});this.nodes.labelsMax=text;}
17
- if(prop.labelsCenter){var center=RG.SVG.numberFormat({object:this,num:this.value.toFixed(typeof prop.labelsCenterDecimals==='number'?prop.labelsCenterDecimals:prop.scaleDecimals),prepend:typeof prop.labelsCenterUnitsPre==='string'?prop.labelsCenterUnitsPre:prop.scaleUnitsPre,append:typeof prop.labelsCenterUnitsPost==='string'?prop.labelsCenterUnitsPost:prop.scaleUnitsPost,point:typeof prop.labelsCenterPoint==='string'?prop.labelsCenterPoint:prop.scalePoint,thousand:typeof prop.labelsCenterThousand==='string'?prop.labelsCenterThousand:prop.scaleThousand,formatter:typeof prop.labelsCenterFormatter==='function'?prop.labelsCenterFormatter:prop.scaleFormatter});var text=RG.SVG.text({object:this,parent:this.svg.all,tag:'labels.center',text:typeof prop.labelsCenterSpecific==='string'?prop.labelsCenterSpecific:center,x:this.centerx,y:this.centery,valign:'bottom',halign:'center',font:prop.labelsCenterFont||prop.textFont,size:typeof prop.labelsCenterSize==='number'?prop.labelsCenterSize:prop.textSize,bold:typeof prop.labelsCenterBold==='boolean'?prop.labelsCenterBold:prop.textBold,italic:typeof prop.labelsCenterItalic==='boolean'?prop.labelsCenterItalic:prop.textItalic,color:prop.labelsCenterColor||prop.textColor});this.nodes.labelsCenter=text;}};this.highlight=function(segment)
18
- {this.removeHighlight();var highlight=RG.SVG.create({svg:this.svg,type:'path',parent:this.nodes.barGroup,attr:{d:this.path.getAttribute('d'),fill:prop.highlightFill,stroke:prop.highlightStroke,'stroke-width':prop.highlightLinewidth},style:{pointerEvents:'none'}});RG.SVG.REG.set('highlight',highlight);var obj=this;doc.body.addEventListener('mousedown',function(e)
19
- {obj.removeHighlight();},false);};this.removeHighlight=function()
20
- {var highlight=RG.SVG.REG.get('highlight');if(highlight){highlight.parentNode.removeChild(highlight);highlight=null;}};this.parseColors=function()
21
- {if(!Object.keys(this.originalColors).length){this.originalColors={colors:RG.SVG.arrayClone(prop.colors),highlightFill:RG.SVG.arrayClone(prop.highlightFill),backgroundColor:RG.SVG.arrayClone(prop.backgroundColor)}}
22
- var colors=prop.colors;if(colors){for(var i=0;i<colors.length;++i){colors[i]=RG.SVG.parseColorLinear({object:this,color:colors[i],start:this.centerx-this.radius,end:this.centerx+this.radius,direction:'horizontal'});}}
23
- prop.highlightFill=RG.SVG.parseColorLinear({object:this,color:prop.highlightFill,start:prop.marginLeft,end:this.width-prop.marginRight,direction:'horizontal'});prop.backgroundColor=RG.SVG.parseColorLinear({object:this,color:prop.backgroundColor,start:prop.marginLeft,end:this.width-prop.marginRight,direction:'horizontal'});};this.grow=function()
24
- {var opt=arguments[0]||{},frames=opt.frames||30,frame=0,obj=this,value=opt.value;value=this.value;this.draw();var iterate=function()
25
- {var multiplier=frame/frames*RG.SVG.FX.getEasingMultiplier(frames,frame)*RG.SVG.FX.getEasingMultiplier(frames,frame);obj.value=value*multiplier;RG.SVG.redraw();if(frame++<frames){RG.SVG.FX.update(iterate);}else if(opt.callback){obj.value=value;RG.SVG.redraw();(opt.callback)(obj);}};iterate();return this;};this.on=function(type,func)
26
- {if(type.substr(0,2)!=='on'){type='on'+type;}
27
- RG.SVG.addCustomEventListener(this,type,func);return this;};this.exec=function(func)
28
- {func(this);return this;};this.removeHighlight=function()
29
- {var highlight=RG.SVG.REG.get('highlight');if(highlight&&highlight.parentNode){highlight.parentNode.removeChild(highlight);}
30
- RG.SVG.REG.set('highlight',null);};for(i in conf.options){if(typeof i==='string'){this.set(i,conf.options[i]);}}};return this;})(window,document);
12
+ RGraph = window.RGraph || {isrgraph:true,isRGraph:true,rgraph:true};
13
+ RGraph.SVG = RGraph.SVG || {};
14
+
15
+ // Module pattern
16
+ (function (win, doc, undefined)
17
+ {
18
+ RGraph.SVG.SemiCircularProgress = function (conf)
19
+ {
20
+ //
21
+ // A setter that the constructor uses (at the end)
22
+ // to set all of the properties
23
+ //
24
+ // @param string name The name of the property to set
25
+ // @param string value The value to set the property to
26
+ //
27
+ this.set = function (name, value)
28
+ {
29
+ if (arguments.length === 1 && typeof name === 'object') {
30
+ for (i in arguments[0]) {
31
+ if (typeof i === 'string') {
32
+
33
+ name = ret.name;
34
+ value = ret.value;
35
+
36
+ if (name === 'backgroundColor') {name = 'backgroundFill';}
37
+ if (name === 'backgroundColorOpacity') {name = 'backgroundFillOpacity';}
38
+
39
+ this.set(name, value);
40
+ }
41
+ }
42
+ } else {
43
+
44
+ if (name === 'backgroundColor') {name = 'backgroundFill';}
45
+ if (name === 'backgroundColorOpacity') {name = 'backgroundFillOpacity';}
46
+
47
+ var ret = RGraph.SVG.commonSetter({
48
+ object: this,
49
+ name: name,
50
+ value: value
51
+ });
52
+
53
+ name = ret.name;
54
+ value = ret.value;
55
+
56
+ this.properties[name] = value;
57
+
58
+ // If setting the colors, update the originalColors
59
+ // property too
60
+ if (name === 'colors') {
61
+ this.originalColors = RGraph.SVG.arrayClone(value);
62
+ this.colorsParsed = false;
63
+ }
64
+ }
65
+
66
+ return this;
67
+ };
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ //
77
+ // A getter.
78
+ //
79
+ // @param name string The name of the property to get
80
+ //
81
+ this.get = function (name)
82
+ {
83
+ return this.properties[name];
84
+ };
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ this.min = RGraph.SVG.stringsToNumbers(conf.min);
94
+ this.max = RGraph.SVG.stringsToNumbers(conf.max);
95
+ this.value = RGraph.SVG.stringsToNumbers(conf.value);
96
+ this.id = conf.id;
97
+ this.uid = RGraph.SVG.createUID();
98
+ this.container = document.getElementById(this.id);
99
+ this.layers = {}; // MUST be before the SVG tag is created!
100
+ this.svg = RGraph.SVG.createSVG({object: this,container: this.container});
101
+ this.isRGraph = true;
102
+ this.isrgraph = true;
103
+ this.rgraph = true;
104
+ this.width = Number(this.svg.getAttribute('width'));
105
+ this.height = Number(this.svg.getAttribute('height'));
106
+ this.data = conf.data; // Is this used? Don't think so.
107
+ this.type = 'semicircularprogress';
108
+ this.colorsParsed = false;
109
+ this.originalColors = {};
110
+ this.gradientCounter = 1;
111
+ this.nodes = {};
112
+ this.coords = [];
113
+ this.shadowNodes = [];
114
+ this.firstDraw = true; // After the first draw this will be false
115
+
116
+ // Used for adjusting
117
+ this.adjusting_mousedown = false;
118
+
119
+ // Bounds checking
120
+ if (this.value > this.max) this.value = this.max;
121
+ if (this.value < this.min) this.value = this.min;
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ // Add this object to the ObjectRegistry
130
+ RGraph.SVG.OR.add(this);
131
+
132
+ // Set the DIV container to be inline-block
133
+ this.container.style.display = 'inline-block';
134
+
135
+ this.properties =
136
+ {
137
+ centerx: null,
138
+ centery: null,
139
+ radius: null,
140
+
141
+ width: 60,
142
+
143
+ marginLeft: 35,
144
+ marginRight: 35,
145
+ marginTop: 35,
146
+ marginBottom: 35,
147
+
148
+ backgroundStrokeLinewidth: 0.25,
149
+ backgroundStroke: 'gray',
150
+ backgroundFill: null,
151
+ backgroundFillOpacity: 0.15,
152
+ backgroundGrid: false,
153
+ backgroundGridMargin: 20,
154
+ backgroundGridColor: '#ddd',
155
+ backgroundGridLinewidth: 1,
156
+ backgroundGridCircles: true,
157
+ backgroundGridRadials: true,
158
+ backgroundGridRadialsCount: 10,
159
+
160
+ colors: ['#6d6','#FFA5A5','#A0A2F8','yellow','gray','pink','orange','cyan','green'],
161
+ colorsStroke: 'transparent',
162
+
163
+ textColor: 'black',
164
+ textFont: 'Arial, Verdana, sans-serif',
165
+ textSize: 12,
166
+ textBold: false,
167
+ textItalic: false,
168
+ text: null,
169
+
170
+ scale: false,
171
+ scaleMin: null, // Defaults to the charts min value
172
+ scaleMax: null, // Defaults to the charts max value
173
+ scaleDecimals: 0,
174
+ scalePoint: '.',
175
+ scaleThousand: ',',
176
+ scaleFormatter: null,
177
+ scaleUnitsPre: '',
178
+ scaleUnitsPost: '',
179
+ scaleLabelsCount: 10,
180
+ scaleLabelsFont: null,
181
+ scaleLabelsSize: null,
182
+ scaleLabelsColor: null,
183
+ scaleLabelsBold: null,
184
+ scaleLabelsItalic: null,
185
+ scaleLabelsOffsetr: 0,
186
+ scaleLabelsOffsetx: 0,
187
+ scaleLabelsOffsety: 0,
188
+
189
+ labelsMin: true,
190
+ labelsMinSpecific: null,
191
+ labelsMinPoint: null,
192
+ labelsMinThousand: null,
193
+ labelsMinDecimals: null,
194
+ labelsMinFormatter: null,
195
+ labelsMinFont: null,
196
+ labelsMinSize: null,
197
+ labelsMinBold: null,
198
+ labelsMinItalic: null,
199
+ labelsMinColor: null,
200
+ labelsMinUnitsPre: null,
201
+ labelsMinUnitsPost: null,
202
+
203
+ labelsMax: true,
204
+ labelsMaxSpecific: null,
205
+ labelsMaxPoint: null,
206
+ labelsMaxThousand: null,
207
+ labelsMaxFormatter: null,
208
+ labelsMaxFont: null,
209
+ labelsMaxSize: null,
210
+ labelsMaxBold: null,
211
+ labelsMaxItalic: null,
212
+ labelsMaxColor: null,
213
+ labelsMaxDecimals: null,
214
+ labelsMaxUnitsPre: null,
215
+ labelsMaxUnitsPost: null,
216
+
217
+ labelsCenter: true,
218
+ labelsCenterIndex: 0,
219
+ labelsCenterSpecific: null,
220
+ labelsCenterPoint: null,
221
+ labelsCenterThousand: null,
222
+ labelsCenterFormatter: null,
223
+ labelsCenterFont: null,
224
+ labelsCenterSize: 40,
225
+ labelsCenterBold: true,
226
+ labelsCenterItalic: null,
227
+ labelsCenterColor: null,
228
+ labelsCenterDecimals: null,
229
+ labelsCenterUnitsPre: null,
230
+ labelsCenterUnitsPost: null,
231
+
232
+ linewidth: 1,
233
+
234
+ tooltips: null,
235
+ tooltipsOverride: null,
236
+ tooltipsEffect: 'fade',
237
+ tooltipsCssClass: 'RGraph_tooltip',
238
+ tooltipsCss: null,
239
+ tooltipsEvent: 'click',
240
+ tooltipsFormattedThousand: ',',
241
+ tooltipsFormattedPoint: '.',
242
+ tooltipsFormattedDecimals: 0,
243
+ tooltipsFormattedUnitsPre: '',
244
+ tooltipsFormattedUnitsPost: '',
245
+ tooltipsFormattedKeyColors: null,
246
+ tooltipsFormattedKeyColorsShape: 'square',
247
+ tooltipsFormattedKeyLabels: [],
248
+ tooltipsFormattedTableHeaders: null,
249
+ tooltipsFormattedTableData: null,
250
+ tooltipsPointer: true,
251
+ tooltipsPointerOffsetx: 0,
252
+ tooltipsPointerOffsety: 0,
253
+ tooltipsPositionStatic: true,
254
+
255
+ adjustable: false,
256
+
257
+ highlightStroke: 'rgba(0,0,0,0)',
258
+ highlightFill: 'rgba(255,255,255,0.7)',
259
+ highlightLinewidth: 1,
260
+
261
+ title: '',
262
+ titleX: null,
263
+ titleY: null,
264
+ titleHalign: 'center',
265
+ titleValign: null,
266
+ titleFont: null,
267
+ titleSize: null,
268
+ titleColor: null,
269
+ titleBold: null,
270
+ titleItalic: null,
271
+
272
+ titleSubtitle: null,
273
+ titleSubtitleSize: null,
274
+ titleSubtitleColor: '#aaa',
275
+ titleSubtitleFont: null,
276
+ titleSubtitleBold: null,
277
+ titleSubtitleItalic: null
278
+ };
279
+
280
+
281
+
282
+
283
+ //
284
+ // Copy the global object properties to this instance
285
+ //
286
+ RGraph.SVG.getGlobals(this);
287
+
288
+
289
+
290
+
291
+
292
+ //
293
+ // "Decorate" the object with the generic effects if the effects library has been included
294
+ //
295
+ if (RGraph.SVG.FX && typeof RGraph.SVG.FX.decorate === 'function') {
296
+ RGraph.SVG.FX.decorate(this);
297
+ }
298
+
299
+
300
+
301
+
302
+
303
+ // Add the responsive function to the object
304
+ this.responsive = RGraph.SVG.responsive;
305
+
306
+
307
+
308
+
309
+
310
+ var properties = this.properties;
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+ //
320
+ // The draw method draws the Bar chart
321
+ //
322
+ this.draw = function ()
323
+ {
324
+ // Fire the beforedraw event
325
+ RGraph.SVG.fireCustomEvent(this, 'onbeforedraw');
326
+
327
+
328
+ // Reset this to prevent it from growing
329
+ this.nodes = {};
330
+
331
+ // Should the first thing that's done inthe.draw() function
332
+ // except for the onbeforedraw event
333
+ this.width = Number(this.svg.getAttribute('width'));
334
+ this.height = Number(this.svg.getAttribute('height'));
335
+
336
+
337
+
338
+ // Create the defs tag if necessary
339
+ RGraph.SVG.createDefs(this);
340
+
341
+
342
+
343
+ // Add these
344
+ this.graphWidth = this.width - properties.marginLeft - properties.marginRight;
345
+ this.graphHeight = this.height - properties.marginTop - properties.marginBottom;
346
+
347
+
348
+
349
+ // Work out the center point
350
+ this.centerx = (this.graphWidth / 2) + properties.marginLeft;
351
+ this.centery = this.height - properties.marginBottom;
352
+ this.radius = Math.min(this.graphWidth / 2, this.graphHeight);
353
+
354
+
355
+
356
+ // Allow the user to override the calculated centerx/y/radius
357
+ this.centerx = typeof properties.centerx === 'number' ? properties.centerx : this.centerx;
358
+ this.centery = typeof properties.centery === 'number' ? properties.centery : this.centery;
359
+ this.radius = typeof properties.radius === 'number' ? properties.radius : this.radius;
360
+
361
+ //
362
+ // Allow the centerx/centery/radius to be a plus/minus
363
+ //
364
+ if (typeof properties.radius === 'string' && properties.radius.match(/^\+|-\d+$/) ) this.radius += parseFloat(properties.radius);
365
+ if (typeof properties.centerx === 'string' && properties.centerx.match(/^\+|-\d+$/) ) this.centerx += parseFloat(properties.centerx);
366
+ if (typeof properties.centery === 'string' && properties.centery.match(/^\+|-\d+$/) ) this.centery += parseFloat(properties.centery);
367
+
368
+ // Set the width of the meter
369
+ this.progressWidth = properties.width || (this.radius / 3);
370
+
371
+
372
+
373
+ // Parse the colors for gradients
374
+ RGraph.SVG.resetColorsToOriginalValues({object:this});
375
+ this.parseColors();
376
+
377
+
378
+
379
+
380
+
381
+
382
+ this.drawBackground(); // Draw the background "grid"
383
+ this.drawMeter(); // Draw the segments
384
+ RGraph.SVG.drawTitle(this); // Draw the title and subtitle
385
+ this.drawLabels(); // Draw the labels
386
+ this.drawScale(); // Draw the scale
387
+
388
+
389
+
390
+ var obj = this;
391
+
392
+ // Add the tooltip event listener
393
+ if (!RGraph.SVG.isNull(properties.tooltips) && (properties.tooltips.length || RGraph.SVG.isString(properties.tooltips)) ) {
394
+
395
+
396
+ for (var i=0; i<this.coords.length; ++i) {
397
+ (function (index)
398
+ {
399
+ if (RGraph.SVG.isString(properties.tooltips) || (RGraph.SVG.isArray(properties.tooltips) && properties.tooltips[index])) {
400
+ obj.coords[index].element.addEventListener(properties.tooltipsEvent.replace(/^on/, ''), function (e)
401
+ {
402
+ obj.removeHighlight();
403
+
404
+ // Show the tooltip
405
+ RGraph.SVG.tooltip({
406
+ object: obj,
407
+ index: index,
408
+ group: null,
409
+ sequentialIndex: index,
410
+ text: RGraph.SVG.isString(properties.tooltips) ? properties.tooltips : properties.tooltips[index],
411
+ event: e
412
+ });
413
+
414
+ // Highlight the rect that has been clicked on
415
+ obj.highlight(e.target);
416
+ }, false);
417
+
418
+ // Add the mousemove listener that changes the
419
+ // mouse pointer
420
+ obj.coords[index].element.addEventListener('mousemove', function (e)
421
+ {
422
+ e.target.style.cursor = 'pointer';
423
+ }, false);
424
+ }
425
+ })(i);
426
+ }
427
+ }
428
+
429
+
430
+ // Add the event listener that clears the highlight if
431
+ // there is any. Must be MOUSEDOWN (ie before the click
432
+ // event)
433
+ if (!this.added_remove_highlight_listener) {
434
+ document.body.addEventListener('mousedown', function (e)
435
+ {
436
+ obj.removeHighlight();
437
+ }, false);
438
+
439
+ this.added_remove_highlight_listener = true;
440
+ }
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+ //
450
+ // Allow the addition of custom text via the
451
+ // text: property.
452
+ //
453
+ RGraph.SVG.addCustomText(this);
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+ //
463
+ // Ajusting
464
+ //
465
+ if (properties.adjustable) {
466
+
467
+ var obj = this;
468
+
469
+ var func = function (e)
470
+ {
471
+ var div = e.currentTarget,
472
+ mouseX = e.offsetX,
473
+ mouseY = e.offsetY;
474
+
475
+ if (RGraph.SVG.ISFF) {
476
+ mouseX = e.pageX - e.currentTarget.offsetLeft;
477
+ mouseY = e.pageY - e.currentTarget.offsetTop;
478
+ }
479
+
480
+ var radius = RGraph.SVG.TRIG.getHypLength({
481
+ x1: mouseX,
482
+ y1: mouseY,
483
+ x2: obj.centerx,
484
+ y2: obj.centery,
485
+ object: obj
486
+ });
487
+
488
+ //if (radius > obj.radius) {
489
+ // return;
490
+ //}
491
+
492
+ var value = obj.getValue(e);
493
+
494
+
495
+ obj.value = value;
496
+ RGraph.SVG.clear(obj.svg);
497
+ obj.draw();
498
+ };
499
+
500
+ //
501
+ // Only add the adjusting event listeners once
502
+ //
503
+ var obj = this;
504
+ RGraph.SVG.runOnce('rgraph-svg-scp-adjusting-event-listeners', function ()
505
+ {
506
+ //
507
+ // Create a reference so that code thats inside
508
+ // the event listeners can easily access the
509
+ // object
510
+
511
+ obj.container.addEventListener('mousedown', function (e)
512
+ {
513
+ var mouseX = e.offsetX,
514
+ mouseY = e.offsetY;
515
+
516
+ if (RGraph.SVG.ISFF) {
517
+ mouseX = e.pageX - e.currentTarget.offsetLeft;
518
+ mouseY = e.pageY - e.currentTarget.offsetTop;
519
+ }
520
+
521
+ var radius = RGraph.SVG.TRIG.getHypLength({
522
+ x1: mouseX,
523
+ y1: mouseY,
524
+ x2: obj.centerx,
525
+ y2: obj.centery,
526
+ object: obj
527
+ });
528
+
529
+ // The first click that starts adjusting
530
+ // must be within the progress meter area
531
+ if (radius > obj.radius || radius < (obj.radius - obj.progressWidth)) {
532
+ return;
533
+ }
534
+
535
+ obj.adjusting_mousedown = true;
536
+ func(e);
537
+
538
+ // Fire the beforedraw event
539
+ RGraph.SVG.fireCustomEvent(obj, 'onadjustbegin');
540
+
541
+ }, false);
542
+
543
+ obj.container.addEventListener('mousemove', function (e)
544
+ {
545
+ if (obj.adjusting_mousedown) {
546
+ func(e);
547
+
548
+ // Fire the beforedraw event
549
+ RGraph.SVG.fireCustomEvent(obj, 'onadjust');
550
+ }
551
+ }, false);
552
+
553
+ window.addEventListener('mouseup', function (e)
554
+ {
555
+ obj.adjusting_mousedown = false;
556
+
557
+ // Fire the beforedraw event
558
+ RGraph.SVG.fireCustomEvent(obj, 'onadjustend');
559
+ }, false);
560
+ });
561
+ }
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+ //
573
+ // Fire the onfirstdraw event
574
+ //
575
+ if (this.firstDraw) {
576
+ this.firstDraw = false;
577
+ RGraph.SVG.fireCustomEvent(this, 'onfirstdraw');
578
+ }
579
+
580
+
581
+
582
+
583
+ // Fire the draw event
584
+ RGraph.SVG.fireCustomEvent(this, 'ondraw');
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+ //
593
+ // Install any inline responsive configuration. This
594
+ // should be last in the draw function - even after
595
+ // the draw events.
596
+ //
597
+ RGraph.SVG.installInlineResponsive(this);
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+ return this;
610
+ };
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+ //
620
+ // New create() shortcut function
621
+ // For example:
622
+ // this.create('rect,x:0,y:0,width:100,height:100'[,parent]);
623
+ //
624
+ // @param str string The tag definition to parse and create
625
+ // @param object The (optional) parent element
626
+ // @return object The new tag
627
+ //
628
+ this.create = function (str)
629
+ {
630
+ var def = RGraph.SVG.create.parseStr(this, str);
631
+ def.svg = this.svg;
632
+
633
+ // By default the parent is the SVG tag - but if
634
+ // requested then change it to the tag that has
635
+ // been given
636
+ if (arguments[1]) {
637
+ def.parent = arguments[1];
638
+ }
639
+
640
+ return RGraph.SVG.create(def);
641
+ };
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+ //
651
+ // This function returns the value that the mouse is positioned at, regardless of
652
+ // the actual indicated value.
653
+ //
654
+ // @param object e The event object
655
+ //
656
+ this.getValue = function (e)
657
+ {
658
+ var mouseX = e.offsetX,
659
+ mouseY = e.offsetY;
660
+
661
+ if (RGraph.SVG.ISFF) {
662
+ mouseX = e.pageX - e.currentTarget.offsetLeft;
663
+ mouseY = e.pageY - e.currentTarget.offsetTop;
664
+ }
665
+
666
+ var angle = RGraph.SVG.TRIG.getAngleByXY({
667
+ cx: this.centerx,
668
+ cy: this.centery,
669
+ x: mouseX,
670
+ y: mouseY
671
+ });
672
+
673
+ var value = ((angle - this.angleStart) / (this.angleEnd - this.angleStart));
674
+
675
+ // Adjust the angle aso that it goes from 0 - 3.14
676
+ if (mouseX < this.centerx) {
677
+ angle = angle - RGraph.SVG.TRIG.PI - RGraph.SVG.TRIG.HALFPI;
678
+ } else if (mouseX > this.centerx) {
679
+ angle += RGraph.SVG.TRIG.HALFPI;
680
+ } else if (mouseX === this.centerx) {
681
+ angle = RGraph.SVG.TRIG.HALFPI;
682
+ }
683
+
684
+ value = (this.max - this.min) * (angle / RGraph.SVG.TRIG.PI);
685
+
686
+ if (value < this.min) value = this.min;
687
+ if (value > this.max) value = this.max;
688
+
689
+ return value;
690
+ };
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+ //
700
+ // Draw the background "grid"
701
+ //
702
+ this.drawBackground = function ()
703
+ {
704
+ if (properties.backgroundGrid) {
705
+
706
+ var margin = properties.backgroundGridMargin;
707
+ var outerRadius = this.radius + margin;
708
+ var innerRadius = this.radius - properties.width - margin;
709
+
710
+ // Draw the background grid "circles"
711
+ if (properties.backgroundGridCircles) {
712
+
713
+ // Create the path for the outer line of the grid
714
+ var arcPath1 = RGraph.SVG.TRIG.getArcPath3({
715
+ cx: this.centerx,
716
+ cy: this.centery,
717
+ r: outerRadius,
718
+ start: -RGraph.SVG.TRIG.HALFPI,
719
+ end: RGraph.SVG.TRIG.HALFPI,
720
+ anticlockwise: false,
721
+ lineto: false,
722
+ moveto: true
723
+ });
724
+
725
+ // Create the path for the inner line of the grid
726
+ var arcPath2 = RGraph.SVG.TRIG.getArcPath3({
727
+ cx: this.centerx,
728
+ cy: this.centery,
729
+ r: innerRadius,
730
+ start: RGraph.SVG.TRIG.HALFPI,
731
+ end: -RGraph.SVG.TRIG.HALFPI,
732
+ anticlockwise: true,
733
+ lineto: true
734
+ });
735
+
736
+ RGraph.SVG.create({
737
+ svg: this.svg,
738
+ type: 'path',
739
+ parent: this.svg.all,
740
+ attr: {
741
+ d: arcPath1 + ' ' + arcPath2 + ' z',
742
+ stroke: properties.backgroundGridColor,
743
+ fill: 'transparent'
744
+ }
745
+ });
746
+ }
747
+
748
+
749
+ //
750
+ // Draw the background grid radials
751
+ //
752
+ if (properties.backgroundGridRadials) {
753
+
754
+ // Calculate the radius increment
755
+ var increment = (RGraph.SVG.TRIG.HALFPI - (0 - RGraph.SVG.TRIG.HALFPI) ) / properties.backgroundGridRadialsCount;
756
+ var angle = -RGraph.SVG.TRIG.HALFPI;
757
+
758
+ for (var i=0,path=''; i<properties.backgroundGridRadialsCount; ++i) {
759
+
760
+ path += RGraph.SVG.TRIG.getArcPath3({
761
+ cx: this.centerx,
762
+ cy: this.centery,
763
+ r: outerRadius,
764
+ start: -RGraph.SVG.TRIG.HALFPI + (i * increment),
765
+ end: -RGraph.SVG.TRIG.HALFPI + (i * increment),
766
+ anticlockwise: true,
767
+ lineto: false,
768
+ moveto: true
769
+ });
770
+
771
+ path += RGraph.SVG.TRIG.getArcPath3({
772
+ cx: this.centerx,
773
+ cy: this.centery,
774
+ r: innerRadius,
775
+ start: -RGraph.SVG.TRIG.HALFPI + (i * increment),
776
+ end: -RGraph.SVG.TRIG.HALFPI + (i * increment),
777
+ anticlockwise: true,
778
+ lineto: true
779
+ });
780
+
781
+ path += ' ';
782
+ angle += increment;
783
+ }
784
+
785
+ RGraph.SVG.create({
786
+ svg: this.svg,
787
+ type: 'path',
788
+ parent: this.svg.all,
789
+ attr: {
790
+ d: path + ' z',
791
+ stroke: properties.backgroundGridColor,
792
+ fill: 'transparent',
793
+ 'stroke-width': properties.backgroundGridLinewidth
794
+ }
795
+ });
796
+ }
797
+ }
798
+ };
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+ //
808
+ // Draws the meter
809
+ //
810
+ this.drawMeter = function ()
811
+ {
812
+ // Reset this
813
+ this.coords = [];
814
+
815
+
816
+
817
+ var path = RGraph.SVG.TRIG.getArcPath({
818
+ cx: this.centerx,
819
+ cy: this.centery,
820
+ r: this.radius,
821
+ start: RGraph.SVG.TRIG.PI + RGraph.SVG.TRIG.HALFPI,
822
+ end: RGraph.SVG.TRIG.HALFPI,
823
+ anticlockwise: false
824
+ });
825
+
826
+
827
+ var path2 = RGraph.SVG.TRIG.getArcPath({
828
+ cx: this.centerx,
829
+ cy: this.centery,
830
+ r: this.radius - this.progressWidth,
831
+ end: RGraph.SVG.TRIG.PI + RGraph.SVG.TRIG.HALFPI,
832
+ start: RGraph.SVG.TRIG.HALFPI,
833
+ anticlockwise: true,
834
+ moveto: false
835
+ });
836
+
837
+ // This element is repeated AFTER the green bar that indicates
838
+ // the value so that the stroke appears AFTER the indicator bar
839
+ var background = RGraph.SVG.create({
840
+ svg: this.svg,
841
+ type: 'path',
842
+ parent: this.svg.all,
843
+ attr: {
844
+ d: path + " L " + (this.centerx + this.radius - this.progressWidth) + " " + this.centery + path2 + " L " + (this.centerx - this.radius) + " " + this.centery,
845
+ fill: properties.backgroundFill || properties.colors[0],
846
+ 'stroke-width': 0,
847
+ 'fill-opacity': properties.backgroundFillOpacity
848
+ }
849
+ });
850
+
851
+ // Store a reference to the background
852
+ this.nodes.background = background;
853
+
854
+
855
+
856
+ //
857
+ // This draws the bar that indicates the value
858
+ //
859
+
860
+ // A single number
861
+ if (typeof this.value === 'number') {
862
+
863
+ var angle = ((this.value - this.min) / (this.max - this.min)) * RGraph.SVG.TRIG.PI; // Because the Meter is always a semi-circle
864
+
865
+ // Take off half a pi because our origin is the north axis
866
+ angle -= RGraph.SVG.TRIG.HALFPI;
867
+
868
+ // Store the angle for later use
869
+ this.angle = angle;
870
+
871
+
872
+ // Now get the path of the inner indicator bar
873
+ var path = RGraph.SVG.TRIG.getArcPath({
874
+ cx: this.centerx,
875
+ cy: this.centery,
876
+ r: this.radius,
877
+ start: RGraph.SVG.TRIG.PI + RGraph.SVG.TRIG.HALFPI,
878
+ end: angle,
879
+ anticlockwise: false
880
+ });
881
+
882
+ var path2 = RGraph.SVG.TRIG.getArcPath({
883
+ cx: this.centerx,
884
+ cy: this.centery,
885
+ r: this.radius - this.progressWidth,
886
+ start: angle,
887
+ end: angle,
888
+ anticlockwise: false,
889
+ array: true
890
+ });
891
+
892
+ var path3 = RGraph.SVG.TRIG.getArcPath({
893
+ cx: this.centerx,
894
+ cy: this.centery,
895
+ r: this.radius - this.progressWidth,
896
+ start: angle,
897
+ end: RGraph.SVG.TRIG.PI + RGraph.SVG.TRIG.HALFPI,
898
+ anticlockwise: true,
899
+ moveto: false
900
+ });
901
+
902
+
903
+ // Create a group for the indicator bar. At a later point any
904
+ // highlight can be also appended to this group
905
+ var group = RGraph.SVG.create({
906
+ svg: this.svg,
907
+ type: 'g',
908
+ parent: this.svg.all,
909
+ attr: {
910
+ id: 'indicator-bar-group'
911
+ }
912
+ });
913
+
914
+ // Now draw the path
915
+ var path = RGraph.SVG.create({
916
+ svg: this.svg,
917
+ type: 'path',
918
+ parent: group,
919
+ attr: {
920
+ d: path + " L{1} {2} ".format(
921
+ path2[1],
922
+ path2[2]
923
+ ) + path3 + ' z',
924
+ fill: properties.colors[0],
925
+ stroke: properties.colorsStroke,
926
+ 'stroke-width': properties.linewidth
927
+ }
928
+ });
929
+
930
+ // Store a reference to the bar in the nodes array and the
931
+ // group as well. If necessary any highlight thats later
932
+ // added can be appended to this group
933
+ this.nodes.barGroup = group;
934
+ this.nodes.bar = path;
935
+
936
+ this.coords.push({
937
+ cx: this.centerx,
938
+ cy: this.centery,
939
+ radiusOuter: this.radius,
940
+ radiusInner: this.radius - this.progressWidth,
941
+ start: -RGraph.SVG.TRIG.HALFPI,
942
+ end: angle,
943
+ element: path
944
+ });
945
+
946
+ //
947
+ // Multiple values
948
+ //
949
+ } else if (RGraph.SVG.isArray(this.value)) {
950
+
951
+
952
+
953
+
954
+ // Create a group for the indicator bars. At a later point any
955
+ // highlight can be also appended to this group
956
+ var group = RGraph.SVG.create({
957
+ svg: this.svg,
958
+ type:'g',
959
+ parent: this.svg.all,
960
+ attr: {
961
+ id: 'indicator-bar-group'
962
+ }
963
+ });
964
+
965
+ for (var i=0,start=-RGraph.SVG.TRIG.HALFPI; i<this.value.length; ++i) {
966
+
967
+ var angle = ((this.value[i] - this.min) / (this.max - this.min)) * RGraph.SVG.TRIG.PI; // Because the Meter is always a semi-circle
968
+
969
+ var path1 = RGraph.SVG.TRIG.getArcPath({
970
+ cx: this.centerx,
971
+ cy: this.centery,
972
+ r: this.radius, // - this.progressWidth,
973
+ start: start,
974
+ end: start + angle,
975
+ anticlockwise: false,
976
+ lineto: false,
977
+ moveto: true
978
+ });
979
+
980
+ var path2 = RGraph.SVG.TRIG.getArcPath3({
981
+ cx: this.centerx,
982
+ cy: this.centery,
983
+ r: this.radius - this.progressWidth,
984
+ start: start + angle,
985
+ end: start,
986
+ anticlockwise: true
987
+ });
988
+
989
+
990
+ var el = RGraph.SVG.create({
991
+ svg: this.svg,
992
+ type: 'path',
993
+ parent: group,
994
+ attr: {
995
+ d: '{1} {2} z'.format(path1, path2),
996
+ stroke: properties.colorsStroke,
997
+ 'stroke-width': properties.linewidth,
998
+ fill: properties.colors[i]
999
+ }
1000
+ });
1001
+
1002
+ // Store the angle for later use
1003
+ this.coords.push({
1004
+ cx: this.centerx,
1005
+ cy: this.centery,
1006
+ radiusOuter: this.radius,
1007
+ radiusInner: this.radius - this.progressWidth,
1008
+ start: start,
1009
+ end: start + angle,
1010
+ element: el
1011
+ });
1012
+
1013
+ // Increment the start angle
1014
+ //
1015
+ // DO THIS LAST
1016
+ start += angle;
1017
+ }
1018
+ }
1019
+ };
1020
+
1021
+
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+ //
1029
+ // Draw the labels
1030
+ //
1031
+ this.drawLabels = function ()
1032
+ {
1033
+ // Draw the min label
1034
+ if (properties.labelsMin) {
1035
+
1036
+ var min = RGraph.SVG.numberFormat({
1037
+ object: this,
1038
+ num: this.min.toFixed(properties.labelsMinDecimals),
1039
+ prepend: properties.labelsMinUnitsPre,
1040
+ append: properties.labelsMinUnitsPost,
1041
+ point: properties.labelsMinPoint,
1042
+ thousand: properties.labelsMinThousand,
1043
+ formatter: properties.labelsMinFormatter
1044
+ });
1045
+
1046
+ // Get the text configuration
1047
+ var textConf = RGraph.SVG.getTextConf({
1048
+ object: this,
1049
+ prefix: 'labelsMin'
1050
+ });
1051
+
1052
+ var text = RGraph.SVG.text({
1053
+ object: this,
1054
+ parent: this.svg.all,
1055
+ tag: 'labels.min',
1056
+ text: typeof properties.labelsMinSpecific === 'string' ? properties.labelsMinSpecific : min,
1057
+ x: this.centerx - this.radius + (this.progressWidth / 2),
1058
+ y: this.centery + 5 + properties.backgroundStrokeLinewidth,
1059
+ valign: 'top',
1060
+ halign: 'center',
1061
+
1062
+ font: textConf.font,
1063
+ size: textConf.size,
1064
+ bold: textConf.bold,
1065
+ italic: textConf.italic,
1066
+ color: textConf.color
1067
+ });
1068
+
1069
+ this.nodes.labelsMin = text;
1070
+ }
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+ // Draw the max label
1079
+ if (properties.labelsMax) {
1080
+
1081
+ var max = RGraph.SVG.numberFormat({
1082
+ object: this,
1083
+ num: this.max.toFixed(properties.labelsMaxDecimals),
1084
+ prepend: properties.labelsMaxUnitsPre,
1085
+ append: properties.labelsMaxUnitsPost,
1086
+ point: properties.labelsMaxPoint,
1087
+ thousand: properties.labelsMaxThousand,
1088
+ formatter: properties.labelsMaxFormatter
1089
+ });
1090
+
1091
+
1092
+ // Get the text configuration
1093
+ var textConf = RGraph.SVG.getTextConf({
1094
+ object: this,
1095
+ prefix: 'labelsMax'
1096
+ });
1097
+
1098
+ var text = RGraph.SVG.text({
1099
+ object: this,
1100
+ parent: this.svg.all,
1101
+ tag: 'labels.max',
1102
+ text: typeof properties.labelsMaxSpecific === 'string' ? properties.labelsMaxSpecific : max,
1103
+ x: this.centerx + this.radius - (this.progressWidth / 2),
1104
+ y: this.centery + 5 + properties.backgroundStrokeLinewidth,
1105
+ valign: 'top',
1106
+ halign: 'center',
1107
+ font: textConf.font,
1108
+ size: textConf.size,
1109
+ bold: textConf.bold,
1110
+ italic: textConf.italic,
1111
+ color: textConf.color
1112
+ });
1113
+
1114
+ // Store a reference to the text node
1115
+ this.nodes.labelsMax = text;
1116
+ }
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+ // Draw the center label
1125
+ if (properties.labelsCenter) {
1126
+
1127
+ var center = RGraph.SVG.numberFormat({
1128
+ object: this,
1129
+ num: (typeof this.value === 'number' ? this.value : this.value[properties.labelsCenterIndex]).toFixed(properties.labelsCenterDecimals),
1130
+ prepend: properties.labelsCenterUnitsPre,
1131
+ append: properties.labelsCenterUnitsPost,
1132
+ point: properties.labelsCenterPoint,
1133
+ thousand: properties.labelsCenterThousand,
1134
+ formatter: properties.labelsCenterFormatter
1135
+ });
1136
+
1137
+
1138
+ // Get the text configuration
1139
+ var textConf = RGraph.SVG.getTextConf({
1140
+ object: this,
1141
+ prefix: 'labelsCenter'
1142
+ });
1143
+
1144
+ var text = RGraph.SVG.text({
1145
+ object: this,
1146
+ parent: this.svg.all,
1147
+ tag: 'labels.center',
1148
+ text: typeof properties.labelsCenterSpecific === 'string' ? properties.labelsCenterSpecific : center,
1149
+ x: this.centerx,
1150
+ y: this.centery,
1151
+ valign: 'bottom',
1152
+ halign: 'center',
1153
+ font: textConf.font,
1154
+ size: textConf.size,
1155
+ bold: textConf.bold,
1156
+ italic: textConf.italic,
1157
+ color: textConf.color
1158
+ });
1159
+
1160
+ // Store a reference to the center label
1161
+ this.nodes.labelsCenter = text;
1162
+ }
1163
+ };
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+ //
1173
+ // Draw the scale if necessary
1174
+ //
1175
+ this.drawScale = function ()
1176
+ {
1177
+ if (properties.scale) {
1178
+
1179
+ //
1180
+ // Generate an appropiate scale
1181
+ //
1182
+ this.scale = RGraph.SVG.getScale({
1183
+ object: this,
1184
+ numlabels: properties.scaleLabelsCount,
1185
+ unitsPre: properties.scaleUnitsPre,
1186
+ unitsPost: properties.scaleUnitsPost,
1187
+ max: typeof properties.scaleMax === 'number' ? properties.scaleMax : this.max,
1188
+ min: typeof properties.scaleMin === 'number' ? properties.scaleMin : this.min,
1189
+ point: properties.scalePoint,
1190
+ round: false,
1191
+ thousand: properties.scaleThousand,
1192
+ decimals: properties.scaleDecimals,
1193
+ strict: true,
1194
+ formatter: properties.scaleFormatter
1195
+ });
1196
+
1197
+ //
1198
+ // Loop thru the number of labels
1199
+ //
1200
+ var textConf = RGraph.SVG.getTextConf({
1201
+ object: this,
1202
+ prefix: 'scaleLabels'
1203
+ });
1204
+
1205
+ for (var i=0; i<this.scale.labels.length; ++i) {
1206
+
1207
+ var xy = RGraph.SVG.TRIG.getRadiusEndPoint({
1208
+ angle: (-RGraph.SVG.TRIG.PI) + (((i+1) / this.scale.labels.length) * (RGraph.SVG.TRIG.HALFPI - (-RGraph.SVG.TRIG.HALFPI)) ),
1209
+ r: this.radius + (properties.backgroundGrid ? properties.backgroundGridMargin : 0) + textConf.size + properties.scaleLabelsOffsetr + 5
1210
+ });
1211
+
1212
+ // Draw the label
1213
+ RGraph.SVG.text({
1214
+ object: this,
1215
+ parent: this.svg.all,
1216
+ tag: 'scale',
1217
+ font: textConf.font,
1218
+ size: textConf.size,
1219
+ color: textConf.color,
1220
+ bold: textConf.bold,
1221
+ italic: textConf.italic,
1222
+ x: xy[0] + this.centerx + (properties.scaleLabelsOffsetx || 0),
1223
+ y: xy[1] + this.centery + (properties.scaleLabelsOffsety || 0),
1224
+ valign: 'center',
1225
+ halign: ((i+1) / this.scale.labels.length === 0.5) ? 'center' : (((i+1) > (this.scale.labels.length / 2)) ? 'left' : 'right'),
1226
+ text: this.scale.labels[i]
1227
+ });
1228
+ }
1229
+
1230
+
1231
+
1232
+ // Draw the zero label
1233
+ //
1234
+ // Draw the zero label
1235
+ //
1236
+ var xy = RGraph.SVG.TRIG.getRadiusEndPoint({
1237
+ angle: -RGraph.SVG.TRIG.PI,
1238
+ r: this.radius + (properties.backgroundGrid ? properties.backgroundGridMargin : 0) + textConf.size + properties.scaleLabelsOffsetr + 5
1239
+ });
1240
+
1241
+ RGraph.SVG.text({
1242
+ object: this,
1243
+ parent: this.svg.all,
1244
+ tag: 'scale',
1245
+ font: textConf.font,
1246
+ size: textConf.size,
1247
+ color: textConf.color,
1248
+ bold: textConf.bold,
1249
+ italic: textConf.italic,
1250
+ x: xy[0] + this.centerx + (properties.scaleLabelsOffsetx || 0),
1251
+ y: xy[1] + this.centery + (properties.scaleLabelsOffsety || 0),
1252
+ valign: 'center',
1253
+ halign: 'right',
1254
+ text: (typeof properties.scaleFormatter === 'function') ?
1255
+ properties.scaleFormatter(this, this.min)
1256
+ :
1257
+ properties.scaleUnitsPre + (typeof properties.scaleMin === 'number' ? properties.scaleMin : this.min).toFixed(properties.scaleDecimals).replace(/\./, properties.scalePoint) + properties.scaleUnitsPost,
1258
+ });
1259
+ }
1260
+ };
1261
+
1262
+
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+ //
1270
+ // This function can be used to highlight a segment on the chart
1271
+ //
1272
+ // @param object segment The segment to highlight
1273
+ //
1274
+ this.highlight = function (segment)
1275
+ {
1276
+ // Remove any highlight that's already been
1277
+ // installed
1278
+ this.removeHighlight();
1279
+
1280
+ var highlight = RGraph.SVG.create({
1281
+ svg: this.svg,
1282
+ type: 'path',
1283
+ parent: this.nodes.barGroup,
1284
+ attr: {
1285
+ d: segment.getAttribute('d'),
1286
+ fill: properties.highlightFill,
1287
+ stroke: properties.highlightStroke,
1288
+ 'stroke-width': properties.highlightLinewidth
1289
+ },
1290
+ style: {
1291
+ pointerEvents: 'none'
1292
+ }
1293
+ });
1294
+
1295
+ // Store the highlight node in the registry
1296
+ RGraph.SVG.REG.set('highlight', highlight);
1297
+
1298
+ // Add the event listener that clears the highlight path if
1299
+ // there is any. Must be MOUSEDOWN (ie before the click event)
1300
+ var obj = this;
1301
+ document.body.addEventListener('mousedown', function (e)
1302
+ {
1303
+ obj.removeHighlight();
1304
+
1305
+ }, false);
1306
+ };
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+ //
1316
+ // This function can be used to remove the highlight that is added
1317
+ // by tooltips
1318
+ //
1319
+ this.removeHighlight = function ()
1320
+ {
1321
+ RGraph.SVG.removeHighlight();
1322
+ };
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+ //
1332
+ // This allows for easy specification of gradients
1333
+ //
1334
+ this.parseColors = function ()
1335
+ {
1336
+ // Save the original colors so that they can be restored when the canvas is reset
1337
+ if (!Object.keys(this.originalColors).length) {
1338
+ this.originalColors = {
1339
+ colors: RGraph.SVG.arrayClone(properties.colors),
1340
+ highlightFill: RGraph.SVG.arrayClone(properties.highlightFill),
1341
+ backgroundFill: RGraph.SVG.arrayClone(properties.backgroundFill)
1342
+ }
1343
+ }
1344
+
1345
+
1346
+ // colors
1347
+ var colors = properties.colors;
1348
+
1349
+ if (colors) {
1350
+ for (var i=0; i<colors.length; ++i) {
1351
+ colors[i] = RGraph.SVG.parseColorLinear({
1352
+ object: this,
1353
+ color: colors[i],
1354
+ start: this.centerx - this.radius,
1355
+ end: this.centerx + this.radius,
1356
+ direction: 'horizontal'
1357
+ });
1358
+ }
1359
+ }
1360
+
1361
+ // Highlight fill
1362
+ properties.highlightFill = RGraph.SVG.parseColorLinear({
1363
+ object: this,
1364
+ color: properties.highlightFill,
1365
+ start: properties.marginLeft,
1366
+ end: this.width - properties.marginRight,
1367
+ direction: 'horizontal'
1368
+ });
1369
+
1370
+ // Background color
1371
+
1372
+ // Background color
1373
+ properties.backgroundFill = RGraph.SVG.parseColorLinear({
1374
+ object: this,
1375
+ color: properties.backgroundFill,
1376
+ start: properties.marginLeft,
1377
+ end: this.width - properties.marginRight,
1378
+ direction: 'horizontal'
1379
+ });
1380
+ };
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+ //
1390
+ // The Bar chart grow effect
1391
+ //
1392
+ this.grow = function ()
1393
+ {
1394
+ var opt = arguments[0] || {},
1395
+ frames = opt.frames || 30,
1396
+ frame = 0,
1397
+ obj = this;
1398
+
1399
+ //
1400
+ // Copy the data
1401
+ //
1402
+ var value = RGraph.SVG.arrayClone(this.value);
1403
+
1404
+ this.draw();
1405
+
1406
+ var iterate = function ()
1407
+ {
1408
+ var multiplier = frame / frames;
1409
+
1410
+ if (typeof obj.value === 'object') {
1411
+ for (var i=0; i<obj.value.length; ++i) {
1412
+ obj.value[i] = value[i] * multiplier;
1413
+ }
1414
+ } else {
1415
+ obj.value = value * multiplier;
1416
+ }
1417
+
1418
+ RGraph.SVG.redraw();
1419
+
1420
+ if (frame++ < frames) {
1421
+ RGraph.SVG.FX.update(iterate);
1422
+ } else if (opt.callback) {
1423
+ obj.value = value;
1424
+ RGraph.SVG.redraw();
1425
+ (opt.callback)(obj);
1426
+ }
1427
+ };
1428
+
1429
+ iterate();
1430
+
1431
+ return this;
1432
+ };
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+ //
1442
+ // Using a function to add events makes it easier to facilitate method
1443
+ // chaining
1444
+ //
1445
+ // @param string type The type of even to add
1446
+ // @param function func
1447
+ //
1448
+ this.on = function (type, func)
1449
+ {
1450
+ if (type.substr(0,2) !== 'on') {
1451
+ type = 'on' + type;
1452
+ }
1453
+
1454
+ RGraph.SVG.addCustomEventListener(this, type, func);
1455
+
1456
+ return this;
1457
+ };
1458
+
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+
1465
+
1466
+ //
1467
+ // Used in chaining. Runs a function there and then - not waiting for
1468
+ // the events to fire (eg the onbeforedraw event)
1469
+ //
1470
+ // @param function func The function to execute
1471
+ //
1472
+ this.exec = function (func)
1473
+ {
1474
+ func(this);
1475
+
1476
+ return this;
1477
+ };
1478
+
1479
+
1480
+
1481
+
1482
+
1483
+
1484
+
1485
+
1486
+ //
1487
+ // Remove highlight from the chart (tooltips)
1488
+ //
1489
+ this.removeHighlight = function ()
1490
+ {
1491
+ RGraph.SVG.removeHighlight();
1492
+ };
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+ //
1502
+ // A worker function that handles Bar chart specific tooltip substitutions
1503
+ //
1504
+ this.tooltipSubstitutions = function (opt)
1505
+ {
1506
+ var value = RGraph.SVG.isArray(this.value) ? this.value[opt.index] : this.value;
1507
+ var values = RGraph.SVG.isArray(this.value) ? this.value : [this.value];
1508
+
1509
+ return {
1510
+ index: opt.index,
1511
+ dataset: 0,
1512
+ sequentialIndex: opt.index,
1513
+ value: value,
1514
+ values: values
1515
+ };
1516
+ };
1517
+
1518
+
1519
+
1520
+
1521
+
1522
+
1523
+
1524
+
1525
+ //
1526
+ // A worker function that returns the correct color/label/value
1527
+ //
1528
+ // @param object specific The indexes that are applicable
1529
+ // @param number index The appropriate index
1530
+ //
1531
+ this.tooltipsFormattedCustom = function (specific, index, colors)
1532
+ {
1533
+ var color = colors[index];
1534
+ var label = ( (typeof properties.tooltipsFormattedKeyLabels === 'object' && typeof properties.tooltipsFormattedKeyLabels[0] === 'string') ? properties.tooltipsFormattedKeyLabels[index] : '');
1535
+
1536
+ return {
1537
+ label: label,
1538
+ color: color
1539
+ };
1540
+ };
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+ //
1550
+ // This allows for static tooltip positioning
1551
+ //
1552
+ this.positionTooltipStatic = function (args)
1553
+ {
1554
+ var obj = args.object,
1555
+ e = args.event,
1556
+ tooltip = args.tooltip,
1557
+ index = args.index,
1558
+ svgXY = RGraph.SVG.getSVGXY(obj.svg);
1559
+
1560
+ // Calculate the coordinates for the tooltip
1561
+ var coords = RGraph.SVG.TRIG.toCartesian({
1562
+ cx: this.centerx,
1563
+ cy: this.centery,
1564
+ //angle: this.angle - RGraph.SVG.TRIG.HALFPI - ((this.angle + RGraph.SVG.TRIG.HALFPI) / 2),
1565
+ angle: this.coords[index].start - RGraph.SVG.TRIG.HALFPI + ((this.coords[index].end - this.coords[index].start) / 2),
1566
+ r: this.radius - (this.progressWidth / 2)
1567
+ });
1568
+
1569
+
1570
+ // Position the tooltip in the X direction
1571
+ args.tooltip.style.left = (
1572
+ svgXY[0] // The X coordinate of the canvas
1573
+ + coords.x
1574
+ - (tooltip.offsetWidth / 2) // Subtract half of the tooltip width
1575
+ ) + 'px';
1576
+
1577
+ args.tooltip.style.top = (
1578
+ svgXY[1] // The Y coordinate of the canvas
1579
+ + coords.y
1580
+ - tooltip.offsetHeight // The height of the tooltip
1581
+ - 10 // An arbitrary amount
1582
+ ) + 'px';
1583
+ };
1584
+
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+
1591
+ //
1592
+ // Set the options that the user has provided
1593
+ //
1594
+ for (i in conf.options) {
1595
+ if (typeof i === 'string') {
1596
+ this.set(i, conf.options[i]);
1597
+ }
1598
+ }
1599
+
1600
+
1601
+
1602
+ return this;
1603
+ };
1604
+
1605
+
1606
+
1607
+
1608
+
1609
+
1610
+
1611
+
1612
+ // End module pattern
1613
+ })(window, document);