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