").text(f.label),c=c.prop("outerHTML"),k=f.y,e=i=0,j=k.length;j>i;e=++i)h=k[e],d=f.y.length-1-e,this.options.labels[d]!==!1&&(c+="
\n "+this.options.labels[d]+":\n "+this.yLabelFormat(h,d)+"\n
");return"function"==typeof this.options.hoverCallback&&(c=this.options.hoverCallback(b,this.options,c,f.src)),this.options.horizontal?(g=this.left+.5*this.width,h=this.top+(b+.5)*this.height/this.data.length,[c,g,h,!0]):(g=this.left+(b+.5)*this.width/this.data.length,[c,g])},d.prototype.drawDataLabel=function(a,b,c){var d;return d=this.raphael.text(a,b,c).attr("text-anchor","middle").attr("font-size",this.options.dataLabelsSize).attr("font-family",this.options.dataLabelsFamily).attr("font-weight",this.options.dataLabelsWeight).attr("fill",this.options.dataLabelsColor)},d.prototype.drawBar=function(a,b,c,d,e,f,g){var h,i;return h=Math.max.apply(Math,g),i=this.options.animate?this.options.horizontal?0===h||h>d?this.raphael.rect(a,b,0,d).animate({x:a,width:c},500):this.raphael.path(this.roundedRect(a,b+d,c,0,g).animate({y:b,height:d},500)):0===h||h>d?this.raphael.rect(a,b+d,c,0).animate({y:b,height:d},500):this.raphael.path(this.roundedRect(a,b+d,c,0,g).animate({y:b,height:d},500)):0===h||h>d?this.raphael.rect(a,b,c,d):this.raphael.path(this.roundedRect(a,b,c,d,g)),i.attr("fill",e).attr("fill-opacity",f).attr("stroke","none")},d.prototype.roundedRect=function(a,b,c,d,e){return null==e&&(e=[0,0,0,0]),["M",a,e[0]+b,"Q",a,b,a+e[0],b,"L",a+c-e[1],b,"Q",a+c,b,a+c,b+e[1],"L",a+c,b+d-e[2],"Q",a+c,b+d,a+c-e[2],b+d,"L",a+e[3],b+d,"Q",a,b+d,a,b+d-e[3],"Z"]},d}(b.Grid),b.Donut=function(c){function d(c){this.resizeHandler=f(this.resizeHandler,this),this.select=f(this.select,this),this.click=f(this.click,this);var d=this;if(!(this instanceof b.Donut))return new b.Donut(c);if(this.options=a.extend({},this.defaults,c),"string"==typeof c.element?this.el=a(document.getElementById(c.element)):this.el=a(c.element),null===this.el||0===this.el.length)throw new Error("Graph placeholder not found.");void 0!==c.data&&0!==c.data.length&&(this.raphael=new Raphael(this.el[0]),this.options.resize&&a(window).bind("resize",function(a){return null!=d.timeoutId&&window.clearTimeout(d.timeoutId),d.timeoutId=window.setTimeout(d.resizeHandler,100)}),this.setData(c.data))}return h(d,c),d.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:b.commas,resize:!1,dataLabels:!0,dataLabelsPosition:"outside",dataLabelsFamily:"sans-serif",dataLabelsSize:12,dataLabelsWeight:"normal",dataLabelsColor:"#000",donutType:"pie",animate:!0},d.prototype.redraw=function(){var a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(this.raphael.clear(),c=this.el.width()/2,d=this.el.height()/2,r=(Math.min(c,d)-10)/3,p=0,y=this.values,s=0,v=y.length;v>s;s++)q=y[s],p+=q;for(k=5/(2*r),a=1.9999*Math.PI-k*this.data.length,i=0,f=0,this.segments=[],z=this.values,e=t=0,w=z.length;w>t;e=++t)q=z[e],l=i+k+a*(q/p),o=new b.DonutSegment(c,d,2*r,r,i,l,this.data[e].color||this.options.colors[f%this.options.colors.length],this.options.backgroundColor,f,this.raphael,this.options),o.render(),this.segments.push(o),o.on("hover",this.select),o.on("click",this.click),this.options.dataLabels&&this.values.length>1&&(n=Math.sin((i+l)/2),m=Math.cos((i+l)/2),"inside"===this.options.dataLabelsPosition?"pie"===this.options.donutType?(g=parseFloat(c)+parseFloat(.3*o.raphael.height*n),h=parseFloat(d)+parseFloat(.3*o.raphael.height*m)):(g=parseFloat(c)+parseFloat(.37*o.raphael.height*n),h=parseFloat(d)+parseFloat(.37*o.raphael.height*m)):(g=parseFloat(c)+parseFloat(.5*(o.raphael.height-9)*n),h=parseFloat(d)+parseFloat(.5*(o.raphael.height-9)*m)),this.drawDataLabel(g,h,q)),i=l,f+=1;for(this.text1=this.drawEmptyDonutLabel(c,d-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(c,d+10,this.options.labelColor,14),j=Math.max.apply(Math,this.values),f=0,A=this.values,B=[],u=0,x=A.length;x>u;u++){if(q=A[u],q===j){this.select(f);break}B.push(f+=1)}return B},d.prototype.setData=function(a){var b;return this.data=a,this.values=function(){var a,c,d,e;for(d=this.data,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(parseFloat(b.value));return e}.call(this),this.redraw()},d.prototype.drawDataLabel=function(a,b,c){var d;return d=this.raphael.text(a,b,c).attr("text-anchor","middle").attr("font-size",this.options.dataLabelsSize).attr("font-family",this.options.dataLabelsFamily).attr("font-weight",this.options.dataLabelsWeight).attr("fill",this.options.dataLabelsColor)},d.prototype.click=function(a){return this.fire("click",a,this.data[a])},d.prototype.select=function(a){var b,c,d,e,f,g;for(g=this.segments,e=0,f=g.length;f>e;e++)c=g[e],c.deselect();return d=this.segments[a],d.select(),b=this.data[a],"donut"===this.options.donutType?this.setLabels(b.label,this.options.formatter(b.value,b)):void 0},d.prototype.setLabels=function(a,b){var c,d,e,f,g,h,i,j;return c=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3,f=1.8*c,e=c/2,d=c/3,this.text1.attr({text:a,transform:""}),g=this.text1.getBBox(),h=Math.min(f/g.width,e/g.height),this.text1.attr({transform:"S"+h+","+h+","+(g.x+g.width/2)+","+(g.y+g.height)}),this.text2.attr({text:b,transform:""}),i=this.text2.getBBox(),j=Math.min(f/i.width,d/i.height),this.text2.attr({transform:"S"+j+","+j+","+(i.x+i.width/2)+","+i.y})},d.prototype.drawEmptyDonutLabel=function(a,b,c,d,e){var f;return f=this.raphael.text(a,b,"").attr("font-size",d).attr("fill",c),null!=e&&f.attr("font-weight",e),f},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.DonutSegment=function(a){function b(a,b,c,d,e,g,h,i,j,k,l){this.cx=a,this.cy=b,this.inner=c,this.outer=d,this.color=h,this.backgroundColor=i,this.index=j,this.raphael=k,this.options=l,this.deselect=f(this.deselect,this),this.select=f(this.select,this),this.sin_p0=Math.sin(e),this.cos_p0=Math.cos(e),this.sin_p1=Math.sin(g),this.cos_p1=Math.cos(g),this.is_long=g-e>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],"pie"===this.options.donutType?"M"+g+","+i+("A"+b+","+b+",0,"+this.is_long+",0,"+h+","+j)+("L"+this.cx+","+this.cy)+"Z":"M"+c+","+e+("A"+a+","+a+",0,"+this.is_long+",0,"+d+","+f)+("L"+h+","+j)+("A"+b+","+b+",0,"+this.is_long+",1,"+g+","+i)+"Z"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],"M"+b+","+d+("A"+a+","+a+",0,"+this.is_long+",0,"+c+","+e)},b.prototype.render=function(){var a=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return a.fire("hover",a.index)},function(){return a.fire("click",a.index)})},b.prototype.drawDonutArc=function(a,b){return this.raphael.path(a).attr({stroke:b,"stroke-width":2,opacity:0})},b.prototype.drawDonutSegment=function(a,b,c,d,e){var f,g,h;return this.options.animate&&"pie"===this.options.donutType?(h=a,h=a.replace("A",","),h=h.replace("M",""),h=h.replace("C",","),h=h.replace("Z",""),g=h.split(","),h="pie"===this.options.donutType?"M"+g[0]+","+g[1]+","+g[g.length-2]+","+g[g.length-1]+","+g[g.length-2]+","+g[g.length-1]+"Z":"M"+g[0]+","+g[1]+","+g[g.length-2]+","+g[g.length-1]+"Z",f=this.raphael.path(h).attr({fill:b,stroke:c,"stroke-width":3}).hover(d).click(e),function(a,b){return a.animate({path:b},500,"<>")}(f,a)):this.raphael.path(a).attr({fill:b,stroke:c,"stroke-width":3}).hover(d).click(e)},b.prototype.select=function(){return"donut"!==this.options.donutType||this.selected?void 0:(this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0)},b.prototype.deselect=function(){return this.selected?(this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1):void 0},b}(b.EventEmitter)}).call(this);
\ No newline at end of file
+this.drawSeries()},d.prototype.drawXAxis=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(b=this.options.horizontal?this.getYAxisLabelX():this.getXAxisLabelY(),j=null,i=null,q=[],c=o=0,p=this.data.length;p>=0?p>o:o>p;c=p>=0?++o:--o)k=this.data[this.data.length-1-c],d=this.options.horizontal?this.drawYAxisLabel(b,k._x-.5*this.options.gridTextSize,k.label):this.drawXAxisLabel(k._x,b,k.label),a=this.options.horizontal?0:this.options.xLabelAngle,n=d.getBBox(),d.transform("r"+-a),e=d.getBBox(),d.transform("t0,"+e.height/2+"..."),0!==a&&(h=-.5*n.width*Math.cos(a*Math.PI/180),d.transform("t"+h+",0...")),this.options.horizontal?(m=e.y,l=e.height,g=this.el.height()):(m=e.x,l=e.width,g=this.el.width()),(null==j||j>=m+l||null!=i&&i>=m)&&m>=0&&g>m+l?(0!==a&&(f=1.25*this.options.gridTextSize/Math.sin(a*Math.PI/180),i=m-f),this.options.horizontal?q.push(j=m):q.push(j=m-this.options.xLabelMargin)):q.push(d.remove());return q},d.prototype.getXAxisLabelY=function(){return this.bottom+(this.options.xAxisLabelTopPadding||this.options.padding/2)},d.prototype.drawSeries=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(this.seriesBars=[],f=this.xSize/this.options.data.length,this.options.stacked)l=1;else for(l=0,g=t=0,u=this.options.ykeys.length-1;u>=0?u>=t:t>=u;g=u>=0?++t:--t)this.hasToShow(g)&&(l+=1);return c=(f*this.options.barSizeRatio-this.options.barGap*(l-1))/l,this.options.barSize&&(c=Math.min(c,this.options.barSize)),p=f-c*l-this.options.barGap*(l-1),k=p/2,s=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var a,g,l,p;for(l=this.data,p=[],h=a=0,g=l.length;g>a;h=++a)m=l[h],this.seriesBars[h]=[],i=0,p.push(function(){var a,g,l,p;for(l=m._y,p=[],n=a=0,g=l.length;g>a;n=++a)r=l[n],this.hasToShow(n)&&(null!==r?(s?(q=Math.min(r,s),d=Math.max(r,s)):(q=r,d=this.bottom),j=this.xStart+h*f+k,this.options.stacked||(j+=n*(c+this.options.barGap)),o=d-q,this.options.verticalGridCondition&&this.options.verticalGridCondition(m.x)&&(this.options.horizontal?this.drawBar(this.yStart,this.xStart+h*f,this.ySize,f,this.options.verticalGridColor,this.options.verticalGridOpacity,this.options.barRadius):this.drawBar(this.xStart+h*f,this.yEnd,f,this.ySize,this.options.verticalGridColor,this.options.verticalGridOpacity,this.options.barRadius)),this.options.stacked&&(q-=i),this.options.horizontal?(i-=o,this.seriesBars[h][n]=this.drawBar(q,j,o,c,this.colorFor(m,n,"bar"),this.options.barOpacity,this.options.barRadius),this.options.dataLabels&&(this.options.stacked||"inside"===this.options.dataLabelsPosition?this.drawDataLabel(q+o/2,j+c/2,this.yLabelFormat(m.y[n])):this.drawDataLabel(q+o+5,j+c/2,this.yLabelFormat(m.y[n]))),this.options.inBarValue&&c>this.options.gridTextSize+2*this.options.inBarValueMinTopMargin?(b=j+.5*c,p.push(this.raphael.text(d-this.options.inBarValueRightMargin,b,this.yLabelFormat(m.y[n],n)).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.inBarValueTextColor).attr("text-anchor","end"))):p.push(void 0)):(i+=o,this.seriesBars[h][n]=this.drawBar(j,q,c,o,this.colorFor(m,n,"bar"),this.options.barOpacity,this.options.barRadius),this.options.dataLabels?(e=this.options.stacked||"inside"===this.options.dataLabelsPosition?o/2:-7,o>this.options.dataLabelsSize||!this.options.stacked?p.push(this.drawDataLabel(j+c/2,q+e,this.yLabelFormat(m.y[n]))):p.push(void 0)):p.push(void 0))):p.push(null));return p}.call(this));return p}.call(this),this.flat_bars=a.map(this.bars,function(a){return a}),this.flat_bars=a.grep(this.flat_bars,function(a){return null!=a}),this.bar_els=a(a.map(this.flat_bars,function(a){return a[0]}))},d.prototype.hilight=function(a){var b,c,d,e,f,g,h,i;if(this.seriesBars&&this.seriesBars[this.prevHilight]&&null!==this.prevHilight&&this.prevHilight!==a)for(h=this.seriesBars[this.prevHilight],b=d=0,f=h.length;f>d;b=++d)c=h[b],c&&c.animate({"fill-opacity":this.options.barOpacity},this.options.highlightSpeed);if(this.seriesBars&&this.seriesBars[a]&&null!==a&&this.prevHilight!==a)for(i=this.seriesBars[a],b=e=0,g=i.length;g>e;b=++e)c=i[b],c&&c.animate({"fill-opacity":this.options.barHighlightOpacity},this.options.highlightSpeed);return this.prevHilight=a},d.prototype.colorFor=function(a,b,c){var d,e;return"function"==typeof this.options.barColors?(d={x:a.x,y:a.y[b],label:a.label,src:a.src},e={index:b,key:this.options.ykeys[b],label:this.options.labels[b]},this.options.barColors.call(this,d,e,c)):this.options.barColors[b%this.options.barColors.length]},d.prototype.hitTest=function(a,b){var c;return 0===this.data.length?null:(c=this.options.horizontal?b:a,c=Math.max(Math.min(c,this.xEnd),this.xStart),Math.min(this.data.length-1,Math.floor((c-this.xStart)/(this.xSize/this.data.length))))},d.prototype.onGridClick=function(b,c){var d,e;return e=this.hitTest(b,c),d=!!this.bar_els.filter(function(){return a(this).is(":hover")}).length,this.fire("click",e,this.data[e].src,b,c,d)},d.prototype.onHoverMove=function(a,b){var c,d;return c=this.hitTest(a,b),this.hilight(c),null!=c?(d=this.hover).update.apply(d,this.hoverContentForRow(c)):this.hover.hide()},d.prototype.onHoverOut=function(){return this.hilight(-1),this.options.hideHover!==!1?this.hover.hide():void 0},d.prototype.hoverContentForRow=function(b){var c,d,e,f,g,h,i,j,k;for(f=this.data[b],c=a("
").text(f.label),c=c.prop("outerHTML"),k=f.y,e=i=0,j=k.length;j>i;e=++i)h=k[e],d=this.options.horizontal?e:f.y.length-1-e,this.options.labels[d]!==!1&&(c+="
\n "+this.options.labels[d]+":\n "+this.yLabelFormat(h,d)+"\n
");return"function"==typeof this.options.hoverCallback&&(c=this.options.hoverCallback(b,this.options,c,f.src)),this.options.horizontal?(g=this.left+.5*this.width,h=this.top+(b+.5)*this.height/this.data.length,[c,g,h,!0]):(g=this.left+(b+.5)*this.width/this.data.length,[c,g])},d.prototype.drawDataLabel=function(a,b,c){var d;return d=this.raphael.text(a,b,c).attr("text-anchor","middle").attr("font-size",this.options.dataLabelsSize).attr("font-family",this.options.dataLabelsFamily).attr("font-weight",this.options.dataLabelsWeight).attr("fill",this.options.dataLabelsColor)},d.prototype.drawBar=function(a,b,c,d,e,f,g){var h,i;return h=Math.max.apply(Math,g),i=this.options.animate?this.options.horizontal?0===h||h>d?this.raphael.rect(a,b,0,d).animate({x:a,width:c},500):this.raphael.path(this.roundedRect(a,b+d,c,0,g).animate({y:b,height:d},500)):0===h||h>d?this.raphael.rect(a,b+d,c,0).animate({y:b,height:d},500):this.raphael.path(this.roundedRect(a,b+d,c,0,g).animate({y:b,height:d},500)):0===h||h>d?this.raphael.rect(a,b,c,d):this.raphael.path(this.roundedRect(a,b,c,d,g)),i.attr("fill",e).attr("fill-opacity",f).attr("stroke","none")},d.prototype.roundedRect=function(a,b,c,d,e){return null==e&&(e=[0,0,0,0]),["M",a,e[0]+b,"Q",a,b,a+e[0],b,"L",a+c-e[1],b,"Q",a+c,b,a+c,b+e[1],"L",a+c,b+d-e[2],"Q",a+c,b+d,a+c-e[2],b+d,"L",a+e[3],b+d,"Q",a,b+d,a,b+d-e[3],"Z"]},d}(b.Grid),b.Donut=function(c){function d(c){this.resizeHandler=f(this.resizeHandler,this),this.select=f(this.select,this),this.click=f(this.click,this);var d=this;if(!(this instanceof b.Donut))return new b.Donut(c);if(this.options=a.extend({},this.defaults,c),"string"==typeof c.element?this.el=a(document.getElementById(c.element)):this.el=a(c.element),null===this.el||0===this.el.length)throw new Error("Graph placeholder not found.");void 0!==c.data&&0!==c.data.length&&(this.raphael=new Raphael(this.el[0]),this.options.resize&&a(window).bind("resize",function(a){return null!=d.timeoutId&&window.clearTimeout(d.timeoutId),d.timeoutId=window.setTimeout(d.resizeHandler,100)}),this.setData(c.data))}return h(d,c),d.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:b.commas,resize:!1,dataLabels:!0,dataLabelsPosition:"outside",dataLabelsFamily:"sans-serif",dataLabelsSize:12,dataLabelsWeight:"normal",dataLabelsColor:"#000",donutType:"pie",animate:!0},d.prototype.redraw=function(){var a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(this.raphael.clear(),c=this.el.width()/2,d=this.el.height()/2,r=(Math.min(c,d)-10)/3,p=0,y=this.values,s=0,v=y.length;v>s;s++)q=y[s],p+=q;for(k=5/(2*r),a=1.9999*Math.PI-k*this.data.length,i=0,f=0,this.segments=[],z=this.values,e=t=0,w=z.length;w>t;e=++t)q=z[e],l=i+k+a*(q/p),o=new b.DonutSegment(c,d,2*r,r,i,l,this.data[e].color||this.options.colors[f%this.options.colors.length],this.options.backgroundColor,f,this.raphael,this.options),o.render(),this.segments.push(o),o.on("hover",this.select),o.on("click",this.click),this.options.dataLabels&&this.values.length>1&&(n=Math.sin((i+l)/2),m=Math.cos((i+l)/2),"inside"===this.options.dataLabelsPosition?"pie"===this.options.donutType?(g=parseFloat(c)+parseFloat(.3*o.raphael.height*n),h=parseFloat(d)+parseFloat(.3*o.raphael.height*m)):(g=parseFloat(c)+parseFloat(.37*o.raphael.height*n),h=parseFloat(d)+parseFloat(.37*o.raphael.height*m)):(g=parseFloat(c)+parseFloat(.5*(o.raphael.height-9)*n),h=parseFloat(d)+parseFloat(.5*(o.raphael.height-9)*m)),this.drawDataLabel(g,h,q)),i=l,f+=1;for(this.text1=this.drawEmptyDonutLabel(c,d-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(c,d+10,this.options.labelColor,14),j=Math.max.apply(Math,this.values),f=0,A=this.values,B=[],u=0,x=A.length;x>u;u++){if(q=A[u],q===j){this.select(f);break}B.push(f+=1)}return B},d.prototype.setData=function(a){var b;return this.data=a,this.values=function(){var a,c,d,e;for(d=this.data,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(parseFloat(b.value));return e}.call(this),this.redraw()},d.prototype.drawDataLabel=function(a,b,c){var d;return d=this.raphael.text(a,b,c).attr("text-anchor","middle").attr("font-size",this.options.dataLabelsSize).attr("font-family",this.options.dataLabelsFamily).attr("font-weight",this.options.dataLabelsWeight).attr("fill",this.options.dataLabelsColor)},d.prototype.click=function(a){return this.fire("click",a,this.data[a])},d.prototype.select=function(a){var b,c,d,e,f,g;for(g=this.segments,e=0,f=g.length;f>e;e++)c=g[e],c.deselect();return d=this.segments[a],d.select(),b=this.data[a],"donut"===this.options.donutType?this.setLabels(b.label,this.options.formatter(b.value,b)):void 0},d.prototype.setLabels=function(a,b){var c,d,e,f,g,h,i,j;return c=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3,f=1.8*c,e=c/2,d=c/3,this.text1.attr({text:a,transform:""}),g=this.text1.getBBox(),h=Math.min(f/g.width,e/g.height),this.text1.attr({transform:"S"+h+","+h+","+(g.x+g.width/2)+","+(g.y+g.height)}),this.text2.attr({text:b,transform:""}),i=this.text2.getBBox(),j=Math.min(f/i.width,d/i.height),this.text2.attr({transform:"S"+j+","+j+","+(i.x+i.width/2)+","+i.y})},d.prototype.drawEmptyDonutLabel=function(a,b,c,d,e){var f;return f=this.raphael.text(a,b,"").attr("font-size",d).attr("fill",c),null!=e&&f.attr("font-weight",e),f},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.DonutSegment=function(a){function b(a,b,c,d,e,g,h,i,j,k,l){this.cx=a,this.cy=b,this.inner=c,this.outer=d,this.color=h,this.backgroundColor=i,this.index=j,this.raphael=k,this.options=l,this.deselect=f(this.deselect,this),this.select=f(this.select,this),this.sin_p0=Math.sin(e),this.cos_p0=Math.cos(e),this.sin_p1=Math.sin(g),this.cos_p1=Math.cos(g),this.is_long=g-e>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],"pie"===this.options.donutType?"M"+g+","+i+("A"+b+","+b+",0,"+this.is_long+",0,"+h+","+j)+("L"+this.cx+","+this.cy)+"Z":"M"+c+","+e+("A"+a+","+a+",0,"+this.is_long+",0,"+d+","+f)+("L"+h+","+j)+("A"+b+","+b+",0,"+this.is_long+",1,"+g+","+i)+"Z"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],"M"+b+","+d+("A"+a+","+a+",0,"+this.is_long+",0,"+c+","+e)},b.prototype.render=function(){var a=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return a.fire("hover",a.index)},function(){return a.fire("click",a.index)})},b.prototype.drawDonutArc=function(a,b){return this.raphael.path(a).attr({stroke:b,"stroke-width":2,opacity:0})},b.prototype.drawDonutSegment=function(a,b,c,d,e){var f,g,h;return this.options.animate&&"pie"===this.options.donutType?(h=a,h=a.replace("A",","),h=h.replace("M",""),h=h.replace("C",","),h=h.replace("Z",""),g=h.split(","),h="pie"===this.options.donutType?"M"+g[0]+","+g[1]+","+g[g.length-2]+","+g[g.length-1]+","+g[g.length-2]+","+g[g.length-1]+"Z":"M"+g[0]+","+g[1]+","+g[g.length-2]+","+g[g.length-1]+"Z",f=this.raphael.path(h).attr({fill:b,stroke:c,"stroke-width":3}).hover(d).click(e),function(a,b){return a.animate({path:b},500,"<>")}(f,a)):this.raphael.path(a).attr({fill:b,stroke:c,"stroke-width":3}).hover(d).click(e)},b.prototype.select=function(){return"donut"!==this.options.donutType||this.selected?void 0:(this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0)},b.prototype.deselect=function(){return this.selected?(this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1):void 0},b}(b.EventEmitter)}).call(this);
\ No newline at end of file