chart.js 19.6 KB
window.JMapChart=function(n){var l=this,c={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return-1*e*(e-2)},easeInOutQuad:function(e){return(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1)},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1*((e=e/1-1)*e*e+1)},easeInOutCubic:function(e){return(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return-1*((e=e/1-1)*e*e*e-1)},easeInOutQuart:function(e){return(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},easeInQuint:function(e){return 1*(e/=1)*e*e*e*e},easeOutQuint:function(e){return 1*((e=e/1-1)*e*e*e*e+1)},easeInOutQuint:function(e){return(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},easeInSine:function(e){return-1*Math.cos(e/1*(Math.PI/2))+1},easeOutSine:function(e){return 1*Math.sin(e/1*(Math.PI/2))},easeInOutSine:function(e){return-.5*(Math.cos(Math.PI*e/1)-1)},easeInExpo:function(e){return 0==e?1:1*Math.pow(2,10*(e/1-1))},easeOutExpo:function(e){return 1==e?1:1*(1-Math.pow(2,-10*e/1))},easeInOutExpo:function(e){return 0==e?0:1==e?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*--e))},easeInCirc:function(e){return 1<=e?e:-1*(Math.sqrt(1-(e/=1)*e)-1)},easeOutCirc:function(e){return 1*Math.sqrt(1-(e=e/1-1)*e)},easeInOutCirc:function(e){return(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},easeInElastic:function(e){var t=1.70158,a=0,n=1;if(0==e)return 0;if(1==(e/=1))return 1;if(a||(a=.3),n<Math.abs(1)){n=1;t=a/4}else t=a/(2*Math.PI)*Math.asin(1/n);return-n*Math.pow(2,10*(e-=1))*Math.sin((1*e-t)*(2*Math.PI)/a)},easeOutElastic:function(e){var t=1.70158,a=0,n=1;if(0==e)return 0;if(1==(e/=1))return 1;if(a||(a=.3),n<Math.abs(1)){n=1;t=a/4}else t=a/(2*Math.PI)*Math.asin(1/n);return n*Math.pow(2,-10*e)*Math.sin((1*e-t)*(2*Math.PI)/a)+1},easeInOutElastic:function(e){var t=1.70158,a=0,n=1;if(0==e)return 0;if(2==(e/=.5))return 1;if(a||(a=.3*1.5*1),n<Math.abs(1)){n=1;t=a/4}else t=a/(2*Math.PI)*Math.asin(1/n);return e<1?n*Math.pow(2,10*(e-=1))*Math.sin((1*e-t)*(2*Math.PI)/a)*-.5:n*Math.pow(2,-10*(e-=1))*Math.sin((1*e-t)*(2*Math.PI)/a)*.5+1},easeInBack:function(e){return 1*(e/=1)*e*(2.70158*e-1.70158)},easeOutBack:function(e){return 1*((e=e/1-1)*e*(2.70158*e+1.70158)+1)},easeInOutBack:function(e){var t=1.70158;return(e/=.5)<1?e*e*((1+(t*=1.525))*e-t)*.5:.5*((e-=2)*e*((1+(t*=1.525))*e+t)+2)},easeInBounce:function(e){return 1-c.easeOutBounce(1-e)},easeOutBounce:function(e){return(e/=1)<1/2.75?7.5625*e*e*1:e<2/2.75?1*(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1*(7.5625*(e-=2.25/2.75)*e+.9375):1*(7.5625*(e-=2.625/2.75)*e+.984375)},easeInOutBounce:function(e){return e<.5?.5*c.easeInBounce(2*e):.5*c.easeOutBounce(2*e-1)+.5}},g=n.canvas.width,b=n.canvas.height;this.PolarArea=function(e,t){l.PolarArea.defaults={scaleOverlay:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var a=t?P(l.PolarArea.defaults,t):l.PolarArea.defaults;return new o(e,a,n)},this.Radar=function(e,t){l.Radar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!1,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,angleShowLineOut:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:12,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var a=t?P(l.Radar.defaults,t):l.Radar.defaults;return new i(e,a,n)},this.Pie=function(e,t){l.Pie.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var a=t?P(l.Pie.defaults,t):l.Pie.defaults;return new s(e,a,n)},this.Doughnut=function(e,t){l.Doughnut.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var a=t?P(l.Doughnut.defaults,t):l.Doughnut.defaults;return new r(e,a,n)},this.Line=function(e,t){l.Line.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,bezierCurve:!0,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:2,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var a=t?P(l.Line.defaults,t):l.Line.defaults;return new u(e,a,n)},this.Bar=function(e,t){l.Bar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var a=t?P(l.Bar.defaults,t):l.Bar.defaults;return new h(e,a,n)};var o=function(i,s,r){var e,c,u,o,h,t,a;!function(){e=p([g,b])/2,e-=S([.5*s.scaleFontSize,.5*s.scaleLineWidth]),o=2*s.scaleFontSize,s.scaleShowLabelBackdrop&&(o+=2*s.scaleBackdropPaddingY,e-=1.5*s.scaleBackdropPaddingY);h=e,o=m(o,5)}(),t=function(){for(var e=Number.MIN_VALUE,t=Number.MAX_VALUE,a=0;a<i.length;a++)i[a].value>e&&(e=i[a].value),i[a].value<t&&(t=i[a].value);var n=Math.floor(h/(.66*o)),l=Math.floor(h/o*.5);return{maxValue:e,minValue:t,maxSteps:n,minSteps:l}}(),a=s.scaleShowLabels?s.scaleLabel:null,s.scaleOverride?M(a,(u={steps:s.scaleSteps,stepValue:s.scaleStepWidth,graphMin:s.scaleStartValue,labels:[]}).labels,u.steps,s.scaleStartValue,s.scaleStepWidth):u=L(h,t.maxSteps,t.minSteps,t.maxValue,t.minValue,a),c=e/u.steps,k(s,function(){for(var e=0;e<u.steps;e++)if(s.scaleShowLine&&(r.beginPath(),r.arc(g/2,b/2,c*(e+1),0,2*Math.PI,!0),r.strokeStyle=s.scaleLineColor,r.lineWidth=s.scaleLineWidth,r.stroke()),s.scaleShowLabels){r.textAlign="center",r.font=s.scaleFontStyle+" "+s.scaleFontSize+"px "+s.scaleFontFamily;var t=u.labels[e];if(s.scaleShowLabelBackdrop){var a=r.measureText(t).width;r.fillStyle=s.scaleBackdropColor,r.beginPath(),r.rect(Math.round(g/2-a/2-s.scaleBackdropPaddingX),Math.round(b/2-c*(e+1)-.5*s.scaleFontSize-s.scaleBackdropPaddingY),Math.round(a+2*s.scaleBackdropPaddingX),Math.round(s.scaleFontSize+2*s.scaleBackdropPaddingY)),r.fill()}r.textBaseline="middle",r.fillStyle=s.scaleFontColor,r.fillText(t,g/2,b/2-c*(e+1))}},function(e){var t=-Math.PI/2,a=2*Math.PI/i.length,n=1,l=1;s.animation&&(s.animateScale&&(n=e),s.animateRotate&&(l=e));for(var o=0;o<i.length;o++)r.beginPath(),r.arc(g/2,b/2,n*v(i[o].value,u,c),t,t+l*a,!1),r.lineTo(g/2,b/2),r.closePath(),r.fillStyle=i[o].color,r.fill(),s.segmentShowStroke&&(r.strokeStyle=s.segmentStrokeColor,r.lineWidth=s.segmentStrokeWidth,r.stroke()),t+=l*a},r)},i=function(r,c,u){var h,d,f,i,s,e;r.labels||(r.labels=[]),function(){h=p([g,b])/2,i=2*c.scaleFontSize;for(var e=0,t=0;t<r.labels.length;t++){u.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily;var a=u.measureText(r.labels[t]).width;e<a&&(e=a)}h-=S([e,c.pointLabelFontSize/2*1.5]),h=F(h-=c.pointLabelFontSize,null,0),s=h,i=m(i,5)}();var t=function(){for(var e=Number.MIN_VALUE,t=Number.MAX_VALUE,a=0;a<r.datasets.length;a++)for(var n=0;n<r.datasets[a].data.length;n++)r.datasets[a].data[n]>e&&(e=r.datasets[a].data[n]),r.datasets[a].data[n]<t&&(t=r.datasets[a].data[n]);var l=Math.floor(s/(.66*i)),o=Math.floor(s/i*.5);return{maxValue:e,minValue:t,maxSteps:l,minSteps:o}}();e=c.scaleShowLabels?c.scaleLabel:null,c.scaleOverride?M(e,(f={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]}).labels,f.steps,c.scaleStartValue,c.scaleStepWidth):f=L(s,t.maxSteps,t.minSteps,t.maxValue,t.minValue,e),d=h/f.steps,k(c,function(){var e=2*Math.PI/r.datasets[0].data.length;if(u.save(),u.translate(g/2,b/2),c.angleShowLineOut){u.strokeStyle=c.angleLineColor,u.lineWidth=c.angleLineWidth;for(var t=0;t<r.datasets[0].data.length;t++)u.rotate(e),u.beginPath(),u.moveTo(0,0),u.lineTo(0,-h),u.stroke()}for(var a=0;a<f.steps;a++){if(u.beginPath(),c.scaleShowLine){u.strokeStyle=c.scaleLineColor,u.lineWidth=c.scaleLineWidth,u.moveTo(0,-d*(a+1));for(var n=0;n<r.datasets[0].data.length;n++)u.rotate(e),u.lineTo(0,-d*(a+1));u.closePath(),u.stroke()}if(c.scaleShowLabels){if(u.textAlign="center",u.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily,u.textBaseline="middle",c.scaleShowLabelBackdrop){var l=u.measureText(f.labels[a]).width;u.fillStyle=c.scaleBackdropColor,u.beginPath(),u.rect(Math.round(-l/2-c.scaleBackdropPaddingX),Math.round(-d*(a+1)-.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(l+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY)),u.fill()}u.fillStyle=c.scaleFontColor,u.fillText(f.labels[a],0,-d*(a+1))}}for(var o=0;o<r.labels.length;o++){u.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily,u.fillStyle=c.pointLabelFontColor;var i=Math.sin(e*o)*(h+c.pointLabelFontSize),s=Math.cos(e*o)*(h+c.pointLabelFontSize);e*o==Math.PI||e*o==0?u.textAlign="center":e*o>Math.PI?u.textAlign="right":u.textAlign="left",u.textBaseline="middle",u.fillText(r.labels[o],i,-s)}u.restore()},function(e){var t=2*Math.PI/r.datasets[0].data.length;u.save(),u.translate(g/2,b/2);for(var a=0;a<r.datasets.length;a++){u.beginPath(),u.moveTo(0,e*(-1*v(r.datasets[a].data[0],f,d)));for(var n=1;n<r.datasets[a].data.length;n++)u.rotate(t),u.lineTo(0,e*(-1*v(r.datasets[a].data[n],f,d)));if(u.closePath(),u.fillStyle=r.datasets[a].fillColor,u.strokeStyle=r.datasets[a].strokeColor,u.lineWidth=c.datasetStrokeWidth,u.fill(),u.stroke(),c.pointDot){u.fillStyle=r.datasets[a].pointColor,u.strokeStyle=r.datasets[a].pointStrokeColor,u.lineWidth=c.pointDotStrokeWidth;for(var l=0;l<r.datasets[a].data.length;l++)u.rotate(t),u.beginPath(),u.arc(0,e*(-1*v(r.datasets[a].data[l],f,d)),c.pointDotRadius,2*Math.PI,!1),u.fill(),u.stroke()}u.rotate(t)}u.restore()},u)},s=function(i,s,r){for(var c=0,u=p([b/2,g/2])-5,e=0;e<i.length;e++)c+=i[e].value;k(s,null,function(e){var t=-Math.PI/2,a=1,n=1;s.animation&&(s.animateScale&&(a=e),s.animateRotate&&(n=e));for(var l=0;l<i.length;l++){var o=n*(i[l].value/c*(2*Math.PI));r.beginPath(),r.arc(g/2,b/2,a*u,t,t+o),r.lineTo(g/2,b/2),r.closePath(),r.fillStyle=i[l].color,r.fill(),s.segmentShowStroke&&(r.lineWidth=s.segmentStrokeWidth,r.strokeStyle=s.segmentStrokeColor,r.stroke()),t+=o}},r)},r=function(i,s,r){for(var c=0,u=p([b/2,g/2])-5,h=u*(s.percentageInnerCutout/100),e=0;e<i.length;e++)c+=i[e].value;k(s,null,function(e){var t=-Math.PI/2,a=1,n=1;s.animation&&(s.animateScale&&(a=e),s.animateRotate&&(n=e));for(var l=0;l<i.length;l++){var o=n*(i[l].value/c*(2*Math.PI));r.beginPath(),r.arc(g/2,b/2,a*u,t,t+o,!1),r.arc(g/2,b/2,a*h,t+o,t,!0),r.closePath(),r.fillStyle=i[l].color,r.fill(),s.segmentShowStroke&&(r.lineWidth=s.segmentStrokeWidth,r.strokeStyle=s.segmentStrokeColor,r.stroke()),t+=o}},r)},u=function(i,s,r){var a,c,u,o,h,e,t,d,n,l,f,S,p=0;!function(){a=b,r.font=s.scaleFontStyle+" "+s.scaleFontSize+"px "+s.scaleFontFamily,n=1;for(var e=0;e<i.labels.length;e++){var t=r.measureText(i.labels[e]).width;n=n<t?t:n}g/i.labels.length<n?(p=45,g/i.labels.length<Math.cos(p)*n?(p=90,a-=n):a-=Math.sin(p)*n):a-=s.scaleFontSize;a-=5,o=s.scaleFontSize,h=a-=o}(),e=function(){for(var e=0,t=0;t<i.datasets.length;t++)for(var a=0;a<i.datasets[t].data.length;a++)parseInt(i.datasets[t].data[a])>e&&(e=parseInt(i.datasets[t].data[a]));var n=Math.floor(h/(.66*o)),l=Math.floor(h/o*.5);return{maxValue:e,minValue:0,maxSteps:n,minSteps:l}}(),t=s.scaleShowLabels?s.scaleLabel:"",s.scaleOverride?M(t,(u={steps:s.scaleSteps,stepValue:s.scaleStepWidth,graphMin:s.scaleStartValue,labels:[]}).labels,u.steps,s.scaleStartValue,s.scaleStepWidth):u=L(h,e.maxSteps,e.minSteps,e.maxValue,e.minValue,t),c=Math.floor(h/u.steps),function(){var e=1;if(s.scaleShowLabels){r.font=s.scaleFontStyle+" "+s.scaleFontSize+"px "+s.scaleFontFamily;for(var t=0;t<u.labels.length;t++){var a=r.measureText(u.labels[t]).width;e=e<a?a:e}e+=10}l=g-e-n,d=Math.floor(l/(i.labels.length-1)),f=g-n/2-l-30,S=h+s.scaleFontSize/2}(),k(s,function(){r.lineWidth=s.scaleLineWidth,r.strokeStyle=s.scaleLineColor,r.beginPath(),r.moveTo(g-n/2+5,S),r.lineTo(g-n/2-l-5,S),r.stroke(),r.textAlign=0<p?(r.save(),"right"):"center";r.fillStyle=s.scaleFontColor;for(var e=0;e<i.labels.length;e++)r.save(),0<p?(r.translate(f+e*d,S+s.scaleFontSize),r.rotate(-p*(Math.PI/270)),r.fillText(i.labels[e],0,0),r.restore()):r.fillText(i.labels[e],f+e*d,S+s.scaleFontSize+3),r.beginPath(),r.moveTo(f+e*d,S+3),s.scaleShowGridLines&&0<e?(r.lineWidth=s.scaleGridLineWidth,r.strokeStyle=s.scaleGridLineColor,r.lineTo(f+e*d,5)):r.lineTo(f+e*d,S+3),r.stroke();r.lineWidth=s.scaleLineWidth,r.strokeStyle=s.scaleLineColor,r.beginPath(),r.moveTo(f,S+5),r.lineTo(f,5),r.stroke(),r.textAlign="right",r.textBaseline="middle";for(var t=0;t<u.steps;t++)r.beginPath(),r.moveTo(f-3,S-(t+1)*c),s.scaleShowGridLines?(r.lineWidth=s.scaleGridLineWidth,r.strokeStyle=s.scaleGridLineColor,r.lineTo(f+l+5,S-(t+1)*c)):r.lineTo(f-.5,S-(t+1)*c),r.stroke(),s.scaleShowLabels&&r.fillText(u.labels[t],f-8,S-(t+1)*c)},function(a){for(var e=0;e<i.datasets.length;e++){r.strokeStyle=i.datasets[e].strokeColor,r.lineWidth=s.datasetStrokeWidth,r.beginPath(),r.moveTo(f,S-a*v(i.datasets[e].data[0],u,c));for(var t=1;t<i.datasets[e].data.length;t++)s.bezierCurve?r.bezierCurveTo(o(t-.5),l(e,t-1),o(t-.5),l(e,t),o(t),l(e,t)):r.lineTo(o(t),l(e,t));if(r.stroke(),s.datasetFill?(r.lineTo(f+d*(i.datasets[e].data.length-1),S),r.lineTo(f,S),r.closePath(),r.fillStyle=i.datasets[e].fillColor,r.fill()):r.closePath(),s.pointDot){r.fillStyle=i.datasets[e].pointColor,r.strokeStyle=i.datasets[e].pointStrokeColor,r.lineWidth=s.pointDotStrokeWidth;for(var n=0;n<i.datasets[e].data.length;n++)r.beginPath(),r.arc(f+d*n,S-a*v(i.datasets[e].data[n],u,c),s.pointDotRadius,0,2*Math.PI,!0),r.fill(),r.stroke()}}function l(e,t){return S-a*v(i.datasets[e].data[t],u,c)}function o(e){return f+d*e}},r)},h=function(i,l,o){var a,s,r,c,u,e,t,h,n,d,f,S,p,m=0;!function(){a=b,o.font=l.scaleFontStyle+" "+l.scaleFontSize+"px "+l.scaleFontFamily,n=1;for(var e=0;e<i.labels.length;e++){var t=o.measureText(i.labels[e]).width;n=n<t?t:n}g/i.labels.length<n?(m=45,g/i.labels.length<Math.cos(m)*n?(m=90,a-=n):a-=Math.sin(m)*n):a-=l.scaleFontSize;a-=5,c=l.scaleFontSize,u=a-=c}(),e=function(){for(var e=Number.MIN_VALUE,t=Number.MAX_VALUE,a=0;a<i.datasets.length;a++)for(var n=0;n<i.datasets[a].data.length;n++)i.datasets[a].data[n]>e&&(e=i.datasets[a].data[n]),i.datasets[a].data[n]<t&&(t=i.datasets[a].data[n]);var l=Math.floor(u/(.66*c)),o=Math.floor(u/c*.5);return{maxValue:e,minValue:t,maxSteps:l,minSteps:o}}(),t=l.scaleShowLabels?l.scaleLabel:"",l.scaleOverride?M(t,(r={steps:l.scaleSteps,stepValue:l.scaleStepWidth,graphMin:l.scaleStartValue,labels:[]}).labels,r.steps,l.scaleStartValue,l.scaleStepWidth):r=L(u,e.maxSteps,e.minSteps,e.maxValue,e.minValue,t),s=Math.floor(u/r.steps),function(){var e=1;if(l.scaleShowLabels){o.font=l.scaleFontStyle+" "+l.scaleFontSize+"px "+l.scaleFontFamily;for(var t=0;t<r.labels.length;t++){var a=o.measureText(r.labels[t]).width;e=e<a?a:e}e+=10}d=g-e-n,h=Math.floor(d/i.labels.length),p=(h-2*l.scaleGridLineWidth-2*l.barValueSpacing-(l.barDatasetSpacing*i.datasets.length-1)-(l.barStrokeWidth/2*i.datasets.length-1))/i.datasets.length,f=g-n/2-d,S=u+l.scaleFontSize/2}(),k(l,function(){o.lineWidth=l.scaleLineWidth,o.strokeStyle=l.scaleLineColor,o.beginPath(),o.moveTo(g-n/2+5,S),o.lineTo(g-n/2-d-5,S),o.stroke(),o.textAlign=0<m?(o.save(),"right"):"center";o.fillStyle=l.scaleFontColor;for(var e=0;e<i.labels.length;e++)o.save(),0<m?(o.translate(f+e*h,S+l.scaleFontSize),o.rotate(-m*(Math.PI/180)),o.fillText(i.labels[e],0,0),o.restore()):o.fillText(i.labels[e],f+e*h+h/2,S+l.scaleFontSize+3),o.beginPath(),o.moveTo(f+(e+1)*h,S+3),o.lineWidth=l.scaleGridLineWidth,o.strokeStyle=l.scaleGridLineColor,o.lineTo(f+(e+1)*h,5),o.stroke();o.lineWidth=l.scaleLineWidth,o.strokeStyle=l.scaleLineColor,o.beginPath(),o.moveTo(f,S+5),o.lineTo(f,5),o.stroke(),o.textAlign="right",o.textBaseline="middle";for(var t=0;t<r.steps;t++)o.beginPath(),o.moveTo(f-3,S-(t+1)*s),l.scaleShowGridLines?(o.lineWidth=l.scaleGridLineWidth,o.strokeStyle=l.scaleGridLineColor,o.lineTo(f+d+5,S-(t+1)*s)):o.lineTo(f-.5,S-(t+1)*s),o.stroke(),l.scaleShowLabels&&o.fillText(r.labels[t],f-8,S-(t+1)*s)},function(e){o.lineWidth=l.barStrokeWidth;for(var t=0;t<i.datasets.length;t++){o.fillStyle=i.datasets[t].fillColor,o.strokeStyle=i.datasets[t].strokeColor;for(var a=0;a<i.datasets[t].data.length;a++){var n=f+l.barValueSpacing+h*a+p*t+l.barDatasetSpacing*t+l.barStrokeWidth*t;o.beginPath(),o.moveTo(n,S),o.lineTo(n,S-e*v(i.datasets[t].data[a],r,s)+l.barStrokeWidth/2),o.lineTo(n+p,S-e*v(i.datasets[t].data[a],r,s)+l.barStrokeWidth/2),o.lineTo(n+p,S),l.barShowStroke&&o.stroke(),o.closePath(),o.fill()}}},o)};function v(e,t,a){var n=t.steps*t.stepValue,l=F((e-t.graphMin)/n,1,0);return a*t.steps*l}function k(t,a,n,l){var o=t.animation?1/F(t.animationSteps,Number.MAX_VALUE,1):1,i=c[t.animationEasing],s=t.animation?0:1;function r(){var e=t.animation?F(i(s),null,0):1;l.clearRect(0,0,g,b),t.scaleOverlay?(n(e),a()):(a(),n(e))}"function"!=typeof a&&(a=function(){}),d(function e(){s+=o;r();s<=1?d(e):"function"==typeof t.onAnimationComplete&&t.onAnimationComplete()})}var d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};function L(e,t,a,n,l,o){var i,s,r,c,u;for(u=n-l,c=Math.floor(Math.log(u)/Math.LN10),0,i=Math.ceil(n/(1*Math.pow(10,c)))*Math.pow(10,c)-0,s=Math.pow(10,c),r=Math.round(i/s);r<a||t<r;)r=(r<a?s/=2:s*=2,Math.round(i/s));var h=[];return M(o,h,r,0,s),{steps:r,stepValue:s,graphMin:0,labels:h}}function M(e,t,a,n,l){if(e)for(var o=1;o<a+1;o++)t.push(y(e,{value:(n+l*o).toFixed(w(l))}))}function S(e){return Math.max.apply(Math,e)}function p(e){return Math.min.apply(Math,e)}function m(e,t){return e||t}function f(e){return!isNaN(parseFloat(e))&&isFinite(e)}function F(e,t,a){return f(t)&&t<e?t:f(a)&&e<a?a:e}function w(e){return e%1!=0?e.toString().split(".")[1].length:0}function P(e,t){var a={};for(var n in e)a[n]=e[n];for(var n in t)a[n]=t[n];return a}var W={};function y(e,t){var a=/\W/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):W[e]=W[e]||y(document.getElementById(e).innerHTML);return t?a(t):a}};