From 45feaec83bf5e84b56ac0deaed77d655e36c5ea8 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 22 Jun 2016 15:19:08 +0800 Subject: [PATCH] MDL-54987 core: Pull Chart.js in core --- .eslintignore | 1 + lib/amd/build/chartjs-lazy.min.js | 5 + lib/amd/build/chartjs.min.js | 1 + lib/amd/src/chartjs-lazy.js | 10253 ++++++++++++++++++++++++++++ lib/amd/src/chartjs.js | 25 + lib/thirdpartylibs.xml | 6 + 6 files changed, 10291 insertions(+) create mode 100644 lib/amd/build/chartjs-lazy.min.js create mode 100644 lib/amd/build/chartjs.min.js create mode 100644 lib/amd/src/chartjs-lazy.js create mode 100644 lib/amd/src/chartjs.js diff --git a/.eslintignore b/.eslintignore index 2ec29c42873..2d7ae1b8f32 100644 --- a/.eslintignore +++ b/.eslintignore @@ -49,6 +49,7 @@ lib/mustache/ lib/amd/src/mustache.js lib/graphlib.php lib/spout/ +lib/amd/src/chartjs-lazy.js mod/assign/feedback/editpdf/fpdi/ repository/s3/S3.php theme/bootstrapbase/less/bootstrap/ diff --git a/lib/amd/build/chartjs-lazy.min.js b/lib/amd/build/chartjs-lazy.min.js new file mode 100644 index 00000000000..c67576c5fda --- /dev/null +++ b/lib/amd/build/chartjs-lazy.min.js @@ -0,0 +1,5 @@ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Chart=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gb||a[3]&&a[3]<1?l(a,b):"rgb("+a[0]+", "+a[1]+", "+a[2]+")"}function l(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"rgba("+a[0]+", "+a[1]+", "+a[2]+", "+b+")"}function m(a,b){if(1>b||a[3]&&a[3]<1)return n(a,b);var c=Math.round(a[0]/255*100),d=Math.round(a[1]/255*100),e=Math.round(a[2]/255*100);return"rgb("+c+"%, "+d+"%, "+e+"%)"}function n(a,b){var c=Math.round(a[0]/255*100),d=Math.round(a[1]/255*100),e=Math.round(a[2]/255*100);return"rgba("+c+"%, "+d+"%, "+e+"%, "+(b||a[3]||1)+")"}function o(a,b){return 1>b||a[3]&&a[3]<1?p(a,b):"hsl("+a[0]+", "+a[1]+"%, "+a[2]+"%)"}function p(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+b+")"}function q(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"hwb("+a[0]+", "+a[1]+"%, "+a[2]+"%"+(void 0!==b&&1!==b?", "+b:"")+")"}function r(a){return v[a.slice(0,3)]}function s(a,b,c){return Math.min(Math.max(b,a),c)}function t(a){var b=a.toString(16).toUpperCase();return b.length<2?"0"+b:b}var u=a(6);b.exports={getRgba:d,getHsla:e,getRgb:g,getHsl:h,getHwb:f,getAlpha:i,hexString:j,rgbString:k,rgbaString:l,percentString:m,percentaString:n,hslString:o,hslaString:p,hwbString:q,keyword:r};var v={};for(var w in u)v[u[w]]=w},{6:6}],3:[function(a,b,c){var d=a(5),e=a(2),f=function(a){if(a instanceof f)return a;if(!(this instanceof f))return new f(a);this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var b;if("string"==typeof a)if(b=e.getRgba(a))this.setValues("rgb",b);else if(b=e.getHsla(a))this.setValues("hsl",b);else{if(!(b=e.getHwb(a)))throw new Error('Unable to parse color from string "'+a+'"');this.setValues("hwb",b)}else if("object"==typeof a)if(b=a,void 0!==b.r||void 0!==b.red)this.setValues("rgb",b);else if(void 0!==b.l||void 0!==b.lightness)this.setValues("hsl",b);else if(void 0!==b.v||void 0!==b.value)this.setValues("hsv",b);else if(void 0!==b.w||void 0!==b.whiteness)this.setValues("hwb",b);else{if(void 0===b.c&&void 0===b.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(a));this.setValues("cmyk",b)}};f.prototype={rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var a=this.values;return 1!==a.alpha?a.hwb.concat([a.alpha]):a.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var a=this.values;return a.rgb.concat([a.alpha])},hslaArray:function(){var a=this.values;return a.hsl.concat([a.alpha])},alpha:function(a){return void 0===a?this.values.alpha:(this.setValues("alpha",a),this)},red:function(a){return this.setChannel("rgb",0,a)},green:function(a){return this.setChannel("rgb",1,a)},blue:function(a){return this.setChannel("rgb",2,a)},hue:function(a){return a&&(a%=360,a=0>a?360+a:a),this.setChannel("hsl",0,a)},saturation:function(a){return this.setChannel("hsl",1,a)},lightness:function(a){return this.setChannel("hsl",2,a)},saturationv:function(a){return this.setChannel("hsv",1,a)},whiteness:function(a){return this.setChannel("hwb",1,a)},blackness:function(a){return this.setChannel("hwb",2,a)},value:function(a){return this.setChannel("hsv",2,a)},cyan:function(a){return this.setChannel("cmyk",0,a)},magenta:function(a){return this.setChannel("cmyk",1,a)},yellow:function(a){return this.setChannel("cmyk",2,a)},black:function(a){return this.setChannel("cmyk",3,a)},hexString:function(){return e.hexString(this.values.rgb)},rgbString:function(){return e.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return e.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return e.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return e.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return e.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return e.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return e.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var a=this.values.rgb;return a[0]<<16|a[1]<<8|a[2]},luminosity:function(){for(var a=this.values.rgb,b=[],c=0;c=d?d/12.92:Math.pow((d+.055)/1.055,2.4)}return.2126*b[0]+.7152*b[1]+.0722*b[2]},contrast:function(a){var b=this.luminosity(),c=a.luminosity();return b>c?(b+.05)/(c+.05):(c+.05)/(b+.05)},level:function(a){var b=this.contrast(a);return b>=7.1?"AAA":b>=4.5?"AA":""},dark:function(){var a=this.values.rgb,b=(299*a[0]+587*a[1]+114*a[2])/1e3;return 128>b},light:function(){return!this.dark()},negate:function(){for(var a=[],b=0;3>b;b++)a[b]=255-this.values.rgb[b];return this.setValues("rgb",a),this},lighten:function(a){var b=this.values.hsl;return b[2]+=b[2]*a,this.setValues("hsl",b),this},darken:function(a){var b=this.values.hsl;return b[2]-=b[2]*a,this.setValues("hsl",b),this},saturate:function(a){var b=this.values.hsl;return b[1]+=b[1]*a,this.setValues("hsl",b),this},desaturate:function(a){var b=this.values.hsl;return b[1]-=b[1]*a,this.setValues("hsl",b),this},whiten:function(a){var b=this.values.hwb;return b[1]+=b[1]*a,this.setValues("hwb",b),this},blacken:function(a){var b=this.values.hwb;return b[2]+=b[2]*a,this.setValues("hwb",b),this},greyscale:function(){var a=this.values.rgb,b=.3*a[0]+.59*a[1]+.11*a[2];return this.setValues("rgb",[b,b,b]),this},clearer:function(a){var b=this.values.alpha;return this.setValues("alpha",b-b*a),this},opaquer:function(a){var b=this.values.alpha;return this.setValues("alpha",b+b*a),this},rotate:function(a){var b=this.values.hsl,c=(b[0]+a)%360;return b[0]=0>c?360+c:c,this.setValues("hsl",b),this},mix:function(a,b){var c=this,d=a,e=void 0===b?.5:b,f=2*e-1,g=c.alpha()-d.alpha(),h=((f*g===-1?f:(f+g)/(1+f*g))+1)/2,i=1-h;return this.rgb(h*c.red()+i*d.red(),h*c.green()+i*d.green(),h*c.blue()+i*d.blue()).alpha(c.alpha()*e+d.alpha()*(1-e))},toJSON:function(){return this.rgb()},clone:function(){var a,b,c=new f,d=this.values,e=c.values;for(var g in d)d.hasOwnProperty(g)&&(a=d[g],b={}.toString.call(a),"[object Array]"===b?e[g]=a.slice(0):"[object Number]"===b?e[g]=a:console.error("unexpected color value:",a));return c}},f.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},f.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},f.prototype.getValues=function(a){for(var b=this.values,c={},d=0;db&&(b+=360),d=(h+i)/2,c=i==h?0:.5>=d?j/(i+h):j/(2-i-h),[b,100*c,100*d]}function f(a){var b,c,d,e=a[0],f=a[1],g=a[2],h=Math.min(e,f,g),i=Math.max(e,f,g),j=i-h;return c=0==i?0:j/i*1e3/10,i==h?b=0:e==i?b=(f-g)/j:f==i?b=2+(g-e)/j:g==i&&(b=4+(e-f)/j),b=Math.min(60*b,360),0>b&&(b+=360),d=i/255*1e3/10,[b,c,d]}function h(a){var b=a[0],c=a[1],d=a[2],f=e(a)[0],g=1/255*Math.min(b,Math.min(c,d)),d=1-1/255*Math.max(b,Math.max(c,d));return[f,100*g,100*d]}function i(a){var b,c,d,e,f=a[0]/255,g=a[1]/255,h=a[2]/255;return e=Math.min(1-f,1-g,1-h),b=(1-f-e)/(1-e)||0,c=(1-g-e)/(1-e)||0,d=(1-h-e)/(1-e)||0,[100*b,100*c,100*d,100*e]}function j(a){return Z[JSON.stringify(a)]}function k(a){var b=a[0]/255,c=a[1]/255,d=a[2]/255;b=b>.04045?Math.pow((b+.055)/1.055,2.4):b/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92,d=d>.04045?Math.pow((d+.055)/1.055,2.4):d/12.92;var e=.4124*b+.3576*c+.1805*d,f=.2126*b+.7152*c+.0722*d,g=.0193*b+.1192*c+.9505*d;return[100*e,100*f,100*g]}function l(a){var b,c,d,e=k(a),f=e[0],g=e[1],h=e[2];return f/=95.047,g/=100,h/=108.883,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,h=h>.008856?Math.pow(h,1/3):7.787*h+16/116,b=116*g-16,c=500*(f-g),d=200*(g-h),[b,c,d]}function m(a){return M(l(a))}function n(a){var b,c,d,e,f,g=a[0]/360,h=a[1]/100,i=a[2]/100;if(0==h)return f=255*i,[f,f,f];c=.5>i?i*(1+h):i+h-i*h,b=2*i-c,e=[0,0,0];for(var j=0;3>j;j++)d=g+1/3*-(j-1),0>d&&d++,d>1&&d--,f=1>6*d?b+6*(c-b)*d:1>2*d?c:2>3*d?b+(c-b)*(2/3-d)*6:b,e[j]=255*f;return e}function o(a){var b,c,d=a[0],e=a[1]/100,f=a[2]/100;return 0===f?[0,0,0]:(f*=2,e*=1>=f?f:2-f,c=(f+e)/2,b=2*e/(f+e),[d,100*b,100*c])}function p(a){return h(n(a))}function q(a){return i(n(a))}function s(a){return j(n(a))}function t(a){var b=a[0]/60,c=a[1]/100,d=a[2]/100,e=Math.floor(b)%6,f=b-Math.floor(b),g=255*d*(1-c),h=255*d*(1-c*f),i=255*d*(1-c*(1-f)),d=255*d;switch(e){case 0:return[d,i,g];case 1:return[h,d,g];case 2:return[g,d,i];case 3:return[g,h,d];case 4:return[i,g,d];case 5:return[d,g,h]}}function u(a){var b,c,d=a[0],e=a[1]/100,f=a[2]/100;return c=(2-e)*f,b=e*f,b/=1>=c?c:2-c,b=b||0,c/=2,[d,100*b,100*c]}function v(a){return h(t(a))}function w(a){return i(t(a))}function x(a){return j(t(a))}function y(a){var c,d,e,f,h=a[0]/360,i=a[1]/100,j=a[2]/100,k=i+j;switch(k>1&&(i/=k,j/=k),c=Math.floor(6*h),d=1-j,e=6*h-c,0!=(1&c)&&(e=1-e),f=i+e*(d-i),c){default:case 6:case 0:r=d,g=f,b=i;break;case 1:r=f,g=d,b=i;break;case 2:r=i,g=d,b=f;break;case 3:r=i,g=f,b=d;break;case 4:r=f,g=i,b=d;break;case 5:r=d,g=i,b=f}return[255*r,255*g,255*b]}function z(a){return e(y(a))}function A(a){return f(y(a))}function B(a){return i(y(a))}function C(a){return j(y(a))}function D(a){var b,c,d,e=a[0]/100,f=a[1]/100,g=a[2]/100,h=a[3]/100;return b=1-Math.min(1,e*(1-h)+h),c=1-Math.min(1,f*(1-h)+h),d=1-Math.min(1,g*(1-h)+h),[255*b,255*c,255*d]}function E(a){return e(D(a))}function F(a){return f(D(a))}function G(a){return h(D(a))}function H(a){return j(D(a))}function I(a){var b,c,d,e=a[0]/100,f=a[1]/100,g=a[2]/100;return b=3.2406*e+-1.5372*f+g*-.4986,c=e*-.9689+1.8758*f+.0415*g,d=.0557*e+f*-.204+1.057*g,b=b>.0031308?1.055*Math.pow(b,1/2.4)-.055:b=12.92*b,c=c>.0031308?1.055*Math.pow(c,1/2.4)-.055:c=12.92*c,d=d>.0031308?1.055*Math.pow(d,1/2.4)-.055:d=12.92*d,b=Math.min(Math.max(0,b),1),c=Math.min(Math.max(0,c),1),d=Math.min(Math.max(0,d),1),[255*b,255*c,255*d]}function J(a){var b,c,d,e=a[0],f=a[1],g=a[2];return e/=95.047,f/=100,g/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,b=116*f-16,c=500*(e-f),d=200*(f-g),[b,c,d]}function K(a){return M(J(a))}function L(a){var b,c,d,e,f=a[0],g=a[1],h=a[2];return 8>=f?(c=100*f/903.3,e=7.787*(c/100)+16/116):(c=100*Math.pow((f+16)/116,3),e=Math.pow(c/100,1/3)),b=.008856>=b/95.047?b=95.047*(g/500+e-16/116)/7.787:95.047*Math.pow(g/500+e,3),d=.008859>=d/108.883?d=108.883*(e-h/200-16/116)/7.787:108.883*Math.pow(e-h/200,3),[b,c,d]}function M(a){var b,c,d,e=a[0],f=a[1],g=a[2];return b=Math.atan2(g,f),c=360*b/2/Math.PI,0>c&&(c+=360),d=Math.sqrt(f*f+g*g),[e,d,c]}function N(a){return I(L(a))}function O(a){var b,c,d,e=a[0],f=a[1],g=a[2];return d=g/360*2*Math.PI,b=f*Math.cos(d),c=f*Math.sin(d),[e,b,c]}function P(a){return L(O(a))}function Q(a){return N(O(a))}function R(a){return Y[a]}function S(a){return e(R(a))}function T(a){return f(R(a))}function U(a){return h(R(a))}function V(a){return i(R(a))}function W(a){return l(R(a))}function X(a){return k(R(a))}c.exports={rgb2hsl:e,rgb2hsv:f,rgb2hwb:h,rgb2cmyk:i,rgb2keyword:j,rgb2xyz:k,rgb2lab:l,rgb2lch:m,hsl2rgb:n,hsl2hsv:o,hsl2hwb:p,hsl2cmyk:q,hsl2keyword:s,hsv2rgb:t,hsv2hsl:u,hsv2hwb:v,hsv2cmyk:w,hsv2keyword:x,hwb2rgb:y,hwb2hsl:z,hwb2hsv:A,hwb2cmyk:B,hwb2keyword:C,cmyk2rgb:D,cmyk2hsl:E,cmyk2hsv:F,cmyk2hwb:G,cmyk2keyword:H,keyword2rgb:R,keyword2hsl:S,keyword2hsv:T,keyword2hwb:U,keyword2cmyk:V,keyword2lab:W,keyword2xyz:X,xyz2rgb:I,xyz2lab:J,xyz2lch:K,lab2xyz:L,lab2rgb:N,lab2lch:M,lch2lab:O,lch2xyz:P,lch2rgb:Q};var Y={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Z={};for(var $ in Y)Z[JSON.stringify(Y[$])]=$},{}],5:[function(a,b,c){var d=a(4),e=function(){return new j};for(var f in d){e[f+"Raw"]=function(a){return function(b){return"number"==typeof b&&(b=Array.prototype.slice.call(arguments)),d[a](b)}}(f);var g=/(\w+)2(\w+)/.exec(f),h=g[1],i=g[2];e[h]=e[h]||{},e[h][i]=e[f]=function(a){return function(b){"number"==typeof b&&(b=Array.prototype.slice.call(arguments));var c=d[a](b);if("string"==typeof c||void 0===c)return c;for(var e=0;ei)for(var j=0;a>j;j++){var k=h[j],l=g.getDatasetMeta(j);l.bar&&l.yAxisID===e.id&&g.isDatasetVisible(j)&&(f+=k.data[b]<0?k.data[b]:0)}else for(var m=0;a>m;m++){var n=h[m],o=g.getDatasetMeta(m);o.bar&&o.yAxisID===e.id&&g.isDatasetVisible(m)&&(f+=n.data[b]>0?n.data[b]:0)}return e.getPixelForValue(f)}return e.getBasePixel()},getRuler:function(a){var b,c=this,d=c.getMeta(),e=c.getScaleForId(d.xAxisID),f=c.getBarCount();b="category"===e.options.type?e.getPixelForTick(a+1)-e.getPixelForTick(a):e.width/e.ticks.length;var g=b*e.options.categoryPercentage,h=(b-b*e.options.categoryPercentage)/2,i=g/f;if(e.ticks.length!==c.chart.data.labels.length){var j=e.ticks.length/c.chart.data.labels.length;i*=j}var k=i*e.options.barPercentage,l=i-i*e.options.barPercentage;return{datasetCount:f,tickWidth:b,categoryWidth:g,categorySpacing:h,fullBarWidth:i,barWidth:k,barSpacing:l}},calculateBarWidth:function(a){var b=this.getScaleForId(this.getMeta().xAxisID),c=this.getRuler(a);return b.options.stacked?c.categoryWidth:c.barWidth},getBarIndex:function(a){var b,c,d=0;for(c=0;a>c;++c)b=this.chart.getDatasetMeta(c),b.bar&&this.chart.isDatasetVisible(c)&&++d;return d},calculateBarX:function(a,b){var c=this,d=c.getMeta(),e=c.getScaleForId(d.xAxisID),f=c.getBarIndex(b),g=c.getRuler(a),h=e.getPixelForValue(null,a,b,c.chart.isCombo);return h-=c.chart.isCombo?g.tickWidth/2:0,e.options.stacked?h+g.categoryWidth/2+g.categorySpacing:h+g.barWidth/2+g.categorySpacing+g.barWidth*f+g.barSpacing/2+g.barSpacing*f},calculateBarY:function(a,b){var c=this,d=c.getMeta(),e=c.getScaleForId(d.yAxisID),f=c.getDataset().data[a];if(e.options.stacked){for(var g=0,h=0,i=0;b>i;i++){var j=c.chart.data.datasets[i],k=c.chart.getDatasetMeta(i);k.bar&&k.yAxisID===e.id&&c.chart.isDatasetVisible(i)&&(j.data[a]<0?h+=j.data[a]||0:g+=j.data[a]||0)}return 0>f?e.getPixelForValue(h+f):e.getPixelForValue(g+f)}return e.getPixelForValue(f)},draw:function(a){var c=this,d=a||1;b.each(c.getMeta().data,function(a,b){var e=c.getDataset().data[b];null===e||void 0===e||isNaN(e)||a.transition(d).draw()},c)},setHoverStyle:function(a){var c=this.chart.data.datasets[a._datasetIndex],d=a._index,e=a.custom||{},f=a._model;f.backgroundColor=e.hoverBackgroundColor?e.hoverBackgroundColor:b.getValueAtIndexOrDefault(c.hoverBackgroundColor,d,b.getHoverColor(f.backgroundColor)),f.borderColor=e.hoverBorderColor?e.hoverBorderColor:b.getValueAtIndexOrDefault(c.hoverBorderColor,d,b.getHoverColor(f.borderColor)),f.borderWidth=e.hoverBorderWidth?e.hoverBorderWidth:b.getValueAtIndexOrDefault(c.hoverBorderWidth,d,f.borderWidth)},removeHoverStyle:function(a){var c=this.chart.data.datasets[a._datasetIndex],d=a._index,e=a.custom||{},f=a._model,g=this.chart.options.elements.rectangle;f.backgroundColor=e.backgroundColor?e.backgroundColor:b.getValueAtIndexOrDefault(c.backgroundColor,d,g.backgroundColor),f.borderColor=e.borderColor?e.borderColor:b.getValueAtIndexOrDefault(c.borderColor,d,g.borderColor),f.borderWidth=e.borderWidth?e.borderWidth:b.getValueAtIndexOrDefault(c.borderWidth,d,g.borderWidth)}}),a.defaults.horizontalBar={hover:{mode:"label"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(a,b){var c="";return a.length>0&&(a[0].yLabel?c=a[0].yLabel:b.labels.length>0&&a[0].indexl;l++)b.lineTo.apply(b,a(l));b.fill(),c.borderWidth&&b.stroke()},inRange:function(a,b){var c=this._view,d=!1;return c&&(d=c.x=c.y-c.height/2&&b<=c.y+c.height/2&&a>=c.x&&a<=c.base:b>=c.y-c.height/2&&b<=c.y+c.height/2&&a>=c.base&&a<=c.x),d}}),a.pivot()},calculateBarBase:function(a,b){ +var c=this,d=c.getMeta(),e=c.getScaleForId(d.xAxisID),f=0;if(e.options.stacked){var g=c.chart.data.datasets[a].data[b];if(0>g)for(var h=0;a>h;h++){var i=c.chart.data.datasets[h],j=c.chart.getDatasetMeta(h);j.bar&&j.xAxisID===e.id&&c.chart.isDatasetVisible(h)&&(f+=i.data[b]<0?i.data[b]:0)}else for(var k=0;a>k;k++){var l=c.chart.data.datasets[k],m=c.chart.getDatasetMeta(k);m.bar&&m.xAxisID===e.id&&c.chart.isDatasetVisible(k)&&(f+=l.data[b]>0?l.data[b]:0)}return e.getPixelForValue(f)}return e.getBasePixel()},getRuler:function(a){var b,c=this,d=c.getMeta(),e=c.getScaleForId(d.yAxisID),f=c.getBarCount();b="category"===e.options.type?e.getPixelForTick(a+1)-e.getPixelForTick(a):e.width/e.ticks.length;var g=b*e.options.categoryPercentage,h=(b-b*e.options.categoryPercentage)/2,i=g/f;if(e.ticks.length!==c.chart.data.labels.length){var j=e.ticks.length/c.chart.data.labels.length;i*=j}var k=i*e.options.barPercentage,l=i-i*e.options.barPercentage;return{datasetCount:f,tickHeight:b,categoryHeight:g,categorySpacing:h,fullBarHeight:i,barHeight:k,barSpacing:l}},calculateBarHeight:function(a){var b=this,c=b.getScaleForId(b.getMeta().yAxisID),d=b.getRuler(a);return c.options.stacked?d.categoryHeight:d.barHeight},calculateBarX:function(a,b){var c=this,d=c.getMeta(),e=c.getScaleForId(d.xAxisID),f=c.getDataset().data[a];if(e.options.stacked){for(var g=0,h=0,i=0;b>i;i++){var j=c.chart.data.datasets[i],k=c.chart.getDatasetMeta(i);k.bar&&k.xAxisID===e.id&&c.chart.isDatasetVisible(i)&&(j.data[a]<0?h+=j.data[a]||0:g+=j.data[a]||0)}return 0>f?e.getPixelForValue(h+f):e.getPixelForValue(g+f)}return e.getPixelForValue(f)},calculateBarY:function(a,b){var c=this,d=c.getMeta(),e=c.getScaleForId(d.yAxisID),f=c.getBarIndex(b),g=c.getRuler(a),h=e.getPixelForValue(null,a,b,c.chart.isCombo);return h-=c.chart.isCombo?g.tickHeight/2:0,e.options.stacked?h+g.categoryHeight/2+g.categorySpacing:h+g.barHeight/2+g.categorySpacing+g.barHeight*f+g.barSpacing/2+g.barSpacing*f}})}},{}],16:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.defaults.bubble={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(a,b){return""},label:function(a,b){var c=b.datasets[a.datasetIndex].label||"",d=b.datasets[a.datasetIndex].data[a.index];return c+": ("+d.x+", "+d.y+", "+d.r+")"}}}},a.controllers.bubble=a.DatasetController.extend({dataElementType:a.elements.Point,update:function(a){var c=this,d=c.getMeta(),e=d.data;b.each(e,function(b,d){c.updateElement(b,d,a)})},updateElement:function(c,d,e){var f=this,g=f.getMeta(),h=f.getScaleForId(g.xAxisID),i=f.getScaleForId(g.yAxisID),j=c.custom||{},k=f.getDataset(),l=k.data[d],m=f.chart.options.elements.point,n=f.index;b.extend(c,{_xScale:h,_yScale:i,_datasetIndex:n,_index:d,_model:{x:e?h.getPixelForDecimal(.5):h.getPixelForValue(l,d,n,f.chart.isCombo),y:e?i.getBasePixel():i.getPixelForValue(l,d,n),radius:e?0:j.radius?j.radius:f.getRadius(l),hitRadius:j.hitRadius?j.hitRadius:b.getValueAtIndexOrDefault(k.hitRadius,d,m.hitRadius)}}),a.DatasetController.prototype.removeHoverStyle.call(f,c,m);var o=c._model;o.skip=j.skip?j.skip:isNaN(o.x)||isNaN(o.y),c.pivot()},getRadius:function(a){return a.r||this.chart.options.elements.point.radius},setHoverStyle:function(c){var d=this;a.DatasetController.prototype.setHoverStyle.call(d,c);var e=d.chart.data.datasets[c._datasetIndex],f=c._index,g=c.custom||{},h=c._model;h.radius=g.hoverRadius?g.hoverRadius:b.getValueAtIndexOrDefault(e.hoverRadius,f,d.chart.options.elements.point.hoverRadius)+d.getRadius(e.data[f])},removeHoverStyle:function(b){var c=this;a.DatasetController.prototype.removeHoverStyle.call(c,b,c.chart.options.elements.point);var d=c.chart.data.datasets[b._datasetIndex].data[b._index],e=b.custom||{},f=b._model;f.radius=e.radius?e.radius:c.getRadius(d)}})}},{}],17:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=a.defaults;c.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(a){var b=[];b.push('
    ');var c=a.data,d=c.datasets,e=c.labels;if(d.length)for(var f=0;f'),e[f]&&b.push(e[f]),b.push("");return b.push("
"),b.join("")},legend:{labels:{generateLabels:function(a){var c=a.data;return c.labels.length&&c.datasets.length?c.labels.map(function(d,e){var f=a.getDatasetMeta(0),g=c.datasets[0],h=f.data[e],i=h.custom||{},j=b.getValueAtIndexOrDefault,k=a.options.elements.arc,l=i.backgroundColor?i.backgroundColor:j(g.backgroundColor,e,k.backgroundColor),m=i.borderColor?i.borderColor:j(g.borderColor,e,k.borderColor),n=i.borderWidth?i.borderWidth:j(g.borderWidth,e,k.borderWidth);return{text:d,fillStyle:l,strokeStyle:m,lineWidth:n,hidden:isNaN(g.data[e])||f.data[e].hidden,index:e}}):[]}},onClick:function(a,b){var c,d,e,f=b.index,g=this.chart;for(c=0,d=(g.data.datasets||[]).length;d>c;++c)e=g.getDatasetMeta(c),e.data[f].hidden=!e.data[f].hidden;g.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(a,b){return b.labels[a.index]+": "+b.datasets[a.datasetIndex].data[a.index]}}}},c.pie=b.clone(c.doughnut),b.extend(c.pie,{cutoutPercentage:0}),a.controllers.doughnut=a.controllers.pie=a.DatasetController.extend({dataElementType:a.elements.Arc,linkScales:b.noop,getRingIndex:function(a){for(var b=0,c=0;a>c;++c)this.chart.isDatasetVisible(c)&&++b;return b},update:function(a){var c=this,d=c.chart,e=d.chartArea,f=d.options,g=f.elements.arc,h=e.right-e.left-g.borderWidth,i=e.bottom-e.top-g.borderWidth,j=Math.min(h,i),k={x:0,y:0},l=c.getMeta(),m=f.cutoutPercentage,n=f.circumference;if(n<2*Math.PI){var o=f.rotation%(2*Math.PI);o+=2*Math.PI*(o>=Math.PI?-1:o<-Math.PI?1:0);var p=o+n,q={x:Math.cos(o),y:Math.sin(o)},r={x:Math.cos(p),y:Math.sin(p)},s=0>=o&&p>=0||o<=2*Math.PI&&2*Math.PI<=p,t=o<=.5*Math.PI&&.5*Math.PI<=p||o<=2.5*Math.PI&&2.5*Math.PI<=p,u=o<=-Math.PI&&-Math.PI<=p||o<=Math.PI&&Math.PI<=p,v=o<=.5*-Math.PI&&.5*-Math.PI<=p||o<=1.5*Math.PI&&1.5*Math.PI<=p,w=m/100,x={x:u?-1:Math.min(q.x*(q.x<0?1:w),r.x*(r.x<0?1:w)),y:v?-1:Math.min(q.y*(q.y<0?1:w),r.y*(r.y<0?1:w))},y={x:s?1:Math.max(q.x*(q.x>0?1:w),r.x*(r.x>0?1:w)),y:t?1:Math.max(q.y*(q.y>0?1:w),r.y*(r.y>0?1:w))},z={width:.5*(y.x-x.x),height:.5*(y.y-x.y)};j=Math.min(h/z.width,i/z.height),k={x:(y.x+x.x)*-.5,y:(y.y+x.y)*-.5}}d.outerRadius=Math.max(j/2,0),d.innerRadius=Math.max(m?d.outerRadius/100*m:1,0),d.radiusLength=(d.outerRadius-d.innerRadius)/d.getVisibleDatasetCount(),d.offsetX=k.x*d.outerRadius,d.offsetY=k.y*d.outerRadius,l.total=c.calculateTotal(),c.outerRadius=d.outerRadius-d.radiusLength*c.getRingIndex(c.index),c.innerRadius=c.outerRadius-d.radiusLength,b.each(l.data,function(b,d){c.updateElement(b,d,a)})},updateElement:function(a,c,d){var e=this,f=e.chart,g=f.chartArea,h=f.options,i=h.animation,j=(h.elements.arc,(g.left+g.right)/2),k=(g.top+g.bottom)/2,l=h.rotation,m=h.rotation,n=e.getDataset(),o=d&&i.animateRotate?0:a.hidden?0:e.calculateCircumference(n.data[c])*(h.circumference/(2*Math.PI)),p=d&&i.animateScale?0:e.innerRadius,q=d&&i.animateScale?0:e.outerRadius,r=(a.custom||{},b.getValueAtIndexOrDefault);b.extend(a,{_datasetIndex:e.index,_index:c,_model:{x:j+f.offsetX,y:k+f.offsetY,startAngle:l,endAngle:m,circumference:o,outerRadius:q,innerRadius:p,label:r(n.label,c,f.data.labels[c])}});var s=a._model;this.removeHoverStyle(a),d&&i.animateRotate||(0===c?s.startAngle=h.rotation:s.startAngle=e.getMeta().data[c-1]._model.endAngle,s.endAngle=s.startAngle+s.circumference),a.pivot()},removeHoverStyle:function(b){a.DatasetController.prototype.removeHoverStyle.call(this,b,this.chart.options.elements.arc)},calculateTotal:function(){var a,c=this.getDataset(),d=this.getMeta(),e=0;return b.each(d.data,function(b,d){a=c.data[d],isNaN(a)||b.hidden||(e+=Math.abs(a))}),e},calculateCircumference:function(a){var b=this.getMeta().total;return b>0&&!isNaN(a)?2*Math.PI*(a/b):0}})}},{}],18:[function(a,b,c){"use strict";b.exports=function(a){function b(a,b){return c.getValueOrDefault(a.showLine,b.showLines)}var c=a.helpers;a.defaults.line={showLines:!0,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},a.controllers.line=a.DatasetController.extend({datasetElementType:a.elements.Line,dataElementType:a.elements.Point,addElementAndReset:function(c){var d=this,e=d.chart.options,f=d.getMeta();a.DatasetController.prototype.addElementAndReset.call(d,c),b(d.getDataset(),e)&&0!==f.dataset._model.tension&&d.updateBezierControlPoints()},update:function(a){var d,e,f,g=this,h=g.getMeta(),i=h.dataset,j=h.data||[],k=g.chart.options,l=k.elements.line,m=g.getScaleForId(h.yAxisID),n=g.getDataset(),o=b(n,k);for(o&&(f=i.custom||{},void 0!==n.tension&&void 0===n.lineTension&&(n.lineTension=n.tension),i._scale=m,i._datasetIndex=g.index,i._children=j,i._model={spanGaps:n.spanGaps?n.spanGaps:!1,tension:f.tension?f.tension:c.getValueOrDefault(n.lineTension,l.tension),backgroundColor:f.backgroundColor?f.backgroundColor:n.backgroundColor||l.backgroundColor,borderWidth:f.borderWidth?f.borderWidth:n.borderWidth||l.borderWidth,borderColor:f.borderColor?f.borderColor:n.borderColor||l.borderColor,borderCapStyle:f.borderCapStyle?f.borderCapStyle:n.borderCapStyle||l.borderCapStyle,borderDash:f.borderDash?f.borderDash:n.borderDash||l.borderDash,borderDashOffset:f.borderDashOffset?f.borderDashOffset:n.borderDashOffset||l.borderDashOffset,borderJoinStyle:f.borderJoinStyle?f.borderJoinStyle:n.borderJoinStyle||l.borderJoinStyle,fill:f.fill?f.fill:void 0!==n.fill?n.fill:l.fill,scaleTop:m.top,scaleBottom:m.bottom,scaleZero:m.getBasePixel()},i.pivot()),d=0,e=j.length;e>d;++d)g.updateElement(j[d],d,a);for(o&&0!==i._model.tension&&g.updateBezierControlPoints(),d=0,e=j.length;e>d;++d)j[d].pivot()},getPointBackgroundColor:function(a,b){var d=this.chart.options.elements.point.backgroundColor,e=this.getDataset(),f=a.custom||{};return f.backgroundColor?d=f.backgroundColor:e.pointBackgroundColor?d=c.getValueAtIndexOrDefault(e.pointBackgroundColor,b,d):e.backgroundColor&&(d=e.backgroundColor),d},getPointBorderColor:function(a,b){var d=this.chart.options.elements.point.borderColor,e=this.getDataset(),f=a.custom||{};return f.borderColor?d=f.borderColor:e.pointBorderColor?d=c.getValueAtIndexOrDefault(e.pointBorderColor,b,d):e.borderColor&&(d=e.borderColor),d},getPointBorderWidth:function(a,b){var d=this.chart.options.elements.point.borderWidth,e=this.getDataset(),f=a.custom||{};return f.borderWidth?d=f.borderWidth:e.pointBorderWidth?d=c.getValueAtIndexOrDefault(e.pointBorderWidth,b,d):e.borderWidth&&(d=e.borderWidth),d},updateElement:function(a,b,d){var e,f,g=this,h=g.getMeta(),i=a.custom||{},j=g.getDataset(),k=g.index,l=j.data[b],m=g.getScaleForId(h.yAxisID),n=g.getScaleForId(h.xAxisID),o=g.chart.options.elements.point;void 0!==j.radius&&void 0===j.pointRadius&&(j.pointRadius=j.radius),void 0!==j.hitRadius&&void 0===j.pointHitRadius&&(j.pointHitRadius=j.hitRadius),e=n.getPixelForValue(l,b,k,g.chart.isCombo),f=d?m.getBasePixel():g.calculatePointY(l,b,k,g.chart.isCombo),a._xScale=n,a._yScale=m,a._datasetIndex=k,a._index=b,a._model={x:e,y:f,skip:i.skip||isNaN(e)||isNaN(f),radius:i.radius||c.getValueAtIndexOrDefault(j.pointRadius,b,o.radius),pointStyle:i.pointStyle||c.getValueAtIndexOrDefault(j.pointStyle,b,o.pointStyle),backgroundColor:g.getPointBackgroundColor(a,b),borderColor:g.getPointBorderColor(a,b),borderWidth:g.getPointBorderWidth(a,b),tension:h.dataset._model?h.dataset._model.tension:0,hitRadius:i.hitRadius||c.getValueAtIndexOrDefault(j.pointHitRadius,b,o.hitRadius)}},calculatePointY:function(a,b,c,d){var e,f,g,h=this,i=h.chart,j=h.getMeta(),k=h.getScaleForId(j.yAxisID),l=0,m=0;if(k.options.stacked){for(e=0;c>e;e++)f=i.data.datasets[e],g=i.getDatasetMeta(e),"line"===g.type&&i.isDatasetVisible(e)&&(f.data[b]<0?m+=f.data[b]||0:l+=f.data[b]||0);return 0>a?k.getPixelForValue(m+a):k.getPixelForValue(l+a)}return k.getPixelForValue(a)},updateBezierControlPoints:function(){var a,b,d,e,f,g=this.getMeta(),h=(this.chart.chartArea,g.data||[]);for(a=0,b=h.length;b>a;++a)d=h[a],e=d._model,f=c.splineCurve(c.previousItem(h,a)._model,e,c.nextItem(h,a)._model,g.dataset._model.tension),e.controlPointPreviousX=f.previous.x,e.controlPointPreviousY=f.previous.y,e.controlPointNextX=f.next.x,e.controlPointNextY=f.next.y},draw:function(a){var c,d,e=this,f=e.getMeta(),g=f.data||[],h=a||1;for(c=0,d=g.length;d>c;++c)g[c].transition(h);for(b(e.getDataset(),e.chart.options)&&f.dataset.transition(h).draw(),c=0,d=g.length;d>c;++c)g[c].draw()},setHoverStyle:function(a){var b=this.chart.data.datasets[a._datasetIndex],d=a._index,e=a.custom||{},f=a._model;f.radius=e.hoverRadius||c.getValueAtIndexOrDefault(b.pointHoverRadius,d,this.chart.options.elements.point.hoverRadius),f.backgroundColor=e.hoverBackgroundColor||c.getValueAtIndexOrDefault(b.pointHoverBackgroundColor,d,c.getHoverColor(f.backgroundColor)),f.borderColor=e.hoverBorderColor||c.getValueAtIndexOrDefault(b.pointHoverBorderColor,d,c.getHoverColor(f.borderColor)),f.borderWidth=e.hoverBorderWidth||c.getValueAtIndexOrDefault(b.pointHoverBorderWidth,d,f.borderWidth)},removeHoverStyle:function(a){var b=this,d=b.chart.data.datasets[a._datasetIndex],e=a._index,f=a.custom||{},g=a._model;void 0!==d.radius&&void 0===d.pointRadius&&(d.pointRadius=d.radius),g.radius=f.radius||c.getValueAtIndexOrDefault(d.pointRadius,e,b.chart.options.elements.point.radius),g.backgroundColor=b.getPointBackgroundColor(a,e),g.borderColor=b.getPointBorderColor(a,e),g.borderWidth=b.getPointBorderWidth(a,e)}})}},{}],19:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0},animation:{animateRotate:!0,animateScale:!0},aspectRatio:1,legendCallback:function(a){var b=[];b.push('
    ');var c=a.data,d=c.datasets,e=c.labels;if(d.length)for(var f=0;f'),e[f]&&b.push(e[f]),b.push("");return b.push("
"),b.join("")},legend:{labels:{generateLabels:function(a){var c=a.data;return c.labels.length&&c.datasets.length?c.labels.map(function(d,e){var f=a.getDatasetMeta(0),g=c.datasets[0],h=f.data[e],i=h.custom||{},j=b.getValueAtIndexOrDefault,k=a.options.elements.arc,l=i.backgroundColor?i.backgroundColor:j(g.backgroundColor,e,k.backgroundColor),m=i.borderColor?i.borderColor:j(g.borderColor,e,k.borderColor),n=i.borderWidth?i.borderWidth:j(g.borderWidth,e,k.borderWidth);return{text:d,fillStyle:l,strokeStyle:m,lineWidth:n,hidden:isNaN(g.data[e])||f.data[e].hidden,index:e}}):[]}},onClick:function(a,b){var c,d,e,f=b.index,g=this.chart;for(c=0,d=(g.data.datasets||[]).length;d>c;++c)e=g.getDatasetMeta(c),e.data[f].hidden=!e.data[f].hidden;g.update()}},tooltips:{callbacks:{title:function(){return""},label:function(a,b){return b.labels[a.index]+": "+a.yLabel}}}},a.controllers.polarArea=a.DatasetController.extend({dataElementType:a.elements.Arc,linkScales:b.noop,update:function(a){var c=this,d=c.chart,e=d.chartArea,f=c.getMeta(),g=d.options,h=g.elements.arc,i=Math.min(e.right-e.left,e.bottom-e.top);d.outerRadius=Math.max((i-h.borderWidth/2)/2,0),d.innerRadius=Math.max(g.cutoutPercentage?d.outerRadius/100*g.cutoutPercentage:1,0),d.radiusLength=(d.outerRadius-d.innerRadius)/d.getVisibleDatasetCount(),c.outerRadius=d.outerRadius-d.radiusLength*c.index,c.innerRadius=c.outerRadius-d.radiusLength,f.count=c.countVisibleElements(),b.each(f.data,function(b,d){c.updateElement(b,d,a)})},updateElement:function(a,c,d){for(var e=this,f=e.chart,g=f.chartArea,h=e.getDataset(),i=f.options,j=i.animation,k=(i.elements.arc,a.custom||{},f.scale),l=b.getValueAtIndexOrDefault,m=f.data.labels,n=e.calculateCircumference(h.data[c]),o=(g.left+g.right)/2,p=(g.top+g.bottom)/2,q=0,r=e.getMeta(),s=0;c>s;++s)isNaN(h.data[s])||r.data[s].hidden||++q;var t=-.5*Math.PI,u=a.hidden?0:k.getDistanceFromCenterForValue(h.data[c]),v=t+n*q,w=v+(a.hidden?0:n),x=j.animateScale?0:k.getDistanceFromCenterForValue(h.data[c]);b.extend(a,{_datasetIndex:e.index,_index:c,_scale:k,_model:{x:o,y:p,innerRadius:0,outerRadius:d?x:u,startAngle:d&&j.animateRotate?t:v,endAngle:d&&j.animateRotate?t:w,label:l(m,c,m[c])}}),e.removeHoverStyle(a),a.pivot()},removeHoverStyle:function(b){a.DatasetController.prototype.removeHoverStyle.call(this,b,this.chart.options.elements.arc)},countVisibleElements:function(){var a=this.getDataset(),c=this.getMeta(),d=0;return b.each(c.data,function(b,c){isNaN(a.data[c])||b.hidden||d++}),d},calculateCircumference:function(a){var b=this.getMeta().count;return b>0&&!isNaN(a)?2*Math.PI/b:0}})}},{}],20:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.defaults.radar={scale:{type:"radialLinear"},elements:{line:{tension:0}}},a.controllers.radar=a.DatasetController.extend({datasetElementType:a.elements.Line,dataElementType:a.elements.Point,linkScales:b.noop,addElementAndReset:function(b){a.DatasetController.prototype.addElementAndReset.call(this,b),this.updateBezierControlPoints()},update:function(a){var c=this,d=c.getMeta(),e=d.dataset,f=d.data,g=e.custom||{},h=c.getDataset(),i=c.chart.options.elements.line,j=c.chart.scale;void 0!==h.tension&&void 0===h.lineTension&&(h.lineTension=h.tension),b.extend(d.dataset,{_datasetIndex:c.index,_children:f,_loop:!0,_model:{tension:g.tension?g.tension:b.getValueOrDefault(h.lineTension,i.tension),backgroundColor:g.backgroundColor?g.backgroundColor:h.backgroundColor||i.backgroundColor,borderWidth:g.borderWidth?g.borderWidth:h.borderWidth||i.borderWidth,borderColor:g.borderColor?g.borderColor:h.borderColor||i.borderColor,fill:g.fill?g.fill:void 0!==h.fill?h.fill:i.fill,borderCapStyle:g.borderCapStyle?g.borderCapStyle:h.borderCapStyle||i.borderCapStyle,borderDash:g.borderDash?g.borderDash:h.borderDash||i.borderDash,borderDashOffset:g.borderDashOffset?g.borderDashOffset:h.borderDashOffset||i.borderDashOffset,borderJoinStyle:g.borderJoinStyle?g.borderJoinStyle:h.borderJoinStyle||i.borderJoinStyle,scaleTop:j.top,scaleBottom:j.bottom,scaleZero:j.getBasePosition()}}),d.dataset.pivot(),b.each(f,function(b,d){c.updateElement(b,d,a)},c),c.updateBezierControlPoints()},updateElement:function(a,c,d){var e=this,f=a.custom||{},g=e.getDataset(),h=e.chart.scale,i=e.chart.options.elements.point,j=h.getPointPositionForValue(c,g.data[c]);b.extend(a,{_datasetIndex:e.index,_index:c,_scale:h,_model:{x:d?h.xCenter:j.x,y:d?h.yCenter:j.y,tension:f.tension?f.tension:b.getValueOrDefault(g.tension,e.chart.options.elements.line.tension),radius:f.radius?f.radius:b.getValueAtIndexOrDefault(g.pointRadius,c,i.radius),backgroundColor:f.backgroundColor?f.backgroundColor:b.getValueAtIndexOrDefault(g.pointBackgroundColor,c,i.backgroundColor),borderColor:f.borderColor?f.borderColor:b.getValueAtIndexOrDefault(g.pointBorderColor,c,i.borderColor),borderWidth:f.borderWidth?f.borderWidth:b.getValueAtIndexOrDefault(g.pointBorderWidth,c,i.borderWidth),pointStyle:f.pointStyle?f.pointStyle:b.getValueAtIndexOrDefault(g.pointStyle,c,i.pointStyle),hitRadius:f.hitRadius?f.hitRadius:b.getValueAtIndexOrDefault(g.hitRadius,c,i.hitRadius)}}),a._model.skip=f.skip?f.skip:isNaN(a._model.x)||isNaN(a._model.y)},updateBezierControlPoints:function(){var a=this.chart.chartArea,c=this.getMeta();b.each(c.data,function(d,e){var f=d._model,g=b.splineCurve(b.previousItem(c.data,e,!0)._model,f,b.nextItem(c.data,e,!0)._model,f.tension);f.controlPointPreviousX=Math.max(Math.min(g.previous.x,a.right),a.left),f.controlPointPreviousY=Math.max(Math.min(g.previous.y,a.bottom),a.top),f.controlPointNextX=Math.max(Math.min(g.next.x,a.right),a.left),f.controlPointNextY=Math.max(Math.min(g.next.y,a.bottom),a.top),d.pivot()})},draw:function(a){var c=this.getMeta(),d=a||1;b.each(c.data,function(a,b){a.transition(d)}),c.dataset.transition(d).draw(),b.each(c.data,function(a){a.draw()})},setHoverStyle:function(a){var c=this.chart.data.datasets[a._datasetIndex],d=a.custom||{},e=a._index,f=a._model;f.radius=d.hoverRadius?d.hoverRadius:b.getValueAtIndexOrDefault(c.pointHoverRadius,e,this.chart.options.elements.point.hoverRadius),f.backgroundColor=d.hoverBackgroundColor?d.hoverBackgroundColor:b.getValueAtIndexOrDefault(c.pointHoverBackgroundColor,e,b.getHoverColor(f.backgroundColor)),f.borderColor=d.hoverBorderColor?d.hoverBorderColor:b.getValueAtIndexOrDefault(c.pointHoverBorderColor,e,b.getHoverColor(f.borderColor)),f.borderWidth=d.hoverBorderWidth?d.hoverBorderWidth:b.getValueAtIndexOrDefault(c.pointHoverBorderWidth,e,f.borderWidth)},removeHoverStyle:function(a){var c=this.chart.data.datasets[a._datasetIndex],d=a.custom||{},e=a._index,f=a._model,g=this.chart.options.elements.point;f.radius=d.radius?d.radius:b.getValueAtIndexOrDefault(c.radius,e,g.radius),f.backgroundColor=d.backgroundColor?d.backgroundColor:b.getValueAtIndexOrDefault(c.pointBackgroundColor,e,g.backgroundColor),f.borderColor=d.borderColor?d.borderColor:b.getValueAtIndexOrDefault(c.pointBorderColor,e,g.borderColor),f.borderWidth=d.borderWidth?d.borderWidth:b.getValueAtIndexOrDefault(c.pointBorderWidth,e,g.borderWidth)}})}},{}],21:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:b.noop,onComplete:b.noop},a.Animation=a.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),a.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(a,b,c,d){var e=this;d||(a.animating=!0);for(var f=0;f1&&(c=Math.floor(a.dropFrames),a.dropFrames=a.dropFrames%1);for(var d=0;da.animations[d].animationObject.numSteps&&(a.animations[d].animationObject.currentStep=a.animations[d].animationObject.numSteps),a.animations[d].animationObject.render(a.animations[d].chartInstance,a.animations[d].animationObject),a.animations[d].animationObject.onAnimationProgress&&a.animations[d].animationObject.onAnimationProgress.call&&a.animations[d].animationObject.onAnimationProgress.call(a.animations[d].chartInstance,a.animations[d]),a.animations[d].animationObject.currentStep===a.animations[d].animationObject.numSteps?(a.animations[d].animationObject.onAnimationComplete&&a.animations[d].animationObject.onAnimationComplete.call&&a.animations[d].animationObject.onAnimationComplete.call(a.animations[d].chartInstance,a.animations[d]),a.animations[d].chartInstance.animating=!1,a.animations.splice(d,1)):++d;var e=Date.now(),f=(e-b)/a.frameDuration;a.dropFrames+=f,a.animations.length>0&&a.requestAnimationFrame()}}}},{}],22:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.types={},a.instances={},a.controllers={},a.Controller=function(c){return this.chart=c,this.config=c.config,this.options=this.config.options=b.configMerge(a.defaults.global,a.defaults[this.config.type],this.config.options||{}),this.id=b.uid(),Object.defineProperty(this,"data",{get:function(){return this.config.data}}),a.instances[this.id]=this,this.options.responsive&&this.resize(!0),this.initialize(),this},b.extend(a.Controller.prototype,{initialize:function(){var b=this;return a.plugins.notify("beforeInit",[b]),b.bindEvents(),b.ensureScalesHaveIDs(),b.buildOrUpdateControllers(),b.buildScales(),b.updateLayout(),b.resetElements(),b.initToolTip(),b.update(),a.plugins.notify("afterInit",[b]),b},clear:function(){return b.clear(this.chart),this},stop:function(){return a.animationService.cancelAnimation(this),this},resize:function(c){var d=this,e=d.chart,f=e.canvas,g=b.getMaximumWidth(f),h=e.aspectRatio,i=d.options.maintainAspectRatio&&isNaN(h)===!1&&isFinite(h)&&0!==h?g/h:b.getMaximumHeight(f),j=e.width!==g||e.height!==i;if(!j)return d;f.width=e.width=g,f.height=e.height=i,b.retinaScale(e);var k={width:g,height:i};return a.plugins.notify("resize",[d,k]),d.options.onResize&&d.options.onResize(d,k),c||(d.stop(),d.update(d.options.responsiveAnimationDuration)),d},ensureScalesHaveIDs:function(){var a=this.options,c=a.scales||{},d=a.scale;b.each(c.xAxes,function(a,b){a.id=a.id||"x-axis-"+b}),b.each(c.yAxes,function(a,b){a.id=a.id||"y-axis-"+b}),d&&(d.id=d.id||"scale")},buildScales:function(){var c=this,d=c.options,e=c.scales={},f=[];d.scales&&(f=f.concat((d.scales.xAxes||[]).map(function(a){return{options:a,dtype:"category"}}),(d.scales.yAxes||[]).map(function(a){return{options:a,dtype:"linear"}}))),d.scale&&f.push({options:d.scale,dtype:"radialLinear",isDefault:!0}),b.each(f,function(d,f){var g=d.options,h=b.getValueOrDefault(g.type,d.dtype),i=a.scaleService.getScaleConstructor(h);if(i){var j=new i({id:g.id,options:g,ctx:c.chart.ctx,chart:c});e[j.id]=j,d.isDefault&&(c.scale=j)}}),a.scaleService.addScalesToLayout(this)},updateLayout:function(){a.layoutService.update(this,this.chart.width,this.chart.height)},buildOrUpdateControllers:function(){var c=this,d=[],e=[];if(b.each(c.data.datasets,function(b,f){var g=c.getDatasetMeta(f);g.type||(g.type=b.type||c.config.type),d.push(g.type),g.controller?g.controller.updateIndex(f):(g.controller=new a.controllers[g.type](c,f),e.push(g.controller))},c),d.length>1)for(var f=1;fb;++b)d.getDatasetMeta(b).controller.update();a.plugins.notify("afterDatasetsUpdate",[d])}},render:function(c,d){var e=this;a.plugins.notify("beforeRender",[e]);var f=e.options.animation;if(f&&("undefined"!=typeof c&&0!==c||"undefined"==typeof c&&0!==f.duration)){var g=new a.Animation;g.numSteps=(c||f.duration)/16.66,g.easing=f.easing,g.render=function(a,c){var d=b.easingEffects[c.easing],e=c.currentStep/c.numSteps,f=d(e);a.draw(f,e,c.currentStep)},g.onAnimationProgress=f.onProgress,g.onAnimationComplete=f.onComplete,a.animationService.addAnimation(e,g,c,d)}else e.draw(),f&&f.onComplete&&f.onComplete.call&&f.onComplete.call(e);return e},draw:function(c){var d=this,e=c||1;d.clear(),a.plugins.notify("beforeDraw",[d,e]),b.each(d.boxes,function(a){a.draw(d.chartArea)},d),d.scale&&d.scale.draw(),a.plugins.notify("beforeDatasetsDraw",[d,e]),b.each(d.data.datasets,function(a,b){d.isDatasetVisible(b)&&d.getDatasetMeta(b).controller.draw(c)},d,!0),a.plugins.notify("afterDatasetsDraw",[d,e]),d.tooltip.transition(e).draw(),a.plugins.notify("afterDraw",[d,e])},getElementAtEvent:function(a){var c=this,d=b.getRelativePosition(a,c.chart),e=[];return b.each(c.data.datasets,function(a,f){if(c.isDatasetVisible(f)){var g=c.getDatasetMeta(f);b.each(g.data,function(a,b){return a.inRange(d.x,d.y)?(e.push(a),e):void 0})}}),e},getElementsAtEvent:function(a){var c=this,d=b.getRelativePosition(a,c.chart),e=[],f=function(){if(c.data.datasets)for(var a=0;a0&&(b=this.getDatasetMeta(b[0]._datasetIndex).data),b},getDatasetMeta:function(a){var b=this,c=b.data.datasets[a];c._meta||(c._meta={});var d=c._meta[b.id];return d||(d=c._meta[b.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),d},getVisibleDatasetCount:function(){for(var a=0,b=0,c=this.data.datasets.length;c>b;++b)this.isDatasetVisible(b)&&a++;return a},isDatasetVisible:function(a){var b=this.getDatasetMeta(a);return"boolean"==typeof b.hidden?!b.hidden:!this.data.datasets[a].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){var c=this;c.stop(),c.clear(),b.unbindEvents(c,c.events),b.removeResizeListener(c.chart.canvas.parentNode);var d=c.chart.canvas;d.width=c.chart.width,d.height=c.chart.height,void 0!==c.chart.originalDevicePixelRatio&&c.chart.ctx.scale(1/c.chart.originalDevicePixelRatio,1/c.chart.originalDevicePixelRatio),d.style.width=c.chart.originalCanvasStyleWidth,d.style.height=c.chart.originalCanvasStyleHeight,a.plugins.notify("destroy",[c]),delete a.instances[c.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var b=this;b.tooltip=new a.Tooltip({_chart:b.chart,_chartInstance:b,_data:b.data,_options:b.options.tooltips},b)},bindEvents:function(){var a=this;b.bindEvents(a,a.options.events,function(b){a.eventHandler(b)})},updateHoverStyle:function(a,b,c){var d,e,f,g=c?"setHoverStyle":"removeHoverStyle";switch(b){case"single":a=[a[0]];break;case"label":case"dataset":break;default:return}for(e=0,f=a.length;f>e;++e)d=a[e],d&&this.getDatasetMeta(d._datasetIndex).controller[g](d)},eventHandler:function(a){var c=this,d=c.tooltip,e=c.options||{},f=e.hover,g=e.tooltips;return c.lastActive=c.lastActive||[],c.lastTooltipActive=c.lastTooltipActive||[],"mouseout"===a.type?(c.active=[],c.tooltipActive=[]):(c.active=c.getElementsAtEventForMode(a,f.mode),c.tooltipActive=c.getElementsAtEventForMode(a,g.mode)),f.onHover&&f.onHover.call(c,c.active),("mouseup"===a.type||"click"===a.type)&&(e.onClick&&e.onClick.call(c,a,c.active),c.legend&&c.legend.handleEvent&&c.legend.handleEvent(a)),c.lastActive.length&&c.updateHoverStyle(c.lastActive,f.mode,!1),c.active.length&&f.mode&&c.updateHoverStyle(c.active,f.mode,!0),(g.enabled||g.custom)&&(d.initialize(),d._active=c.tooltipActive,d.update(!0)),d.pivot(),c.animating||b.arrayEquals(c.active,c.lastActive)&&b.arrayEquals(c.tooltipActive,c.lastTooltipActive)||(c.stop(),(g.enabled||g.custom)&&d.update(!0),c.render(f.animationDuration,!0)),c.lastActive=c.active,c.lastTooltipActive=c.tooltipActive,c}})}},{}],23:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=b.noop;a.DatasetController=function(a,b){this.initialize.call(this,a,b)},b.extend(a.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(a,b){var c=this;c.chart=a,c.index=b,c.linkScales(),c.addElements()},updateIndex:function(a){this.index=a},linkScales:function(){var a=this,b=a.getMeta(),c=a.getDataset();null===b.xAxisID&&(b.xAxisID=c.xAxisID||a.chart.options.scales.xAxes[0].id),null===b.yAxisID&&(b.yAxisID=c.yAxisID||a.chart.options.scales.yAxes[0].id); +},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(a){return this.chart.scales[a]},reset:function(){this.update(!0)},createMetaDataset:function(){var a=this,b=a.datasetElementType;return b&&new b({_chart:a.chart.chart,_datasetIndex:a.index})},createMetaData:function(a){var b=this,c=b.dataElementType;return c&&new c({_chart:b.chart.chart,_datasetIndex:b.index,_index:a})},addElements:function(){var a,b,c=this,d=c.getMeta(),e=c.getDataset().data||[],f=d.data;for(a=0,b=e.length;b>a;++a)f[a]=f[a]||c.createMetaData(d,a);d.dataset=d.dataset||c.createMetaDataset()},addElementAndReset:function(a){var b=this,c=b.createMetaData(a);b.getMeta().data.splice(a,0,c),b.updateElement(c,a,!0)},buildOrUpdateElements:function(){var a=this.getMeta(),b=a.data,c=this.getDataset().data.length,d=b.length;if(d>c)b.splice(c,d-c);else if(c>d)for(var e=d;c>e;++e)this.addElementAndReset(e)},update:c,draw:function(a){var c=a||1;b.each(this.getMeta().data,function(a,b){a.transition(c).draw()})},removeHoverStyle:function(a,c){var d=this.chart.data.datasets[a._datasetIndex],e=a._index,f=a.custom||{},g=b.getValueAtIndexOrDefault,h=(b.color,a._model);h.backgroundColor=f.backgroundColor?f.backgroundColor:g(d.backgroundColor,e,c.backgroundColor),h.borderColor=f.borderColor?f.borderColor:g(d.borderColor,e,c.borderColor),h.borderWidth=f.borderWidth?f.borderWidth:g(d.borderWidth,e,c.borderWidth)},setHoverStyle:function(a){var c=this.chart.data.datasets[a._datasetIndex],d=a._index,e=a.custom||{},f=b.getValueAtIndexOrDefault,g=(b.color,b.getHoverColor),h=a._model;h.backgroundColor=e.hoverBackgroundColor?e.hoverBackgroundColor:f(c.hoverBackgroundColor,d,g(h.backgroundColor)),h.borderColor=e.hoverBorderColor?e.hoverBorderColor:f(c.hoverBorderColor,d,g(h.borderColor)),h.borderWidth=e.hoverBorderWidth?e.hoverBorderWidth:f(c.hoverBorderWidth,d,h.borderWidth)}}),a.DatasetController.extend=b.inherits}},{}],24:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.elements={},a.Element=function(a){b.extend(this,a),this.initialize.apply(this,arguments)},b.extend(a.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var a=this;return a._view||(a._view=b.clone(a._model)),a._start=b.clone(a._view),a},transition:function(a){var c=this;return c._view||(c._view=b.clone(c._model)),1===a?(c._view=c._model,c._start=null,c):(c._start||c.pivot(),b.each(c._model,function(d,e){if("_"===e[0]);else if(c._view.hasOwnProperty(e))if(d===c._view[e]);else if("string"==typeof d)try{var f=b.color(c._model[e]).mix(b.color(c._start[e]),a);c._view[e]=f.rgbString()}catch(g){c._view[e]=d}else if("number"==typeof d){var h=void 0!==c._start[e]&&isNaN(c._start[e])===!1?c._start[e]:0;c._view[e]=(c._model[e]-h)*a+h}else c._view[e]=d;else"number"!=typeof d||isNaN(c._view[e])?c._view[e]=d:c._view[e]=d*a},c),c)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return b.isNumber(this._model.x)&&b.isNumber(this._model.y)}}),a.Element.extend=b.inherits}},{}],25:[function(a,b,c){"use strict";var d=a(3);b.exports=function(a){function b(a,b,c){var d;return"string"==typeof a?(d=parseInt(a,10),-1!=a.indexOf("%")&&(d=d/100*b.parentNode[c])):d=a,d}function c(a){return void 0!==a&&null!==a&&"none"!==a}function e(a,d,e){var f=document.defaultView,g=a.parentNode,h=f.getComputedStyle(a)[d],i=f.getComputedStyle(g)[d],j=c(h),k=c(i),l=Number.POSITIVE_INFINITY;return j||k?Math.min(j?b(h,a,e):l,k?b(i,g,e):l):"none"}var f=a.helpers={};f.each=function(a,b,c,d){var e,g;if(f.isArray(a))if(g=a.length,d)for(e=g-1;e>=0;e--)b.call(c,a[e],e);else for(e=0;g>e;e++)b.call(c,a[e],e);else if("object"==typeof a){var h=Object.keys(a);for(g=h.length,e=0;g>e;e++)b.call(c,a[h[e]],h[e])}},f.clone=function(a){var b={};return f.each(a,function(a,c){f.isArray(a)?b[c]=a.slice(0):"object"==typeof a&&null!==a?b[c]=f.clone(a):b[c]=a}),b},f.extend=function(a){for(var b=function(b,c){a[c]=b},c=1,d=arguments.length;d>c;c++)f.each(arguments[c],b);return a},f.configMerge=function(b){var c=f.clone(b);return f.each(Array.prototype.slice.call(arguments,1),function(b){f.each(b,function(b,d){if("scales"===d)c[d]=f.scaleMerge(c.hasOwnProperty(d)?c[d]:{},b);else if("scale"===d)c[d]=f.configMerge(c.hasOwnProperty(d)?c[d]:{},a.scaleService.getScaleDefaults(b.type),b);else if(c.hasOwnProperty(d)&&f.isArray(c[d])&&f.isArray(b)){var e=c[d];f.each(b,function(a,b){b=d[c].length||!d[c][e].type?d[c].push(f.configMerge(h,b)):b.type&&b.type!==d[c][e].type?d[c][e]=f.configMerge(d[c][e],h,b):d[c][e]=f.configMerge(d[c][e],b)}):(d[c]=[],f.each(b,function(b){var e=f.getValueOrDefault(b.type,"xAxes"===c?"category":"linear");d[c].push(f.configMerge(a.scaleService.getScaleDefaults(e),b))})):d.hasOwnProperty(c)&&"object"==typeof d[c]&&null!==d[c]&&"object"==typeof b?d[c]=f.configMerge(d[c],b):d[c]=b}),d},f.getValueAtIndexOrDefault=function(a,b,c){return void 0===a||null===a?c:f.isArray(a)?bc;++c)if(a[c]===b)return c;return-1},f.where=function(a,b){if(f.isArray(a)&&Array.prototype.filter)return a.filter(b);var c=[];return f.each(a,function(a){b(a)&&c.push(a)}),c},f.findIndex=Array.prototype.findIndex?function(a,b,c){return a.findIndex(b,c)}:function(a,b,c){c=void 0===c?a:c;for(var d=0,e=a.length;e>d;++d)if(b.call(c,a[d],d,a))return d;return-1},f.findNextWhere=function(a,b,c){(void 0===c||null===c)&&(c=-1);for(var d=c+1;d=0;d--){var e=a[d];if(b(e))return e}},f.inherits=function(a){var b=this,c=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return b.apply(this,arguments)},d=function(){this.constructor=c};return d.prototype=b.prototype,c.prototype=new d,c.extend=f.inherits,a&&f.extend(c.prototype,a),c.__super__=b.prototype,c},f.noop=function(){},f.uid=function(){var a=0;return function(){return a++}}(),f.isNumber=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},f.almostEquals=function(a,b,c){return Math.abs(a-b)0?1:-1},f.log10=Math.log10?function(a){return Math.log10(a)}:function(a){return Math.log(a)/Math.LN10},f.toRadians=function(a){return a*(Math.PI/180)},f.toDegrees=function(a){return a*(180/Math.PI)},f.getAngleFromPoint=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=Math.sqrt(c*c+d*d),f=Math.atan2(d,c);return f<-.5*Math.PI&&(f+=2*Math.PI),{angle:f,distance:e}},f.aliasPixel=function(a){return a%2===0?0:.5},f.splineCurve=function(a,b,c,d){var e=a.skip?b:a,f=b,g=c.skip?b:c,h=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),i=Math.sqrt(Math.pow(g.x-f.x,2)+Math.pow(g.y-f.y,2)),j=h/(h+i),k=i/(h+i);j=isNaN(j)?0:j,k=isNaN(k)?0:k;var l=d*j,m=d*k;return{previous:{x:f.x-l*(g.x-e.x),y:f.y-l*(g.y-e.y)},next:{x:f.x+m*(g.x-e.x),y:f.y+m*(g.y-e.y)}}},f.nextItem=function(a,b,c){return c?b>=a.length-1?a[0]:a[b+1]:b>=a.length-1?a[a.length-1]:a[b+1]},f.previousItem=function(a,b,c){return c?0>=b?a[a.length-1]:a[b-1]:0>=b?a[0]:a[b-1]},f.niceNum=function(a,b){var c,d=Math.floor(f.log10(a)),e=a/Math.pow(10,d);return c=b?1.5>e?1:3>e?2:7>e?5:10:1>=e?1:2>=e?2:5>=e?5:10,c*Math.pow(10,d)};var g=f.easingEffects={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return(a/=.5)<1?.5*a*a:-0.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(a/=.5)<1?.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(a/=.5)<1?.5*a*a*a*a:-0.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(a/=.5)<1?.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-0.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:(a/=.5)<1?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return a>=1?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(a/=.5)<1?-0.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var b=1.70158,c=0,d=1;return 0===a?0:1===(a/=1)?1:(c||(c=.3),da?-.5*(d*Math.pow(2,10*(a-=1))*Math.sin((1*a-b)*(2*Math.PI)/c)):d*Math.pow(2,-10*(a-=1))*Math.sin((1*a-b)*(2*Math.PI)/c)*.5+1)},easeInBack:function(a){var b=1.70158;return 1*(a/=1)*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return 1*((a=a/1-1)*a*((b+1)*a+b)+1)},easeInOutBack:function(a){var b=1.70158;return(a/=.5)<1?.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-g.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=1)<1/2.75?1*(7.5625*a*a):2/2.75>a?1*(7.5625*(a-=1.5/2.75)*a+.75):2.5/2.75>a?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*g.easeInBounce(2*a):.5*g.easeOutBounce(2*a-1)+.5}};f.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return window.setTimeout(a,1e3/60)}}(),f.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(a){return window.clearTimeout(a,1e3/60)}}(),f.getRelativePosition=function(a,b){var c,d,e=a.originalEvent||a,g=a.currentTarget||a.srcElement,h=g.getBoundingClientRect(),i=e.touches;i&&i.length>0?(c=i[0].clientX,d=i[0].clientY):(c=e.clientX,d=e.clientY);var j=parseFloat(f.getStyle(g,"padding-left")),k=parseFloat(f.getStyle(g,"padding-top")),l=parseFloat(f.getStyle(g,"padding-right")),m=parseFloat(f.getStyle(g,"padding-bottom")),n=h.right-h.left-j-l,o=h.bottom-h.top-k-m;return c=Math.round((c-h.left-j)/n*g.width/b.currentDevicePixelRatio),d=Math.round((d-h.top-k)/o*g.height/b.currentDevicePixelRatio),{x:c,y:d}},f.addEvent=function(a,b,c){a.addEventListener?a.addEventListener(b,c):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},f.removeEvent=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=f.noop},f.bindEvents=function(a,b,c){var d=a.events=a.events||{};f.each(b,function(b){d[b]=function(){c.apply(a,arguments)},f.addEvent(a.chart.canvas,b,d[b])})},f.unbindEvents=function(a,b){var c=a.chart.canvas;f.each(b,function(a,b){f.removeEvent(c,b,a)})},f.getConstraintWidth=function(a){return e(a,"max-width","clientWidth")},f.getConstraintHeight=function(a){return e(a,"max-height","clientHeight")},f.getMaximumWidth=function(a){var b=a.parentNode,c=parseInt(f.getStyle(b,"padding-left"))+parseInt(f.getStyle(b,"padding-right")),d=b.clientWidth-c,e=f.getConstraintWidth(a);return isNaN(e)?d:Math.min(d,e)},f.getMaximumHeight=function(a){var b=a.parentNode,c=parseInt(f.getStyle(b,"padding-top"))+parseInt(f.getStyle(b,"padding-bottom")),d=b.clientHeight-c,e=f.getConstraintHeight(a);return isNaN(e)?d:Math.min(d,e)},f.getStyle=function(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView.getComputedStyle(a,null).getPropertyValue(b)},f.retinaScale=function(a){var b=a.ctx,c=a.canvas,d=c.width,e=c.height,f=a.currentDevicePixelRatio=window.devicePixelRatio||1;1!==f&&(c.height=e*f,c.width=d*f,b.scale(f,f),a.originalDevicePixelRatio=a.originalDevicePixelRatio||f),c.style.width=d+"px",c.style.height=e+"px"},f.clear=function(a){a.ctx.clearRect(0,0,a.width,a.height)},f.fontString=function(a,b,c){return b+" "+a+"px "+c},f.longestText=function(a,b,c,d){d=d||{};var e=d.data=d.data||{},g=d.garbageCollect=d.garbageCollect||[];d.font!==b&&(e=d.data={},g=d.garbageCollect=[],d.font=b),a.font=b;var h=0;f.each(c,function(b){void 0!==b&&null!==b&&f.isArray(b)!==!0?h=f.measureText(a,e,g,h,b):f.isArray(b)&&f.each(b,function(b){void 0===b||null===b||f.isArray(b)||(h=f.measureText(a,e,g,h,b))})});var i=g.length/2;if(i>c.length){for(var j=0;i>j;j++)delete e[g[j]];g.splice(0,i)}return h},f.measureText=function(a,b,c,d,e){var f=b[e];return f||(f=b[e]=a.measureText(e).width,c.push(e)),f>d&&(d=f),d},f.numberOfLabelLines=function(a){var b=1;return f.each(a,function(a){f.isArray(a)&&a.length>b&&(b=a.length)}),b},f.drawRoundedRectangle=function(a,b,c,d,e,f){a.beginPath(),a.moveTo(b+f,c),a.lineTo(b+d-f,c),a.quadraticCurveTo(b+d,c,b+d,c+f),a.lineTo(b+d,c+e-f),a.quadraticCurveTo(b+d,c+e,b+d-f,c+e),a.lineTo(b+f,c+e),a.quadraticCurveTo(b,c+e,b,c+e-f),a.lineTo(b,c+f),a.quadraticCurveTo(b,c,b+f,c),a.closePath()},f.color=function(b){return d?d(b instanceof CanvasGradient?a.defaults.global.defaultColor:b):(console.log("Color.js not found!"),b)},f.addResizeListener=function(a,b){var c=document.createElement("iframe"),d="chartjs-hidden-iframe";c.classlist?c.classlist.add(d):c.setAttribute("class",d);var e=c.style;e.width="100%",e.display="block",e.border=0,e.height=0,e.margin=0,e.position="absolute",e.left=0,e.right=0,e.top=0,e.bottom=0,a.insertBefore(c,a.firstChild),(c.contentWindow||c).onresize=function(){b&&b()}},f.removeResizeListener=function(a){var b=a.querySelector(".chartjs-hidden-iframe");b&&b.parentNode.removeChild(b)},f.isArray=Array.isArray?function(a){return Array.isArray(a)}:function(a){return"[object Array]"===Object.prototype.toString.call(a)},f.arrayEquals=function(a,b){var c,d,e,g;if(!a||!b||a.length!=b.length)return!1;for(c=0,d=a.length;d>c;++c)if(e=a[c],g=b[c],e instanceof Array&&g instanceof Array){if(!f.arrayEquals(e,g))return!1}else if(e!=g)return!1;return!0},f.callCallback=function(a,b,c){a&&"function"==typeof a.call&&a.apply(c,b)},f.getHoverColor=function(a){return a instanceof CanvasPattern?a:f.color(a).saturate(.5).darken(.1).rgbString()}}},{3:3}],26:[function(a,b,c){"use strict";b.exports=function(){var a=function(b,c){var d=this,e=a.helpers;return d.config=c,b.length&&b[0].getContext&&(b=b[0]),b.getContext&&(b=b.getContext("2d")),d.ctx=b,d.canvas=b.canvas,b.canvas.style.display=b.canvas.style.display||"block",d.width=b.canvas.width||parseInt(e.getStyle(b.canvas,"width"),10)||e.getMaximumWidth(b.canvas),d.height=b.canvas.height||parseInt(e.getStyle(b.canvas,"height"),10)||e.getMaximumHeight(b.canvas),d.aspectRatio=d.width/d.height,(isNaN(d.aspectRatio)||isFinite(d.aspectRatio)===!1)&&(d.aspectRatio=void 0!==c.aspectRatio?c.aspectRatio:2),d.originalCanvasStyleWidth=b.canvas.style.width,d.originalCanvasStyleHeight=b.canvas.style.height,e.retinaScale(d),c&&(d.controller=new a.Controller(d)),e.addResizeListener(b.canvas.parentNode,function(){d.controller&&d.controller.config.options.responsive&&d.controller.resize()}),d.controller?d.controller:d};return a.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"single",animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(a){var b=[];b.push('
    ');for(var c=0;c'),a.data.datasets[c].label&&b.push(a.data.datasets[c].label),b.push("");return b.push("
"),b.join("")}}},a.Chart=a,a}},{}],27:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.layoutService={defaults:{},addBox:function(a,b){a.boxes||(a.boxes=[]),a.boxes.push(b)},removeBox:function(a,b){a.boxes&&a.boxes.splice(a.boxes.indexOf(b),1)},update:function(a,c,d){function e(a){var b,c=a.isHorizontal();c?(b=a.update(a.options.fullWidth?p:v,u),w-=b.height):(b=a.update(t,s),v-=b.width),x.push({horizontal:c,minSize:b,box:a})}function f(a){var c=b.findNextWhere(x,function(b){return b.box===a});if(c)if(a.isHorizontal()){var d={left:y,right:z,top:0,bottom:0};a.update(a.options.fullWidth?p:v,q/2,d)}else a.update(c.minSize.width,w)}function g(a){var c=b.findNextWhere(x,function(b){return b.box===a}),d={left:0,right:0,top:A,bottom:B};c&&a.update(c.minSize.width,w,d)}function h(a){a.isHorizontal()?(a.left=a.options.fullWidth?i:y,a.right=a.options.fullWidth?c-i:y+v,a.top=F,a.bottom=F+a.height,F=a.bottom):(a.left=E,a.right=E+a.width,a.top=A,a.bottom=A+w,E=a.right)}if(a){var i=0,j=0,k=b.where(a.boxes,function(a){return"left"===a.options.position}),l=b.where(a.boxes,function(a){return"right"===a.options.position}),m=b.where(a.boxes,function(a){return"top"===a.options.position}),n=b.where(a.boxes,function(a){return"bottom"===a.options.position}),o=b.where(a.boxes,function(a){return"chartArea"===a.options.position});m.sort(function(a,b){return(b.options.fullWidth?1:0)-(a.options.fullWidth?1:0)}),n.sort(function(a,b){return(a.options.fullWidth?1:0)-(b.options.fullWidth?1:0)});var p=c-2*i,q=d-2*j,r=p/2,s=q/2,t=(c-r)/(k.length+l.length),u=(d-s)/(m.length+n.length),v=p,w=q,x=[];b.each(k.concat(l,m,n),e);var y=i,z=i,A=j,B=j;b.each(k.concat(l),f),b.each(k,function(a){y+=a.width}),b.each(l,function(a){z+=a.width}),b.each(m.concat(n),f),b.each(m,function(a){A+=a.height}),b.each(n,function(a){B+=a.height}),b.each(k.concat(l),g),y=i,z=i,A=j,B=j,b.each(k,function(a){y+=a.width}),b.each(l,function(a){z+=a.width}),b.each(m,function(a){A+=a.height}),b.each(n,function(a){B+=a.height});var C=d-A-B,D=c-y-z;(D!==v||C!==w)&&(b.each(k,function(a){a.height=C}),b.each(l,function(a){a.height=C}),b.each(m,function(a){a.options.fullWidth||(a.width=D)}),b.each(n,function(a){a.options.fullWidth||(a.width=D)}),w=C,v=D);var E=i,F=j;b.each(k.concat(m),h),E+=v,F+=w,b.each(l,h),b.each(n,h),a.chartArea={left:y,top:A,right:y+v,bottom:A+w},b.each(o,function(b){b.left=a.chartArea.left,b.top=a.chartArea.top,b.right=a.chartArea.right,b.bottom=a.chartArea.bottom,b.update(v,w)})}}}}},{}],28:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=b.noop;a.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(a,b){var c=b.datasetIndex,d=this.chart,e=d.getDatasetMeta(c);e.hidden=null===e.hidden?!d.data.datasets[c].hidden:null,d.update()},labels:{boxWidth:40,padding:10,generateLabels:function(a){var c=a.data;return b.isArray(c.datasets)?c.datasets.map(function(c,d){return{text:c.label,fillStyle:b.isArray(c.backgroundColor)?c.backgroundColor[0]:c.backgroundColor,hidden:!a.isDatasetVisible(d),lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,datasetIndex:d}},this):[]}}},a.Legend=a.Element.extend({initialize:function(a){b.extend(this,a),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:c,update:function(a,b,c){var d=this;return d.beforeUpdate(),d.maxWidth=a,d.maxHeight=b,d.margins=c,d.beforeSetDimensions(),d.setDimensions(),d.afterSetDimensions(),d.beforeBuildLabels(),d.buildLabels(),d.afterBuildLabels(),d.beforeFit(),d.fit(),d.afterFit(),d.afterUpdate(),d.minSize},afterUpdate:c,beforeSetDimensions:c,setDimensions:function(){var a=this;a.isHorizontal()?(a.width=a.maxWidth,a.left=0,a.right=a.width):(a.height=a.maxHeight,a.top=0,a.bottom=a.height),a.paddingLeft=0,a.paddingTop=0,a.paddingRight=0,a.paddingBottom=0,a.minSize={width:0,height:0}},afterSetDimensions:c,beforeBuildLabels:c,buildLabels:function(){var a=this;a.legendItems=a.options.labels.generateLabels.call(a,a.chart),a.options.reverse&&a.legendItems.reverse()},afterBuildLabels:c,beforeFit:c,fit:function(){var c=this,d=c.options,e=d.labels,f=d.display,g=c.ctx,h=a.defaults.global,i=b.getValueOrDefault,j=i(e.fontSize,h.defaultFontSize),k=i(e.fontStyle,h.defaultFontStyle),l=i(e.fontFamily,h.defaultFontFamily),m=b.fontString(j,k,l),n=c.legendHitBoxes=[],o=c.minSize,p=c.isHorizontal();if(p?(o.width=c.maxWidth,o.height=f?10:0):(o.width=f?10:0,o.height=c.maxHeight),f)if(g.font=m,p){var q=c.lineWidths=[0],r=c.legendItems.length?j+e.padding:0;g.textAlign="left",g.textBaseline="top",b.each(c.legendItems,function(a,b){var d=e.boxWidth+j/2+g.measureText(a.text).width;q[q.length-1]+d+e.padding>=c.width&&(r+=j+e.padding,q[q.length]=c.left),n[b]={left:0,top:0,width:d,height:j},q[q.length-1]+=d+e.padding}),o.height+=r}else{var s=e.padding,t=c.columnWidths=[],u=e.padding,v=0,w=0,x=j+s;b.each(c.legendItems,function(a,b){var c=e.boxWidth+j/2+g.measureText(a.text).width;w+x>o.height&&(u+=v+e.padding,t.push(v),v=0,w=0),v=Math.max(v,c),w+=x,n[b]={left:0,top:0,width:c,height:j}}),u+=v,t.push(v),o.width+=u}c.width=o.width,c.height=o.height},afterFit:c,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var c=this,d=c.options,e=d.labels,f=a.defaults.global,g=f.elements.line,h=c.width,i=(c.height,c.lineWidths);if(d.display){var j,k=c.ctx,l=b.getValueOrDefault,m=l(e.fontColor,f.defaultFontColor),n=l(e.fontSize,f.defaultFontSize),o=l(e.fontStyle,f.defaultFontStyle),p=l(e.fontFamily,f.defaultFontFamily),q=b.fontString(n,o,p);k.textAlign="left",k.textBaseline="top",k.lineWidth=.5,k.strokeStyle=m,k.fillStyle=m,k.font=q;var r=e.boxWidth,s=c.legendHitBoxes,t=function(a,b,c){k.save(),k.fillStyle=l(c.fillStyle,f.defaultColor),k.lineCap=l(c.lineCap,g.borderCapStyle),k.lineDashOffset=l(c.lineDashOffset,g.borderDashOffset),k.lineJoin=l(c.lineJoin,g.borderJoinStyle),k.lineWidth=l(c.lineWidth,g.borderWidth),k.strokeStyle=l(c.strokeStyle,f.defaultColor),k.setLineDash&&k.setLineDash(l(c.lineDash,g.borderDash)),k.strokeRect(a,b,r,n),k.fillRect(a,b,r,n),k.restore()},u=function(a,b,c,d){k.fillText(c.text,r+n/2+a,b),c.hidden&&(k.beginPath(),k.lineWidth=2,k.moveTo(r+n/2+a,b+n/2),k.lineTo(r+n/2+a+d,b+n/2),k.stroke())},v=c.isHorizontal();j=v?{x:c.left+(h-i[0])/2,y:c.top+e.padding,line:0}:{x:c.left+e.padding,y:c.top,line:0};var w=n+e.padding;b.each(c.legendItems,function(a,b){var d=k.measureText(a.text).width,f=r+n/2+d,g=j.x,l=j.y;v?g+f>=h&&(l=j.y+=n+e.padding,j.line++,g=j.x=c.left+(h-i[j.line])/2):l+w>c.bottom&&(g=j.x=g+c.columnWidths[j.line]+e.padding,l=j.y=c.top,j.line++),t(g,l,a),s[b].left=g,s[b].top=l,u(g,l,a,d),v?j.x+=f+e.padding:j.y+=w})}},handleEvent:function(a){var c=this,d=b.getRelativePosition(a,c.chart.chart),e=d.x,f=d.y,g=c.options;if(e>=c.left&&e<=c.right&&f>=c.top&&f<=c.bottom)for(var h=c.legendHitBoxes,i=0;i=j.left&&e<=j.left+j.width&&f>=j.top&&f<=j.top+j.height){g.onClick&&g.onClick.call(c,a,c.legendItems[i]);break}}}}),a.plugins.register({beforeInit:function(b){var c=b.options,d=c.legend;d&&(b.legend=new a.Legend({ctx:b.chart.ctx,options:d,chart:b}),a.layoutService.addBox(b,b.legend))}})}},{}],29:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers.noop;a.plugins={_plugins:[],register:function(a){var b=this._plugins;[].concat(a).forEach(function(a){-1===b.indexOf(a)&&b.push(a)})},unregister:function(a){var b=this._plugins;[].concat(a).forEach(function(a){var c=b.indexOf(a);-1!==c&&b.splice(c,1)})},clear:function(){this._plugins=[]},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(a,b){var c,d,e=this._plugins,f=e.length;for(c=0;f>c;++c)if(d=e[c],"function"==typeof d[a]&&d[a].apply(d,b||[])===!1)return!1;return!0}},a.PluginBase=a.Element.extend({beforeInit:b,afterInit:b,beforeUpdate:b,afterUpdate:b,beforeDraw:b,afterDraw:b,destroy:b}),a.pluginService=a.plugins}},{}],30:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers;a.defaults.scale={display:!0,position:"left",gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:10,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:function(a){return b.isArray(a)?a:""+a}}},a.Scale=a.Element.extend({beforeUpdate:function(){b.callCallback(this.options.beforeUpdate,[this])},update:function(a,c,d){var e=this;return e.beforeUpdate(),e.maxWidth=a,e.maxHeight=c,e.margins=b.extend({left:0,right:0,top:0,bottom:0},d),e.beforeSetDimensions(),e.setDimensions(),e.afterSetDimensions(),e.beforeDataLimits(),e.determineDataLimits(),e.afterDataLimits(),e.beforeBuildTicks(),e.buildTicks(),e.afterBuildTicks(),e.beforeTickToLabelConversion(),e.convertTicksToLabels(),e.afterTickToLabelConversion(),e.beforeCalculateTickRotation(),e.calculateTickRotation(),e.afterCalculateTickRotation(),e.beforeFit(),e.fit(),e.afterFit(),e.afterUpdate(),e.minSize},afterUpdate:function(){b.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){b.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var a=this;a.isHorizontal()?(a.width=a.maxWidth,a.left=0,a.right=a.width):(a.height=a.maxHeight,a.top=0,a.bottom=a.height),a.paddingLeft=0,a.paddingTop=0,a.paddingRight=0,a.paddingBottom=0},afterSetDimensions:function(){b.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){b.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:b.noop,afterDataLimits:function(){b.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){b.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:b.noop,afterBuildTicks:function(){b.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){b.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var a=this;a.ticks=a.ticks.map(function(b,c,d){return a.options.ticks.userCallback?a.options.ticks.userCallback(b,c,d):a.options.ticks.callback(b,c,d)},a)},afterTickToLabelConversion:function(){b.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){b.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var c=this,d=c.ctx,e=a.defaults.global,f=c.options.ticks,g=b.getValueOrDefault(f.fontSize,e.defaultFontSize),h=b.getValueOrDefault(f.fontStyle,e.defaultFontStyle),i=b.getValueOrDefault(f.fontFamily,e.defaultFontFamily),j=b.fontString(g,h,i);d.font=j;var k,l=d.measureText(c.ticks[0]).width,m=d.measureText(c.ticks[c.ticks.length-1]).width;if(c.labelRotation=f.minRotation||0,c.paddingRight=0,c.paddingLeft=0,c.options.display&&c.isHorizontal()){c.paddingRight=m/2+3,c.paddingLeft=l/2+3,c.longestTextCache||(c.longestTextCache={});for(var n,o,p=b.longestText(d,j,c.ticks,c.longestTextCache),q=p,r=c.getPixelForTick(1)-c.getPixelForTick(0)-6;q>r&&c.labelRotationc.yLabelWidth&&(c.paddingLeft=k+g/2),c.paddingRight=g/2,o*p>c.maxHeight){c.labelRotation--;break}c.labelRotation++,q=n*p}}c.margins&&(c.paddingLeft=Math.max(c.paddingLeft-c.margins.left,0),c.paddingRight=Math.max(c.paddingRight-c.margins.right,0))},afterCalculateTickRotation:function(){b.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){b.callCallback(this.options.beforeFit,[this])},fit:function(){var c=this,d=c.minSize={width:0,height:0},e=c.options,f=a.defaults.global,g=e.ticks,h=e.scaleLabel,i=e.display,j=c.isHorizontal(),k=b.getValueOrDefault(g.fontSize,f.defaultFontSize),l=b.getValueOrDefault(g.fontStyle,f.defaultFontStyle),m=b.getValueOrDefault(g.fontFamily,f.defaultFontFamily),n=b.fontString(k,l,m),o=b.getValueOrDefault(h.fontSize,f.defaultFontSize),p=b.getValueOrDefault(h.fontStyle,f.defaultFontStyle),q=b.getValueOrDefault(h.fontFamily,f.defaultFontFamily),r=(b.fontString(o,p,q),e.gridLines.tickMarkLength);if(j?d.width=c.isFullWidth()?c.maxWidth-c.margins.left-c.margins.right:c.maxWidth:d.width=i?r:0,j?d.height=i?r:0:d.height=c.maxHeight,h.display&&i&&(j?d.height+=1.5*o:d.width+=1.5*o),g.display&&i){c.longestTextCache||(c.longestTextCache={});var s=b.longestText(c.ctx,n,c.ticks,c.longestTextCache),t=b.numberOfLabelLines(c.ticks),u=.5*k;if(j){c.longestLabelWidth=s;var v=Math.sin(b.toRadians(c.labelRotation))*c.longestLabelWidth+k*t+u*t;d.height=Math.min(c.maxHeight,d.height+v),c.ctx.font=n;var w=c.ctx.measureText(c.ticks[0]).width,x=c.ctx.measureText(c.ticks[c.ticks.length-1]).width,y=Math.cos(b.toRadians(c.labelRotation)),z=Math.sin(b.toRadians(c.labelRotation));c.paddingLeft=0!==c.labelRotation?y*w+3:w/2+3,c.paddingRight=0!==c.labelRotation?z*(k/2)+3:x/2+3}else{var A=c.maxWidth-d.width,B=g.mirror;B?s=0:s+=c.options.ticks.padding,A>s?d.width+=s:d.width=c.maxWidth,c.paddingTop=k/2,c.paddingBottom=k/2}}c.margins&&(c.paddingLeft=Math.max(c.paddingLeft-c.margins.left,0),c.paddingTop=Math.max(c.paddingTop-c.margins.top,0),c.paddingRight=Math.max(c.paddingRight-c.margins.right,0),c.paddingBottom=Math.max(c.paddingBottom-c.margins.bottom,0)),c.width=d.width,c.height=d.height},afterFit:function(){b.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function c(a){return null===a||"undefined"==typeof a?NaN:"number"==typeof a&&isNaN(a)?NaN:"object"==typeof a?a instanceof Date||a.isValid?a:c(this.isHorizontal()?a.x:a.y):a},getLabelForIndex:b.noop,getPixelForValue:b.noop,getValueForPixel:b.noop,getPixelForTick:function(a,b){var c=this;if(c.isHorizontal()){var d=c.width-(c.paddingLeft+c.paddingRight),e=d/Math.max(c.ticks.length-(c.options.gridLines.offsetGridLines?0:1),1),f=e*a+c.paddingLeft;b&&(f+=e/2);var g=c.left+Math.round(f);return g+=c.isFullWidth()?c.margins.left:0}var h=c.height-(c.paddingTop+c.paddingBottom);return c.top+a*(h/(c.ticks.length-1))},getPixelForDecimal:function(a){var b=this;if(b.isHorizontal()){var c=b.width-(b.paddingLeft+b.paddingRight),d=c*a+b.paddingLeft,e=b.left+Math.round(d);return e+=b.isFullWidth()?b.margins.left:0}return b.top+a*b.height},getBasePixel:function(){var a=this,b=a.min,c=a.max;return a.getPixelForValue(a.beginAtZero?0:0>b&&0>c?c:b>0&&c>0?b:0)},draw:function(c){var d=this,e=d.options;if(e.display){ +var f,g,h=d.ctx,i=a.defaults.global,j=e.ticks,k=e.gridLines,l=e.scaleLabel,m=0!==d.labelRotation,n=j.autoSkip,o=d.isHorizontal();j.maxTicksLimit&&(g=j.maxTicksLimit);var p=b.getValueOrDefault(j.fontColor,i.defaultFontColor),q=b.getValueOrDefault(j.fontSize,i.defaultFontSize),r=b.getValueOrDefault(j.fontStyle,i.defaultFontStyle),s=b.getValueOrDefault(j.fontFamily,i.defaultFontFamily),t=b.fontString(q,r,s),u=k.tickMarkLength,v=b.getValueOrDefault(l.fontColor,i.defaultFontColor),w=b.getValueOrDefault(l.fontSize,i.defaultFontSize),x=b.getValueOrDefault(l.fontStyle,i.defaultFontStyle),y=b.getValueOrDefault(l.fontFamily,i.defaultFontFamily),z=b.fontString(w,x,y),A=b.toRadians(d.labelRotation),B=Math.cos(A),C=(Math.sin(A),d.longestLabelWidth*B);h.fillStyle=p;var D=[];if(o){if(f=!1,m&&(C/=2),(C+j.autoSkipPadding)*d.ticks.length>d.width-(d.paddingLeft+d.paddingRight)&&(f=1+Math.floor((C+j.autoSkipPadding)*d.ticks.length/(d.width-(d.paddingLeft+d.paddingRight)))),g&&d.ticks.length>g)for(;!f||d.ticks.length/(f||1)>g;)f||(f=1),f+=1;n||(f=!1)}var E="right"===e.position?d.left:d.right-u,F="right"===e.position?d.left+u:d.right,G="bottom"===e.position?d.top:d.bottom-u,H="bottom"===e.position?d.top+u:d.bottom;if(b.each(d.ticks,function(a,g){if(void 0!==a&&null!==a){var h=d.ticks.length===g+1,i=f>1&&g%f>0||g%f===0&&g+f>=d.ticks.length;if((!i||h)&&void 0!==a&&null!==a){var l,n;g===("undefined"!=typeof d.zeroLineIndex?d.zeroLineIndex:0)?(l=k.zeroLineWidth,n=k.zeroLineColor):(l=b.getValueAtIndexOrDefault(k.lineWidth,g),n=b.getValueAtIndexOrDefault(k.color,g));var p,q,r,s,t,v,w,x,y,z,B,C="middle";if(o){m||(C="top"===e.position?"bottom":"top"),B=m?"right":"center";var I=d.getPixelForTick(g)+b.aliasPixel(l);y=d.getPixelForTick(g,k.offsetGridLines)+j.labelOffset,z=m?d.top+12:"top"===e.position?d.bottom-u:d.top+u,p=r=t=w=I,q=G,s=H,v=c.top,x=c.bottom}else{"left"===e.position?j.mirror?(y=d.right+j.padding,B="left"):(y=d.right-j.padding,B="right"):j.mirror?(y=d.left-j.padding,B="right"):(y=d.left+j.padding,B="left");var J=d.getPixelForTick(g);J+=b.aliasPixel(l),z=d.getPixelForTick(g,k.offsetGridLines),p=E,r=F,t=c.left,w=c.right,q=s=v=x=J}D.push({tx1:p,ty1:q,tx2:r,ty2:s,x1:t,y1:v,x2:w,y2:x,labelX:y,labelY:z,glWidth:l,glColor:n,rotation:-1*A,label:a,textBaseline:C,textAlign:B})}}}),b.each(D,function(a){if(k.display&&(h.lineWidth=a.glWidth,h.strokeStyle=a.glColor,h.beginPath(),k.drawTicks&&(h.moveTo(a.tx1,a.ty1),h.lineTo(a.tx2,a.ty2)),k.drawOnChartArea&&(h.moveTo(a.x1,a.y1),h.lineTo(a.x2,a.y2)),h.stroke()),j.display){h.save(),h.translate(a.labelX,a.labelY),h.rotate(a.rotation),h.font=t,h.textBaseline=a.textBaseline,h.textAlign=a.textAlign;var c=a.label;if(b.isArray(c))for(var d=0,e=0;db;++b){var f=a[b];if(f&&f.hasValue()){var g=f.tooltipPosition();d.push(g.x),e.push(g.y)}}var h=0,i=0;for(b=0,c-d.length;c>b;++b)h+=d[b],i+=e[b];return{x:Math.round(h/d.length),y:Math.round(i/d.length)}}function d(a){var b=a._xScale,c=a._yScale||a._scale,d=a._index,e=a._datasetIndex;return{xLabel:b?b.getLabelForIndex(d,e):"",yLabel:c?c.getLabelForIndex(d,e):"",index:d,datasetIndex:e}}var e=a.helpers;a.defaults.global.tooltips={enabled:!0,custom:null,mode:"single",backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,yAlign:"center",xAlign:"center",caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",callbacks:{beforeTitle:e.noop,title:function(a,b){var c="",d=b.labels,e=d?d.length:0;if(a.length>0){var f=a[0];f.xLabel?c=f.xLabel:e>0&&f.indexb;++b)o.push(d(j[b]));h.itemSort&&(o=o.sort(h.itemSort)),j.length>1&&e.each(o,function(a){m.push(h.callbacks.labelColor.call(g,a,l))}),e.extend(i,{title:g.getTitle(o,k),beforeBody:g.getBeforeBody(o,k),body:g.getBody(o,k),afterBody:g.getAfterBody(o,k),footer:g.getFooter(o,k),x:Math.round(n.x),y:Math.round(n.y),caretPadding:e.getValueOrDefault(n.padding,2),labelColors:m});var p=g.getTooltipSize(i);g.determineAlignment(p),e.extend(i,g.getBackgroundPoint(i,p))}else g._model.opacity=0;return a&&h.custom&&h.custom.call(g,i),g},getTooltipSize:function(a){var b=this._chart.ctx,c={height:2*a.yPadding,width:0},d=a.body,f=d.reduce(function(a,b){return a+b.before.length+b.lines.length+b.after.length},0);f+=a.beforeBody.length+a.afterBody.length;var g=a.title.length,h=a.footer.length,i=a.titleFontSize,j=a.bodyFontSize,k=a.footerFontSize;c.height+=g*i,c.height+=(g-1)*a.titleSpacing,c.height+=g?a.titleMarginBottom:0,c.height+=f*j,c.height+=f?(f-1)*a.bodySpacing:0,c.height+=h?a.footerMarginTop:0,c.height+=h*k,c.height+=h?(h-1)*a.footerSpacing:0;var l=0,m=function(a){c.width=Math.max(c.width,b.measureText(a).width+l)};return b.font=e.fontString(i,a._titleFontStyle,a._titleFontFamily),e.each(a.title,m),b.font=e.fontString(j,a._bodyFontStyle,a._bodyFontFamily),e.each(a.beforeBody.concat(a.afterBody),m),l=d.length>1?j+2:0,e.each(d,function(a){e.each(a.before,m),e.each(a.lines,m),e.each(a.after,m)}),l=0,b.font=e.fontString(k,a._footerFontStyle,a._footerFontFamily),e.each(a.footer,m),c.width+=2*a.xPadding,c},determineAlignment:function(a){var b=this,c=b._model,d=b._chart,e=b._chartInstance.chartArea;c.yd.height-a.height&&(c.yAlign="bottom");var f,g,h,i,j,k=(e.left+e.right)/2,l=(e.top+e.bottom)/2;"center"===c.yAlign?(f=function(a){return k>=a},g=function(a){return a>k}):(f=function(b){return b<=a.width/2},g=function(b){return b>=d.width-a.width/2}),h=function(b){return b+a.width>d.width},i=function(b){return b-a.width<0},j=function(a){return l>=a?"top":"bottom"},f(c.x)?(c.xAlign="left",h(c.x)&&(c.xAlign="center",c.yAlign=j(c.y))):g(c.x)&&(c.xAlign="right",i(c.x)&&(c.xAlign="center",c.yAlign=j(c.y)))},getBackgroundPoint:function(a,b){var c={x:a.x,y:a.y},d=a.caretSize,e=a.caretPadding,f=a.cornerRadius,g=a.xAlign,h=a.yAlign,i=d+e,j=f+e;return"right"===g?c.x-=b.width:"center"===g&&(c.x-=b.width/2),"top"===h?c.y+=i:"bottom"===h?c.y-=b.height+i:c.y-=b.height/2,"center"===h?"left"===g?c.x+=i:"right"===g&&(c.x-=i):"left"===g?c.x-=j:"right"===g&&(c.x+=j),c},drawCaret:function(a,b,c,d){var f,g,h,i,j,k,l=this._view,m=this._chart.ctx,n=l.caretSize,o=l.cornerRadius,p=l.xAlign,q=l.yAlign,r=a.x,s=a.y,t=b.width,u=b.height;"center"===q?("left"===p?(f=r,g=f-n,h=f):(f=r+t,g=f+n,h=f),j=s+u/2,i=j-n,k=j+n):("left"===p?(f=r+o,g=f+n,h=g+n):"right"===p?(f=r+t-o,g=f-n,h=g-n):(g=r+t/2,f=g-n,h=g+n),"top"===q?(i=s,j=i-n,k=i):(i=s+u,j=i+n,k=i));var v=e.color(l.backgroundColor);m.fillStyle=v.alpha(c*v.alpha()).rgbString(),m.beginPath(),m.moveTo(f,i),m.lineTo(g,j),m.lineTo(h,k),m.closePath(),m.fill()},drawTitle:function(a,b,c,d){var f=b.title;if(f.length){c.textAlign=b._titleAlign,c.textBaseline="top";var g=b.titleFontSize,h=b.titleSpacing,i=e.color(b.titleFontColor);c.fillStyle=i.alpha(d*i.alpha()).rgbString(),c.font=e.fontString(g,b._titleFontStyle,b._titleFontFamily);var j,k;for(j=0,k=f.length;k>j;++j)c.fillText(f[j],a.x,a.y),a.y+=g+h,j+1===f.length&&(a.y+=b.titleMarginBottom-h)}},drawBody:function(a,b,c,d){var f=b.bodyFontSize,g=b.bodySpacing,h=b.body;c.textAlign=b._bodyAlign,c.textBaseline="top";var i=e.color(b.bodyFontColor),j=i.alpha(d*i.alpha()).rgbString();c.fillStyle=j,c.font=e.fontString(f,b._bodyFontStyle,b._bodyFontFamily);var k=0,l=function(b){c.fillText(b,a.x+k,a.y),a.y+=f+g};e.each(b.beforeBody,l);var m=h.length>1;k=m?f+2:0,e.each(h,function(g,h){e.each(g.before,l),e.each(g.lines,function(g){m&&(c.fillStyle=e.color(b.legendColorBackground).alpha(d).rgbaString(),c.fillRect(a.x,a.y,f,f),c.strokeStyle=e.color(b.labelColors[h].borderColor).alpha(d).rgbaString(),c.strokeRect(a.x,a.y,f,f),c.fillStyle=e.color(b.labelColors[h].backgroundColor).alpha(d).rgbaString(),c.fillRect(a.x+1,a.y+1,f-2,f-2),c.fillStyle=j),l(g)}),e.each(g.after,l)}),k=0,e.each(b.afterBody,l),a.y-=g},drawFooter:function(a,b,c,d){var f=b.footer;if(f.length){a.y+=b.footerMarginTop,c.textAlign=b._footerAlign,c.textBaseline="top";var g=e.color(b.footerFontColor);c.fillStyle=g.alpha(d*g.alpha()).rgbString(),c.font=e.fontString(b.footerFontSize,b._footerFontStyle,b._footerFontFamily),e.each(f,function(d){c.fillText(d,a.x,a.y),a.y+=b.footerFontSize+b.footerSpacing})}},draw:function(){var a=this._chart.ctx,b=this._view;if(0!==b.opacity){var c=this.getTooltipSize(b),d={x:b.x,y:b.y},f=Math.abs(b.opacity<.001)?0:b.opacity;if(this._options.enabled){var g=e.color(b.backgroundColor);a.fillStyle=g.alpha(f*g.alpha()).rgbString(),e.drawRoundedRectangle(a,d.x,d.y,c.width,c.height,b.cornerRadius),a.fill(),this.drawCaret(d,c,f,b.caretPadding),d.x+=b.xPadding,d.y+=b.yPadding,this.drawTitle(d,b,a,f),this.drawBody(d,b,a,f),this.drawFooter(d,b,a,f)}}}})}},{}],34:[function(a,b,c){"use strict";b.exports=function(a,b){var c=a.helpers,d=a.defaults.global;d.elements.arc={backgroundColor:d.defaultColor,borderColor:"#fff",borderWidth:2},a.elements.Arc=a.Element.extend({inLabelRange:function(a){var b=this._view;return b?Math.pow(a-b.x,2)i;)i+=2*Math.PI;for(;f>i;)f-=2*Math.PI;for(;h>f;)f+=2*Math.PI;var j=f>=h&&i>=f,k=g>=d.innerRadius&&g<=d.outerRadius;return j&&k}return!1},tooltipPosition:function(){var a=this._view,b=a.startAngle+(a.endAngle-a.startAngle)/2,c=(a.outerRadius-a.innerRadius)/2+a.innerRadius;return{x:a.x+Math.cos(b)*c,y:a.y+Math.sin(b)*c}},draw:function(){var a=this._chart.ctx,b=this._view,c=b.startAngle,d=b.endAngle;a.beginPath(),a.arc(b.x,b.y,b.outerRadius,c,d),a.arc(b.x,b.y,b.innerRadius,d,c,!0),a.closePath(),a.strokeStyle=b.borderColor,a.lineWidth=b.borderWidth,a.fillStyle=b.backgroundColor,a.fill(),a.lineJoin="bevel",b.borderWidth&&a.stroke()}})}},{}],35:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=a.defaults.global;a.defaults.global.elements.line={tension:.4,backgroundColor:c.defaultColor,borderWidth:3,borderColor:c.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",fill:!0},a.elements.Line=a.Element.extend({lineToNextPoint:function(a,b,c,d,e){var f=this,g=f._chart.ctx,h=f._view?f._view.spanGaps:!1;b._view.skip&&!h?d.call(f,a,b,c):a._view.skip&&!h?e.call(f,a,b,c):0===b._view.tension?g.lineTo(b._view.x,b._view.y):g.bezierCurveTo(a._view.controlPointNextX,a._view.controlPointNextY,b._view.controlPointPreviousX,b._view.controlPointPreviousY,b._view.x,b._view.y)},draw:function(){function a(a){g._view.skip||h._view.skip?a&&f.lineTo(d._view.scaleZero.x,d._view.scaleZero.y):f.bezierCurveTo(h._view.controlPointNextX,h._view.controlPointNextY,g._view.controlPointPreviousX,g._view.controlPointPreviousY,g._view.x,g._view.y)}var d=this,e=d._view,f=d._chart.ctx,g=d._children[0],h=d._children[d._children.length-1];f.save(),d._children.length>0&&e.fill&&(f.beginPath(),b.each(d._children,function(a,c){var g=b.previousItem(d._children,c),h=b.nextItem(d._children,c);0===c?(d._loop?f.moveTo(e.scaleZero.x,e.scaleZero.y):f.moveTo(a._view.x,e.scaleZero),a._view.skip?d._loop||f.moveTo(h._view.x,d._view.scaleZero):f.lineTo(a._view.x,a._view.y)):d.lineToNextPoint(g,a,h,function(a,b,c){d._loop?f.lineTo(d._view.scaleZero.x,d._view.scaleZero.y):(f.lineTo(a._view.x,d._view.scaleZero),f.moveTo(c._view.x,d._view.scaleZero))},function(a,b){f.lineTo(b._view.x,b._view.y)})},d),d._loop?a(!0):(f.lineTo(d._children[d._children.length-1]._view.x,e.scaleZero),f.lineTo(d._children[0]._view.x,e.scaleZero)),f.fillStyle=e.backgroundColor||c.defaultColor,f.closePath(),f.fill());var i=c.elements.line;f.lineCap=e.borderCapStyle||i.borderCapStyle,f.setLineDash&&f.setLineDash(e.borderDash||i.borderDash),f.lineDashOffset=e.borderDashOffset||i.borderDashOffset,f.lineJoin=e.borderJoinStyle||i.borderJoinStyle,f.lineWidth=e.borderWidth||i.borderWidth,f.strokeStyle=e.borderColor||c.defaultColor,f.beginPath(),b.each(d._children,function(a,c){var e=b.previousItem(d._children,c),g=b.nextItem(d._children,c);0===c?f.moveTo(a._view.x,a._view.y):d.lineToNextPoint(e,a,g,function(a,b,c){f.moveTo(c._view.x,c._view.y)},function(a,b){f.moveTo(b._view.x,b._view.y)})},d),d._loop&&d._children.length>0&&a(),f.stroke(),f.restore()}})}},{}],36:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=a.defaults.global,d=c.defaultColor;c.elements.point={radius:3,pointStyle:"circle",backgroundColor:d,borderWidth:1,borderColor:d,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},a.elements.Point=a.Element.extend({inRange:function(a,b){var c=this._view;return c?Math.pow(a-c.x,2)+Math.pow(b-c.y,2)=m)){switch(k.strokeStyle=j.borderColor||d,k.lineWidth=b.getValueOrDefault(j.borderWidth,c.elements.point.borderWidth),k.fillStyle=j.backgroundColor||d,l){default:k.beginPath(),k.arc(n,o,m,0,2*Math.PI),k.closePath(),k.fill();break;case"triangle":k.beginPath(),e=3*m/Math.sqrt(3),h=e*Math.sqrt(3)/2,k.moveTo(n-e/2,o+h/3),k.lineTo(n+e/2,o+h/3),k.lineTo(n,o-2*h/3),k.closePath(),k.fill();break;case"rect":i=1/Math.SQRT2*m,k.fillRect(n-i,o-i,2*i,2*i),k.strokeRect(n-i,o-i,2*i,2*i);break;case"rectRot":i=1/Math.SQRT2*m,k.beginPath(),k.moveTo(n-i,o),k.lineTo(n,o+i),k.lineTo(n+i,o),k.lineTo(n,o-i),k.closePath(),k.fill();break;case"cross":k.beginPath(),k.moveTo(n,o+m),k.lineTo(n,o-m),k.moveTo(n-m,o),k.lineTo(n+m,o),k.closePath();break;case"crossRot":k.beginPath(),f=Math.cos(Math.PI/4)*m,g=Math.sin(Math.PI/4)*m,k.moveTo(n-f,o-g),k.lineTo(n+f,o+g),k.moveTo(n-f,o+g),k.lineTo(n+f,o-g),k.closePath();break;case"star":k.beginPath(),k.moveTo(n,o+m),k.lineTo(n,o-m),k.moveTo(n-m,o),k.lineTo(n+m,o),f=Math.cos(Math.PI/4)*m,g=Math.sin(Math.PI/4)*m,k.moveTo(n-f,o-g),k.lineTo(n+f,o+g),k.moveTo(n-f,o+g),k.lineTo(n+f,o-g),k.closePath();break;case"line":k.beginPath(),k.moveTo(n-m,o),k.lineTo(n+m,o),k.closePath();break;case"dash":k.beginPath(),k.moveTo(n,o),k.lineTo(n+m,o),k.closePath()}k.stroke()}}}})}},{}],37:[function(a,b,c){"use strict";b.exports=function(a){var b=(a.helpers,a.defaults.global);b.elements.rectangle={backgroundColor:b.defaultColor,borderWidth:0,borderColor:b.defaultColor,borderSkipped:"bottom"},a.elements.Rectangle=a.Element.extend({draw:function(){function a(a){return i[(k+a)%4]}var b=this._chart.ctx,c=this._view,d=c.width/2,e=c.x-d,f=c.x+d,g=c.base-(c.base-c.y),h=c.borderWidth/2;c.borderWidth&&(e+=h,f-=h,g+=h),b.beginPath(),b.fillStyle=c.backgroundColor,b.strokeStyle=c.borderColor,b.lineWidth=c.borderWidth;var i=[[e,c.base],[e,g],[f,g],[f,c.base]],j=["bottom","left","top","right"],k=j.indexOf(c.borderSkipped,0);-1===k&&(k=0),b.moveTo.apply(b,a(0));for(var l=1;4>l;l++)b.lineTo.apply(b,a(l));b.fill(),c.borderWidth&&b.stroke()},height:function(){var a=this._view;return a.base-a.y},inRange:function(a,b){var c=this._view;return c?c.y=c.x-c.width/2&&a<=c.x+c.width/2&&b>=c.y&&b<=c.base:a>=c.x-c.width/2&&a<=c.x+c.width/2&&b>=c.base&&b<=c.y:!1},inLabelRange:function(a){var b=this._view;return b?a>=b.x-b.width/2&&a<=b.x+b.width/2:!1},tooltipPosition:function(){var a=this._view;return{x:a.x,y:a.y}}})}},{}],38:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c={position:"bottom"},d=a.Scale.extend({determineDataLimits:function(){var a=this;a.minIndex=0,a.maxIndex=a.chart.data.labels.length-1;var c;void 0!==a.options.ticks.min&&(c=b.indexOf(a.chart.data.labels,a.options.ticks.min),a.minIndex=-1!==c?c:a.minIndex),void 0!==a.options.ticks.max&&(c=b.indexOf(a.chart.data.labels,a.options.ticks.max),a.maxIndex=-1!==c?c:a.maxIndex),a.min=a.chart.data.labels[a.minIndex],a.max=a.chart.data.labels[a.maxIndex]},buildTicks:function(a){var b=this;b.ticks=0===b.minIndex&&b.maxIndex===b.chart.data.labels.length-1?b.chart.data.labels:b.chart.data.labels.slice(b.minIndex,b.maxIndex+1)},getLabelForIndex:function(a,b){return this.ticks[a]},getPixelForValue:function(a,b,c,d){var e=this,f=Math.max(e.maxIndex+1-e.minIndex-(e.options.gridLines.offsetGridLines?0:1),1);if(e.isHorizontal()){var g=e.width-(e.paddingLeft+e.paddingRight),h=g/f,i=h*(b-e.minIndex)+e.paddingLeft;return e.options.gridLines.offsetGridLines&&d&&(i+=h/2),e.left+Math.round(i)}var j=e.height-(e.paddingTop+e.paddingBottom),k=j/f,l=k*(b-e.minIndex)+e.paddingTop;return e.options.gridLines.offsetGridLines&&d&&(l+=k/2),e.top+Math.round(l)},getPixelForTick:function(a,b){return this.getPixelForValue(this.ticks[a],a+this.minIndex,null,b)},getValueForPixel:function(a){var b,c=this,d=Math.max(c.ticks.length-(c.options.gridLines.offsetGridLines?0:1),1),e=c.isHorizontal(),f=e?c.width-(c.paddingLeft+c.paddingRight):c.height-(c.paddingTop+c.paddingBottom),g=f/d;return c.options.gridLines.offsetGridLines&&(a-=g/2),a-=e?c.paddingLeft:c.paddingTop,b=0>=a?0:Math.round(a/g)}});a.scaleService.registerScaleType("category",d,c)}},{}],39:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c={position:"left",ticks:{callback:function(a,c,d){var e=d.length>3?d[2]-d[1]:d[1]-d[0];Math.abs(e)>1&&a!==Math.floor(a)&&(e=a-Math.floor(a));var f=b.log10(Math.abs(e)),g="";if(0!==a){var h=-1*Math.floor(f);h=Math.max(Math.min(h,20),0),g=a.toFixed(h)}else g="0";return g}}},d=a.LinearScaleBase.extend({determineDataLimits:function(){function a(a){return h?a.xAxisID===c.id:a.yAxisID===c.id}var c=this,d=c.options,e=(d.ticks,c.chart),f=e.data,g=f.datasets,h=c.isHorizontal();if(c.min=null,c.max=null,d.stacked){var i={},j=!1,k=!1;b.each(g,function(f,g){var h=e.getDatasetMeta(g);void 0===i[h.type]&&(i[h.type]={positiveValues:[],negativeValues:[]});var l=i[h.type].positiveValues,m=i[h.type].negativeValues;e.isDatasetVisible(g)&&a(h)&&b.each(f.data,function(a,b){var e=+c.getRightValue(a);isNaN(e)||h.data[b].hidden||(l[b]=l[b]||0,m[b]=m[b]||0,d.relativePoints?l[b]=100:0>e?(k=!0,m[b]+=e):(j=!0,l[b]+=e))})}),b.each(i,function(a){var d=a.positiveValues.concat(a.negativeValues),e=b.min(d),f=b.max(d);c.min=null===c.min?e:Math.min(c.min,e),c.max=null===c.max?f:Math.max(c.max,f)})}else b.each(g,function(d,f){var g=e.getDatasetMeta(f);e.isDatasetVisible(f)&&a(g)&&b.each(d.data,function(a,b){var d=+c.getRightValue(a);isNaN(d)||g.data[b].hidden||(null===c.min?c.min=d:dc.max&&(c.max=d))})});this.handleTickRangeOptions()},getTickLimit:function(){var c,d=this,e=d.options.ticks;if(d.isHorizontal())c=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(d.width/50));else{var f=b.getValueOrDefault(e.fontSize,a.defaults.global.defaultFontSize);c=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(d.height/(2*f)))}return c},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(a,b){return+this.getRightValue(this.chart.data.datasets[b].data[a])},getPixelForValue:function(a,b,c,d){var e,f,g=this,h=g.paddingLeft,i=g.paddingBottom,j=g.start,k=+g.getRightValue(a),l=g.end-j;return g.isHorizontal()?(f=g.width-(h+g.paddingRight),e=g.left+f/l*(k-j),Math.round(e+h)):(f=g.height-(g.paddingTop+i),e=g.bottom-i-f/l*(k-j),Math.round(e))},getValueForPixel:function(a){var b=this,c=b.isHorizontal(),d=b.paddingLeft,e=b.paddingBottom,f=c?b.width-(d+b.paddingRight):b.height-(b.paddingTop+e),g=(c?a-b.left-d:b.bottom-e-a)/f;return b.start+(b.end-b.start)*g},getPixelForTick:function(a,b){return this.getPixelForValue(this.ticksAsNumbers[a],null,null,b)}});a.scaleService.registerScaleType("linear",d,c)}},{}],40:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c=b.noop;a.LinearScaleBase=a.Scale.extend({handleTickRangeOptions:function(){var a=this,c=a.options,d=c.ticks;if(d.beginAtZero){var e=b.sign(a.min),f=b.sign(a.max);0>e&&0>f?a.max=0:e>0&&f>0&&(a.min=0)}void 0!==d.min?a.min=d.min:void 0!==d.suggestedMin&&(a.min=Math.min(a.min,d.suggestedMin)),void 0!==d.max?a.max=d.max:void 0!==d.suggestedMax&&(a.max=Math.max(a.max,d.suggestedMax)),a.min===a.max&&(a.max++,d.beginAtZero||a.min--)},getTickLimit:c,handleDirectionalChanges:c,buildTicks:function(){var a=this,c=a.options,d=c.ticks,e=b.getValueOrDefault,f=(a.isHorizontal(),a.ticks=[]),g=a.getTickLimit();g=Math.max(2,g);var h,i=d.fixedStepSize&&d.fixedStepSize>0||d.stepSize&&d.stepSize>0;if(i)h=e(d.fixedStepSize,d.stepSize);else{var j=b.niceNum(a.max-a.min,!1);h=b.niceNum(j/(g-1),!0)}var k=Math.floor(a.min/h)*h,l=Math.ceil(a.max/h)*h,m=(l-k)/h;m=b.almostEquals(m,Math.round(m),h/1e3)?Math.round(m):Math.ceil(m),f.push(void 0!==d.min?d.min:k);for(var n=1;m>n;++n)f.push(k+n*h);f.push(void 0!==d.max?d.max:l),a.handleDirectionalChanges(),a.max=b.max(f),a.min=b.min(f),d.reverse?(f.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){var b=this;b.ticksAsNumbers=b.ticks.slice(),b.zeroLineIndex=b.ticks.indexOf(0),a.Scale.prototype.convertTicksToLabels.call(b)}})}},{}],41:[function(a,b,c){"use strict";b.exports=function(a){var b=a.helpers,c={position:"left",ticks:{callback:function(a,c,d){var e=a/Math.pow(10,Math.floor(b.log10(a)));return 1===e||2===e||5===e||0===c||c===d.length-1?a.toExponential():""}}},d=a.Scale.extend({determineDataLimits:function(){function a(a){return j?a.xAxisID===c.id:a.yAxisID===c.id}var c=this,d=c.options,e=d.ticks,f=c.chart,g=f.data,h=g.datasets,i=b.getValueOrDefault,j=c.isHorizontal();if(c.min=null,c.max=null,d.stacked){var k={};b.each(h,function(e,g){var h=f.getDatasetMeta(g);f.isDatasetVisible(g)&&a(h)&&(void 0===k[h.type]&&(k[h.type]=[]),b.each(e.data,function(a,b){var e=k[h.type],f=+c.getRightValue(a);isNaN(f)||h.data[b].hidden||(e[b]=e[b]||0,d.relativePoints?e[b]=100:e[b]+=f)}))}),b.each(k,function(a){var d=b.min(a),e=b.max(a);c.min=null===c.min?d:Math.min(c.min,d),c.max=null===c.max?e:Math.max(c.max,e)})}else b.each(h,function(d,e){var g=f.getDatasetMeta(e);f.isDatasetVisible(e)&&a(g)&&b.each(d.data,function(a,b){var d=+c.getRightValue(a);isNaN(d)||g.data[b].hidden||(null===c.min?c.min=d:dc.max&&(c.max=d))})});c.min=i(e.min,c.min),c.max=i(e.max,c.max),c.min===c.max&&(0!==c.min&&null!==c.min?(c.min=Math.pow(10,Math.floor(b.log10(c.min))-1),c.max=Math.pow(10,Math.floor(b.log10(c.max))+1)):(c.min=1,c.max=10))},buildTicks:function(){for(var a=this,c=a.options,d=c.ticks,e=b.getValueOrDefault,f=a.ticks=[],g=e(d.min,Math.pow(10,Math.floor(b.log10(a.min))));ga.max&&(a.max=d))})}}),a.handleTickRangeOptions()},getTickLimit:function(){var a=this.options.ticks,d=b.getValueOrDefault(a.fontSize,c.defaultFontSize);return Math.min(a.maxTicksLimit?a.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*d)))},convertTicksToLabels:function(){ +var b=this;a.LinearScaleBase.prototype.convertTicksToLabels.call(b),b.pointLabels=b.chart.data.labels.map(b.options.pointLabels.callback,b)},getLabelForIndex:function(a,b){return+this.getRightValue(this.chart.data.datasets[b].data[a])},fit:function(){var a,d,e,f,g,h,i,j,k,l,m,n,o=this.options.pointLabels,p=b.getValueOrDefault(o.fontSize,c.defaultFontSize),q=b.getValueOrDefault(o.fontStyle,c.defaultFontStyle),r=b.getValueOrDefault(o.fontFamily,c.defaultFontFamily),s=b.fontString(p,q,r),t=b.min([this.height/2-p-5,this.width/2]),u=this.width,v=0;for(this.ctx.font=s,d=0;du&&(u=a.x+f,g=d),a.x-fu&&(u=a.x+e,g=d):d>this.getValueCount()/2&&a.x-eb&&0>c?c:b>0&&c>0?b:0)},draw:function(){var a=this,d=a.options,e=d.gridLines,f=d.ticks,g=d.angleLines,h=d.pointLabels,i=b.getValueOrDefault;if(d.display){var j=a.ctx,k=i(f.fontSize,c.defaultFontSize),l=i(f.fontStyle,c.defaultFontStyle),m=i(f.fontFamily,c.defaultFontFamily),n=b.fontString(k,l,m);if(b.each(a.ticks,function(g,h){if(h>0||d.reverse){var l=a.getDistanceFromCenterForValue(a.ticksAsNumbers[h]),m=a.yCenter-l;if(e.display&&0!==h)if(j.strokeStyle=b.getValueAtIndexOrDefault(e.color,h-1),j.lineWidth=b.getValueAtIndexOrDefault(e.lineWidth,h-1),d.lineArc)j.beginPath(),j.arc(a.xCenter,a.yCenter,l,0,2*Math.PI),j.closePath(),j.stroke();else{j.beginPath();for(var o=0;o=0;t--){if(g.display){var u=a.getPointPosition(t,o);j.beginPath(),j.moveTo(a.xCenter,a.yCenter),j.lineTo(u.x,u.y),j.stroke(),j.closePath()}var v=a.getPointPosition(t,o+5),w=i(h.fontColor,c.defaultFontColor);j.font=s,j.fillStyle=w;var x=a.pointLabels,y=x.length,z=x.length/2,A=z/2,B=A>t||t>y-A,C=t===A||t===y-A;0===t?j.textAlign="center":t===z?j.textAlign="center":z>t?j.textAlign="left":j.textAlign="right",C?j.textBaseline="middle":B?j.textBaseline="bottom":j.textBaseline="top",j.fillText(x[t]?x[t]:"",v.x,v.y)}}}}});a.scaleService.registerScaleType("radialLinear",e,d)}},{}],43:[function(a,b,c){"use strict";var d=a(1);d="function"==typeof d?d:window.moment,b.exports=function(a){var b=a.helpers,c={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},e={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},f=a.Scale.extend({initialize:function(){if(!d)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");a.Scale.prototype.initialize.call(this)},getLabelMoment:function(a,b){return this.labelMoments[a][b]},getMomentStartOf:function(a){var b=this;return"week"===b.options.time.unit&&b.options.time.isoWeekday!==!1?a.clone().startOf("isoWeek").isoWeekday(b.options.time.isoWeekday):a.clone().startOf(b.tickUnit)},determineDataLimits:function(){var a=this;a.labelMoments=[];var c=[];a.chart.data.labels&&a.chart.data.labels.length>0?(b.each(a.chart.data.labels,function(b,d){var e=a.parseTime(b);e.isValid()&&(a.options.time.round&&e.startOf(a.options.time.round),c.push(e))},a),a.firstTick=d.min.call(a,c),a.lastTick=d.max.call(a,c)):(a.firstTick=null,a.lastTick=null),b.each(a.chart.data.datasets,function(e,f){var g=[],h=a.chart.isDatasetVisible(f);"object"==typeof e.data[0]&&null!==e.data[0]?b.each(e.data,function(b,c){var e=a.parseTime(a.getRightValue(b));e.isValid()&&(a.options.time.round&&e.startOf(a.options.time.round),g.push(e),h&&(a.firstTick=null!==a.firstTick?d.min(a.firstTick,e):e,a.lastTick=null!==a.lastTick?d.max(a.lastTick,e):e))},a):g=c,a.labelMoments.push(g)},a),a.options.time.min&&(a.firstTick=a.parseTime(a.options.time.min)),a.options.time.max&&(a.lastTick=a.parseTime(a.options.time.max)),a.firstTick=(a.firstTick||d()).clone(),a.lastTick=(a.lastTick||d()).clone()},buildTicks:function(d){var e=this;e.ctx.save();var f=b.getValueOrDefault(e.options.ticks.fontSize,a.defaults.global.defaultFontSize),g=b.getValueOrDefault(e.options.ticks.fontStyle,a.defaults.global.defaultFontStyle),h=b.getValueOrDefault(e.options.ticks.fontFamily,a.defaults.global.defaultFontFamily),i=b.fontString(f,g,h);if(e.ctx.font=i,e.ticks=[],e.unitScale=1,e.scaleSizeInUnits=0,e.options.time.unit)e.tickUnit=e.options.time.unit||"day",e.displayFormat=e.options.time.displayFormats[e.tickUnit],e.scaleSizeInUnits=e.lastTick.diff(e.firstTick,e.tickUnit,!0),e.unitScale=b.getValueOrDefault(e.options.time.unitStepSize,1);else{var j=e.isHorizontal()?e.width-(e.paddingLeft+e.paddingRight):e.height-(e.paddingTop+e.paddingBottom),k=e.tickFormatFunction(e.firstTick,0,[]),l=e.ctx.measureText(k).width,m=Math.cos(b.toRadians(e.options.ticks.maxRotation)),n=Math.sin(b.toRadians(e.options.ticks.maxRotation));l=l*m+f*n;var o=j/l;e.tickUnit="millisecond",e.scaleSizeInUnits=e.lastTick.diff(e.firstTick,e.tickUnit,!0),e.displayFormat=e.options.time.displayFormats[e.tickUnit];for(var p=0,q=c.units[p];p=Math.ceil(e.scaleSizeInUnits/o)){e.unitScale=b.getValueOrDefault(e.options.time.unitStepSize,q.steps[r]);break}break}if(q.maxStep===!1||Math.ceil(e.scaleSizeInUnits/o)=0)break;w%e.unitScale===0&&e.ticks.push(x)}var y=e.ticks[e.ticks.length-1].diff(e.lastTick,e.tickUnit);(0!==y||0===e.scaleSizeInUnits)&&(e.options.time.max?(e.ticks.push(e.lastTick.clone()),e.scaleSizeInUnits=e.lastTick.diff(e.ticks[0],e.tickUnit,!0)):(e.ticks.push(e.lastTick.clone()),e.scaleSizeInUnits=e.lastTick.diff(e.firstTick,e.tickUnit,!0))),e.ctx.restore()},getLabelForIndex:function(a,b){var c=this,d=c.chart.data.labels&&a lum2) { + return (lum1 + 0.05) / (lum2 + 0.05); + } + return (lum2 + 0.05) / (lum1 + 0.05); + }, + + level: function (color2) { + var contrastRatio = this.contrast(color2); + if (contrastRatio >= 7.1) { + return 'AAA'; + } + + return (contrastRatio >= 4.5) ? 'AA' : ''; + }, + + dark: function () { + // YIQ equation from http://24ways.org/2010/calculating-color-contrast + var rgb = this.values.rgb; + var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000; + return yiq < 128; + }, + + light: function () { + return !this.dark(); + }, + + negate: function () { + var rgb = []; + for (var i = 0; i < 3; i++) { + rgb[i] = 255 - this.values.rgb[i]; + } + this.setValues('rgb', rgb); + return this; + }, + + lighten: function (ratio) { + var hsl = this.values.hsl; + hsl[2] += hsl[2] * ratio; + this.setValues('hsl', hsl); + return this; + }, + + darken: function (ratio) { + var hsl = this.values.hsl; + hsl[2] -= hsl[2] * ratio; + this.setValues('hsl', hsl); + return this; + }, + + saturate: function (ratio) { + var hsl = this.values.hsl; + hsl[1] += hsl[1] * ratio; + this.setValues('hsl', hsl); + return this; + }, + + desaturate: function (ratio) { + var hsl = this.values.hsl; + hsl[1] -= hsl[1] * ratio; + this.setValues('hsl', hsl); + return this; + }, + + whiten: function (ratio) { + var hwb = this.values.hwb; + hwb[1] += hwb[1] * ratio; + this.setValues('hwb', hwb); + return this; + }, + + blacken: function (ratio) { + var hwb = this.values.hwb; + hwb[2] += hwb[2] * ratio; + this.setValues('hwb', hwb); + return this; + }, + + greyscale: function () { + var rgb = this.values.rgb; + // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale + var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11; + this.setValues('rgb', [val, val, val]); + return this; + }, + + clearer: function (ratio) { + var alpha = this.values.alpha; + this.setValues('alpha', alpha - (alpha * ratio)); + return this; + }, + + opaquer: function (ratio) { + var alpha = this.values.alpha; + this.setValues('alpha', alpha + (alpha * ratio)); + return this; + }, + + rotate: function (degrees) { + var hsl = this.values.hsl; + var hue = (hsl[0] + degrees) % 360; + hsl[0] = hue < 0 ? 360 + hue : hue; + this.setValues('hsl', hsl); + return this; + }, + + /** + * Ported from sass implementation in C + * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 + */ + mix: function (mixinColor, weight) { + var color1 = this; + var color2 = mixinColor; + var p = weight === undefined ? 0.5 : weight; + + var w = 2 * p - 1; + var a = color1.alpha() - color2.alpha(); + + var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; + var w2 = 1 - w1; + + return this + .rgb( + w1 * color1.red() + w2 * color2.red(), + w1 * color1.green() + w2 * color2.green(), + w1 * color1.blue() + w2 * color2.blue() + ) + .alpha(color1.alpha() * p + color2.alpha() * (1 - p)); + }, + + toJSON: function () { + return this.rgb(); + }, + + clone: function () { + // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify, + // making the final build way to big to embed in Chart.js. So let's do it manually, + // assuming that values to clone are 1 dimension arrays containing only numbers, + // except 'alpha' which is a number. + var result = new Color(); + var source = this.values; + var target = result.values; + var value, type; + + for (var prop in source) { + if (source.hasOwnProperty(prop)) { + value = source[prop]; + type = ({}).toString.call(value); + if (type === '[object Array]') { + target[prop] = value.slice(0); + } else if (type === '[object Number]') { + target[prop] = value; + } else { + console.error('unexpected color value:', value); + } + } + } + + return result; + } +}; + +Color.prototype.spaces = { + rgb: ['red', 'green', 'blue'], + hsl: ['hue', 'saturation', 'lightness'], + hsv: ['hue', 'saturation', 'value'], + hwb: ['hue', 'whiteness', 'blackness'], + cmyk: ['cyan', 'magenta', 'yellow', 'black'] +}; + +Color.prototype.maxes = { + rgb: [255, 255, 255], + hsl: [360, 100, 100], + hsv: [360, 100, 100], + hwb: [360, 100, 100], + cmyk: [100, 100, 100, 100] +}; + +Color.prototype.getValues = function (space) { + var values = this.values; + var vals = {}; + + for (var i = 0; i < space.length; i++) { + vals[space.charAt(i)] = values[space][i]; + } + + if (values.alpha !== 1) { + vals.a = values.alpha; + } + + // {r: 255, g: 255, b: 255, a: 0.4} + return vals; +}; + +Color.prototype.setValues = function (space, vals) { + var values = this.values; + var spaces = this.spaces; + var maxes = this.maxes; + var alpha = 1; + var i; + + if (space === 'alpha') { + alpha = vals; + } else if (vals.length) { + // [10, 10, 10] + values[space] = vals.slice(0, space.length); + alpha = vals[space.length]; + } else if (vals[space.charAt(0)] !== undefined) { + // {r: 10, g: 10, b: 10} + for (i = 0; i < space.length; i++) { + values[space][i] = vals[space.charAt(i)]; + } + + alpha = vals.a; + } else if (vals[spaces[space][0]] !== undefined) { + // {red: 10, green: 10, blue: 10} + var chans = spaces[space]; + + for (i = 0; i < space.length; i++) { + values[space][i] = vals[chans[i]]; + } + + alpha = vals.alpha; + } + + values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha))); + + if (space === 'alpha') { + return false; + } + + var capped; + + // cap values of the space prior converting all values + for (i = 0; i < space.length; i++) { + capped = Math.max(0, Math.min(maxes[space][i], values[space][i])); + values[space][i] = Math.round(capped); + } + + // convert to all the other color spaces + for (var sname in spaces) { + if (sname !== space) { + values[sname] = convert[space][sname](values[space]); + } + } + + return true; +}; + +Color.prototype.setSpace = function (space, args) { + var vals = args[0]; + + if (vals === undefined) { + // color.rgb() + return this.getValues(space); + } + + // color.rgb(10, 10, 10) + if (typeof vals === 'number') { + vals = Array.prototype.slice.call(args); + } + + this.setValues(space, vals); + return this; +}; + +Color.prototype.setChannel = function (space, index, val) { + var svalues = this.values[space]; + if (val === undefined) { + // color.red() + return svalues[index]; + } else if (val === svalues[index]) { + // color.red(color.red()) + return this; + } + + // color.red(100) + svalues[index] = val; + this.setValues(space, svalues); + + return this; +}; + +if (typeof window !== 'undefined') { + window.Color = Color; +} + +module.exports = Color; + +},{"2":2,"5":5}],4:[function(require,module,exports){ +/* MIT license */ + +module.exports = { + rgb2hsl: rgb2hsl, + rgb2hsv: rgb2hsv, + rgb2hwb: rgb2hwb, + rgb2cmyk: rgb2cmyk, + rgb2keyword: rgb2keyword, + rgb2xyz: rgb2xyz, + rgb2lab: rgb2lab, + rgb2lch: rgb2lch, + + hsl2rgb: hsl2rgb, + hsl2hsv: hsl2hsv, + hsl2hwb: hsl2hwb, + hsl2cmyk: hsl2cmyk, + hsl2keyword: hsl2keyword, + + hsv2rgb: hsv2rgb, + hsv2hsl: hsv2hsl, + hsv2hwb: hsv2hwb, + hsv2cmyk: hsv2cmyk, + hsv2keyword: hsv2keyword, + + hwb2rgb: hwb2rgb, + hwb2hsl: hwb2hsl, + hwb2hsv: hwb2hsv, + hwb2cmyk: hwb2cmyk, + hwb2keyword: hwb2keyword, + + cmyk2rgb: cmyk2rgb, + cmyk2hsl: cmyk2hsl, + cmyk2hsv: cmyk2hsv, + cmyk2hwb: cmyk2hwb, + cmyk2keyword: cmyk2keyword, + + keyword2rgb: keyword2rgb, + keyword2hsl: keyword2hsl, + keyword2hsv: keyword2hsv, + keyword2hwb: keyword2hwb, + keyword2cmyk: keyword2cmyk, + keyword2lab: keyword2lab, + keyword2xyz: keyword2xyz, + + xyz2rgb: xyz2rgb, + xyz2lab: xyz2lab, + xyz2lch: xyz2lch, + + lab2xyz: lab2xyz, + lab2rgb: lab2rgb, + lab2lch: lab2lch, + + lch2lab: lch2lab, + lch2xyz: lch2xyz, + lch2rgb: lch2rgb +} + + +function rgb2hsl(rgb) { + var r = rgb[0]/255, + g = rgb[1]/255, + b = rgb[2]/255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + delta = max - min, + h, s, l; + + if (max == min) + h = 0; + else if (r == max) + h = (g - b) / delta; + else if (g == max) + h = 2 + (b - r) / delta; + else if (b == max) + h = 4 + (r - g)/ delta; + + h = Math.min(h * 60, 360); + + if (h < 0) + h += 360; + + l = (min + max) / 2; + + if (max == min) + s = 0; + else if (l <= 0.5) + s = delta / (max + min); + else + s = delta / (2 - max - min); + + return [h, s * 100, l * 100]; +} + +function rgb2hsv(rgb) { + var r = rgb[0], + g = rgb[1], + b = rgb[2], + min = Math.min(r, g, b), + max = Math.max(r, g, b), + delta = max - min, + h, s, v; + + if (max == 0) + s = 0; + else + s = (delta/max * 1000)/10; + + if (max == min) + h = 0; + else if (r == max) + h = (g - b) / delta; + else if (g == max) + h = 2 + (b - r) / delta; + else if (b == max) + h = 4 + (r - g) / delta; + + h = Math.min(h * 60, 360); + + if (h < 0) + h += 360; + + v = ((max / 255) * 1000) / 10; + + return [h, s, v]; +} + +function rgb2hwb(rgb) { + var r = rgb[0], + g = rgb[1], + b = rgb[2], + h = rgb2hsl(rgb)[0], + w = 1/255 * Math.min(r, Math.min(g, b)), + b = 1 - 1/255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +} + +function rgb2cmyk(rgb) { + var r = rgb[0] / 255, + g = rgb[1] / 255, + b = rgb[2] / 255, + c, m, y, k; + + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; + return [c * 100, m * 100, y * 100, k * 100]; +} + +function rgb2keyword(rgb) { + return reverseKeywords[JSON.stringify(rgb)]; +} + +function rgb2xyz(rgb) { + var r = rgb[0] / 255, + g = rgb[1] / 255, + b = rgb[2] / 255; + + // assume sRGB + r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); + g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); + b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); + + var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y *100, z * 100]; +} + +function rgb2lab(rgb) { + var xyz = rgb2xyz(rgb), + x = xyz[0], + y = xyz[1], + z = xyz[2], + l, a, b; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); + + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); + + return [l, a, b]; +} + +function rgb2lch(args) { + return lab2lch(rgb2lab(args)); +} + +function hsl2rgb(hsl) { + var h = hsl[0] / 360, + s = hsl[1] / 100, + l = hsl[2] / 100, + t1, t2, t3, rgb, val; + + if (s == 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) + t2 = l * (1 + s); + else + t2 = l + s - l * s; + t1 = 2 * l - t2; + + rgb = [0, 0, 0]; + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * - (i - 1); + t3 < 0 && t3++; + t3 > 1 && t3--; + + if (6 * t3 < 1) + val = t1 + (t2 - t1) * 6 * t3; + else if (2 * t3 < 1) + val = t2; + else if (3 * t3 < 2) + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + else + val = t1; + + rgb[i] = val * 255; + } + + return rgb; +} + +function hsl2hsv(hsl) { + var h = hsl[0], + s = hsl[1] / 100, + l = hsl[2] / 100, + sv, v; + + if(l === 0) { + // no need to do calc on black + // also avoids divide by 0 error + return [0, 0, 0]; + } + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + v = (l + s) / 2; + sv = (2 * s) / (l + s); + return [h, sv * 100, v * 100]; +} + +function hsl2hwb(args) { + return rgb2hwb(hsl2rgb(args)); +} + +function hsl2cmyk(args) { + return rgb2cmyk(hsl2rgb(args)); +} + +function hsl2keyword(args) { + return rgb2keyword(hsl2rgb(args)); +} + + +function hsv2rgb(hsv) { + var h = hsv[0] / 60, + s = hsv[1] / 100, + v = hsv[2] / 100, + hi = Math.floor(h) % 6; + + var f = h - Math.floor(h), + p = 255 * v * (1 - s), + q = 255 * v * (1 - (s * f)), + t = 255 * v * (1 - (s * (1 - f))), + v = 255 * v; + + switch(hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +} + +function hsv2hsl(hsv) { + var h = hsv[0], + s = hsv[1] / 100, + v = hsv[2] / 100, + sl, l; + + l = (2 - s) * v; + sl = s * v; + sl /= (l <= 1) ? l : 2 - l; + sl = sl || 0; + l /= 2; + return [h, sl * 100, l * 100]; +} + +function hsv2hwb(args) { + return rgb2hwb(hsv2rgb(args)) +} + +function hsv2cmyk(args) { + return rgb2cmyk(hsv2rgb(args)); +} + +function hsv2keyword(args) { + return rgb2keyword(hsv2rgb(args)); +} + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +function hwb2rgb(hwb) { + var h = hwb[0] / 360, + wh = hwb[1] / 100, + bl = hwb[2] / 100, + ratio = wh + bl, + i, v, f, n; + + // wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; + if ((i & 0x01) != 0) { + f = 1 - f; + } + n = wh + f * (v - wh); // linear interpolation + + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + + return [r * 255, g * 255, b * 255]; +} + +function hwb2hsl(args) { + return rgb2hsl(hwb2rgb(args)); +} + +function hwb2hsv(args) { + return rgb2hsv(hwb2rgb(args)); +} + +function hwb2cmyk(args) { + return rgb2cmyk(hwb2rgb(args)); +} + +function hwb2keyword(args) { + return rgb2keyword(hwb2rgb(args)); +} + +function cmyk2rgb(cmyk) { + var c = cmyk[0] / 100, + m = cmyk[1] / 100, + y = cmyk[2] / 100, + k = cmyk[3] / 100, + r, g, b; + + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); + return [r * 255, g * 255, b * 255]; +} + +function cmyk2hsl(args) { + return rgb2hsl(cmyk2rgb(args)); +} + +function cmyk2hsv(args) { + return rgb2hsv(cmyk2rgb(args)); +} + +function cmyk2hwb(args) { + return rgb2hwb(cmyk2rgb(args)); +} + +function cmyk2keyword(args) { + return rgb2keyword(cmyk2rgb(args)); +} + + +function xyz2rgb(xyz) { + var x = xyz[0] / 100, + y = xyz[1] / 100, + z = xyz[2] / 100, + r, g, b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // assume sRGB + r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + : r = (r * 12.92); + + g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + : g = (g * 12.92); + + b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + : b = (b * 12.92); + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +} + +function xyz2lab(xyz) { + var x = xyz[0], + y = xyz[1], + z = xyz[2], + l, a, b; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); + + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); + + return [l, a, b]; +} + +function xyz2lch(args) { + return lab2lch(xyz2lab(args)); +} + +function lab2xyz(lab) { + var l = lab[0], + a = lab[1], + b = lab[2], + x, y, z, y2; + + if (l <= 8) { + y = (l * 100) / 903.3; + y2 = (7.787 * (y / 100)) + (16 / 116); + } else { + y = 100 * Math.pow((l + 16) / 116, 3); + y2 = Math.pow(y / 100, 1/3); + } + + x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); + + z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); + + return [x, y, z]; +} + +function lab2lch(lab) { + var l = lab[0], + a = lab[1], + b = lab[2], + hr, h, c; + + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + if (h < 0) { + h += 360; + } + c = Math.sqrt(a * a + b * b); + return [l, c, h]; +} + +function lab2rgb(args) { + return xyz2rgb(lab2xyz(args)); +} + +function lch2lab(lch) { + var l = lch[0], + c = lch[1], + h = lch[2], + a, b, hr; + + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); + return [l, a, b]; +} + +function lch2xyz(args) { + return lab2xyz(lch2lab(args)); +} + +function lch2rgb(args) { + return lab2rgb(lch2lab(args)); +} + +function keyword2rgb(keyword) { + return cssKeywords[keyword]; +} + +function keyword2hsl(args) { + return rgb2hsl(keyword2rgb(args)); +} + +function keyword2hsv(args) { + return rgb2hsv(keyword2rgb(args)); +} + +function keyword2hwb(args) { + return rgb2hwb(keyword2rgb(args)); +} + +function keyword2cmyk(args) { + return rgb2cmyk(keyword2rgb(args)); +} + +function keyword2lab(args) { + return rgb2lab(keyword2rgb(args)); +} + +function keyword2xyz(args) { + return rgb2xyz(keyword2rgb(args)); +} + +var cssKeywords = { + aliceblue: [240,248,255], + antiquewhite: [250,235,215], + aqua: [0,255,255], + aquamarine: [127,255,212], + azure: [240,255,255], + beige: [245,245,220], + bisque: [255,228,196], + black: [0,0,0], + blanchedalmond: [255,235,205], + blue: [0,0,255], + blueviolet: [138,43,226], + brown: [165,42,42], + burlywood: [222,184,135], + cadetblue: [95,158,160], + chartreuse: [127,255,0], + chocolate: [210,105,30], + coral: [255,127,80], + cornflowerblue: [100,149,237], + cornsilk: [255,248,220], + crimson: [220,20,60], + cyan: [0,255,255], + darkblue: [0,0,139], + darkcyan: [0,139,139], + darkgoldenrod: [184,134,11], + darkgray: [169,169,169], + darkgreen: [0,100,0], + darkgrey: [169,169,169], + darkkhaki: [189,183,107], + darkmagenta: [139,0,139], + darkolivegreen: [85,107,47], + darkorange: [255,140,0], + darkorchid: [153,50,204], + darkred: [139,0,0], + darksalmon: [233,150,122], + darkseagreen: [143,188,143], + darkslateblue: [72,61,139], + darkslategray: [47,79,79], + darkslategrey: [47,79,79], + darkturquoise: [0,206,209], + darkviolet: [148,0,211], + deeppink: [255,20,147], + deepskyblue: [0,191,255], + dimgray: [105,105,105], + dimgrey: [105,105,105], + dodgerblue: [30,144,255], + firebrick: [178,34,34], + floralwhite: [255,250,240], + forestgreen: [34,139,34], + fuchsia: [255,0,255], + gainsboro: [220,220,220], + ghostwhite: [248,248,255], + gold: [255,215,0], + goldenrod: [218,165,32], + gray: [128,128,128], + green: [0,128,0], + greenyellow: [173,255,47], + grey: [128,128,128], + honeydew: [240,255,240], + hotpink: [255,105,180], + indianred: [205,92,92], + indigo: [75,0,130], + ivory: [255,255,240], + khaki: [240,230,140], + lavender: [230,230,250], + lavenderblush: [255,240,245], + lawngreen: [124,252,0], + lemonchiffon: [255,250,205], + lightblue: [173,216,230], + lightcoral: [240,128,128], + lightcyan: [224,255,255], + lightgoldenrodyellow: [250,250,210], + lightgray: [211,211,211], + lightgreen: [144,238,144], + lightgrey: [211,211,211], + lightpink: [255,182,193], + lightsalmon: [255,160,122], + lightseagreen: [32,178,170], + lightskyblue: [135,206,250], + lightslategray: [119,136,153], + lightslategrey: [119,136,153], + lightsteelblue: [176,196,222], + lightyellow: [255,255,224], + lime: [0,255,0], + limegreen: [50,205,50], + linen: [250,240,230], + magenta: [255,0,255], + maroon: [128,0,0], + mediumaquamarine: [102,205,170], + mediumblue: [0,0,205], + mediumorchid: [186,85,211], + mediumpurple: [147,112,219], + mediumseagreen: [60,179,113], + mediumslateblue: [123,104,238], + mediumspringgreen: [0,250,154], + mediumturquoise: [72,209,204], + mediumvioletred: [199,21,133], + midnightblue: [25,25,112], + mintcream: [245,255,250], + mistyrose: [255,228,225], + moccasin: [255,228,181], + navajowhite: [255,222,173], + navy: [0,0,128], + oldlace: [253,245,230], + olive: [128,128,0], + olivedrab: [107,142,35], + orange: [255,165,0], + orangered: [255,69,0], + orchid: [218,112,214], + palegoldenrod: [238,232,170], + palegreen: [152,251,152], + paleturquoise: [175,238,238], + palevioletred: [219,112,147], + papayawhip: [255,239,213], + peachpuff: [255,218,185], + peru: [205,133,63], + pink: [255,192,203], + plum: [221,160,221], + powderblue: [176,224,230], + purple: [128,0,128], + rebeccapurple: [102, 51, 153], + red: [255,0,0], + rosybrown: [188,143,143], + royalblue: [65,105,225], + saddlebrown: [139,69,19], + salmon: [250,128,114], + sandybrown: [244,164,96], + seagreen: [46,139,87], + seashell: [255,245,238], + sienna: [160,82,45], + silver: [192,192,192], + skyblue: [135,206,235], + slateblue: [106,90,205], + slategray: [112,128,144], + slategrey: [112,128,144], + snow: [255,250,250], + springgreen: [0,255,127], + steelblue: [70,130,180], + tan: [210,180,140], + teal: [0,128,128], + thistle: [216,191,216], + tomato: [255,99,71], + turquoise: [64,224,208], + violet: [238,130,238], + wheat: [245,222,179], + white: [255,255,255], + whitesmoke: [245,245,245], + yellow: [255,255,0], + yellowgreen: [154,205,50] +}; + +var reverseKeywords = {}; +for (var key in cssKeywords) { + reverseKeywords[JSON.stringify(cssKeywords[key])] = key; +} + +},{}],5:[function(require,module,exports){ +var conversions = require(4); + +var convert = function() { + return new Converter(); +} + +for (var func in conversions) { + // export Raw versions + convert[func + "Raw"] = (function(func) { + // accept array or plain args + return function(arg) { + if (typeof arg == "number") + arg = Array.prototype.slice.call(arguments); + return conversions[func](arg); + } + })(func); + + var pair = /(\w+)2(\w+)/.exec(func), + from = pair[1], + to = pair[2]; + + // export rgb2hsl and ["rgb"]["hsl"] + convert[from] = convert[from] || {}; + + convert[from][to] = convert[func] = (function(func) { + return function(arg) { + if (typeof arg == "number") + arg = Array.prototype.slice.call(arguments); + + var val = conversions[func](arg); + if (typeof val == "string" || val === undefined) + return val; // keyword + + for (var i = 0; i < val.length; i++) + val[i] = Math.round(val[i]); + return val; + } + })(func); +} + + +/* Converter does lazy conversion and caching */ +var Converter = function() { + this.convs = {}; +}; + +/* Either get the values for a space or + set the values for a space, depending on args */ +Converter.prototype.routeSpace = function(space, args) { + var values = args[0]; + if (values === undefined) { + // color.rgb() + return this.getValues(space); + } + // color.rgb(10, 10, 10) + if (typeof values == "number") { + values = Array.prototype.slice.call(args); + } + + return this.setValues(space, values); +}; + +/* Set the values for a space, invalidating cache */ +Converter.prototype.setValues = function(space, values) { + this.space = space; + this.convs = {}; + this.convs[space] = values; + return this; +}; + +/* Get the values for a space. If there's already + a conversion for the space, fetch it, otherwise + compute it */ +Converter.prototype.getValues = function(space) { + var vals = this.convs[space]; + if (!vals) { + var fspace = this.space, + from = this.convs[fspace]; + vals = convert[fspace][space](from); + + this.convs[space] = vals; + } + return vals; +}; + +["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) { + Converter.prototype[space] = function(vals) { + return this.routeSpace(space, arguments); + } +}); + +module.exports = convert; +},{"4":4}],6:[function(require,module,exports){ +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; +},{}],7:[function(require,module,exports){ +/** + * @namespace Chart + */ +var Chart = require(26)(); + +require(25)(Chart); +require(24)(Chart); +require(21)(Chart); +require(22)(Chart); +require(23)(Chart); +require(27)(Chart); +require(31)(Chart); +require(29)(Chart); +require(30)(Chart); +require(32)(Chart); +require(28)(Chart); +require(33)(Chart); + +require(34)(Chart); +require(35)(Chart); +require(36)(Chart); +require(37)(Chart); + +require(40)(Chart); +require(38)(Chart); +require(39)(Chart); +require(41)(Chart); +require(42)(Chart); +require(43)(Chart); + +// Controllers must be loaded after elements +// See Chart.core.datasetController.dataElementType +require(15)(Chart); +require(16)(Chart); +require(17)(Chart); +require(18)(Chart); +require(19)(Chart); +require(20)(Chart); + +require(8)(Chart); +require(9)(Chart); +require(10)(Chart); +require(11)(Chart); +require(12)(Chart); +require(13)(Chart); +require(14)(Chart); + +window.Chart = module.exports = Chart; + +},{"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"36":36,"37":37,"38":38,"39":39,"40":40,"41":41,"42":42,"43":43,"8":8,"9":9}],8:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.Bar = function(context, config) { + config.type = 'bar'; + + return new Chart(context, config); + }; + +}; +},{}],9:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.Bubble = function(context, config) { + config.type = 'bubble'; + return new Chart(context, config); + }; + +}; +},{}],10:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.Doughnut = function(context, config) { + config.type = 'doughnut'; + + return new Chart(context, config); + }; + +}; +},{}],11:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.Line = function(context, config) { + config.type = 'line'; + + return new Chart(context, config); + }; + +}; +},{}],12:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.PolarArea = function(context, config) { + config.type = 'polarArea'; + + return new Chart(context, config); + }; + +}; +},{}],13:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + Chart.Radar = function(context, config) { + config.options = Chart.helpers.configMerge({ aspectRatio: 1 }, config.options); + config.type = 'radar'; + + return new Chart(context, config); + }; + +}; + +},{}],14:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var defaultConfig = { + hover: { + mode: 'single' + }, + + scales: { + xAxes: [{ + type: "linear", // scatter should not use a category axis + position: "bottom", + id: "x-axis-1" // need an ID so datasets can reference the scale + }], + yAxes: [{ + type: "linear", + position: "left", + id: "y-axis-1" + }] + }, + + tooltips: { + callbacks: { + title: function(tooltipItems, data) { + // Title doesn't make sense for scatter since we format the data as a point + return ''; + }, + label: function(tooltipItem, data) { + return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')'; + } + } + } + }; + + // Register the default config for this type + Chart.defaults.scatter = defaultConfig; + + // Scatter charts use line controllers + Chart.controllers.scatter = Chart.controllers.line; + + Chart.Scatter = function(context, config) { + config.type = 'scatter'; + return new Chart(context, config); + }; + +}; +},{}],15:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + + Chart.defaults.bar = { + hover: { + mode: "label" + }, + + scales: { + xAxes: [{ + type: "category", + + // Specific to Bar Controller + categoryPercentage: 0.8, + barPercentage: 0.9, + + // grid line settings + gridLines: { + offsetGridLines: true + } + }], + yAxes: [{ + type: "linear" + }] + } + }; + + Chart.controllers.bar = Chart.DatasetController.extend({ + + dataElementType: Chart.elements.Rectangle, + + initialize: function(chart, datasetIndex) { + Chart.DatasetController.prototype.initialize.call(this, chart, datasetIndex); + + // Use this to indicate that this is a bar dataset. + this.getMeta().bar = true; + }, + + // Get the number of datasets that display bars. We use this to correctly calculate the bar width + getBarCount: function getBarCount() { + var me = this; + var barCount = 0; + helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { + var meta = me.chart.getDatasetMeta(datasetIndex); + if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) { + ++barCount; + } + }, me); + return barCount; + }, + + update: function update(reset) { + var me = this; + helpers.each(me.getMeta().data, function(rectangle, index) { + me.updateElement(rectangle, index, reset); + }, me); + }, + + updateElement: function updateElement(rectangle, index, reset) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var yScale = me.getScaleForId(meta.yAxisID); + var scaleBase = yScale.getBasePixel(); + var rectangleElementOptions = me.chart.options.elements.rectangle; + var custom = rectangle.custom || {}; + var dataset = me.getDataset(); + + helpers.extend(rectangle, { + // Utility + _xScale: xScale, + _yScale: yScale, + _datasetIndex: me.index, + _index: index, + + // Desired view properties + _model: { + x: me.calculateBarX(index, me.index), + y: reset ? scaleBase : me.calculateBarY(index, me.index), + + // Tooltip + label: me.chart.data.labels[index], + datasetLabel: dataset.label, + + // Appearance + base: reset ? scaleBase : me.calculateBarBase(me.index, index), + width: me.calculateBarWidth(index), + backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), + borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, + borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), + borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) + } + }); + rectangle.pivot(); + }, + + calculateBarBase: function(datasetIndex, index) { + var me = this; + var meta = me.getMeta(); + var yScale = me.getScaleForId(meta.yAxisID); + var base = 0; + + if (yScale.options.stacked) { + var chart = me.chart; + var datasets = chart.data.datasets; + var value = datasets[datasetIndex].data[index]; + + if (value < 0) { + for (var i = 0; i < datasetIndex; i++) { + var negDS = datasets[i]; + var negDSMeta = chart.getDatasetMeta(i); + if (negDSMeta.bar && negDSMeta.yAxisID === yScale.id && chart.isDatasetVisible(i)) { + base += negDS.data[index] < 0 ? negDS.data[index] : 0; + } + } + } else { + for (var j = 0; j < datasetIndex; j++) { + var posDS = datasets[j]; + var posDSMeta = chart.getDatasetMeta(j); + if (posDSMeta.bar && posDSMeta.yAxisID === yScale.id && chart.isDatasetVisible(j)) { + base += posDS.data[index] > 0 ? posDS.data[index] : 0; + } + } + } + + return yScale.getPixelForValue(base); + } + + return yScale.getBasePixel(); + }, + + getRuler: function(index) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var datasetCount = me.getBarCount(); + + var tickWidth; + + if (xScale.options.type === 'category') { + tickWidth = xScale.getPixelForTick(index + 1) - xScale.getPixelForTick(index); + } else { + // Average width + tickWidth = xScale.width / xScale.ticks.length; + } + var categoryWidth = tickWidth * xScale.options.categoryPercentage; + var categorySpacing = (tickWidth - (tickWidth * xScale.options.categoryPercentage)) / 2; + var fullBarWidth = categoryWidth / datasetCount; + + if (xScale.ticks.length !== me.chart.data.labels.length) { + var perc = xScale.ticks.length / me.chart.data.labels.length; + fullBarWidth = fullBarWidth * perc; + } + + var barWidth = fullBarWidth * xScale.options.barPercentage; + var barSpacing = fullBarWidth - (fullBarWidth * xScale.options.barPercentage); + + return { + datasetCount: datasetCount, + tickWidth: tickWidth, + categoryWidth: categoryWidth, + categorySpacing: categorySpacing, + fullBarWidth: fullBarWidth, + barWidth: barWidth, + barSpacing: barSpacing + }; + }, + + calculateBarWidth: function(index) { + var xScale = this.getScaleForId(this.getMeta().xAxisID); + var ruler = this.getRuler(index); + return xScale.options.stacked ? ruler.categoryWidth : ruler.barWidth; + }, + + // Get bar index from the given dataset index accounting for the fact that not all bars are visible + getBarIndex: function(datasetIndex) { + var barIndex = 0; + var meta, j; + + for (j = 0; j < datasetIndex; ++j) { + meta = this.chart.getDatasetMeta(j); + if (meta.bar && this.chart.isDatasetVisible(j)) { + ++barIndex; + } + } + + return barIndex; + }, + + calculateBarX: function(index, datasetIndex) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var barIndex = me.getBarIndex(datasetIndex); + + var ruler = me.getRuler(index); + var leftTick = xScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); + leftTick -= me.chart.isCombo ? (ruler.tickWidth / 2) : 0; + + if (xScale.options.stacked) { + return leftTick + (ruler.categoryWidth / 2) + ruler.categorySpacing; + } + + return leftTick + + (ruler.barWidth / 2) + + ruler.categorySpacing + + (ruler.barWidth * barIndex) + + (ruler.barSpacing / 2) + + (ruler.barSpacing * barIndex); + }, + + calculateBarY: function(index, datasetIndex) { + var me = this; + var meta = me.getMeta(); + var yScale = me.getScaleForId(meta.yAxisID); + var value = me.getDataset().data[index]; + + if (yScale.options.stacked) { + + var sumPos = 0, + sumNeg = 0; + + for (var i = 0; i < datasetIndex; i++) { + var ds = me.chart.data.datasets[i]; + var dsMeta = me.chart.getDatasetMeta(i); + if (dsMeta.bar && dsMeta.yAxisID === yScale.id && me.chart.isDatasetVisible(i)) { + if (ds.data[index] < 0) { + sumNeg += ds.data[index] || 0; + } else { + sumPos += ds.data[index] || 0; + } + } + } + + if (value < 0) { + return yScale.getPixelForValue(sumNeg + value); + } else { + return yScale.getPixelForValue(sumPos + value); + } + } + + return yScale.getPixelForValue(value); + }, + + draw: function(ease) { + var me = this; + var easingDecimal = ease || 1; + helpers.each(me.getMeta().data, function(rectangle, index) { + var d = me.getDataset().data[index]; + if (d !== null && d !== undefined && !isNaN(d)) { + rectangle.transition(easingDecimal).draw(); + } + }, me); + }, + + setHoverStyle: function(rectangle) { + var dataset = this.chart.data.datasets[rectangle._datasetIndex]; + var index = rectangle._index; + + var custom = rectangle.custom || {}; + var model = rectangle._model; + model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); + model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor)); + model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); + }, + + removeHoverStyle: function(rectangle) { + var dataset = this.chart.data.datasets[rectangle._datasetIndex]; + var index = rectangle._index; + var custom = rectangle.custom || {}; + var model = rectangle._model; + var rectangleElementOptions = this.chart.options.elements.rectangle; + + model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor); + model.borderColor = custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor); + model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth); + } + + }); + + + // including horizontalBar in the bar file, instead of a file of its own + // it extends bar (like pie extends doughnut) + Chart.defaults.horizontalBar = { + hover: { + mode: "label" + }, + + scales: { + xAxes: [{ + type: "linear", + position: "bottom" + }], + yAxes: [{ + position: "left", + type: "category", + + // Specific to Horizontal Bar Controller + categoryPercentage: 0.8, + barPercentage: 0.9, + + // grid line settings + gridLines: { + offsetGridLines: true + } + }] + }, + elements: { + rectangle: { + borderSkipped: 'left' + } + }, + tooltips: { + callbacks: { + title: function(tooltipItems, data) { + // Pick first xLabel for now + var title = ''; + + if (tooltipItems.length > 0) { + if (tooltipItems[0].yLabel) { + title = tooltipItems[0].yLabel; + } else if (data.labels.length > 0 && tooltipItems[0].index < data.labels.length) { + title = data.labels[tooltipItems[0].index]; + } + } + + return title; + }, + label: function(tooltipItem, data) { + var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || ''; + return datasetLabel + ': ' + tooltipItem.xLabel; + } + } + } + }; + + Chart.controllers.horizontalBar = Chart.controllers.bar.extend({ + updateElement: function updateElement(rectangle, index, reset, numBars) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var yScale = me.getScaleForId(meta.yAxisID); + var scaleBase = xScale.getBasePixel(); + var custom = rectangle.custom || {}; + var dataset = me.getDataset(); + var rectangleElementOptions = me.chart.options.elements.rectangle; + + helpers.extend(rectangle, { + // Utility + _xScale: xScale, + _yScale: yScale, + _datasetIndex: me.index, + _index: index, + + // Desired view properties + _model: { + x: reset ? scaleBase : me.calculateBarX(index, me.index), + y: me.calculateBarY(index, me.index), + + // Tooltip + label: me.chart.data.labels[index], + datasetLabel: dataset.label, + + // Appearance + base: reset ? scaleBase : me.calculateBarBase(me.index, index), + height: me.calculateBarHeight(index), + backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), + borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, + borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), + borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) + }, + + draw: function () { + var ctx = this._chart.ctx; + var vm = this._view; + + var halfHeight = vm.height / 2, + topY = vm.y - halfHeight, + bottomY = vm.y + halfHeight, + right = vm.base - (vm.base - vm.x), + halfStroke = vm.borderWidth / 2; + + // Canvas doesn't allow us to stroke inside the width so we can + // adjust the sizes to fit if we're setting a stroke on the line + if (vm.borderWidth) { + topY += halfStroke; + bottomY -= halfStroke; + right += halfStroke; + } + + ctx.beginPath(); + + ctx.fillStyle = vm.backgroundColor; + ctx.strokeStyle = vm.borderColor; + ctx.lineWidth = vm.borderWidth; + + // Corner points, from bottom-left to bottom-right clockwise + // | 1 2 | + // | 0 3 | + var corners = [ + [vm.base, bottomY], + [vm.base, topY], + [right, topY], + [right, bottomY] + ]; + + // Find first (starting) corner with fallback to 'bottom' + var borders = ['bottom', 'left', 'top', 'right']; + var startCorner = borders.indexOf(vm.borderSkipped, 0); + if (startCorner === -1) + startCorner = 0; + + function cornerAt(index) { + return corners[(startCorner + index) % 4]; + } + + // Draw rectangle from 'startCorner' + ctx.moveTo.apply(ctx, cornerAt(0)); + for (var i = 1; i < 4; i++) + ctx.lineTo.apply(ctx, cornerAt(i)); + + ctx.fill(); + if (vm.borderWidth) { + ctx.stroke(); + } + }, + + inRange: function (mouseX, mouseY) { + var vm = this._view; + var inRange = false; + + if (vm) { + if (vm.x < vm.base) { + inRange = (mouseY >= vm.y - vm.height / 2 && mouseY <= vm.y + vm.height / 2) && (mouseX >= vm.x && mouseX <= vm.base); + } else { + inRange = (mouseY >= vm.y - vm.height / 2 && mouseY <= vm.y + vm.height / 2) && (mouseX >= vm.base && mouseX <= vm.x); + } + } + + return inRange; + } + }); + + rectangle.pivot(); + }, + + calculateBarBase: function (datasetIndex, index) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var base = 0; + + if (xScale.options.stacked) { + + var value = me.chart.data.datasets[datasetIndex].data[index]; + + if (value < 0) { + for (var i = 0; i < datasetIndex; i++) { + var negDS = me.chart.data.datasets[i]; + var negDSMeta = me.chart.getDatasetMeta(i); + if (negDSMeta.bar && negDSMeta.xAxisID === xScale.id && me.chart.isDatasetVisible(i)) { + base += negDS.data[index] < 0 ? negDS.data[index] : 0; + } + } + } else { + for (var j = 0; j < datasetIndex; j++) { + var posDS = me.chart.data.datasets[j]; + var posDSMeta = me.chart.getDatasetMeta(j); + if (posDSMeta.bar && posDSMeta.xAxisID === xScale.id && me.chart.isDatasetVisible(j)) { + base += posDS.data[index] > 0 ? posDS.data[index] : 0; + } + } + } + + return xScale.getPixelForValue(base); + } + + return xScale.getBasePixel(); + }, + + getRuler: function (index) { + var me = this; + var meta = me.getMeta(); + var yScale = me.getScaleForId(meta.yAxisID); + var datasetCount = me.getBarCount(); + + var tickHeight; + if (yScale.options.type === 'category') { + tickHeight = yScale.getPixelForTick(index + 1) - yScale.getPixelForTick(index); + } else { + // Average width + tickHeight = yScale.width / yScale.ticks.length; + } + var categoryHeight = tickHeight * yScale.options.categoryPercentage; + var categorySpacing = (tickHeight - (tickHeight * yScale.options.categoryPercentage)) / 2; + var fullBarHeight = categoryHeight / datasetCount; + + if (yScale.ticks.length !== me.chart.data.labels.length) { + var perc = yScale.ticks.length / me.chart.data.labels.length; + fullBarHeight = fullBarHeight * perc; + } + + var barHeight = fullBarHeight * yScale.options.barPercentage; + var barSpacing = fullBarHeight - (fullBarHeight * yScale.options.barPercentage); + + return { + datasetCount: datasetCount, + tickHeight: tickHeight, + categoryHeight: categoryHeight, + categorySpacing: categorySpacing, + fullBarHeight: fullBarHeight, + barHeight: barHeight, + barSpacing: barSpacing, + }; + }, + + calculateBarHeight: function (index) { + var me = this; + var yScale = me.getScaleForId(me.getMeta().yAxisID); + var ruler = me.getRuler(index); + return yScale.options.stacked ? ruler.categoryHeight : ruler.barHeight; + }, + + calculateBarX: function (index, datasetIndex) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var value = me.getDataset().data[index]; + + if (xScale.options.stacked) { + + var sumPos = 0, + sumNeg = 0; + + for (var i = 0; i < datasetIndex; i++) { + var ds = me.chart.data.datasets[i]; + var dsMeta = me.chart.getDatasetMeta(i); + if (dsMeta.bar && dsMeta.xAxisID === xScale.id && me.chart.isDatasetVisible(i)) { + if (ds.data[index] < 0) { + sumNeg += ds.data[index] || 0; + } else { + sumPos += ds.data[index] || 0; + } + } + } + + if (value < 0) { + return xScale.getPixelForValue(sumNeg + value); + } else { + return xScale.getPixelForValue(sumPos + value); + } + } + + return xScale.getPixelForValue(value); + }, + + calculateBarY: function (index, datasetIndex) { + var me = this; + var meta = me.getMeta(); + var yScale = me.getScaleForId(meta.yAxisID); + var barIndex = me.getBarIndex(datasetIndex); + + var ruler = me.getRuler(index); + var topTick = yScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); + topTick -= me.chart.isCombo ? (ruler.tickHeight / 2) : 0; + + if (yScale.options.stacked) { + return topTick + (ruler.categoryHeight / 2) + ruler.categorySpacing; + } + + return topTick + + (ruler.barHeight / 2) + + ruler.categorySpacing + + (ruler.barHeight * barIndex) + + (ruler.barSpacing / 2) + + (ruler.barSpacing * barIndex); + } + }); +}; + +},{}],16:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + + Chart.defaults.bubble = { + hover: { + mode: "single" + }, + + scales: { + xAxes: [{ + type: "linear", // bubble should probably use a linear scale by default + position: "bottom", + id: "x-axis-0" // need an ID so datasets can reference the scale + }], + yAxes: [{ + type: "linear", + position: "left", + id: "y-axis-0" + }] + }, + + tooltips: { + callbacks: { + title: function(tooltipItems, data) { + // Title doesn't make sense for scatter since we format the data as a point + return ''; + }, + label: function(tooltipItem, data) { + var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || ''; + var dataPoint = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; + return datasetLabel + ': (' + dataPoint.x + ', ' + dataPoint.y + ', ' + dataPoint.r + ')'; + } + } + } + }; + + Chart.controllers.bubble = Chart.DatasetController.extend({ + + dataElementType: Chart.elements.Point, + + update: function update(reset) { + var me = this; + var meta = me.getMeta(); + var points = meta.data; + + // Update Points + helpers.each(points, function(point, index) { + me.updateElement(point, index, reset); + }); + }, + + updateElement: function(point, index, reset) { + var me = this; + var meta = me.getMeta(); + var xScale = me.getScaleForId(meta.xAxisID); + var yScale = me.getScaleForId(meta.yAxisID); + + var custom = point.custom || {}; + var dataset = me.getDataset(); + var data = dataset.data[index]; + var pointElementOptions = me.chart.options.elements.point; + var dsIndex = me.index; + + helpers.extend(point, { + // Utility + _xScale: xScale, + _yScale: yScale, + _datasetIndex: dsIndex, + _index: index, + + // Desired view properties + _model: { + x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(data, index, dsIndex, me.chart.isCombo), + y: reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex), + // Appearance + radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data), + + // Tooltip + hitRadius: custom.hitRadius ? custom.hitRadius : helpers.getValueAtIndexOrDefault(dataset.hitRadius, index, pointElementOptions.hitRadius) + } + }); + + // Trick to reset the styles of the point + Chart.DatasetController.prototype.removeHoverStyle.call(me, point, pointElementOptions); + + var model = point._model; + model.skip = custom.skip ? custom.skip : (isNaN(model.x) || isNaN(model.y)); + + point.pivot(); + }, + + getRadius: function(value) { + return value.r || this.chart.options.elements.point.radius; + }, + + setHoverStyle: function(point) { + var me = this; + Chart.DatasetController.prototype.setHoverStyle.call(me, point); + + // Radius + var dataset = me.chart.data.datasets[point._datasetIndex]; + var index = point._index; + var custom = point.custom || {}; + var model = point._model; + model.radius = custom.hoverRadius ? custom.hoverRadius : (helpers.getValueAtIndexOrDefault(dataset.hoverRadius, index, me.chart.options.elements.point.hoverRadius)) + me.getRadius(dataset.data[index]); + }, + + removeHoverStyle: function(point) { + var me = this; + Chart.DatasetController.prototype.removeHoverStyle.call(me, point, me.chart.options.elements.point); + + var dataVal = me.chart.data.datasets[point._datasetIndex].data[point._index]; + var custom = point.custom || {}; + var model = point._model; + + model.radius = custom.radius ? custom.radius : me.getRadius(dataVal); + } + }); +}; + +},{}],17:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers, + defaults = Chart.defaults; + + defaults.doughnut = { + animation: { + //Boolean - Whether we animate the rotation of the Doughnut + animateRotate: true, + //Boolean - Whether we animate scaling the Doughnut from the centre + animateScale: false + }, + aspectRatio: 1, + hover: { + mode: 'single' + }, + legendCallback: function(chart) { + var text = []; + text.push('
    '); + + var data = chart.data; + var datasets = data.datasets; + var labels = data.labels; + + if (datasets.length) { + for (var i = 0; i < datasets[0].data.length; ++i) { + text.push('
  • '); + if (labels[i]) { + text.push(labels[i]); + } + text.push('
  • '); + } + } + + text.push('
'); + return text.join(""); + }, + legend: { + labels: { + generateLabels: function(chart) { + var data = chart.data; + if (data.labels.length && data.datasets.length) { + return data.labels.map(function(label, i) { + var meta = chart.getDatasetMeta(0); + var ds = data.datasets[0]; + var arc = meta.data[i]; + var custom = arc.custom || {}; + var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; + var arcOpts = chart.options.elements.arc; + var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); + var stroke = custom.borderColor ? custom.borderColor : getValueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); + var bw = custom.borderWidth ? custom.borderWidth : getValueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); + + return { + text: label, + fillStyle: fill, + strokeStyle: stroke, + lineWidth: bw, + hidden: isNaN(ds.data[i]) || meta.data[i].hidden, + + // Extra data used for toggling the correct item + index: i + }; + }); + } else { + return []; + } + } + }, + + onClick: function(e, legendItem) { + var index = legendItem.index; + var chart = this.chart; + var i, ilen, meta; + + for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { + meta = chart.getDatasetMeta(i); + meta.data[index].hidden = !meta.data[index].hidden; + } + + chart.update(); + } + }, + + //The percentage of the chart that we cut out of the middle. + cutoutPercentage: 50, + + //The rotation of the chart, where the first data arc begins. + rotation: Math.PI * -0.5, + + //The total circumference of the chart. + circumference: Math.PI * 2.0, + + // Need to override these to give a nice default + tooltips: { + callbacks: { + title: function() { + return ''; + }, + label: function(tooltipItem, data) { + return data.labels[tooltipItem.index] + ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; + } + } + } + }; + + defaults.pie = helpers.clone(defaults.doughnut); + helpers.extend(defaults.pie, { + cutoutPercentage: 0 + }); + + + Chart.controllers.doughnut = Chart.controllers.pie = Chart.DatasetController.extend({ + + dataElementType: Chart.elements.Arc, + + linkScales: helpers.noop, + + // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly + getRingIndex: function getRingIndex(datasetIndex) { + var ringIndex = 0; + + for (var j = 0; j < datasetIndex; ++j) { + if (this.chart.isDatasetVisible(j)) { + ++ringIndex; + } + } + + return ringIndex; + }, + + update: function update(reset) { + var me = this; + var chart = me.chart, + chartArea = chart.chartArea, + opts = chart.options, + arcOpts = opts.elements.arc, + availableWidth = chartArea.right - chartArea.left - arcOpts.borderWidth, + availableHeight = chartArea.bottom - chartArea.top - arcOpts.borderWidth, + minSize = Math.min(availableWidth, availableHeight), + offset = { + x: 0, + y: 0 + }, + meta = me.getMeta(), + cutoutPercentage = opts.cutoutPercentage, + circumference = opts.circumference; + + // If the chart's circumference isn't a full circle, calculate minSize as a ratio of the width/height of the arc + if (circumference < Math.PI * 2.0) { + var startAngle = opts.rotation % (Math.PI * 2.0); + startAngle += Math.PI * 2.0 * (startAngle >= Math.PI ? -1 : startAngle < -Math.PI ? 1 : 0); + var endAngle = startAngle + circumference; + var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)}; + var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)}; + var contains0 = (startAngle <= 0 && 0 <= endAngle) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle); + var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle); + var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle); + var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle); + var cutout = cutoutPercentage / 100.0; + var min = {x: contains180 ? -1 : Math.min(start.x * (start.x < 0 ? 1 : cutout), end.x * (end.x < 0 ? 1 : cutout)), y: contains270 ? -1 : Math.min(start.y * (start.y < 0 ? 1 : cutout), end.y * (end.y < 0 ? 1 : cutout))}; + var max = {x: contains0 ? 1 : Math.max(start.x * (start.x > 0 ? 1 : cutout), end.x * (end.x > 0 ? 1 : cutout)), y: contains90 ? 1 : Math.max(start.y * (start.y > 0 ? 1 : cutout), end.y * (end.y > 0 ? 1 : cutout))}; + var size = {width: (max.x - min.x) * 0.5, height: (max.y - min.y) * 0.5}; + minSize = Math.min(availableWidth / size.width, availableHeight / size.height); + offset = {x: (max.x + min.x) * -0.5, y: (max.y + min.y) * -0.5}; + } + + chart.outerRadius = Math.max(minSize / 2, 0); + chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 1, 0); + chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); + chart.offsetX = offset.x * chart.outerRadius; + chart.offsetY = offset.y * chart.outerRadius; + + meta.total = me.calculateTotal(); + + me.outerRadius = chart.outerRadius - (chart.radiusLength * me.getRingIndex(me.index)); + me.innerRadius = me.outerRadius - chart.radiusLength; + + helpers.each(meta.data, function(arc, index) { + me.updateElement(arc, index, reset); + }); + }, + + updateElement: function(arc, index, reset) { + var me = this; + var chart = me.chart, + chartArea = chart.chartArea, + opts = chart.options, + animationOpts = opts.animation, + arcOpts = opts.elements.arc, + centerX = (chartArea.left + chartArea.right) / 2, + centerY = (chartArea.top + chartArea.bottom) / 2, + startAngle = opts.rotation, // non reset case handled later + endAngle = opts.rotation, // non reset case handled later + dataset = me.getDataset(), + circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI)), + innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius, + outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius, + custom = arc.custom || {}, + valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; + + helpers.extend(arc, { + // Utility + _datasetIndex: me.index, + _index: index, + + // Desired view properties + _model: { + x: centerX + chart.offsetX, + y: centerY + chart.offsetY, + startAngle: startAngle, + endAngle: endAngle, + circumference: circumference, + outerRadius: outerRadius, + innerRadius: innerRadius, + label: valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index]) + } + }); + + var model = arc._model; + // Resets the visual styles + this.removeHoverStyle(arc); + + // Set correct angles if not resetting + if (!reset || !animationOpts.animateRotate) { + if (index === 0) { + model.startAngle = opts.rotation; + } else { + model.startAngle = me.getMeta().data[index - 1]._model.endAngle; + } + + model.endAngle = model.startAngle + model.circumference; + } + + arc.pivot(); + }, + + removeHoverStyle: function(arc) { + Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); + }, + + calculateTotal: function() { + var dataset = this.getDataset(); + var meta = this.getMeta(); + var total = 0; + var value; + + helpers.each(meta.data, function(element, index) { + value = dataset.data[index]; + if (!isNaN(value) && !element.hidden) { + total += Math.abs(value); + } + }); + + return total; + }, + + calculateCircumference: function(value) { + var total = this.getMeta().total; + if (total > 0 && !isNaN(value)) { + return (Math.PI * 2.0) * (value / total); + } else { + return 0; + } + } + }); +}; + +},{}],18:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + + Chart.defaults.line = { + showLines: true, + + hover: { + mode: "label" + }, + + scales: { + xAxes: [{ + type: "category", + id: 'x-axis-0' + }], + yAxes: [{ + type: "linear", + id: 'y-axis-0' + }] + } + }; + + function lineEnabled(dataset, options) { + return helpers.getValueOrDefault(dataset.showLine, options.showLines); + } + + Chart.controllers.line = Chart.DatasetController.extend({ + + datasetElementType: Chart.elements.Line, + + dataElementType: Chart.elements.Point, + + addElementAndReset: function(index) { + var me = this; + var options = me.chart.options; + var meta = me.getMeta(); + + Chart.DatasetController.prototype.addElementAndReset.call(me, index); + + // Make sure bezier control points are updated + if (lineEnabled(me.getDataset(), options) && meta.dataset._model.tension !== 0) { + me.updateBezierControlPoints(); + } + }, + + update: function update(reset) { + var me = this; + var meta = me.getMeta(); + var line = meta.dataset; + var points = meta.data || []; + var options = me.chart.options; + var lineElementOptions = options.elements.line; + var scale = me.getScaleForId(meta.yAxisID); + var i, ilen, custom; + var dataset = me.getDataset(); + var showLine = lineEnabled(dataset, options); + + // Update Line + if (showLine) { + custom = line.custom || {}; + + // Compatibility: If the properties are defined with only the old name, use those values + if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { + dataset.lineTension = dataset.tension; + } + + // Utility + line._scale = scale; + line._datasetIndex = me.index; + // Data + line._children = points; + // Model + line._model = { + // Appearance + // The default behavior of lines is to break at null values, according + // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 + // This option gives linse the ability to span gaps + spanGaps: dataset.spanGaps ? dataset.spanGaps : false, + tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension), + backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), + borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), + borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), + borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), + borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), + borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), + borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), + fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), + // Scale + scaleTop: scale.top, + scaleBottom: scale.bottom, + scaleZero: scale.getBasePixel() + }; + + line.pivot(); + } + + // Update Points + for (i=0, ilen=points.length; i'); + + var data = chart.data; + var datasets = data.datasets; + var labels = data.labels; + + if (datasets.length) { + for (var i = 0; i < datasets[0].data.length; ++i) { + text.push('
  • '); + if (labels[i]) { + text.push(labels[i]); + } + text.push('
  • '); + } + } + + text.push(''); + return text.join(""); + }, + legend: { + labels: { + generateLabels: function(chart) { + var data = chart.data; + if (data.labels.length && data.datasets.length) { + return data.labels.map(function(label, i) { + var meta = chart.getDatasetMeta(0); + var ds = data.datasets[0]; + var arc = meta.data[i]; + var custom = arc.custom || {}; + var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; + var arcOpts = chart.options.elements.arc; + var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); + var stroke = custom.borderColor ? custom.borderColor : getValueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); + var bw = custom.borderWidth ? custom.borderWidth : getValueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); + + return { + text: label, + fillStyle: fill, + strokeStyle: stroke, + lineWidth: bw, + hidden: isNaN(ds.data[i]) || meta.data[i].hidden, + + // Extra data used for toggling the correct item + index: i + }; + }); + } else { + return []; + } + } + }, + + onClick: function(e, legendItem) { + var index = legendItem.index; + var chart = this.chart; + var i, ilen, meta; + + for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { + meta = chart.getDatasetMeta(i); + meta.data[index].hidden = !meta.data[index].hidden; + } + + chart.update(); + } + }, + + // Need to override these to give a nice default + tooltips: { + callbacks: { + title: function() { + return ''; + }, + label: function(tooltipItem, data) { + return data.labels[tooltipItem.index] + ': ' + tooltipItem.yLabel; + } + } + } + }; + + Chart.controllers.polarArea = Chart.DatasetController.extend({ + + dataElementType: Chart.elements.Arc, + + linkScales: helpers.noop, + + update: function update(reset) { + var me = this; + var chart = me.chart; + var chartArea = chart.chartArea; + var meta = me.getMeta(); + var opts = chart.options; + var arcOpts = opts.elements.arc; + var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top); + chart.outerRadius = Math.max((minSize - arcOpts.borderWidth / 2) / 2, 0); + chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0); + chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); + + me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index); + me.innerRadius = me.outerRadius - chart.radiusLength; + + meta.count = me.countVisibleElements(); + + helpers.each(meta.data, function(arc, index) { + me.updateElement(arc, index, reset); + }); + }, + + updateElement: function(arc, index, reset) { + var me = this; + var chart = me.chart; + var chartArea = chart.chartArea; + var dataset = me.getDataset(); + var opts = chart.options; + var animationOpts = opts.animation; + var arcOpts = opts.elements.arc; + var custom = arc.custom || {}; + var scale = chart.scale; + var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; + var labels = chart.data.labels; + + var circumference = me.calculateCircumference(dataset.data[index]); + var centerX = (chartArea.left + chartArea.right) / 2; + var centerY = (chartArea.top + chartArea.bottom) / 2; + + // If there is NaN data before us, we need to calculate the starting angle correctly. + // We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data + var visibleCount = 0; + var meta = me.getMeta(); + for (var i = 0; i < index; ++i) { + if (!isNaN(dataset.data[i]) && !meta.data[i].hidden) { + ++visibleCount; + } + } + + var negHalfPI = -0.5 * Math.PI; + var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); + var startAngle = (negHalfPI) + (circumference * visibleCount); + var endAngle = startAngle + (arc.hidden ? 0 : circumference); + + var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); + + helpers.extend(arc, { + // Utility + _datasetIndex: me.index, + _index: index, + _scale: scale, + + // Desired view properties + _model: { + x: centerX, + y: centerY, + innerRadius: 0, + outerRadius: reset ? resetRadius : distance, + startAngle: reset && animationOpts.animateRotate ? negHalfPI : startAngle, + endAngle: reset && animationOpts.animateRotate ? negHalfPI : endAngle, + label: getValueAtIndexOrDefault(labels, index, labels[index]) + } + }); + + // Apply border and fill style + me.removeHoverStyle(arc); + + arc.pivot(); + }, + + removeHoverStyle: function(arc) { + Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); + }, + + countVisibleElements: function() { + var dataset = this.getDataset(); + var meta = this.getMeta(); + var count = 0; + + helpers.each(meta.data, function(element, index) { + if (!isNaN(dataset.data[index]) && !element.hidden) { + count++; + } + }); + + return count; + }, + + calculateCircumference: function(value) { + var count = this.getMeta().count; + if (count > 0 && !isNaN(value)) { + return (2 * Math.PI) / count; + } else { + return 0; + } + } + }); +}; + +},{}],20:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + + Chart.defaults.radar = { + scale: { + type: "radialLinear" + }, + elements: { + line: { + tension: 0 // no bezier in radar + } + } + }; + + Chart.controllers.radar = Chart.DatasetController.extend({ + + datasetElementType: Chart.elements.Line, + + dataElementType: Chart.elements.Point, + + linkScales: helpers.noop, + + addElementAndReset: function(index) { + Chart.DatasetController.prototype.addElementAndReset.call(this, index); + + // Make sure bezier control points are updated + this.updateBezierControlPoints(); + }, + + update: function update(reset) { + var me = this; + var meta = me.getMeta(); + var line = meta.dataset; + var points = meta.data; + var custom = line.custom || {}; + var dataset = me.getDataset(); + var lineElementOptions = me.chart.options.elements.line; + var scale = me.chart.scale; + + // Compatibility: If the properties are defined with only the old name, use those values + if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { + dataset.lineTension = dataset.tension; + } + + helpers.extend(meta.dataset, { + // Utility + _datasetIndex: me.index, + // Data + _children: points, + _loop: true, + // Model + _model: { + // Appearance + tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension), + backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), + borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), + borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), + fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), + borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), + borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), + borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), + borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), + + // Scale + scaleTop: scale.top, + scaleBottom: scale.bottom, + scaleZero: scale.getBasePosition() + } + }); + + meta.dataset.pivot(); + + // Update Points + helpers.each(points, function(point, index) { + me.updateElement(point, index, reset); + }, me); + + + // Update bezier control points + me.updateBezierControlPoints(); + }, + updateElement: function(point, index, reset) { + var me = this; + var custom = point.custom || {}; + var dataset = me.getDataset(); + var scale = me.chart.scale; + var pointElementOptions = me.chart.options.elements.point; + var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]); + + helpers.extend(point, { + // Utility + _datasetIndex: me.index, + _index: index, + _scale: scale, + + // Desired view properties + _model: { + x: reset ? scale.xCenter : pointPosition.x, // value not used in dataset scale, but we want a consistent API between scales + y: reset ? scale.yCenter : pointPosition.y, + + // Appearance + tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.tension, me.chart.options.elements.line.tension), + radius: custom.radius ? custom.radius : helpers.getValueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius), + backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor), + borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor), + borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth), + pointStyle: custom.pointStyle ? custom.pointStyle : helpers.getValueAtIndexOrDefault(dataset.pointStyle, index, pointElementOptions.pointStyle), + + // Tooltip + hitRadius: custom.hitRadius ? custom.hitRadius : helpers.getValueAtIndexOrDefault(dataset.hitRadius, index, pointElementOptions.hitRadius) + } + }); + + point._model.skip = custom.skip ? custom.skip : (isNaN(point._model.x) || isNaN(point._model.y)); + }, + updateBezierControlPoints: function() { + var chartArea = this.chart.chartArea; + var meta = this.getMeta(); + + helpers.each(meta.data, function(point, index) { + var model = point._model; + var controlPoints = helpers.splineCurve( + helpers.previousItem(meta.data, index, true)._model, + model, + helpers.nextItem(meta.data, index, true)._model, + model.tension + ); + + // Prevent the bezier going outside of the bounds of the graph + model.controlPointPreviousX = Math.max(Math.min(controlPoints.previous.x, chartArea.right), chartArea.left); + model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, chartArea.bottom), chartArea.top); + + model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, chartArea.right), chartArea.left); + model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, chartArea.bottom), chartArea.top); + + // Now pivot the point for animation + point.pivot(); + }); + }, + + draw: function(ease) { + var meta = this.getMeta(); + var easingDecimal = ease || 1; + + // Transition Point Locations + helpers.each(meta.data, function(point, index) { + point.transition(easingDecimal); + }); + + // Transition and Draw the line + meta.dataset.transition(easingDecimal).draw(); + + // Draw the points + helpers.each(meta.data, function(point) { + point.draw(); + }); + }, + + setHoverStyle: function(point) { + // Point + var dataset = this.chart.data.datasets[point._datasetIndex]; + var custom = point.custom || {}; + var index = point._index; + var model = point._model; + + model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.getValueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); + model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); + model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); + model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); + }, + + removeHoverStyle: function(point) { + var dataset = this.chart.data.datasets[point._datasetIndex]; + var custom = point.custom || {}; + var index = point._index; + var model = point._model; + var pointElementOptions = this.chart.options.elements.point; + + model.radius = custom.radius ? custom.radius : helpers.getValueAtIndexOrDefault(dataset.radius, index, pointElementOptions.radius); + model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor); + model.borderColor = custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor); + model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth); + } + }); +}; + +},{}],21:[function(require,module,exports){ +/*global window: false */ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + + Chart.defaults.global.animation = { + duration: 1000, + easing: "easeOutQuart", + onProgress: helpers.noop, + onComplete: helpers.noop + }; + + Chart.Animation = Chart.Element.extend({ + currentStep: null, // the current animation step + numSteps: 60, // default number of steps + easing: "", // the easing to use for this animation + render: null, // render function used by the animation service + + onAnimationProgress: null, // user specified callback to fire on each step of the animation + onAnimationComplete: null // user specified callback to fire when the animation finishes + }); + + Chart.animationService = { + frameDuration: 17, + animations: [], + dropFrames: 0, + request: null, + addAnimation: function(chartInstance, animationObject, duration, lazy) { + var me = this; + + if (!lazy) { + chartInstance.animating = true; + } + + for (var index = 0; index < me.animations.length; ++index) { + if (me.animations[index].chartInstance === chartInstance) { + // replacing an in progress animation + me.animations[index].animationObject = animationObject; + return; + } + } + + me.animations.push({ + chartInstance: chartInstance, + animationObject: animationObject + }); + + // If there are no animations queued, manually kickstart a digest, for lack of a better word + if (me.animations.length === 1) { + me.requestAnimationFrame(); + } + }, + // Cancel the animation for a given chart instance + cancelAnimation: function(chartInstance) { + var index = helpers.findIndex(this.animations, function(animationWrapper) { + return animationWrapper.chartInstance === chartInstance; + }); + + if (index !== -1) { + this.animations.splice(index, 1); + chartInstance.animating = false; + } + }, + requestAnimationFrame: function() { + var me = this; + if (me.request === null) { + // Skip animation frame requests until the active one is executed. + // This can happen when processing mouse events, e.g. 'mousemove' + // and 'mouseout' events will trigger multiple renders. + me.request = helpers.requestAnimFrame.call(window, function() { + me.request = null; + me.startDigest(); + }); + } + }, + startDigest: function() { + var me = this; + + var startTime = Date.now(); + var framesToDrop = 0; + + if (me.dropFrames > 1) { + framesToDrop = Math.floor(me.dropFrames); + me.dropFrames = me.dropFrames % 1; + } + + var i = 0; + while (i < me.animations.length) { + if (me.animations[i].animationObject.currentStep === null) { + me.animations[i].animationObject.currentStep = 0; + } + + me.animations[i].animationObject.currentStep += 1 + framesToDrop; + + if (me.animations[i].animationObject.currentStep > me.animations[i].animationObject.numSteps) { + me.animations[i].animationObject.currentStep = me.animations[i].animationObject.numSteps; + } + + me.animations[i].animationObject.render(me.animations[i].chartInstance, me.animations[i].animationObject); + if (me.animations[i].animationObject.onAnimationProgress && me.animations[i].animationObject.onAnimationProgress.call) { + me.animations[i].animationObject.onAnimationProgress.call(me.animations[i].chartInstance, me.animations[i]); + } + + if (me.animations[i].animationObject.currentStep === me.animations[i].animationObject.numSteps) { + if (me.animations[i].animationObject.onAnimationComplete && me.animations[i].animationObject.onAnimationComplete.call) { + me.animations[i].animationObject.onAnimationComplete.call(me.animations[i].chartInstance, me.animations[i]); + } + + // executed the last frame. Remove the animation. + me.animations[i].chartInstance.animating = false; + + me.animations.splice(i, 1); + } else { + ++i; + } + } + + var endTime = Date.now(); + var dropFrames = (endTime - startTime) / me.frameDuration; + + me.dropFrames += dropFrames; + + // Do we have more stuff to animate? + if (me.animations.length > 0) { + me.requestAnimationFrame(); + } + } + }; +}; +},{}],22:[function(require,module,exports){ +"use strict"; + +module.exports = function(Chart) { + + var helpers = Chart.helpers; + //Create a dictionary of chart types, to allow for extension of existing types + Chart.types = {}; + + //Store a reference to each instance - allowing us to globally resize chart instances on window resize. + //Destroy method on the chart will remove the instance of the chart from this reference. + Chart.instances = {}; + + // Controllers available for dataset visualization eg. bar, line, slice, etc. + Chart.controllers = {}; + + /** + * @class Chart.Controller + * The main controller of a chart. + */ + Chart.Controller = function(instance) { + + this.chart = instance; + this.config = instance.config; + this.options = this.config.options = helpers.configMerge(Chart.defaults.global, Chart.defaults[this.config.type], this.config.options || {}); + this.id = helpers.uid(); + + Object.defineProperty(this, 'data', { + get: function() { + return this.config.data; + } + }); + + //Add the chart instance to the global namespace + Chart.instances[this.id] = this; + + if (this.options.responsive) { + // Silent resize before chart draws + this.resize(true); + } + + this.initialize(); + + return this; + }; + + helpers.extend(Chart.Controller.prototype, /** @lends Chart.Controller */ { + + initialize: function initialize() { + var me = this; + // Before init plugin notification + Chart.plugins.notify('beforeInit', [me]); + + me.bindEvents(); + + // Make sure controllers are built first so that each dataset is bound to an axis before the scales + // are built + me.ensureScalesHaveIDs(); + me.buildOrUpdateControllers(); + me.buildScales(); + me.updateLayout(); + me.resetElements(); + me.initToolTip(); + me.update(); + + // After init plugin notification + Chart.plugins.notify('afterInit', [me]); + + return me; + }, + + clear: function clear() { + helpers.clear(this.chart); + return this; + }, + + stop: function stop() { + // Stops any current animation loop occuring + Chart.animationService.cancelAnimation(this); + return this; + }, + + resize: function resize(silent) { + var me = this; + var chart = me.chart; + var canvas = chart.canvas; + var newWidth = helpers.getMaximumWidth(canvas); + var aspectRatio = chart.aspectRatio; + var newHeight = (me.options.maintainAspectRatio && isNaN(aspectRatio) === false && isFinite(aspectRatio) && aspectRatio !== 0) ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas); + + var sizeChanged = chart.width !== newWidth || chart.height !== newHeight; + + if (!sizeChanged) { + return me; + } + + canvas.width = chart.width = newWidth; + canvas.height = chart.height = newHeight; + + helpers.retinaScale(chart); + + // Notify any plugins about the resize + var newSize = { width: newWidth, height: newHeight }; + Chart.plugins.notify('resize', [me, newSize]); + + // Notify of resize + if (me.options.onResize) { + me.options.onResize(me, newSize); + } + + if (!silent) { + me.stop(); + me.update(me.options.responsiveAnimationDuration); + } + + return me; + }, + + ensureScalesHaveIDs: function ensureScalesHaveIDs() { + var options = this.options; + var scalesOptions = options.scales || {}; + var scaleOptions = options.scale; + + helpers.each(scalesOptions.xAxes, function(xAxisOptions, index) { + xAxisOptions.id = xAxisOptions.id || ('x-axis-' + index); + }); + + helpers.each(scalesOptions.yAxes, function(yAxisOptions, index) { + yAxisOptions.id = yAxisOptions.id || ('y-axis-' + index); + }); + + if (scaleOptions) { + scaleOptions.id = scaleOptions.id || 'scale'; + } + }, + + /** + * Builds a map of scale ID to scale object for future lookup. + */ + buildScales: function buildScales() { + var me = this; + var options = me.options; + var scales = me.scales = {}; + var items = []; + + if (options.scales) { + items = items.concat( + (options.scales.xAxes || []).map(function(xAxisOptions) { + return { options: xAxisOptions, dtype: 'category' }; }), + (options.scales.yAxes || []).map(function(yAxisOptions) { + return { options: yAxisOptions, dtype: 'linear' }; })); + } + + if (options.scale) { + items.push({ options: options.scale, dtype: 'radialLinear', isDefault: true }); + } + + helpers.each(items, function(item, index) { + var scaleOptions = item.options; + var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype); + var scaleClass = Chart.scaleService.getScaleConstructor(scaleType); + if (!scaleClass) { + return; + } + + var scale = new scaleClass({ + id: scaleOptions.id, + options: scaleOptions, + ctx: me.chart.ctx, + chart: me + }); + + scales[scale.id] = scale; + + // TODO(SB): I think we should be able to remove this custom case (options.scale) + // and consider it as a regular scale part of the "scales"" map only! This would + // make the logic easier and remove some useless? custom code. + if (item.isDefault) { + me.scale = scale; + } + }); + + Chart.scaleService.addScalesToLayout(this); + }, + + updateLayout: function() { + Chart.layoutService.update(this, this.chart.width, this.chart.height); + }, + + buildOrUpdateControllers: function buildOrUpdateControllers() { + var me = this; + var types = []; + var newControllers = []; + + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + var meta = me.getDatasetMeta(datasetIndex); + if (!meta.type) { + meta.type = dataset.type || me.config.type; + } + + types.push(meta.type); + + if (meta.controller) { + meta.controller.updateIndex(datasetIndex); + } else { + meta.controller = new Chart.controllers[meta.type](me, datasetIndex); + newControllers.push(meta.controller); + } + }, me); + + if (types.length > 1) { + for (var i = 1; i < types.length; i++) { + if (types[i] !== types[i - 1]) { + me.isCombo = true; + break; + } + } + } + + return newControllers; + }, + + resetElements: function resetElements() { + var me = this; + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + me.getDatasetMeta(datasetIndex).controller.reset(); + }, me); + }, + + update: function update(animationDuration, lazy) { + var me = this; + Chart.plugins.notify('beforeUpdate', [me]); + + // In case the entire data object changed + me.tooltip._data = me.data; + + // Make sure dataset controllers are updated and new controllers are reset + var newControllers = me.buildOrUpdateControllers(); + + // Make sure all dataset controllers have correct meta data counts + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + me.getDatasetMeta(datasetIndex).controller.buildOrUpdateElements(); + }, me); + + Chart.layoutService.update(me, me.chart.width, me.chart.height); + + // Apply changes to the dataets that require the scales to have been calculated i.e BorderColor chages + Chart.plugins.notify('afterScaleUpdate', [me]); + + // Can only reset the new controllers after the scales have been updated + helpers.each(newControllers, function(controller) { + controller.reset(); + }); + + me.updateDatasets(); + + // Do this before render so that any plugins that need final scale updates can use it + Chart.plugins.notify('afterUpdate', [me]); + + me.render(animationDuration, lazy); + }, + + /** + * @method beforeDatasetsUpdate + * @description Called before all datasets are updated. If a plugin returns false, + * the datasets update will be cancelled until another chart update is triggered. + * @param {Object} instance the chart instance being updated. + * @returns {Boolean} false to cancel the datasets update. + * @memberof Chart.PluginBase + * @since version 2.1.5 + * @instance + */ + + /** + * @method afterDatasetsUpdate + * @description Called after all datasets have been updated. Note that this + * extension will not be called if the datasets update has been cancelled. + * @param {Object} instance the chart instance being updated. + * @memberof Chart.PluginBase + * @since version 2.1.5 + * @instance + */ + + /** + * Updates all datasets unless a plugin returns false to the beforeDatasetsUpdate + * extension, in which case no datasets will be updated and the afterDatasetsUpdate + * notification will be skipped. + * @protected + * @instance + */ + updateDatasets: function() { + var me = this; + var i, ilen; + + if (Chart.plugins.notify('beforeDatasetsUpdate', [ me ])) { + for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { + me.getDatasetMeta(i).controller.update(); + } + + Chart.plugins.notify('afterDatasetsUpdate', [ me ]); + } + }, + + render: function render(duration, lazy) { + var me = this; + Chart.plugins.notify('beforeRender', [me]); + + var animationOptions = me.options.animation; + if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) { + var animation = new Chart.Animation(); + animation.numSteps = (duration || animationOptions.duration) / 16.66; //60 fps + animation.easing = animationOptions.easing; + + // render function + animation.render = function(chartInstance, animationObject) { + var easingFunction = helpers.easingEffects[animationObject.easing]; + var stepDecimal = animationObject.currentStep / animationObject.numSteps; + var easeDecimal = easingFunction(stepDecimal); + + chartInstance.draw(easeDecimal, stepDecimal, animationObject.currentStep); + }; + + // user events + animation.onAnimationProgress = animationOptions.onProgress; + animation.onAnimationComplete = animationOptions.onComplete; + + Chart.animationService.addAnimation(me, animation, duration, lazy); + } else { + me.draw(); + if (animationOptions && animationOptions.onComplete && animationOptions.onComplete.call) { + animationOptions.onComplete.call(me); + } + } + return me; + }, + + draw: function(ease) { + var me = this; + var easingDecimal = ease || 1; + me.clear(); + + Chart.plugins.notify('beforeDraw', [me, easingDecimal]); + + // Draw all the scales + helpers.each(me.boxes, function(box) { + box.draw(me.chartArea); + }, me); + if (me.scale) { + me.scale.draw(); + } + + Chart.plugins.notify('beforeDatasetsDraw', [me, easingDecimal]); + + // Draw each dataset via its respective controller (reversed to support proper line stacking) + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + if (me.isDatasetVisible(datasetIndex)) { + me.getDatasetMeta(datasetIndex).controller.draw(ease); + } + }, me, true); + + Chart.plugins.notify('afterDatasetsDraw', [me, easingDecimal]); + + // Finally draw the tooltip + me.tooltip.transition(easingDecimal).draw(); + + Chart.plugins.notify('afterDraw', [me, easingDecimal]); + }, + + // Get the single element that was clicked on + // @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw + getElementAtEvent: function(e) { + var me = this; + var eventPosition = helpers.getRelativePosition(e, me.chart); + var elementsArray = []; + + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + if (me.isDatasetVisible(datasetIndex)) { + var meta = me.getDatasetMeta(datasetIndex); + helpers.each(meta.data, function(element, index) { + if (element.inRange(eventPosition.x, eventPosition.y)) { + elementsArray.push(element); + return elementsArray; + } + }); + } + }); + + return elementsArray; + }, + + getElementsAtEvent: function(e) { + var me = this; + var eventPosition = helpers.getRelativePosition(e, me.chart); + var elementsArray = []; + + var found = (function() { + if (me.data.datasets) { + for (var i = 0; i < me.data.datasets.length; i++) { + var meta = me.getDatasetMeta(i); + if (me.isDatasetVisible(i)) { + for (var j = 0; j < meta.data.length; j++) { + if (meta.data[j].inRange(eventPosition.x, eventPosition.y)) { + return meta.data[j]; + } + } + } + } + } + }).call(me); + + if (!found) { + return elementsArray; + } + + helpers.each(me.data.datasets, function(dataset, datasetIndex) { + if (me.isDatasetVisible(datasetIndex)) { + var meta = me.getDatasetMeta(datasetIndex); + elementsArray.push(meta.data[found._index]); + } + }, me); + + return elementsArray; + }, + + getElementsAtEventForMode: function(e, mode) { + var me = this; + switch (mode) { + case 'single': + return me.getElementAtEvent(e); + case 'label': + return me.getElementsAtEvent(e); + case 'dataset': + return me.getDatasetAtEvent(e); + default: + return e; + } + }, + + getDatasetAtEvent: function(e) { + var elementsArray = this.getElementAtEvent(e); + + if (elementsArray.length > 0) { + elementsArray = this.getDatasetMeta(elementsArray[0]._datasetIndex).data; + } + + return elementsArray; + }, + + getDatasetMeta: function(datasetIndex) { + var me = this; + var dataset = me.data.datasets[datasetIndex]; + if (!dataset._meta) { + dataset._meta = {}; + } + + var meta = dataset._meta[me.id]; + if (!meta) { + meta = dataset._meta[me.id] = { + type: null, + data: [], + dataset: null, + controller: null, + hidden: null, // See isDatasetVisible() comment + xAxisID: null, + yAxisID: null + }; + } + + return meta; + }, + + getVisibleDatasetCount: function() { + var count = 0; + for (var i = 0, ilen = this.data.datasets.length; i