(function(){var l=this,d=l.Chart,c=function(a){this.canvas=a.canvas;this.ctx=a;var g=function(a,g){return a["offset"+g]?a["offset"+g]:document.defaultView.getComputedStyle(a).getPropertyValue(g)},k=this.width=g(a.canvas,"Width"),g=this.height=g(a.canvas,"Height");a.canvas.width=k;a.canvas.height=g;k=this.width=a.canvas.width;g=this.height=a.canvas.height;this.aspectRatio=this.width/this.height;b.retinaScale(this);return this};c.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",
showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",
tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",
onAnimationProgress:function(){},onAnimationComplete:function(){}}};c.types={};var b=c.helpers={},e=b.each=function(a,g,k){var b=Array.prototype.slice.call(arguments,3);if(a)if(a.length===+a.length){var c;for(c=0;c<a.length;c++)g.apply(k,[a[c],c].concat(b))}else for(c in a)g.apply(k,[a[c],c].concat(b))},f=b.clone=function(a){var g={};e(a,function(k,b){a.hasOwnProperty(b)&&(g[b]=k)});return g},h=b.extend=function(a){e(Array.prototype.slice.call(arguments,1),function(g){e(g,function(k,b){g.hasOwnProperty(b)&&
(a[b]=k)})});return a},D=b.merge=function(a,g){var k=Array.prototype.slice.call(arguments,0);k.unshift({});return h.apply(null,k)},E=b.indexOf=function(a,g){if(Array.prototype.indexOf)return a.indexOf(g);for(var k=0;k<a.length;k++)if(a[k]===g)return k;return-1};b.where=function(a,g){var k=[];b.each(a,function(a){g(a)&&k.push(a)});return k};b.findNextWhere=function(a,g,k){k||(k=-1);for(k+=1;k<a.length;k++){var b=a[k];if(g(b))return b}};b.findPreviousWhere=function(a,g,k){k||(k=a.length);for(--k;0<=
k;k--){var b=a[k];if(g(b))return b}};var n=b.inherits=function(a){var g=this,k=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return g.apply(this,arguments)},b=function(){this.constructor=k};b.prototype=g.prototype;k.prototype=new b;k.extend=n;a&&h(k.prototype,a);k.__super__=g.prototype;return k},m=b.noop=function(){},F=b.uid=function(){var a=0;return function(){return"chart-"+a++}}(),G=b.warn=function(a){window.console&&"function"==typeof window.console.warn&&console.warn(a)},H=b.amd=
"function"==typeof define&&define.amd,p=b.isNumber=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},v=b.max=function(a){return Math.max.apply(Math,a)},t=b.min=function(a){return Math.min.apply(Math,a)};b.cap=function(a,g,b){if(p(g)){if(a>g)return g}else if(p(b)&&a<b)return b;return a};var z=b.getDecimalPlaces=function(a){return 0!==a%1&&p(a)?a.toString().split(".")[1].length:0},w=b.radians=function(a){return Math.PI/180*a};b.getAngleFromPoint=function(a,g){var b=g.x-a.x,c=g.y-a.y,e=Math.sqrt(b*
b+c*c),d=2*Math.PI+Math.atan2(c,b);0>b&&0>c&&(d+=2*Math.PI);return{angle:d,distance:e}};var A=b.aliasPixel=function(a){return 0===a%2?0:.5};b.splineCurve=function(a,g,b,c){var e=Math.sqrt(Math.pow(g.x-a.x,2)+Math.pow(g.y-a.y,2)),d=Math.sqrt(Math.pow(b.x-g.x,2)+Math.pow(b.y-g.y,2)),f=c*e/(e+d);c=c*d/(e+d);return{inner:{x:g.x-f*(b.x-a.x),y:g.y-f*(b.y-a.y)},outer:{x:g.x+c*(b.x-a.x),y:g.y+c*(b.y-a.y)}}};var I=b.calculateOrderOfMagnitude=function(a){return Math.floor(Math.log(a)/Math.LN10)};b.calculateScaleRange=
function(a,g,b,c,e){g=Math.floor(g/(1.5*b));b=2>=g;var d=v(a),f=t(a);d===f&&(d+=.5,.5<=f&&!c?f-=.5:d+=.5);a=Math.abs(d-f);a=I(a);d=Math.ceil(d/(1*Math.pow(10,a)))*Math.pow(10,a);c=c?0:Math.floor(f/(1*Math.pow(10,a)))*Math.pow(10,a);for(var d=d-c,f=Math.pow(10,a),h=Math.round(d/f);(h>g||2*h<g)&&!b;)if(h>g)f*=2,h=Math.round(d/f),0!==h%1&&(b=!0);else if(e&&0<=a)if(0===f/2%1)f/=2,h=Math.round(d/f);else break;else f/=2,h=Math.round(d/f);b&&(h=2,f=d/h);return{steps:h,stepValue:f,min:c,max:c+h*f}};var q=
b.template=function(a,g){if(a instanceof Function)return a(g);var b={},b=/\W/.test(a)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.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('');"):b[a]=b[a];return g?b(g):b};b.generateLabels=function(a,g,b,c){var d=Array(g);labelTemplateString&&e(d,
function(g,e){d[e]=q(a,{value:b+c*(e+1)})});return d};var u=b.easingEffects={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return 1>(a/=.5)?.5*a*a:-.5*(--a*(a-2)-1)},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1*((a=a/1-1)*a*a+1)},easeInOutCubic:function(a){return 1>(a/=.5)?.5*a*a*a:.5*((a-=2)*a*a+2)},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return-1*((a=a/1-1)*a*
a*a-1)},easeInOutQuart:function(a){return 1>(a/=.5)?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)},easeInQuint:function(a){return 1*(a/=1)*a*a*a*a},easeOutQuint:function(a){return 1*((a=a/1-1)*a*a*a*a+1)},easeInOutQuint:function(a){return 1>(a/=.5)?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)},easeInSine:function(a){return-1*Math.cos(a/1*(Math.PI/2))+1},easeOutSine:function(a){return 1*Math.sin(a/1*(Math.PI/2))},easeInOutSine:function(a){return-.5*(Math.cos(Math.PI*a/1)-1)},easeInExpo:function(a){return 0===a?1:1*Math.pow(2,
10*(a/1-1))},easeOutExpo:function(a){return 1===a?1:1*(-Math.pow(2,-10*a/1)+1)},easeInOutExpo:function(a){return 0===a?0:1===a?1:1>(a/=.5)?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return 1<=a?a:-1*(Math.sqrt(1-(a/=1)*a)-1)},easeOutCirc:function(a){return 1*Math.sqrt(1-(a=a/1-1)*a)},easeInOutCirc:function(a){return 1>(a/=.5)?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var g=1.70158,b=0,c=1;if(0===a)return 0;if(1==(a/=1))return 1;
b||(b=.3);c<Math.abs(1)?(c=1,g=b/4):g=b/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*--a)*Math.sin(2*(1*a-g)*Math.PI/b))},easeOutElastic:function(a){var b=1.70158,c=0,e=1;if(0===a)return 0;if(1==(a/=1))return 1;c||(c=.3);e<Math.abs(1)?(e=1,b=c/4):b=c/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin(2*(1*a-b)*Math.PI/c)+1},easeInOutElastic:function(a){var b=1.70158,c=0,e=1;if(0===a)return 0;if(2==(a/=.5))return 1;c||(c=.3*1.5);e<Math.abs(1)?(e=1,b=c/4):b=c/(2*Math.PI)*Math.asin(1/
e);return 1>a?-.5*e*Math.pow(2,10*--a)*Math.sin(2*(1*a-b)*Math.PI/c):e*Math.pow(2,-10*--a)*Math.sin(2*(1*a-b)*Math.PI/c)*.5+1},easeInBack:function(a){return 1*(a/=1)*a*(2.70158*a-1.70158)},easeOutBack:function(a){return 1*((a=a/1-1)*a*(2.70158*a+1.70158)+1)},easeInOutBack:function(a){var b=1.70158;return 1>(a/=.5)?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},easeInBounce:function(a){return 1-u.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?
1*(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?1*(7.5625*(a-=2.25/2.75)*a+.9375):1*(7.5625*(a-=2.625/2.75)*a+.984375)},easeInOutBounce:function(a){return.5>a?.5*u.easeInBounce(2*a):.5*u.easeOutBounce(2*a-1)+.5}},B=b.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return window.setTimeout(a,1E3/60)}}(),J=b.cancelAnimFrame=function(){return window.cancelAnimationFrame||
window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(a){return window.clearTimeout(a,1E3/60)}}();b.animationLoop=function(a,b,c,e,d,f){var h=0,m=u[c]||u.linear,l=function(){h++;var c=h/b,k=m(c);a.call(f,k,c,h);e.call(f,k,c);h<b?f.animationFrame=B(l):d.apply(f)};B(l)};b.getRelativePosition=function(a){var b;b=a.originalEvent||a;var c=(a.currentTarget||a.srcElement).getBoundingClientRect();b.touches?(a=b.touches[0].clientX-
c.left,b=b.touches[0].clientY-c.top):(a=b.clientX-c.left,b=b.clientY-c.top);return{x:a,y:b}};var K=b.addEvent=function(a,b,c){a.addEventListener?a.addEventListener(b,c):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},L=b.removeEvent=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=m};b.bindEvents=function(a,b,c){a.events||(a.events={});e(b,function(b){a.events[b]=function(){c.apply(a,arguments)};K(a.chart.canvas,b,a.events[b])})};
var M=b.unbindEvents=function(a,b){e(b,function(b,c){L(a.chart.canvas,c,b)})},N=b.getMaximumWidth=function(a){return a.parentNode.clientWidth},O=b.getMaximumHeight=function(a){return a.parentNode.clientHeight};b.getMaximumSize=b.getMaximumWidth;var P=b.retinaScale=function(a){var b=a.ctx,c=a.canvas.width;a=a.canvas.height;window.devicePixelRatio&&(b.canvas.style.width=c+"px",b.canvas.style.height=a+"px",b.canvas.height=a*window.devicePixelRatio,b.canvas.width=c*window.devicePixelRatio,b.scale(window.devicePixelRatio,
window.devicePixelRatio))},Q=b.clear=function(a){a.ctx.clearRect(0,0,a.width,a.height)},r=b.fontString=function(a,b,c){return b+" "+a+"px "+c},x=b.longestText=function(a,b,c){a.font=b;var d=0;e(c,function(b){b=a.measureText(b).width;d=b>d?b:d});return d},C=b.drawRoundedRectangle=function(a,b,c,e,d,f){a.beginPath();a.moveTo(b+f,c);a.lineTo(b+e-f,c);a.quadraticCurveTo(b+e,c,b+e,c+f);a.lineTo(b+e,c+d-f);a.quadraticCurveTo(b+e,c+d,b+e-f,c+d);a.lineTo(b+f,c+d);a.quadraticCurveTo(b,c+d,b,c+d-f);a.lineTo(b,
c+f);a.quadraticCurveTo(b,c,b+f,c);a.closePath()};c.instances={};c.Type=function(a,b,e){this.options=b;this.chart=e;this.id=F();c.instances[this.id]=this;b.responsive&&this.resize();this.initialize.call(this,a)};h(c.Type.prototype,{initialize:function(){return this},clear:function(){Q(this.chart);return this},stop:function(){J(this.animationFrame);return this},resize:function(a){this.stop();var b=this.chart.canvas,c=N(this.chart.canvas),e=this.options.maintainAspectRatio?c/this.chart.aspectRatio:
O(this.chart.canvas);b.width=this.chart.width=c;b.height=this.chart.height=e;P(this.chart);"function"===typeof a&&a.apply(this,Array.prototype.slice.call(arguments,1));return this},reflow:m,render:function(a){a&&this.reflow();this.options.animation&&!a?b.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this));return this},generateLegend:function(){return q(this.options.legendTemplate,
this)},destroy:function(){this.clear();M(this,this.events);var a=this.chart.canvas;a.width=this.chart.width;a.height=this.chart.height;a.style.removeProperty?(a.style.removeProperty("width"),a.style.removeProperty("height")):(a.style.removeAttribute("width"),a.style.removeAttribute("height"));delete c.instances[this.id]},showTooltip:function(a,g){"undefined"===typeof this.activeElements&&(this.activeElements=[]);if(function(a){var b=!1;if(a.length!==this.activeElements.length)return b=!0;e(a,function(a,
c){a!==this.activeElements[c]&&(b=!0)},this);return b}.call(this,a)||g){this.activeElements=a;this.draw();this.options.customTooltips&&this.options.customTooltips(!1);if(0<a.length)if(this.datasets&&1<this.datasets.length){for(var d,f,h=this.datasets.length-1;0<=h&&(d=this.datasets[h].points||this.datasets[h].bars||this.datasets[h].segments,f=E(d,a[0]),-1===f);h--);var m=[],l=[];d=function(a){var c=[],e,g=[],d=[],k,h,y;b.each(this.datasets,function(a){e=a.points||a.bars||a.segments;e[f]&&e[f].hasValue()&&
c.push(e[f])});b.each(c,function(a){g.push(a.x);d.push(a.y);m.push(b.template(this.options.multiTooltipTemplate,a));l.push({fill:a._saved.fillColor||a.fillColor,stroke:a._saved.strokeColor||a.strokeColor})},this);y=t(d);k=v(d);h=t(g);a=v(g);return{x:h>this.chart.width/2?h:a,y:(y+k)/2}}.call(this,f);(new c.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,
fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:m,legendColors:l,legendColorBackground:this.options.multiTooltipKeyBackground,title:a[0].label,chart:this.chart,ctx:this.chart.ctx,
custom:this.options.customTooltips})).draw()}else e(a,function(a){var b=a.tooltipPosition();(new c.Tooltip({x:Math.round(b.x),y:Math.round(b.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,
text:q(this.options.tooltipTemplate,a),chart:this.chart,custom:this.options.customTooltips})).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}});c.Type.extend=function(a){var b=this,e=function(){return b.apply(this,arguments)};e.prototype=f(b.prototype);h(e.prototype,a);e.extend=c.Type.extend;if(a.name||b.prototype.name){var d=a.name||b.prototype.name,m=c.defaults[b.prototype.name]?f(c.defaults[b.prototype.name]):{};c.defaults[d]=
h(m,a.defaults);c.types[d]=e;c.prototype[d]=function(a,b){var g=D(c.defaults.global,c.defaults[d],b||{});return new e(a,g,this)}}else G("Name not provided for this chart, so it hasn't been registered");return b};c.Element=function(a){h(this,a);this.initialize.apply(this,arguments);this.save()};h(c.Element.prototype,{initialize:function(){},restore:function(a){a?e(a,function(a){this[a]=this._saved[a]},this):h(this,this._saved);return this},save:function(){this._saved=f(this);delete this._saved._saved;
return this},update:function(a){e(a,function(a,b){this._saved[b]=this[b];this[b]=a},this);return this},transition:function(a,b){e(a,function(a,c){this[c]=(a-this._saved[c])*b+this._saved[c]},this);return this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return p(this.value)}});c.Element.extend=n;c.Point=c.Element.extend({display:!0,inRange:function(a,b){var c=this.hitDetectionRadius+this.radius;return Math.pow(a-this.x,2)+Math.pow(b-this.y,2)<Math.pow(c,2)},draw:function(){if(this.display){var a=
this.ctx;a.beginPath();a.arc(this.x,this.y,this.radius,0,2*Math.PI);a.closePath();a.strokeStyle=this.strokeColor;a.lineWidth=this.strokeWidth;a.fillStyle=this.fillColor;a.fill();a.stroke()}}});c.Arc=c.Element.extend({inRange:function(a,c){var e=b.getAngleFromPoint(this,{x:a,y:c}),d=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return e.angle>=this.startAngle&&e.angle<=this.endAngle&&d},tooltipPosition:function(){var a=this.startAngle+(this.endAngle-this.startAngle)/2,b=(this.outerRadius-
this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(a)*b,y:this.y+Math.sin(a)*b}},draw:function(a){a=this.ctx;a.beginPath();a.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle);a.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0);a.closePath();a.strokeStyle=this.strokeColor;a.lineWidth=this.strokeWidth;a.fillStyle=this.fillColor;a.fill();a.lineJoin="bevel";this.showStroke&&a.stroke()}});c.Rectangle=c.Element.extend({draw:function(){var a=this.ctx,b=this.width/
2,c=this.x-b,b=this.x+b,e=this.base-(this.base-this.y),d=this.strokeWidth/2;this.showStroke&&(c+=d,b-=d,e+=d);a.beginPath();a.fillStyle=this.fillColor;a.strokeStyle=this.strokeColor;a.lineWidth=this.strokeWidth;a.moveTo(c,this.base);a.lineTo(c,e);a.lineTo(b,e);a.lineTo(b,this.base);a.fill();this.showStroke&&a.stroke()},height:function(){return this.base-this.y},inRange:function(a,b){return a>=this.x-this.width/2&&a<=this.x+this.width/2&&b>=this.y&&b<=this.base}});c.Tooltip=c.Element.extend({draw:function(){var a=
this.chart.ctx;a.font=r(this.fontSize,this.fontStyle,this.fontFamily);this.xAlign="center";this.yAlign="above";var b=this.caretPadding=2,c=a.measureText(this.text).width+2*this.xPadding,e=this.fontSize+2*this.yPadding,d=e+this.caretHeight+b;this.x+c/2>this.chart.width?this.xAlign="left":0>this.x-c/2&&(this.xAlign="right");0>this.y-d&&(this.yAlign="below");var f=this.x-c/2,d=this.y-d;a.fillStyle=this.fillColor;if(this.custom)this.custom(this);else{switch(this.yAlign){case "above":a.beginPath();a.moveTo(this.x,
this.y-b);a.lineTo(this.x+this.caretHeight,this.y-(b+this.caretHeight));a.lineTo(this.x-this.caretHeight,this.y-(b+this.caretHeight));a.closePath();a.fill();break;case "below":d=this.y+b+this.caretHeight,a.beginPath(),a.moveTo(this.x,this.y+b),a.lineTo(this.x+this.caretHeight,this.y+b+this.caretHeight),a.lineTo(this.x-this.caretHeight,this.y+b+this.caretHeight),a.closePath(),a.fill()}switch(this.xAlign){case "left":f=this.x-c+(this.cornerRadius+this.caretHeight);break;case "right":f=this.x-(this.cornerRadius+
this.caretHeight)}C(a,f,d,c,e,this.cornerRadius);a.fill();a.fillStyle=this.textColor;a.textAlign="center";a.textBaseline="middle";a.fillText(this.text,f+c/2,d+e/2)}}});c.MultiTooltip=c.Element.extend({initialize:function(){this.font=r(this.fontSize,this.fontStyle,this.fontFamily);this.titleFont=r(this.titleFontSize,this.titleFontStyle,this.titleFontFamily);this.height=this.labels.length*this.fontSize+this.fontSize/2*(this.labels.length-1)+2*this.yPadding+1.5*this.titleFontSize;this.ctx.font=this.titleFont;
var a=this.ctx.measureText(this.title).width,b=x(this.ctx,this.font,this.labels)+this.fontSize+3;this.width=v([b,a])+2*this.xPadding;a=this.height/2;0>this.y-a?this.y=a:this.y+a>this.chart.height&&(this.y=this.chart.height-a);this.x=this.x>this.chart.width/2?this.x-(this.xOffset+this.width):this.x+this.xOffset},getLineHeight:function(a){var b=this.y-this.height/2+this.yPadding;return 0===a?b+this.titleFontSize/2:b+(1.5*this.fontSize*(a-1)+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){if(this.custom)this.custom(this);
else{C(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var a=this.ctx;a.fillStyle=this.fillColor;a.fill();a.closePath();a.textAlign="left";a.textBaseline="middle";a.fillStyle=this.titleTextColor;a.font=this.titleFont;a.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0));a.font=this.font;b.each(this.labels,function(b,c){a.fillStyle=this.textColor;a.fillText(b,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(c+1));a.fillStyle=this.legendColorBackground;
a.fillRect(this.x+this.xPadding,this.getLineHeight(c+1)-this.fontSize/2,this.fontSize,this.fontSize);a.fillStyle=this.legendColors[c].fill;a.fillRect(this.x+this.xPadding,this.getLineHeight(c+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}});c.Scale=c.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var a=z(this.stepValue),b=0;b<=this.steps;b++)this.yLabels.push(q(this.templateString,{value:(this.min+b*this.stepValue).toFixed(a)}));this.yLabelWidth=
this.display&&this.showLabels?x(this.ctx,this.font,this.yLabels):0},addXLabel:function(a){this.xLabels.push(a);this.valuesCount++;this.fit()},removeXLabel:function(){this.xLabels.shift();this.valuesCount--;this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0;this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height;this.startPoint+=this.padding;this.endPoint-=this.padding;var a=this.endPoint-this.startPoint,b;this.calculateYRange(a);this.buildYLabels();for(this.calculateXLabelRotation();a>
this.endPoint-this.startPoint;)a=this.endPoint-this.startPoint,b=this.yLabelWidth,this.calculateYRange(a),this.buildYLabels(),b<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var a=this.ctx.measureText(this.xLabels[0]).width,b;this.xScalePaddingRight=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width/2+3;this.xScalePaddingLeft=a/2>this.yLabelWidth+10?a/2:this.yLabelWidth+10;this.xLabelRotation=0;if(this.display){var c=x(this.ctx,
this.font,this.xLabels),e;this.xLabelWidth=c;for(var d=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>d&&0===this.xLabelRotation||this.xLabelWidth>d&&90>=this.xLabelRotation&&0<this.xLabelRotation;)e=Math.cos(w(this.xLabelRotation)),b=e*a,b+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=b+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=e*c;0<this.xLabelRotation&&(this.endPoint-=Math.sin(w(this.xLabelRotation))*c+3)}else this.xLabelWidth=
0,this.xScalePaddingLeft=this.xScalePaddingRight=this.padding},calculateYRange:m,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(a){var b=this.drawingArea()/(this.min-this.max);return this.endPoint-b*(a-this.min)},calculateX:function(a){var b=(this.width-(this.xScalePaddingLeft+this.xScalePaddingRight))/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1);a=b*a+this.xScalePaddingLeft;this.offsetGridLines&&(a+=b/2);return Math.round(a)},update:function(a){b.extend(this,
a);this.fit()},draw:function(){var a=this.ctx,c=(this.endPoint-this.startPoint)/this.steps,d=Math.round(this.xScalePaddingLeft);this.display&&(a.fillStyle=this.textColor,a.font=this.font,e(this.yLabels,function(e,f){var h=this.endPoint-c*f,m=Math.round(h),l=this.showHorizontalLines;a.textAlign="right";a.textBaseline="middle";this.showLabels&&a.fillText(e,d-10,h);0!==f||l||(l=!0);l&&a.beginPath();0<f?(a.lineWidth=this.gridLineWidth,a.strokeStyle=this.gridLineColor):(a.lineWidth=this.lineWidth,a.strokeStyle=
this.lineColor);m+=b.aliasPixel(a.lineWidth);l&&(a.moveTo(d,m),a.lineTo(this.width,m),a.stroke(),a.closePath());a.lineWidth=this.lineWidth;a.strokeStyle=this.lineColor;a.beginPath();a.moveTo(d-5,m);a.lineTo(d,m);a.stroke();a.closePath()},this),e(this.xLabels,function(b,c){var e=this.calculateX(c)+A(this.lineWidth),d=this.calculateX(c-(this.offsetGridLines?.5:0))+A(this.lineWidth),f=0<this.xLabelRotation,g=this.showVerticalLines;0!==c||g||(g=!0);g&&a.beginPath();0<c?(a.lineWidth=this.gridLineWidth,
a.strokeStyle=this.gridLineColor):(a.lineWidth=this.lineWidth,a.strokeStyle=this.lineColor);g&&(a.moveTo(d,this.endPoint),a.lineTo(d,this.startPoint-3),a.stroke(),a.closePath());a.lineWidth=this.lineWidth;a.strokeStyle=this.lineColor;a.beginPath();a.moveTo(d,this.endPoint);a.lineTo(d,this.endPoint+5);a.stroke();a.closePath();a.save();a.translate(e,f?this.endPoint+12:this.endPoint+8);a.rotate(-1*w(this.xLabelRotation));a.font=this.font;a.textAlign=f?"right":"center";a.textBaseline=f?"middle":"top";
a.fillText(b,0,0);a.restore()},this))}});c.RadialScale=c.Element.extend({initialize:function(){this.size=t([this.height,this.width]);this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(a){return this.drawingArea/(this.max-this.min)*(a-this.min)},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize();this.buildYLabels()},buildYLabels:function(){this.yLabels=
[];for(var a=z(this.stepValue),b=0;b<=this.steps;b++)this.yLabels.push(q(this.templateString,{value:(this.min+b*this.stepValue).toFixed(a)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var a=t([this.height/2-this.pointLabelFontSize-5,this.width/2]),b,c,e,d=this.width,f,h=0,m;this.ctx.font=r(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily);for(c=0;c<this.valuesCount;c++)b=this.getPointPosition(c,a),e=this.ctx.measureText(q(this.templateString,
{value:this.labels[c]})).width+5,0===c||c===this.valuesCount/2?(e/=2,b.x+e>d&&(d=b.x+e,f=c),b.x-e<h&&(h=b.x-e,m=c)):c<this.valuesCount/2?b.x+e>d&&(d=b.x+e,f=c):c>this.valuesCount/2&&b.x-e<h&&(h=b.x-e,m=c);b=h;d=Math.ceil(d-this.width);f=this.getIndexAngle(f);m=this.getIndexAngle(m);f=d/Math.sin(f+Math.PI/2);m=b/Math.sin(m+Math.PI/2);f=p(f)?f:0;m=p(m)?m:0;this.drawingArea=a-(m+f)/2;this.setCenterPoint(m,f)},setCenterPoint:function(a,b){this.xCenter=(a+this.drawingArea+(this.width-b-this.drawingArea))/
2;this.yCenter=this.height/2},getIndexAngle:function(a){return 2*Math.PI/this.valuesCount*a-Math.PI/2},getPointPosition:function(a,b){var c=this.getIndexAngle(a);return{x:Math.cos(c)*b+this.xCenter,y:Math.sin(c)*b+this.yCenter}},draw:function(){if(this.display){var a=this.ctx;e(this.yLabels,function(b,c){if(0<c){var e=this.drawingArea/this.steps*c,d=this.yCenter-e;if(0<this.lineWidth){a.strokeStyle=this.lineColor;a.lineWidth=this.lineWidth;if(this.lineArc)a.beginPath(),a.arc(this.xCenter,this.yCenter,
e,0,2*Math.PI);else{a.beginPath();for(var f=0;f<this.valuesCount;f++)e=this.getPointPosition(f,this.calculateCenterOffset(this.min+c*this.stepValue)),0===f?a.moveTo(e.x,e.y):a.lineTo(e.x,e.y)}a.closePath();a.stroke()}this.showLabels&&(a.font=r(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop&&(e=a.measureText(b).width,a.fillStyle=this.backdropColor,a.fillRect(this.xCenter-e/2-this.backdropPaddingX,d-this.fontSize/2-this.backdropPaddingY,e+2*this.backdropPaddingX,this.fontSize+
2*this.backdropPaddingY)),a.textAlign="center",a.textBaseline="middle",a.fillStyle=this.fontColor,a.fillText(b,this.xCenter,d))}},this);if(!this.lineArc){a.lineWidth=this.angleLineWidth;a.strokeStyle=this.angleLineColor;for(var b=this.valuesCount-1;0<=b;b--){if(0<this.angleLineWidth){var c=this.getPointPosition(b,this.calculateCenterOffset(this.max));a.beginPath();a.moveTo(this.xCenter,this.yCenter);a.lineTo(c.x,c.y);a.stroke();a.closePath()}c=this.getPointPosition(b,this.calculateCenterOffset(this.max)+
5);a.font=r(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily);a.fillStyle=this.pointLabelFontColor;var d=this.labels.length,f=this.labels.length/2,h=f/2,m=b<h||b>d-h,d=b===h||b===d-h;a.textAlign=0===b?"center":b===f?"center":b<f?"left":"right";a.textBaseline=d?"middle":m?"bottom":"top";a.fillText(this.labels[b],c.x,c.y)}}}}});b.addEvent(window,"resize",function(){var a;return function(){clearTimeout(a);a=setTimeout(function(){e(c.instances,function(a){a.options.responsive&&
a.resize(a.render,!0)})},50)}}());H?define(function(){return c}):"object"===typeof module&&module.exports&&(module.exports=c);l.Chart=c;c.noConflict=function(){l.Chart=d;return c}}).call(this);
(function(){var l=this.Chart,d=l.helpers;l.Type.extend({name:"Bar",defaults:{scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(c){var b=
this.options;this.ScaleClass=l.Scale.extend({offsetGridLines:!0,calculateBarX:function(c,d,h){var l=this.calculateBaseWidth();h=this.calculateX(h)-l/2;c=this.calculateBarWidth(c);return h+c*d+d*b.barDatasetSpacing+c/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*b.barValueSpacing},calculateBarWidth:function(c){return(this.calculateBaseWidth()-(c-1)*b.barDatasetSpacing)/c}});this.datasets=[];this.options.showTooltips&&d.bindEvents(this,this.options.tooltipEvents,function(b){b=
"mouseout"!==b.type?this.getBarsAtEvent(b):[];this.eachBars(function(b){b.restore(["fillColor","strokeColor"])});d.each(b,function(b){b.fillColor=b.highlightFill;b.strokeColor=b.highlightStroke});this.showTooltip(b)});this.BarClass=l.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx});d.each(c.datasets,function(b,f){var h={label:b.label||null,fillColor:b.fillColor,strokeColor:b.strokeColor,bars:[]};this.datasets.push(h);d.each(b.data,
function(d,f){h.bars.push(new this.BarClass({value:d,label:c.labels[f],datasetLabel:b.label,strokeColor:b.strokeColor,fillColor:b.fillColor,highlightFill:b.highlightFill||b.fillColor,highlightStroke:b.highlightStroke||b.strokeColor}))},this)},this);this.buildScale(c.labels);this.BarClass.prototype.base=this.scale.endPoint;this.eachBars(function(b,c,h){d.extend(b,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,h,c),y:this.scale.endPoint});b.save()},
this);this.render()},update:function(){this.scale.update();d.each(this.activeElements,function(c){c.restore(["fillColor","strokeColor"])});this.eachBars(function(c){c.save()});this.render()},eachBars:function(c){d.each(this.datasets,function(b,e){d.each(b.bars,c,this,e)},this)},getBarsAtEvent:function(c){var b=[];c=d.getRelativePosition(c);for(var e=function(c){b.push(c.bars[f])},f,h=0;h<this.datasets.length;h++)for(f=0;f<this.datasets[h].bars.length;f++)if(this.datasets[h].bars[f].inRange(c.x,c.y))return d.each(this.datasets,
e),b;return b},buildScale:function(c){var b=this,e=function(){var c=[];b.eachBars(function(b){c.push(b.value)});return c};c={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:c.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(b){b=
d.calculateScaleRange(e(),b,this.fontSize,this.beginAtZero,this.integersOnly);d.extend(this,b)},xLabels:c,font:d.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?
this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&d.extend(c,{calculateYRange:d.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth});this.scale=new this.ScaleClass(c)},addData:function(c,
b){d.each(c,function(c,d){this.datasets[d].bars.push(new this.BarClass({value:c,label:b,x:this.scale.calculateBarX(this.datasets.length,d,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[d].strokeColor,fillColor:this.datasets[d].fillColor}))},this);this.scale.addXLabel(b);this.update()},removeData:function(){this.scale.removeXLabel();d.each(this.datasets,function(c){c.bars.shift()},this);this.update()},
reflow:function(){d.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var c=d.extend({height:this.chart.height,width:this.chart.width});this.scale.update(c)},draw:function(c){var b=c||1;this.clear();this.scale.draw(b);d.each(this.datasets,function(c,f){d.each(c.bars,function(c,d){c.hasValue()&&(c.base=this.scale.endPoint,c.transition({x:this.scale.calculateBarX(this.datasets.length,f,d),y:this.scale.calculateY(c.value),width:this.scale.calculateBarWidth(this.datasets.length)},
b).draw())},this)},this)}})}).call(this);
(function(){var l=this.Chart,d=l.helpers,c={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};l.Type.extend({name:"Doughnut",defaults:c,
initialize:function(b){this.segments=[];this.outerRadius=(d.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2;this.SegmentArc=l.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2});this.options.showTooltips&&d.bindEvents(this,this.options.tooltipEvents,function(b){b="mouseout"!==b.type?this.getSegmentsAtEvent(b):[];d.each(this.segments,function(b){b.restore(["fillColor"])});d.each(b,function(b){b.fillColor=b.highlightColor});this.showTooltip(b)});
this.calculateTotal(b);d.each(b,function(b,c){this.addData(b,c,!0)},this);this.render()},getSegmentsAtEvent:function(b){var c=[],f=d.getRelativePosition(b);d.each(this.segments,function(b){b.inRange(f.x,f.y)&&c.push(b)},this);return c},addData:function(b,c,d){this.segments.splice(c||this.segments.length,0,new this.SegmentArc({value:b.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:b.color,
highlightColor:b.highlight||b.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(b.value),label:b.label}));d||(this.reflow(),this.update())},calculateCircumference:function(b){return 2*Math.PI*(Math.abs(b)/this.total)},calculateTotal:function(b){this.total=0;d.each(b,function(b){this.total+=Math.abs(b.value)},this)},update:function(){this.calculateTotal(this.segments);
d.each(this.activeElements,function(b){b.restore(["fillColor"])});d.each(this.segments,function(b){b.save()});this.render()},removeData:function(b){b=d.isNumber(b)?b:this.segments.length-1;this.segments.splice(b,1);this.reflow();this.update()},reflow:function(){d.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2});this.outerRadius=(d.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2;d.each(this.segments,function(b){b.update({outerRadius:this.outerRadius,
innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(b){var c=b?b:1;this.clear();d.each(this.segments,function(b,d){b.transition({circumference:this.calculateCircumference(b.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},c);b.endAngle=b.startAngle+b.circumference;b.draw();0===d&&(b.startAngle=1.5*Math.PI);d<this.segments.length-1&&(this.segments[d+1].startAngle=b.endAngle)},this)}});l.types.Doughnut.extend({name:"Pie",
defaults:d.merge(c,{percentageInnerCutout:0})})}).call(this);
(function(){var l=this.Chart,d=l.helpers;l.Type.extend({name:"Line",defaults:{scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(c){this.PointClass=
l.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(b){return Math.pow(b-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}});this.datasets=[];this.options.showTooltips&&d.bindEvents(this,this.options.tooltipEvents,function(b){b="mouseout"!==b.type?this.getPointsAtEvent(b):[];this.eachPoints(function(b){b.restore(["fillColor",
"strokeColor"])});d.each(b,function(b){b.fillColor=b.highlightFill;b.strokeColor=b.highlightStroke});this.showTooltip(b)});d.each(c.datasets,function(b){var e={label:b.label||null,fillColor:b.fillColor,strokeColor:b.strokeColor,pointColor:b.pointColor,pointStrokeColor:b.pointStrokeColor,points:[]};this.datasets.push(e);d.each(b.data,function(d,h){e.points.push(new this.PointClass({value:d,label:c.labels[h],datasetLabel:b.label,strokeColor:b.pointStrokeColor,fillColor:b.pointColor,highlightFill:b.pointHighlightFill||
b.pointColor,highlightStroke:b.pointHighlightStroke||b.pointStrokeColor}))},this);this.buildScale(c.labels);this.eachPoints(function(b,c){d.extend(b,{x:this.scale.calculateX(c),y:this.scale.endPoint});b.save()},this)},this);this.render()},update:function(){this.scale.update();d.each(this.activeElements,function(c){c.restore(["fillColor","strokeColor"])});this.eachPoints(function(c){c.save()});this.render()},eachPoints:function(c){d.each(this.datasets,function(b){d.each(b.points,c,this)},this)},getPointsAtEvent:function(c){var b=
[],e=d.getRelativePosition(c);d.each(this.datasets,function(c){d.each(c.points,function(c){c.inRange(e.x,e.y)&&b.push(c)})},this);return b},buildScale:function(c){var b=this,e=function(){var c=[];b.eachPoints(function(b){c.push(b.value)});return c};c={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,
valuesCount:c.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(b){b=d.calculateScaleRange(e(),b,this.fontSize,this.beginAtZero,this.integersOnly);d.extend(this,b)},xLabels:c,font:d.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,
gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&d.extend(c,{calculateYRange:d.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,
max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth});this.scale=new l.Scale(c)},addData:function(c,b){d.each(c,function(c,d){this.datasets[d].points.push(new this.PointClass({value:c,label:b,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[d].pointStrokeColor,fillColor:this.datasets[d].pointColor}))},this);this.scale.addXLabel(b);this.update()},removeData:function(){this.scale.removeXLabel();d.each(this.datasets,function(c){c.points.shift()},
this);this.update()},reflow:function(){var c=d.extend({height:this.chart.height,width:this.chart.width});this.scale.update(c)},draw:function(c){var b=c||1;this.clear();var e=this.chart.ctx,f=function(b){return null!==b.value},h=function(b,c,e){return d.findNextWhere(c,f,e)||b},l=function(b,c,e){return d.findPreviousWhere(c,f,e)||b};this.scale.draw(b);d.each(this.datasets,function(c){var n=d.where(c.points,f);d.each(c.points,function(c,d){c.hasValue()&&c.transition({y:this.scale.calculateY(c.value),
x:this.scale.calculateX(d)},b)},this);this.options.bezierCurve&&d.each(n,function(b,c){var e=0<c&&c<n.length-1?this.options.bezierCurveTension:0;b.controlPoints=d.splineCurve(l(b,n,c),b,h(b,n,c),e);b.controlPoints.outer.y>this.scale.endPoint?b.controlPoints.outer.y=this.scale.endPoint:b.controlPoints.outer.y<this.scale.startPoint&&(b.controlPoints.outer.y=this.scale.startPoint);b.controlPoints.inner.y>this.scale.endPoint?b.controlPoints.inner.y=this.scale.endPoint:b.controlPoints.inner.y<this.scale.startPoint&&
(b.controlPoints.inner.y=this.scale.startPoint)},this);e.lineWidth=this.options.datasetStrokeWidth;e.strokeStyle=c.strokeColor;e.beginPath();d.each(n,function(b,c){if(0===c)e.moveTo(b.x,b.y);else if(this.options.bezierCurve){var d=l(b,n,c);e.bezierCurveTo(d.controlPoints.outer.x,d.controlPoints.outer.y,b.controlPoints.inner.x,b.controlPoints.inner.y,b.x,b.y)}else e.lineTo(b.x,b.y)},this);e.stroke();this.options.datasetFill&&0<n.length&&(e.lineTo(n[n.length-1].x,this.scale.endPoint),e.lineTo(n[0].x,
this.scale.endPoint),e.fillStyle=c.fillColor,e.closePath(),e.fill());d.each(n,function(b){b.draw()})},this)}})}).call(this);
(function(){var l=this.Chart,d=l.helpers;l.Type.extend({name:"PolarArea",defaults:{scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'},
initialize:function(c){this.segments=[];this.SegmentArc=l.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2});this.scale=new l.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,
showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:c.length});
this.updateScaleRange(c);this.scale.update();d.each(c,function(b,c){this.addData(b,c,!0)},this);this.options.showTooltips&&d.bindEvents(this,this.options.tooltipEvents,function(b){b="mouseout"!==b.type?this.getSegmentsAtEvent(b):[];d.each(this.segments,function(b){b.restore(["fillColor"])});d.each(b,function(b){b.fillColor=b.highlightColor});this.showTooltip(b)});this.render()},getSegmentsAtEvent:function(c){var b=[],e=d.getRelativePosition(c);d.each(this.segments,function(c){c.inRange(e.x,e.y)&&
b.push(c)},this);return b},addData:function(c,b,d){this.segments.splice(b||this.segments.length,0,new this.SegmentArc({fillColor:c.color,highlightColor:c.highlight||c.color,label:c.label,value:c.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(c.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI}));d||(this.reflow(),this.update())},removeData:function(c){c=d.isNumber(c)?c:this.segments.length-1;this.segments.splice(c,
1);this.reflow();this.update()},calculateTotal:function(c){this.total=0;d.each(c,function(b){this.total+=b.value},this);this.scale.valuesCount=this.segments.length},updateScaleRange:function(c){var b=[];d.each(c,function(c){b.push(c.value)});c=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:d.calculateScaleRange(b,d.min([this.chart.width,
this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);d.extend(this.scale,c,{size:d.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments);d.each(this.segments,function(c){c.save()});this.reflow();this.render()},reflow:function(){d.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2});this.updateScaleRange(this.segments);
this.scale.update();d.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2});d.each(this.segments,function(c){c.update({outerRadius:this.scale.calculateCenterOffset(c.value)})},this)},draw:function(c){var b=c||1;this.clear();d.each(this.segments,function(c,d){c.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(c.value)},b);c.endAngle=c.startAngle+c.circumference;0===d&&(c.startAngle=1.5*Math.PI);d<this.segments.length-1&&(this.segments[d+
1].startAngle=c.endAngle);c.draw()},this);this.scale.draw()}})}).call(this);
(function(){var l=this.Chart,d=l.helpers;l.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},
initialize:function(c){this.PointClass=l.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx});this.datasets=[];this.buildScale(c);this.options.showTooltips&&d.bindEvents(this,this.options.tooltipEvents,function(b){b="mouseout"!==b.type?this.getPointsAtEvent(b):[];this.eachPoints(function(b){b.restore(["fillColor","strokeColor"])});d.each(b,function(b){b.fillColor=
b.highlightFill;b.strokeColor=b.highlightStroke});this.showTooltip(b)});d.each(c.datasets,function(b){var e={label:b.label||null,fillColor:b.fillColor,strokeColor:b.strokeColor,pointColor:b.pointColor,pointStrokeColor:b.pointStrokeColor,points:[]};this.datasets.push(e);d.each(b.data,function(d,h){var l;this.scale.animation||(l=this.scale.getPointPosition(h,this.scale.calculateCenterOffset(d)));e.points.push(new this.PointClass({value:d,label:c.labels[h],datasetLabel:b.label,x:this.options.animation?
this.scale.xCenter:l.x,y:this.options.animation?this.scale.yCenter:l.y,strokeColor:b.pointStrokeColor,fillColor:b.pointColor,highlightFill:b.pointHighlightFill||b.pointColor,highlightStroke:b.pointHighlightStroke||b.pointStrokeColor}))},this)},this);this.render()},eachPoints:function(c){d.each(this.datasets,function(b){d.each(b.points,c,this)},this)},getPointsAtEvent:function(c){c=d.getRelativePosition(c);c=d.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},c);var b=Math.round((c.angle-
1.5*Math.PI)/(2*Math.PI/this.scale.valuesCount)),e=[];if(b>=this.scale.valuesCount||0>b)b=0;c.distance<=this.scale.drawingArea&&d.each(this.datasets,function(c){e.push(c.points[b])});return e},buildScale:function(c){this.scale=new l.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,
backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,
pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:c.labels,valuesCount:c.datasets[0].data.length});this.scale.setScaleSize();this.updateScaleRange(c.datasets);this.scale.buildYLabels()},updateScaleRange:function(c){var b=function(){var b=[];d.each(c,function(c){c.data?b=b.concat(c.data):d.each(c.points,function(c){b.push(c.value)})});
return b}(),b=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:d.calculateScaleRange(b,d.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);d.extend(this.scale,b)},addData:function(c,b){this.scale.valuesCount++;d.each(c,function(c,d){var h=this.scale.getPointPosition(this.scale.valuesCount,
this.scale.calculateCenterOffset(c));this.datasets[d].points.push(new this.PointClass({value:c,label:b,x:h.x,y:h.y,strokeColor:this.datasets[d].pointStrokeColor,fillColor:this.datasets[d].pointColor}))},this);this.scale.labels.push(b);this.reflow();this.update()},removeData:function(){this.scale.valuesCount--;this.scale.labels.shift();d.each(this.datasets,function(c){c.points.shift()},this);this.reflow();this.update()},update:function(){this.eachPoints(function(c){c.save()});this.reflow();this.render()},
reflow:function(){d.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:d.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2});this.updateScaleRange(this.datasets);this.scale.setScaleSize();this.scale.buildYLabels()},draw:function(c){var b=c||1,e=this.chart.ctx;this.clear();this.scale.draw();d.each(this.datasets,function(c){d.each(c.points,function(c,d){c.hasValue()&&c.transition(this.scale.getPointPosition(d,this.scale.calculateCenterOffset(c.value)),
b)},this);e.lineWidth=this.options.datasetStrokeWidth;e.strokeStyle=c.strokeColor;e.beginPath();d.each(c.points,function(b,c){0===c?e.moveTo(b.x,b.y):e.lineTo(b.x,b.y)},this);e.closePath();e.stroke();e.fillStyle=c.fillColor;e.fill();d.each(c.points,function(b){b.hasValue()&&b.draw()})},this)}})}).call(this);
