-------------------------------------------------------------------------------- /esquema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS clientes( 2 | id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 | nombre VARCHAR(255) NOT NULL, 4 | departamento VARCHAR(255) NOT NULL, 5 | edad INT NOT NULL, 6 | fecha_registro VARCHAR(10) NOT NULL 7 | ); 8 | CREATE TABLE IF NOT EXISTS ventas_clientes( 9 | id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 10 | id_cliente BIGINT UNSIGNED NOT NULL, 11 | monto DECIMAL(9,2) NOT NULL, 12 | fecha VARCHAR(10) NOT NULL, 13 | FOREIGN KEY (id_cliente) REFERENCES clientes(id) ON UPDATE CASCADE ON DELETE CASCADE 14 | ); -------------------------------------------------------------------------------- /estilo.css: -------------------------------------------------------------------------------- 1 | body{ 2 | padding-top: 90px; 3 | } -------------------------------------------------------------------------------- /formulario_agregar_cliente.php: -------------------------------------------------------------------------------- 1 | 35 | 40 |
41 |
42 |

Agregar cliente

43 |
44 |
45 | 46 | 47 |
48 |
49 | 50 | 51 |
52 |
53 | 54 | 59 |
60 |
61 | 62 |
63 |
64 |
65 |
66 | -------------------------------------------------------------------------------- /formulario_editar_cliente.php: -------------------------------------------------------------------------------- 1 | 35 | 41 |
42 |
43 |

Editar cliente

44 |
45 | 46 |
47 | 48 | 49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 | 64 |
65 |
66 | 67 |
68 |
69 |
70 |
71 | -------------------------------------------------------------------------------- /funciones.php: -------------------------------------------------------------------------------- 1 | 35 | query("set names utf8;"); 55 | $database->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); 56 | $database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 57 | $database->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); 58 | return $database; 59 | } 60 | 61 | function agregarCliente($nombre, $edad, $departamento) 62 | { 63 | $bd = obtenerBD(); 64 | $fechaRegistro = date("Y-m-d"); 65 | $sentencia = $bd->prepare("INSERT INTO clientes(nombre, edad, departamento, fecha_registro) VALUES (?, ?, ? ,?)"); 66 | return $sentencia->execute([$nombre, $edad, $departamento, $fechaRegistro]); 67 | } 68 | 69 | function obtenerClientes() 70 | { 71 | $bd = obtenerBD(); 72 | $sentencia = $bd->query("SELECT id, nombre, edad, departamento, fecha_registro FROM clientes"); 73 | return $sentencia->fetchAll(); 74 | } 75 | 76 | function buscarClientes($nombre) 77 | { 78 | $bd = obtenerBD(); 79 | $sentencia = $bd->prepare("SELECT id, nombre, edad, departamento, fecha_registro FROM clientes WHERE nombre LIKE ?"); 80 | $sentencia->execute(["%$nombre%"]); 81 | return $sentencia->fetchAll(); 82 | } 83 | 84 | 85 | function eliminarCliente($id) 86 | { 87 | $bd = obtenerBD(); 88 | $sentencia = $bd->prepare("DELETE FROM clientes WHERE id = ?"); 89 | return $sentencia->execute([$id]); 90 | } 91 | 92 | function obtenerClientePorId($id) 93 | { 94 | $bd = obtenerBD(); 95 | $sentencia = $bd->prepare("SELECT id, nombre, edad, departamento, fecha_registro FROM clientes WHERE id = ?"); 96 | $sentencia->execute([$id]); 97 | return $sentencia->fetchObject(); 98 | } 99 | function actualizarCliente($nombre, $edad, $departamento, $id) 100 | { 101 | $bd = obtenerBD(); 102 | $sentencia = $bd->prepare("UPDATE clientes SET nombre = ?, edad = ?, departamento = ? WHERE id = ?"); 103 | return $sentencia->execute([$nombre, $edad, $departamento, $id]); 104 | } 105 | 106 | function agregarVenta($idCliente, $monto, $fecha) 107 | { 108 | $bd = obtenerBD(); 109 | $sentencia = $bd->prepare("INSERT INTO ventas_clientes(id_cliente, monto, fecha) VALUES (?, ?, ?)"); 110 | return $sentencia->execute([$idCliente, $monto, $fecha]); 111 | } 112 | 113 | function totalAcumuladoVentasPorCliente($idCliente) 114 | { 115 | $bd = obtenerBD(); 116 | $sentencia = $bd->prepare("SELECT COALESCE(SUM(monto), 0) AS total FROM ventas_clientes WHERE id_cliente = ?"); 117 | $sentencia->execute([$idCliente]); 118 | return $sentencia->fetchObject()->total; 119 | } 120 | 121 | function totalAcumuladoVentasPorClienteEnUltimoMes($idCliente) 122 | { 123 | $inicio = date("Y-m-01"); 124 | $bd = obtenerBD(); 125 | $sentencia = $bd->prepare("SELECT COALESCE(SUM(monto), 0) AS total FROM ventas_clientes WHERE id_cliente = ? AND fecha >= ?"); 126 | $sentencia->execute([$idCliente, $inicio]); 127 | return $sentencia->fetchObject()->total; 128 | } 129 | function totalAcumuladoVentasPorClienteEnUltimoAnio($idCliente) 130 | { 131 | $inicio = date("Y-01-01"); 132 | $bd = obtenerBD(); 133 | $sentencia = $bd->prepare("SELECT COALESCE(SUM(monto), 0) AS total FROM ventas_clientes WHERE id_cliente = ? AND fecha >= ?"); 134 | $sentencia->execute([$idCliente, $inicio]); 135 | return $sentencia->fetchObject()->total; 136 | } 137 | function totalAcumuladoVentasPorClienteAntesDeUltimoAnio($idCliente) 138 | { 139 | $inicio = date("Y-01-01"); 140 | $bd = obtenerBD(); 141 | $sentencia = $bd->prepare("SELECT COALESCE(SUM(monto), 0) AS total FROM ventas_clientes WHERE id_cliente = ? AND fecha < ?"); 142 | $sentencia->execute([$idCliente, $inicio]); 143 | return $sentencia->fetchObject()->total; 144 | } 145 | 146 | function obtenerNumeroTotalClientes() 147 | { 148 | $bd = obtenerBD(); 149 | $sentencia = $bd->query("SELECT COUNT(*) AS conteo FROM clientes"); 150 | return $sentencia->fetchObject()->conteo; 151 | } 152 | function obtenerNumeroTotalClientesUltimos30Dias() 153 | { 154 | $hace30Dias = date("Y-m-d", strtotime("-30 day")); 155 | $bd = obtenerBD(); 156 | $sentencia = $bd->prepare("SELECT COUNT(*) AS conteo FROM clientes WHERE fecha_registro >= ?"); 157 | $sentencia->execute([$hace30Dias]); 158 | return $sentencia->fetchObject()->conteo; 159 | } 160 | 161 | function obtenerNumeroTotalClientesUltimoAnio() 162 | { 163 | $inicio = date("Y-01-01"); 164 | $bd = obtenerBD(); 165 | $sentencia = $bd->prepare("SELECT COUNT(*) AS conteo FROM clientes WHERE fecha_registro >= ?"); 166 | $sentencia->execute([$inicio]); 167 | return $sentencia->fetchObject()->conteo; 168 | } 169 | 170 | function obtenerNumeroTotalClientesAniosAnteriores() 171 | { 172 | $inicio = date("Y-01-01"); 173 | $bd = obtenerBD(); 174 | $sentencia = $bd->prepare("SELECT COUNT(*) AS conteo FROM clientes WHERE fecha_registro < ?"); 175 | $sentencia->execute([$inicio]); 176 | return $sentencia->fetchObject()->conteo; 177 | } 178 | 179 | function obtenerTotalDeVentas() 180 | { 181 | $bd = obtenerBD(); 182 | $sentencia = $bd->query("SELECT COALESCE(SUM(monto), 0) AS total FROM ventas_clientes"); 183 | return $sentencia->fetchObject()->total; 184 | } 185 | 186 | function obtenerClientesPorDepartamento() 187 | { 188 | $bd = obtenerBD(); 189 | $sentencia = $bd->query("SELECT departamento, COUNT(*) AS conteo FROM clientes GROUP BY departamento"); 190 | return $sentencia->fetchAll(); 191 | } 192 | 193 | function obtenerConteoClientesPorRangoDeEdad($inicio, $fin) 194 | { 195 | $bd = obtenerBD(); 196 | $sentencia = $bd->prepare("select count(*) AS conteo from clientes WHERE edad >= ? AND edad <= ?;"); 197 | $sentencia->execute([$inicio, $fin]); 198 | return $sentencia->fetchObject()->conteo; 199 | } 200 | 201 | function obtenerVentasAnioActualOrganizadasPorMes() 202 | { 203 | $bd = obtenerBD(); 204 | $anio = date("Y"); 205 | $sentencia = $bd->prepare("select MONTH(fecha) AS mes, COUNT(*) AS total from ventas_clientes WHERE YEAR(fecha) = ? GROUP BY MONTH(fecha);"); 206 | $sentencia->execute([$anio]); 207 | return $sentencia->fetchAll(); 208 | } 209 | 210 | function obtenerReporteClientesEdades() 211 | { 212 | $rangos = [ 213 | [1, 10], 214 | [11, 20], 215 | [20, 40], 216 | [40, 80], 217 | ]; 218 | $resultados = []; 219 | foreach ($rangos as $rango) { 220 | $inicio = $rango[0]; 221 | $fin = $rango[1]; 222 | $conteo = obtenerConteoClientesPorRangoDeEdad($inicio, $fin); 223 | $dato = new stdClass; 224 | $dato->etiqueta = $inicio . " - " . $fin; 225 | $dato->valor = $conteo; 226 | array_push($resultados, $dato); 227 | } 228 | return $resultados; 229 | } 230 | -------------------------------------------------------------------------------- /guardar_cliente.php: -------------------------------------------------------------------------------- 1 | 35 | 35 | 35 | =0;a--)e.call(i,t[a],a);else for(a=0;an&&(n=r),n}function B(t,e,i,n){var a=(n=n||{}).data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(a=n.data={},r=n.garbageCollect=[],n.font=e),t.save(),t.font=e;var o,s,l,u,c,h=0,d=i.length;for(o=0;oi.length){for(o=0;o0&&e.stroke()}}function N(t,e){return t.x>e.left-.5&&t.xe.top-.5&&t.y=t}function et(t,e,i){var n,a,r;for(n=0,a=t.length;n0?1:-1};function nt(t){return t*(q/180)}function at(t){return t*(180/q)}function rt(t){if(x(t)){for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i}}function ot(t,e){var i=e.x-t.x,n=e.y-t.y,a=Math.sqrt(i*i+n*n),r=Math.atan2(n,i);return r<-.5*q&&(r+=$),{angle:r,distance:a}}function st(t,e){return(t-e+G)%$-q}function lt(t){return(t%$+$)%$}function ut(t,e,i){var n=lt(t),a=lt(e),r=lt(i),o=lt(a-n),s=lt(r-n),l=lt(n-a),u=lt(n-r);return n===a||n===r||o>s&&l0?c[e-1]:null,(a=e0?c[e-1]:null,a=e0&&N(t[i-1],e)&&(a.controlPointPreviousX=pt(a.controlPointPreviousX,e.left,e.right),a.controlPointPreviousY=pt(a.controlPointPreviousY,e.top,e.bottom)),i-1?i*parseInt(e,10)/100:parseInt(e,10)}function wt(t){var e=bt(t);if(!e)return"number"==typeof t.clientWidth?t.clientWidth:t.width;var i=e.clientWidth,n=i-Mt(e,"padding-left",i)-Mt(e,"padding-right",i),a=function(t){return _t(t,"max-width","clientWidth")}(t);return isNaN(a)?n:Math.min(n,a)}function St(t){var e=bt(t);if(!e)return"number"==typeof t.clientHeight?t.clientHeight:t.height;var i=e.clientHeight,n=i-Mt(e,"padding-top",i)-Mt(e,"padding-bottom",i),a=function(t){return _t(t,"max-height","clientHeight")}(t);return isNaN(a)?n:Math.min(n,a)}var Pt=Object.freeze({__proto__:null,_getParentNode:bt,getStyle:kt,getRelativePosition:function(t,e){var i,n,a=t.originalEvent||t,r=t.target||t.srcElement,o=r.getBoundingClientRect(),s=a.touches;s&&s.length>0?(i=s[0].clientX,n=s[0].clientY):(i=a.clientX,n=a.clientY);var l=parseFloat(kt(r,"padding-left")),u=parseFloat(kt(r,"padding-top")),c=parseFloat(kt(r,"padding-right")),h=parseFloat(kt(r,"padding-bottom")),d=o.right-o.left-l-c,f=o.bottom-o.top-u-h;return{x:i=Math.round((i-o.left-l)/d*r.width/e.currentDevicePixelRatio),y:n=Math.round((n-o.top-u)/f*r.height/e.currentDevicePixelRatio)}},getMaximumWidth:wt,getMaximumHeight:St,retinaScale:function(t,e){var i=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1,n=t.canvas,a=t.width,r=t.height;n.height=r*i,n.width=a*i,t.ctx.setTransform(i,0,0,i,0,0),!n.style||n.style.height||n.style.width||(n.style.height=r+"px",n.style.width=a+"px")}}),Dt={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return(t-=1)*t*t+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-((t-=1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return(t-=1)*t*t*t*t+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return 1-Math.cos(t*(Math.PI/2))},easeOutSine:function(t){return Math.sin(t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return t>=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e,i=0;return 0===t?0:1===t?1:(i||(i=.3),e=i/(2*Math.PI)*Math.asin(1),-1*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i))},easeOutElastic:function(t){var e,i=0;return 0===t?0:1===t?1:(i||(i=.3),e=i/(2*Math.PI)*Math.asin(1),1*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/i)+1)},easeInOutElastic:function(t){var e,i=0;return 0===t?0:2==(t/=.5)?1:(i||(i=.45),e=i/(2*Math.PI)*Math.asin(1),t<1?1*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:1*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-Dt.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*Dt.easeInBounce(2*t):.5*Dt.easeOutBounce(2*t-1)+.5}},Ot=new(function(){function t(){e(this,t),this.color="rgba(0,0,0,0.1)",this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.fontColor="#666",this.fontFamily="'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",this.fontSize=12,this.fontStyle="normal",this.lineHeight=1.2,this.hover={onHover:null,mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onClick=null,this.responsive=!0,this.showLines=!0,this.plugins=void 0,this.scale=void 0,this.legend=void 0,this.title=void 0,this.tooltips=void 0,this.doughnut=void 0}return n(t,[{key:"set",value:function(t,e){return P(this[t]||(this[t]={}),e)}}]),t}());function At(t,e){var i=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function Tt(t){var e,i,n,a;return b(t)?(e=+t.top||0,i=+t.right||0,n=+t.bottom||0,a=+t.left||0):e=i=n=a=+t||0,{top:e,right:i,bottom:n,left:a,height:e+n,width:a+i}}function Ct(t){var e=_(t.fontSize,Ot.fontSize);"string"==typeof e&&(e=parseInt(e,10));var i={family:_(t.fontFamily,Ot.fontFamily),lineHeight:At(_(t.lineHeight,Ot.lineHeight),e),size:e,style:_(t.fontStyle,Ot.fontStyle),weight:null,string:""};return i.string=function(t){return!t||y(t.size)||y(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(i),i}function Ft(t,e,i,n){var a,r,o,s=!0;for(a=0,r=t.length;a>4]+Vt[15&t]},Ht=function(t){return(240&t)>>4==(15&t)}; 8 | /*! 9 | * @kurkle/color v0.1.6 10 | * https://github.com/kurkle/color#readme 11 | * (c) 2020 Jukka Kurkela 12 | * Released under the MIT License 13 | */function jt(t){var e=function(t){return Ht(t.r)&&Ht(t.g)&&Ht(t.b)&&Ht(t.a)}(t)?Wt:Nt;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function Yt(t){return t+.5|0}var Ut=function(t,e,i){return Math.max(Math.min(t,i),e)};function Xt(t){return Ut(Yt(2.55*t),0,255)}function qt(t){return Ut(Yt(255*t),0,255)}function $t(t){return Ut(Yt(t/2.55)/100,0,1)}function Gt(t){return Ut(Yt(100*t),0,100)}var Kt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;var Zt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Qt(t,e,i){var n=e*Math.min(i,1-i),a=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e+t/30)%12;return i-n*Math.max(Math.min(a-3,9-a,1),-1)};return[a(0),a(8),a(4)]}function Jt(t,e,i){var n=function(n){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(n+t/60)%6;return i-i*e*Math.max(Math.min(a,4-a,1),0)};return[n(5),n(3),n(1)]}function te(t,e,i){var n,a=Qt(t,1,.5);for(e+i>1&&(e*=n=1/(e+i),i*=n),n=0;n<3;n++)a[n]*=1-e-i,a[n]+=e;return a}function ee(t){var e,i,n,a=t.r/255,r=t.g/255,o=t.b/255,s=Math.max(a,r,o),l=Math.min(a,r,o),u=(s+l)/2;return s!==l&&(n=s-l,i=u>.5?n/(2-s-l):n/(s+l),e=60*(e=s===a?(r-o)/n+(r>16&255,n>>8&255,255&n]}return o}({OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"});function le(t,e,i){if(t){var n=ee(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=ne(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function ue(t,e){return t?r(e||{},t):t}function ce(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=qt(t[3]))):(e=ue(t,{r:0,g:0,b:0,a:1})).a=qt(e.a),e}function he(t){return"r"===t.charAt(0)?function(t){var e,i,n,a=Kt.exec(t),r=255;if(a){if(a[7]!==e){var o=+a[7];r=255&(a[8]?Xt(o):255*o)}return e=+a[1],i=+a[3],n=+a[5],{r:e=255&(a[2]?Xt(e):e),g:i=255&(a[4]?Xt(i):i),b:n=255&(a[6]?Xt(n):n),a:r}}}(t):re(t)}se.transparent=[0,0,0,0];var de=function(){function i(n){if(e(this,i),n instanceof i)return n;var a,r,o,s,l=t(n);"object"===l?a=ce(n):"string"===l&&(s=(r=n).length,"#"===r[0]&&(4===s||5===s?o={r:255&17*Bt[r[1]],g:255&17*Bt[r[2]],b:255&17*Bt[r[3]],a:5===s?17*Bt[r[4]]:255}:7!==s&&9!==s||(o={r:Bt[r[1]]<<4|Bt[r[2]],g:Bt[r[3]]<<4|Bt[r[4]],b:Bt[r[5]]<<4|Bt[r[6]],a:9===s?Bt[r[7]]<<4|Bt[r[8]]:255})),a=o||function(t){var e=se[t];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(n)||he(n)),this._rgb=a,this._valid=!!a}return n(i,[{key:"rgbString",value:function(){return(t=this._rgb)&&(t.a<255?"rgba(".concat(t.r,", ").concat(t.g,", ").concat(t.b,", ").concat($t(t.a),")"):"rgb(".concat(t.r,", ").concat(t.g,", ").concat(t.b,")"));var t}},{key:"hexString",value:function(){return jt(this._rgb)}},{key:"hslString",value:function(){return function(t){if(t){var e=ee(t),i=e[0],n=Gt(e[1]),a=Gt(e[2]);return t.a<255?"hsla(".concat(i,", ").concat(n,"%, ").concat(a,"%, ").concat($t(t.a),")"):"hsl(".concat(i,", ").concat(n,"%, ").concat(a,"%)")}}(this._rgb)}},{key:"mix",value:function(t,e){if(t){var i,n=this.rgb,a=t.rgb,r=e===i?.5:e,o=2*r-1,s=n.a-a.a,l=((o*s==-1?o:(o+s)/(1+o*s))+1)/2;i=1-l,n.r=255&l*n.r+i*a.r+.5,n.g=255&l*n.g+i*a.g+.5,n.b=255&l*n.b+i*a.b+.5,n.a=r*n.a+(1-r)*a.a,this.rgb=n}return this}},{key:"clone",value:function(){return new i(this.rgb)}},{key:"alpha",value:function(t){return this._rgb.a=qt(t),this}},{key:"clearer",value:function(t){return this._rgb.a*=1-t,this}},{key:"greyscale",value:function(){var t=this._rgb,e=Yt(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}},{key:"opaquer",value:function(t){return this._rgb.a*=1+t,this}},{key:"negate",value:function(){var t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}},{key:"lighten",value:function(t){return le(this._rgb,2,t),this}},{key:"darken",value:function(t){return le(this._rgb,2,-t),this}},{key:"saturate",value:function(t){return le(this._rgb,1,t),this}},{key:"desaturate",value:function(t){return le(this._rgb,1,-t),this}},{key:"rotate",value:function(t){return function(t,e){var i=ee(t);i[0]=ae(i[0]+e),i=ne(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}},{key:"valid",get:function(){return this._valid}},{key:"rgb",get:function(){var t=ue(this._rgb);return t&&(t.a=$t(t.a)),t},set:function(t){this._rgb=ce(t)}}]),i}();function fe(t){return new de(t)}var ve=function(t){return t instanceof CanvasGradient||t instanceof CanvasPattern};var pe=function(t){for(var e=1;e=0;--s)(r=o[s])._active?(r.tick(e),l=!0):(o[s]=o[o.length-1],o.pop());l&&a.draw(),a.options.animation.debug&&function(t,e,i,n){var a=1e3/(i-n)|0,r=t.ctx;r.save(),r.clearRect(0,0,50,24),r.fillStyle="black",r.textAlign="right",e&&(r.fillText(e,50,8),r.fillText(a+" fps",50,18)),r.restore()}(a,o.length,e,t._lastDate),t._notify(a,n,e,"progress"),o.length||(n.running=!1,t._notify(a,n,e,"complete")),i+=o.length}})),t._lastDate=e,0===i&&(t._running=!1)}},{key:"_getAnims",value:function(t){var e=this._charts,i=e.get(t);return i||(i={running:!1,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}},{key:"listen",value:function(t,e,i){this._getAnims(t).listeners[e].push(i)}},{key:"add",value:function(t,e){var i;e&&e.length&&(i=this._getAnims(t).items).push.apply(i,f(e))}},{key:"has",value:function(t){return this._getAnims(t).items.length>0}},{key:"start",value:function(t){var e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((function(t,e){return Math.max(t,e._duration)}),0),this._refresh())}},{key:"running",value:function(t){if(!this._running)return!1;var e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}},{key:"stop",value:function(t){var e=this._charts.get(t);if(e&&e.items.length){for(var i=e.items,n=i.length-1;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}}},{key:"remove",value:function(t){return this._charts.delete(t)}}]),t}()),ye={boolean:function(t,e,i){return i>.5?e:t},color:function(t,e,i){var n=pe.color(t||"transparent"),a=n.valid&&pe.color(e||"transparent");return a&&a.valid?a.mix(n,i).hexString():e},number:function(t,e,i){return t+(e-t)*i}},me=function(){function i(n,a,r,o){e(this,i);var s=a[r];o=Ft([n.to,o,s,n.from]);var l=Ft([n.from,s,o]);this._active=!0,this._fn=n.fn||ye[n.type||t(l)],this._easing=Dt[n.easing||"linear"],this._start=Math.floor(Date.now()+(n.delay||0)),this._duration=Math.floor(n.duration),this._loop=!!n.loop,this._target=a,this._prop=r,this._from=l,this._to=o}return n(i,[{key:"active",value:function(){return this._active}},{key:"cancel",value:function(){this._active&&(this.tick(Date.now()),this._active=!1)}},{key:"tick",value:function(t){var e,i=this,n=t-i._start,a=i._duration,r=i._prop,o=i._from,s=i._loop,l=i._to;i._active=o!==l&&(s||n1?2-e:e,e=i._easing(Math.min(1,Math.max(0,e))),i._target[r]=i._fn(o,l,e)):i._target[r]=l}}]),i}(),be=["borderColor","backgroundColor"];Ot.set("animation",{duration:1e3,easing:"easeOutQuart",onProgress:v,onComplete:v,colors:{type:"color",properties:be},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]},active:{duration:400},resize:{duration:0},show:{colors:{type:"color",properties:be,from:"transparent"},visible:{type:"boolean",duration:0}},hide:{colors:{type:"color",properties:be,to:"transparent"},visible:{type:"boolean",easing:"easeInExpo"}}});var xe=function(){function t(i,n){e(this,t),this._chart=i,this._properties=new Map,this.configure(n)}return n(t,[{key:"configure",value:function(t){if(b(t)){var e=this._properties,i=function(t){var e={};return Object.keys(t).forEach((function(i){var n=t[i];b(n)||(e[i]=n)})),e}(t);Object.keys(t).forEach((function(n){var a=t[n];b(a)&&(a.properties||[n]).forEach((function(t){e.has(t)?t===n&&e.set(t,r({},e.get(t),a)):e.set(t,r({},i,a))}))}))}}},{key:"_animateOptions",value:function(t,e){var i=e.options,n=[];if(!i)return n;var a=t.options;return a?(a.$shared&&(t.options=a=r({},a,{$shared:!1,$animations:{}})),n=this._createAnimations(a,i)):t.options=i,n}},{key:"_createAnimations",value:function(t,e){var i,n=this._properties,a=[],r=t.$animations||(t.$animations={}),o=Object.keys(e);for(i=o.length-1;i>=0;--i){var s=o[i];if("$"!==s.charAt(0))if("options"!==s){var l=e[s],u=r[s];u&&u.cancel();var c=n.get(s);c&&c.duration?(r[s]=u=new me(c,t,s,l),a.push(u)):t[s]=l}else a.push.apply(a,f(this._animateOptions(t,e)))}return a}},{key:"update",value:function(t,e){if(0===this._properties.size)return function(t,e){var i=t.options,n=e.options;i&&n&&!n.$shared&&(i.$shared?t.options=r({},i,n,{$shared:!1}):r(i,n),delete e.options)}(t,e),void r(t,e);var i=this._createAnimations(t,e);return i.length?(ge.add(this._chart,i),!0):void 0}}]),t}(),_e=pe.options.resolve,ke=["push","pop","shift","splice","unshift"];function Me(t,e){var i=t&&t.options||{},n=i.reverse,a=void 0===i.min?e:0,r=void 0===i.max?e:0;return{start:n?r:a,end:n?a:r}}function we(t,e){var i=t._chartjs;if(i){var n=i.listeners,a=n.indexOf(e);-1!==a&&n.splice(a,1),n.length>0||(ke.forEach((function(e){delete t[e]})),delete t._chartjs)}}function Se(t,e){var i,n,a=[],r=t._getSortedDatasetMetas(e);for(i=0,n=r.length;i0&&(f=s._sorted,r=s._parsed[t-1]),!1===o._parsing)s._parsed=l,s._sorted=!0;else{for(n=pe.isArray(l[t])?o.parseArrayData(s,l,t,e):pe.isObject(l[t])?o.parseObjectData(s,l,t,e):o.parsePrimitiveData(s,l,t,e),i=0;ir||g=0;--i)if(!m()){y();break}return{min:d,max:f}}},{key:"getAllParsedValues",value:function(t){var e,i,n,a=this._cachedMeta._parsed,r=[];for(e=0,i=a.length;e=0;o--)i=r[o],e[i]=n(a[i])}},{key:"getStyle",value:function(t,e){var i=this,n=i._cachedMeta.dataset;i._config||i.configure();var a=n&&void 0===t?i.resolveDatasetElementOptions(e):i.resolveDataElementOptions(t||0,e&&"active");return e&&i._addAutomaticHoverColors(t,a),a}},{key:"_getContext",value:function(t,e){return{chart:this.chart,dataIndex:t,dataset:this.getDataset(),datasetIndex:this.index,active:e}}},{key:"resolveDatasetElementOptions",value:function(t){var e,i,n,a,r,o=this,s=o.chart,l=o._config,u=s.options.elements[o.datasetElementType._type]||{},c=o.datasetElementOptions,h={},d=o._getContext(void 0,t);for(e=0,i=c.length;en?(e._insertElements(n,a-n),t&&n&&e.parse(0,n)):aa?(s=a/e.innerRadius,t.arc(r,o,e.innerRadius-a,n+s,i-s,!0)):t.arc(r,o,a,n+Math.PI/2,i-Math.PI/2),t.closePath(),t.clip()}function Le(t,e,i){var n=e.options,a="inner"===n.borderAlign;a?(t.lineWidth=2*n.borderWidth,t.lineJoin="round"):(t.lineWidth=n.borderWidth,t.lineJoin="bevel"),i.fullCircles&&function(t,e,i,n){var a,r=i.endAngle;for(n&&(i.endAngle=i.startAngle+Ee,Ie(t,i),i.endAngle=r,i.endAngle===i.startAngle&&i.fullCircles&&(i.endAngle+=Ee,i.fullCircles--)),t.beginPath(),t.arc(i.x,i.y,i.innerRadius,i.startAngle+Ee,i.startAngle,!0),a=0;a=Ee||ut(a,s,l))&&(r>=u&&r<=c)}},{key:"getCenterPoint",value:function(t){var e=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),i=e.x,n=e.y,a=(e.startAngle+e.endAngle)/2,r=(e.innerRadius+e.outerRadius)/2;return{x:i+Math.cos(a)*r,y:n+Math.sin(a)*r}}},{key:"tooltipPosition",value:function(t){return this.getCenterPoint(t)}},{key:"draw",value:function(t){var e,i=this,n=i.options,a="inner"===n.borderAlign?.33:0,r={x:i.x,y:i.y,innerRadius:i.innerRadius,outerRadius:Math.max(i.outerRadius-a,0),pixelMargin:a,startAngle:i.startAngle,endAngle:i.endAngle,fullCircles:Math.floor(i.circumference/Ee)};if(t.save(),t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,r.fullCircles){for(r.endAngle=r.startAngle+Ee,t.beginPath(),t.arc(r.x,r.y,r.outerRadius,r.startAngle,r.endAngle),t.arc(r.x,r.y,r.innerRadius,r.endAngle,r.startAngle,!0),t.closePath(),e=0;e0?e.y:t.y}}function Ve(t,e,i,n){var a={x:t.controlPointNextX,y:t.controlPointNextY},r={x:e.controlPointPreviousX,y:e.controlPointPreviousY},o=ze(t,a,i),s=ze(a,r,i),l=ze(r,e,i),u=ze(o,s,i),c=ze(s,l,i);return ze(u,c,i)}function We(t){return"angle"===t?{between:ut,compare:st,normalize:lt}:{between:function(t,e,i){return t>=e&&t<=i},compare:function(t,e){return t-e},normalize:function(t){return t}}}function Ne(t,e,i,n){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n==0}}function He(t,e,i){if(!i)return[t];var n,a,r,o,s=i.property,l=i.start,u=i.end,c=e.length,h=We(s),d=h.compare,f=h.between,v=h.normalize,p=function(t,e,i){var n,a,r=i.property,o=i.start,s=i.end,l=We(r),u=l.between,c=l.normalize,h=e.length,d=t.start,f=t.end,v=t.loop;if(v){for(d+=h,f+=h,n=0,a=h;ng&&d(a,l)>0?o:n),null===_||x&&0!==d(a,u)||(b.push(Ne(_,n,m,c)),_=null),o=n);return null!==_&&b.push(Ne(_,y,m,c)),b}function je(t,e){for(var i=[],n=t.segments,a=0;al&&(l=k),b=(x*b+_)/++x):(s!==l&&(t.lineTo(b,l),t.lineTo(b,s),t.lineTo(b,u)),t.lineTo(_,k),o=M,x=0,s=l=k),u=k}}function $e(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._loop||e.tension||e.stepped||i)?qe:Xe}Ot.set("elements",{line:{backgroundColor:Ye,borderCapStyle:"butt",borderColor:Ye,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,fill:!0,tension:.4}});var Ge=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this))).options=void 0,n._loop=void 0,n._fullLoop=void 0,n._controlPointsUpdated=void 0,n._points=void 0,n._segments=void 0,t&&r(c(n),t),n}return s(i,t),n(i,[{key:"updateControlPoints",value:function(t){var e=this;if(!e._controlPointsUpdated){var i=e.options;if(i.tension&&!i.stepped){var n=i.spanGaps?e._loop:e._fullLoop;gt(e._points,i,t,n)}}}},{key:"first",value:function(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}},{key:"last",value:function(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}},{key:"interpolate",value:function(t,e){var i=this.options,n=t[e],a=this.points,r=je(this,{property:e,start:n,end:n});if(r.length){var o,s,l=[],u=function(t){return t.stepped?Be:t.tension?Ve:ze}(i);for(o=0,s=r.length;oa&&t[r%e].skip;)r--;return{start:a,end:r%=e}}(e,n,a,i),o=r.start,s=r.end;return!0===i?[{start:o,end:s,loop:a}]:function(t,e,i,n){var a,r=t.length,o=[],s=e,l=t[e];for(a=e+1;a<=i;++a){var u=t[a%r];u.skip||u.stop?l.skip||(n=!1,o.push({start:e%r,end:(a-1)%r,loop:n}),e=s=u.stop?a:null):(s=a,l.skip&&(e=a)),l=u}return null!==s&&o.push({start:e%r,end:s%r,loop:n}),o}(e,o,st.x&&(e=ti(e,"left","right")):t.base=o.left&&e<=o.right)&&(r||i>=o.top&&i<=o.bottom)}Ot.set("elements",{rectangle:{backgroundColor:Qe,borderColor:Qe,borderSkipped:"bottom",borderWidth:0}});var ai=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this))).options=void 0,n.horizontal=void 0,n.base=void 0,n.width=void 0,n.height=void 0,t&&r(c(n),t),n}return s(i,t),n(i,[{key:"draw",value:function(t){var e,i,n,a,r,o=this.options,s=(i=Je(e=this),n=i.right-i.left,a=i.bottom-i.top,r=ii(e,n/2,a/2),{outer:{x:i.left,y:i.top,w:n,h:a},inner:{x:i.left+r.l,y:i.top+r.t,w:n-r.l-r.r,h:a-r.t-r.b}}),l=s.inner,u=s.outer;t.save(),u.w===l.w&&u.h===l.h||(t.beginPath(),t.rect(u.x,u.y,u.w,u.h),t.clip(),t.rect(l.x,l.y,l.w,l.h),t.fillStyle=o.borderColor,t.fill("evenodd")),t.fillStyle=o.backgroundColor,t.fillRect(l.x,l.y,l.w,l.h),t.restore()}},{key:"inRange",value:function(t,e,i){return ni(this,t,e,i)}},{key:"inXRange",value:function(t,e){return ni(this,t,null,e)}},{key:"inYRange",value:function(t,e){return ni(this,null,t,e)}},{key:"getCenterPoint",value:function(t){var e=this.getProps(["x","y","base","horizontal",t]),i=e.x,n=e.y,a=e.base,r=e.horizontal;return{x:r?(i+a)/2:i,y:r?n:(n+a)/2}}},{key:"getRange",value:function(t){return"x"===t?this.width/2:this.height/2}}]),i}(Fe);a(ai,"_type","rectangle");var ri=Object.freeze({__proto__:null,Arc:Re,Line:Ge,Point:Ze,Rectangle:ai});function oi(t,e,i){var n,a,r=i.barThickness,o=e.stackCount,s=e.pixels[t],l=y(r)?function(t,e){var i,n,a,r,o=t._length;for(a=1,r=e.length;a0?Math.min(o,Math.abs(n-i)):o,i=n;return o}(e.scale,e.pixels):-1;return y(r)?(n=l*i.categoryPercentage,a=i.barPercentage):(n=r*o,a=1),{chunk:n/o,ratio:a,start:s-n/2}}function si(t,e,i,n){var a=i.parse(t[0],n),r=i.parse(t[1],n),o=Math.min(a,r),s=Math.max(a,r),l=o,u=s;Math.abs(o)>Math.abs(s)&&(l=s,u=o),e[i.axis]=u,e._custom={barStart:l,barEnd:u,start:a,end:r,min:o,max:s}}function li(t,e,i,n){var a,r,o,s,l=t.iScale,u=t.vScale,c=l.getLabels(),h=l===u,d=[];for(a=i,r=i+n;a0?n[t-1]:null,o=t=0;--t)e=Math.max(e,this.getStyle(t,!0).radius);return e>0&&e}},{key:"getLabelAndValue",value:function(t){var e=this._cachedMeta,i=e.xScale,n=e.yScale,a=this.getParsed(t),r=i.getLabelForValue(a.x),o=n.getLabelForValue(a.y),s=a._custom;return{label:e.label,value:"("+r+", "+o+(s?", "+s:"")+")"}}},{key:"update",value:function(t){var e=this._cachedMeta.data;this.updateElements(e,0,t)}},{key:"updateElements",value:function(t,e,i){for(var n=this,a="reset"===i,r=n._cachedMeta,o=r.xScale,s=r.yScale,l=n.resolveDataElementOptions(e,i),u=n.getSharedOptions(i,t[e],l),c=n.includeOptions(i,u),h=0;h=di?-fi:s<-di?fi:0)+e,u=Math.cos(s),c=Math.sin(s),h=Math.cos(l),d=Math.sin(l),f=s<=0&&l>=0||l>=fi,v=s<=vi&&l>=vi||l>=fi+vi,p=s<=-vi&&l>=-vi||l>=di+vi,g=s===-di||l>=di?-1:Math.min(u,u*i,h,h*i),y=p?-1:Math.min(c,c*i,d,d*i),m=f?1:Math.max(u,u*i,h,h*i),b=v?1:Math.max(c,c*i,d,d*i);n=(m-g)/2,a=(b-y)/2,r=-(m+g)/2,o=-(b+y)/2}return{ratioX:n,ratioY:a,offsetX:r,offsetY:o}}(a.rotation,a.circumference,s),c=u.ratioX,h=u.ratioY,d=u.offsetX,f=u.offsetY,v=e.getMaxBorderWidth(),p=(n.right-n.left-v)/c,g=(n.bottom-n.top-v)/h,y=Math.max(Math.min(p,g)/2,0),m=(y-Math.max(y*s,0))/e._getVisibleDatasetWeightTotal();e.offsetX=d*y,e.offsetY=f*y,r.total=e.calculateTotal(),e.outerRadius=y-m*e._getRingWeightOffset(e.index),e.innerRadius=Math.max(e.outerRadius-m*l,0),e.updateElements(o,0,t)}},{key:"_circumference",value:function(t,e){var i=this.chart.options,n=this._cachedMeta;return e&&i.animation.animateRotate?0:this.chart.getDataVisibility(t)?this.calculateCircumference(n._parsed[t]*i.circumference/fi):0}},{key:"updateElements",value:function(t,e,i){var n,a=this,r="reset"===i,o=a.chart,s=o.chartArea,l=o.options,u=l.animation,c=(s.left+s.right)/2,h=(s.top+s.bottom)/2,d=r&&u.animateScale,f=d?0:a.innerRadius,v=d?0:a.outerRadius,p=a.resolveDataElementOptions(e,i),g=a.getSharedOptions(i,t[e],p),y=a.includeOptions(i,g),m=l.rotation;for(n=0;n0&&!isNaN(t)?fi*(Math.abs(t)/e):0}},{key:"getMaxBorderWidth",value:function(t){var e,i,n,a,r,o=0,s=this.chart;if(!t)for(e=0,i=s.data.datasets.length;e0&&m.x-n.x>v};d&&(k.options=a.resolveDataElementOptions(g,i)),a.updateElement(y,g,k,i),n=m}a.updateSharedOptions(h,i)}},{key:"resolveDatasetElementOptions",value:function(t){var e=this._config,n=this.chart.options,a=n.elements.line,r=d(l(i.prototype),"resolveDatasetElementOptions",this).call(this,t);return r.spanGaps=_(e.spanGaps,n.spanGaps),r.tension=_(e.lineTension,a.tension),r.stepped=Ft([e.stepped,a.stepped]),r}},{key:"getMaxOverflow",value:function(){var t=this._cachedMeta,e=this._showLine&&t.dataset.options.borderWidth||0,i=t.data||[];if(!i.length)return e;var n=i[0].size(),a=i[i.length-1].size();return Math.max(e,n,a)/2}},{key:"draw",value:function(){var t,e,i=this._ctx,n=this.chart,a=this._cachedMeta,r=a.data||[],o=n.chartArea,s=[],l=r.length;for(this._showLine&&a.dataset.draw(i,o),t=0;t1;)t[n=r+a>>1][e]1;)t[n=r+a>>1][e]0){var s=o[0].datasetIndex,l=t.getDatasetMeta(s).data;o=[];for(var u=0;u0},t.prototype.connect_=function(){ji&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),qi?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){ji&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,i=void 0===e?"":e;Xi.some((function(t){return!!~i.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),Gi=function(t,e){for(var i=0,n=Object.keys(e);i0},t}(),ln="undefined"!=typeof WeakMap?new WeakMap:new Hi,un=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=$i.getInstance(),n=new sn(e,i,this);ln.set(this,n)};["observe","unobserve","disconnect"].forEach((function(t){un.prototype[t]=function(){var e;return(e=ln.get(this))[t].apply(e,arguments)}}));var cn=void 0!==Yi.ResizeObserver?Yi.ResizeObserver:un,hn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function dn(t,e){var i=pe.dom.getStyle(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}var fn=!!function(){var t=!1;try{var e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}()&&{passive:!0};function vn(t,e){var i=!1,n=[];return function(){for(var a=arguments.length,r=new Array(a),o=0;oe){for(var n=e;n=0;--e)this._drawDataset(t[e]);kn.notify(this,"afterDatasetsDraw")}}},{key:"_drawDataset",value:function(t){var e=this,i=e.ctx,n=t._clip,a=e.chartArea,r={meta:t,index:t.index};!1!==kn.notify(e,"beforeDatasetDraw",[r])&&(pe.canvas.clipArea(i,{left:!1===n.left?0:a.left-n.left,right:!1===n.right?e.width:a.right+n.right,top:!1===n.top?0:a.top-n.top,bottom:!1===n.bottom?e.height:a.bottom+n.bottom}),t.controller.draw(),pe.canvas.unclipArea(i),kn.notify(e,"afterDatasetDraw",[r]))}},{key:"getElementAtEvent",value:function(t){return Ai.modes.nearest(this,t,{intersect:!0})}},{key:"getElementsAtEvent",value:function(t){return Ai.modes.index(this,t,{intersect:!0})}},{key:"getElementsAtXAxis",value:function(t){return Ai.modes.index(this,t,{intersect:!1})}},{key:"getElementsAtEventForMode",value:function(t,e,i,n){var a=Ai.modes[e];return"function"==typeof a?a(this,t,i,n):[]}},{key:"getDatasetAtEvent",value:function(t){return Ai.modes.dataset(this,t,{intersect:!0})}},{key:"getDatasetMeta",value:function(t){var e=this.data.datasets[t],i=this._metasets,n=i.filter((function(t){return t._dataset===e})).pop();return n||(n=i[t]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1}),n}},{key:"getVisibleDatasetCount",value:function(){return this.getSortedVisibleDatasetMetas().length}},{key:"isDatasetVisible",value:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden}},{key:"setDatasetVisibility",value:function(t,e){this.getDatasetMeta(t).hidden=!e}},{key:"toggleDataVisibility",value:function(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}},{key:"getDataVisibility",value:function(t){return!this._hiddenIndices[t]}},{key:"_updateDatasetVisibility",value:function(t,e){var i=e?"show":"hide",n=this.getDatasetMeta(t),a=n.controller._resolveAnimations(void 0,i);this.setDatasetVisibility(t,e),a.update(n,{visible:e}),this.update((function(e){return e.datasetIndex===t?i:void 0}))}},{key:"hide",value:function(t){this._updateDatasetVisibility(t,!1)}},{key:"show",value:function(t){this._updateDatasetVisibility(t,!0)}},{key:"_destroyDatasetMeta",value:function(t){var e=this._metasets&&this._metasets[t];e&&(e.controller._destroy(),delete this._metasets[t])}},{key:"destroy",value:function(){var e,i,n=this,a=n.canvas;for(n.stop(),ge.remove(n),e=0,i=n.data.datasets.length;e3?i[2].value-i[1].value:i[1].value-i[0].value;Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var a=Z(Math.abs(n)),r=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value)),o=Math.min(Math.abs(i[0].value),Math.abs(i[i.length-1].value)),s=this.chart.options.locale;if(r<1e-4||o>1e7){var l=Z(Math.abs(t)),u=Math.floor(l)-Math.floor(a);return u=Math.max(Math.min(u,20),0),t.toExponential(u)}var c=-1*Math.floor(a);return c=Math.max(Math.min(c,20),0),new Intl.NumberFormat(s,{minimumFractionDigits:c,maximumFractionDigits:c}).format(t)}}};function Bn(t,e){for(var i=[],n=t.length/e,a=t.length,r=0;rs+1e-6)))return l}function Wn(t){return t.drawTicks?t.tickMarkLength:0}function Nn(t){if(!t.display)return 0;var e=Ct(t),i=Tt(t.padding);return e.lineHeight+i.height}function Hn(t,e,i,n,a){var r,o,s,l=_(n,0),u=Math.min(_(a,t.length),t.length),c=0;for(i=Math.ceil(i),a&&(i=(r=a-n)/Math.floor(r/i)),s=l;s<0;)c++,s=Math.round(l+c*i);for(o=Math.max(l,0);o=l||o<=1||!n.isHorizontal())n.labelRotation=s;else{var c=n._getLabelSizes(),h=c.widest.width,d=c.highest.height-c.highest.offset,f=Math.min(n.maxWidth,n.chart.width-h);h+6>(t=a.offset?n.maxWidth/o:f/(o-1))&&(t=f/(o-(a.offset?.5:1)),e=n.maxHeight-Wn(a.gridLines)-r.padding-Nn(a.scaleLabel),i=Math.sqrt(h*h+d*d),u=at(Math.min(Math.asin(Math.min((c.highest.height+6)/t,1)),Math.asin(Math.min(e/i,1))-Math.asin(d/i))),u=Math.max(s,Math.min(l,u))),n.labelRotation=u}}},{key:"afterCalculateLabelRotation",value:function(){k(this.options.afterCalculateLabelRotation,[this])}},{key:"beforeFit",value:function(){k(this.options.beforeFit,[this])}},{key:"fit",value:function(){var t=this,e={width:0,height:0},i=t.chart,n=t.options,a=n.ticks,r=n.scaleLabel,o=n.gridLines,s=t._isVisible(),l="top"!==n.position&&"x"===t.axis,u=t.isHorizontal();if(u?e.width=t.maxWidth:s&&(e.width=Wn(o)+Nn(r)),u?s&&(e.height=Wn(o)+Nn(r)):e.height=t.maxHeight,a.display&&s){var c=t._getLabelSizes(),h=c.first,d=c.last,f=c.widest,v=c.highest,p=.8*v.offset,g=a.padding;if(u){var y=0!==t.labelRotation,m=nt(t.labelRotation),b=Math.cos(m),x=Math.sin(m),_=x*f.width+b*(v.height-(y?v.offset:0))+(y?0:p);e.height=Math.min(t.maxHeight,e.height+_+g);var k,M,w=t.getPixelForTick(0)-t.left,S=t.right-t.getPixelForTick(t.ticks.length-1);y?(k=l?b*h.width+x*h.offset:x*(h.height-h.offset),M=l?x*(d.height-d.offset):b*d.width+x*d.offset):(k=h.width/2,M=d.width/2),t.paddingLeft=Math.max((k-w)*t.width/(t.width-w),0)+3,t.paddingRight=Math.max((M-S)*t.width/(t.width-S),0)+3}else{var P=a.mirror?0:f.width+g+p;e.width=Math.min(t.maxWidth,e.width+P),t.paddingTop=h.height/2,t.paddingBottom=d.height/2}}t._handleMargins(),u?(t.width=t._length=i.width-t._margins.left-t._margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=i.height-t._margins.top-t._margins.bottom)}},{key:"_handleMargins",value:function(){var t=this;t._margins&&(t._margins.left=Math.max(t.paddingLeft,t._margins.left),t._margins.top=Math.max(t.paddingTop,t._margins.top),t._margins.right=Math.max(t.paddingRight,t._margins.right),t._margins.bottom=Math.max(t.paddingBottom,t._margins.bottom))}},{key:"afterFit",value:function(){k(this.options.afterFit,[this])}},{key:"isHorizontal",value:function(){var t=this.options,e=t.axis,i=t.position;return"top"===i||"bottom"===i||"x"===e}},{key:"isFullWidth",value:function(){return this.options.fullWidth}},{key:"_convertTicksToLabels",value:function(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t),this.afterTickToLabelConversion()}},{key:"_getLabelSizes",value:function(){var t=this._labelSizes;return t||(this._labelSizes=t=this._computeLabelSizes()),t}},{key:"_computeLabelSizes",value:function(){var t=this,e=t.ctx,i=t._longestTextCache,n=t.options.ticks.sampleSize,a=[],r=[],o=[],s=t.ticks;ne){for(i=0;ii-1?null:this.getPixelForDecimal(t*n+(e?n/2:0))}},{key:"getPixelForDecimal",value:function(t){return this._reversePixels&&(t=1-t),this._startPixel+t*this._length}},{key:"getDecimalForPixel",value:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}},{key:"getBasePixel",value:function(){return this.getPixelForValue(this.getBaseValue())}},{key:"getBaseValue",value:function(){var t=this.min,e=this.max;return t<0&&e<0?e:t>0&&e>0?t:0}},{key:"_autoSkip",value:function(t){var e=this.options.ticks,i=this._length,n=e.maxTicksLimit||i/this._tickSize(),a=e.major.enabled?function(t){var e,i,n=[];for(e=0,i=t.length;en)return function(t,e,i,n){var a,r=0,o=i[0];for(n=Math.ceil(n),a=0;ar)return u}return Math.max(r,1)}(a,t,0,n);if(r>0){var c,h,d=r>1?Math.round((s-o)/(r-1)):null;for(Hn(t,l,u,y(d)?0:o-d,o),c=0,h=r-1;co*n?o/i:s/n:s*n0}},{key:"_computeGridLineItems",value:function(t){var e,i,n,a,r,o,s,l,u,c,h,d,f=this,v=f.axis,p=f.chart,g=f.options,y=g.gridLines,m=g.position,x=y.offsetGridLines,_=f.isHorizontal(),k=f.ticks,M=k.length+(x?1:0),w=Wn(y),S=[],P={scale:f,tick:k[0]},D=y.drawBorder?Ft([y.borderWidth,y.lineWidth,0],P,0):0,O=D/2,A=function(t){return V(p,t,D)};if("top"===m)e=A(f.bottom),o=f.bottom-w,l=e-O,c=A(t.top)+O,d=t.bottom;else if("bottom"===m)e=A(f.top),c=t.top,d=A(t.bottom)-O,o=e+O,l=f.top+w;else if("left"===m)e=A(f.right),r=f.right-w,s=e-O,u=A(t.left)+O,h=t.right;else if("right"===m)e=A(f.left),u=t.left,h=A(t.right)-O,r=e+O,s=f.left+w;else if("x"===v){if("center"===m)e=A((t.top+t.bottom)/2);else if(b(m)){var T=Object.keys(m)[0],C=m[T];e=A(f.chart.scales[T].getPixelForValue(C))}c=t.top,d=t.bottom,l=(o=e+O)+w}else if("y"===v){if("center"===m)e=A((t.left+t.right)/2);else if(b(m)){var F=Object.keys(m)[0],E=m[F];e=A(f.chart.scales[F].getPixelForValue(E))}s=(r=e-O)-w,u=t.left,h=t.right}for(i=0;i0&&""!==u.strokeStyle;o.save(),o.translate(l.x,l.y),o.rotate(l.rotation),o.font=u.string,o.fillStyle=u.color,o.textBaseline="middle",o.textAlign=l.textAlign,c&&(o.strokeStyle=u.strokeStyle,o.lineWidth=u.lineWidth);var h=l.label,d=l.textOffset;if(m(h))for(n=0,r=h.length;n=0&&te.length-1?null:this.getPixelForValue(t*this._numLabels/e.length+this.min)}},{key:"getValueForPixel",value:function(t){var e=Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange);return Math.min(Math.max(e,0),this.ticks.length-1)}},{key:"getBasePixel",value:function(){return this.bottom}}]),i}(jn);function Un(t,e){var i=Math.floor(Z(t)),n=t/Math.pow(10,i);return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*Math.pow(10,i)}a(Yn,"id","category"),a(Yn,"defaults",{});var Xn=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this,t))).start=void 0,n.end=void 0,n._startValue=void 0,n._endValue=void 0,n._valueRange=0,n}return s(i,t),n(i,[{key:"parse",value:function(t,e){return y(t)?NaN:("number"==typeof t||t instanceof Number)&&!isFinite(+t)?NaN:+t}},{key:"handleTickRangeOptions",value:function(){var t=this,e=t.options;if(e.beginAtZero){var i=it(t.min),n=it(t.max);i<0&&n<0?t.max=0:i>0&&n>0&&(t.min=0)}var a=void 0!==e.min||void 0!==e.suggestedMin,r=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),a!==r&&t.min>=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)}},{key:"getTickLimit",value:function(){var t,e=this.options.ticks,i=e.maxTicksLimit,n=e.stepSize;return n?t=Math.ceil(this.max/n)-Math.floor(this.min/n)+1:(t=this.computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t}},{key:"computeTickLimit",value:function(){return Number.POSITIVE_INFINITY}},{key:"handleDirectionalChanges",value:function(t){return t}},{key:"buildTicks",value:function(){var t=this,e=t.options,i=e.ticks,n=t.getTickLimit(),a=function(t,e){var i,n,a,r,o=[],s=t.stepSize,l=t.min,u=t.max,c=t.precision,h=s||1,d=t.maxTicks-1,f=e.min,v=e.max,p=Un((v-f)/d/h)*h;if(p<1e-14&&y(l)&&y(u))return[{value:f},{value:v}];(r=Math.ceil(v/p)-Math.floor(f/p))>d&&(p=Un(r*p/d/h)*h),s||y(c)?i=Math.pow(10,rt(p)):(i=Math.pow(10,c),p=Math.ceil(p*i)/i),n=Math.floor(f/p)*p,a=Math.ceil(v/p)*p,!s||y(l)||y(u)||tt((u-l)/s,p/1e3)&&(n=l,a=u),r=J(r=(a-n)/p,Math.round(r),p/1e3)?Math.round(r):Math.ceil(r),n=Math.round(n*i)/i,a=Math.round(a*i)/i,o.push({value:y(l)?n:l});for(var g=1;g0&&(t.min=0),t.handleTickRangeOptions()}},{key:"computeTickLimit",value:function(){if(this.isHorizontal())return Math.ceil(this.width/40);var t=Ct(this.options.ticks);return Math.ceil(this.height/t.lineHeight)}},{key:"handleDirectionalChanges",value:function(t){return this.isHorizontal()?t:t.reverse()}},{key:"getPixelForValue",value:function(t){return this.getPixelForDecimal((t-this._startValue)/this._valueRange)}},{key:"getValueForPixel",value:function(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},{key:"getPixelForTick",value:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}}]),i}(Xn);function Gn(t){return 1===t/Math.pow(10,Math.floor(Z(t)))}function Kn(t,e){return x(t)?t:e}a($n,"id","linear"),a($n,"defaults",qn);var Zn={ticks:{callback:zn.formatters.numeric,major:{enabled:!0}}},Qn=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this,t))).start=void 0,n.end=void 0,n._startValue=void 0,n._valueRange=0,n}return s(i,t),n(i,[{key:"parse",value:function(t,e){var i=Xn.prototype.parse.apply(this,[t,e]);if(0!==i)return x(i)&&i>0?i:NaN}},{key:"determineDataLimits",value:function(){var t=this.getMinMax(!0),e=t.min,i=t.max;this.min=x(e)?Math.max(0,e):null,this.max=x(i)?Math.max(0,i):null,this.handleTickRangeOptions()}},{key:"handleTickRangeOptions",value:function(){var t=this.min,e=this.max;t===e&&(t<=0?(t=1,e=10):(t=Math.pow(10,Math.floor(Z(t))-1),e=Math.pow(10,Math.floor(Z(e))+1))),t<=0&&(t=Math.pow(10,Math.floor(Z(e))-1)),e<=0&&(e=Math.pow(10,Math.floor(Z(t))+1)),this.min=t,this.max=e}},{key:"buildTicks",value:function(){var t=this,e=t.options,i=function(t,e){var i=Math.floor(Z(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),a=[],r=Kn(t.min,Math.pow(10,Math.floor(Z(e.min)))),o=Math.floor(Z(r)),s=Math.floor(r/Math.pow(10,o)),l=o<0?Math.pow(10,Math.abs(o)):1;do{a.push({value:r,major:Gn(r)}),10===++s&&(s=1,l=++o>=0?1:l),r=Math.round(s*Math.pow(10,o)*l)/l}while(oe.length-1?null:this.getPixelForValue(e[t].value)}},{key:"configure",value:function(){var t=this.min;d(l(i.prototype),"configure",this).call(this),this._startValue=Z(t),this._valueRange=Z(this.max)-Z(t)}},{key:"getPixelForValue",value:function(t){var e=this;return void 0!==t&&0!==t||(t=e.min),e.getPixelForDecimal(t===e.min?0:(Z(t)-e._startValue)/e._valueRange)}},{key:"getValueForPixel",value:function(t){var e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}]),i}(jn);a(Qn,"id","logarithmic"),a(Qn,"defaults",Zn);var Jn=pe.valueOrDefault,ta=pe.valueAtIndexOrDefault,ea=pe.options.resolve,ia={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:zn.formatters.numeric},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function na(t){var e=t.ticks;return e.display&&t.display?Jn(e.fontSize,Ot.fontSize)+2*e.backdropPaddingY:0}function aa(t,e,i,n,a){return t===n||t===a?{start:e-i/2,end:e+i/2}:ta?{start:e-i,end:e}:{start:e,end:e+i}}function ra(t){return 0===t||180===t?"center":t<180?"left":"right"}function oa(t,e,i,n){var a,r,o=i.y+n/2;if(pe.isArray(e))for(a=0,r=e.length;a270||t<90)&&(i.y-=e.h)}function la(t){return Q(t)?t:0}var ua=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this,t))).xCenter=void 0,n.yCenter=void 0,n.drawingArea=void 0,n.pointLabels=[],n}return s(i,t),n(i,[{key:"setDimensions",value:function(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=na(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2}},{key:"determineDataLimits",value:function(){var t=this.getMinMax(!1),e=t.min,i=t.max;this.min=pe.isFinite(e)&&!isNaN(e)?e:0,this.max=pe.isFinite(i)&&!isNaN(i)?i:0,this.handleTickRangeOptions()}},{key:"computeTickLimit",value:function(){return Math.ceil(this.drawingArea/na(this.options))}},{key:"generateTickLabels",value:function(t){var e=this;Xn.prototype.generateTickLabels.call(e,t),e.pointLabels=e.chart.data.labels.map((function(t,i){var n=pe.callback(e.options.pointLabels.callback,[t,i],e);return n||0===n?n:""}))}},{key:"fit",value:function(){var t=this.options;t.display&&t.pointLabels.display?function(t){var e,i,n,a=pe.options._parseFont(t.options.pointLabels),r={l:0,r:t.width,t:0,b:t.height-t.paddingTop},o={};t.ctx.font=a.string,t._pointLabelSizes=[];var s,l,u,c=t.chart.data.labels.length;for(e=0;er.r&&(r.r=f.end,o.r=h),v.startr.b&&(r.b=v.end,o.b=h)}t._setReductions(t.drawingArea,r,o)}(this):this.setCenterPoint(0,0,0,0)}},{key:"_setReductions",value:function(t,e,i){var n=this,a=e.l/Math.sin(i.l),r=Math.max(e.r-n.width,0)/Math.sin(i.r),o=-e.t/Math.cos(i.t),s=-Math.max(e.b-(n.height-n.paddingTop),0)/Math.cos(i.b);a=la(a),r=la(r),o=la(o),s=la(s),n.drawingArea=Math.min(Math.floor(t-(a+r)/2),Math.floor(t-(o+s)/2)),n.setCenterPoint(a,r,o,s)}},{key:"setCenterPoint",value:function(t,e,i,n){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=i+a.drawingArea,l=a.height-a.paddingTop-n-a.drawingArea;a.xCenter=Math.floor((o+r)/2+a.left),a.yCenter=Math.floor((s+l)/2+a.top+a.paddingTop)}},{key:"getIndexAngle",value:function(t){var e=this.chart;return lt(t*(2*Math.PI/e.data.labels.length)+nt((e.options||{}).startAngle||0))}},{key:"getDistanceFromCenterForValue",value:function(t){var e=this;if(pe.isNullOrUndef(t))return NaN;var i=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*i:(t-e.min)*i}},{key:"getPointPosition",value:function(t,e){var i=this.getIndexAngle(t)-Math.PI/2;return{x:Math.cos(i)*e+this.xCenter,y:Math.sin(i)*e+this.yCenter,angle:i}}},{key:"getPointPositionForValue",value:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}},{key:"getBasePosition",value:function(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}},{key:"drawGrid",value:function(){var t,e,i,n=this,a=n.ctx,r=n.options,o=r.gridLines,s=r.angleLines,l=Jn(s.lineWidth,o.lineWidth),u=Jn(s.color,o.color);if(r.pointLabels.display&&function(t){var e=t.ctx,i=t.options,n=i.pointLabels,a=na(i),r=t.getDistanceFromCenterForValue(i.ticks.reverse?t.min:t.max),o=pe.options._parseFont(n);e.save(),e.font=o.string,e.textBaseline="middle";for(var s=t.chart.data.labels.length-1;s>=0;s--){var l=0===s?a/2:0,u=t.getPointPosition(s,r+l+5),c=ta(n.fontColor,s,Ot.fontColor);e.fillStyle=c;var h=at(t.getIndexAngle(s));e.textAlign=ra(h),sa(h,t._pointLabelSizes[s],u),oa(e,t.pointLabels[s],u,o.lineHeight)}e.restore()}(n),o.display&&n.ticks.forEach((function(t,i){0!==i&&(e=n.getDistanceFromCenterForValue(n.ticks[i].value),function(t,e,i,n){var a,r=t.ctx,o=e.circular,s=t.chart.data.labels.length,l=ta(e.color,n-1,void 0),u=ta(e.lineWidth,n-1,void 0);if((o||s)&&l&&u){if(r.save(),r.strokeStyle=l,r.lineWidth=u,r.setLineDash&&(r.setLineDash(e.borderDash||[]),r.lineDashOffset=e.borderDashOffset||0),r.beginPath(),o)r.arc(t.xCenter,t.yCenter,i,0,2*Math.PI);else{a=t.getPointPosition(0,i),r.moveTo(a.x,a.y);for(var c=1;c=0;t--)e=n.getDistanceFromCenterForValue(r.ticks.reverse?n.min:n.max),i=n.getPointPosition(t,e),a.beginPath(),a.moveTo(n.xCenter,n.yCenter),a.lineTo(i.x,i.y),a.stroke();a.restore()}}},{key:"drawLabels",value:function(){var t=this,e=t.ctx,i=t.options,n=i.ticks;if(n.display){var a,r,o=t.getIndexAngle(0),s=pe.options._parseFont(n),l=Jn(n.fontColor,Ot.fontColor);e.save(),e.font=s.string,e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",t.ticks.forEach((function(o,u){(0!==u||i.reverse)&&(a=t.getDistanceFromCenterForValue(t.ticks[u].value),n.showLabelBackdrop&&(r=e.measureText(o.label).width,e.fillStyle=n.backdropColor,e.fillRect(-r/2-n.backdropPaddingX,-a-s.size/2-n.backdropPaddingY,r+2*n.backdropPaddingX,s.size+2*n.backdropPaddingY)),e.fillStyle=l,e.fillText(o.label,0,-a))})),e.restore()}}},{key:"drawTitle",value:function(){}}]),i}(Xn);a(ua,"id","radialLinear"),a(ua,"defaults",ia);var ca=Number.MAX_SAFE_INTEGER||9007199254740991,ha={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},da=Object.keys(ha);function fa(t,e){return t-e}function va(t){var e,i,n=new Set;for(e=0,i=t.length;e1;)t[i=a+n>>1]=i?t[a]:t[r];e.add(o)}}function _a(t,e,i){var n,a,r=[],o={},s=e.length;for(n=0;n=0&&(e[r].major=!0);return e}(t,r,o,i):r}function ka(t){return"labels"===t.options.ticks.source?ya(t):function(t){var e,i=t._adapter,n=t.min,a=t.max,r=t.options,o=r.time,s=o.unit||ba(o.minUnit,n,a,t._getLabelCapacity(n)),l=_(o.stepSize,1),u="week"===s&&o.isoWeekday,c=new Set,h=n;if(u&&(h=+i.startOf(h,"isoWeek",u)),h=+i.startOf(h,u?"day":s),i.diff(a,n,s)>1e5*l)throw new Error(n+" and "+a+" are too far apart with stepSize of "+l+" "+s);if("data"===t.options.ticks.source){var d=ga(t);for(e=h;en&&t[a]>i;)a--;return a++,n>0||a=da.indexOf(i);r--){var o=da[r];if(ha[o].common&&t._adapter.diff(a,n,o)>=e-1)return o}return da[i?da.indexOf(i):0]}(t,l.length,i.minUnit,t.min,t.max)),t._majorUnit=n.major.enabled&&"year"!==t._unit?function(t){for(var e=da.indexOf(t)+1,i=da.length;ee&&se.length-1?null:this.getPixelForValue(e[t].value)}},{key:"getValueForPixel",value:function(t){var e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ma(this._table,"pos",i,"time")}},{key:"_getLabelSize",value:function(t){var e=this.options.ticks,i=this.ctx.measureText(t).width,n=nt(this.isHorizontal()?e.maxRotation:e.minRotation),a=Math.cos(n),r=Math.sin(n),o=_(e.fontSize,Ot.fontSize);return{w:i*a+o*r,h:i*r+o*a}}},{key:"_getLabelCapacity",value:function(t){var e=this,i=e.options.time,n=i.displayFormats,a=n[i.unit]||n.millisecond,r=e._tickFormatFunction(t,0,_a(e,[t],e._majorUnit),a),o=e._getLabelSize(r),s=Math.floor(e.isHorizontal()?e.width/o.w:e.height/o.h)-1;return s>0?s:1}}]),i}(jn);a(wa,"id","time"),a(wa,"defaults",{distribution:"linear",bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}});var Sa=Object.freeze({__proto__:null,CategoryScale:Yn,LinearScale:$n,LogarithmicScale:Qn,RadialLinearScale:ua,TimeScale:wa});function Pa(t,e,i){var n=function(t){var e=t.options,i=e.fill,n=_(i&&i.target,i);return void 0===n&&(n=!!e.backgroundColor),!1!==n&&null!==n&&(!0===n?"origin":n)}(t),a=parseFloat(n);return x(a)&&Math.floor(a)===a?("-"!==n[0]&&"+"!==n[0]||(a=e+a),!(a===e||a<0||a>=i)&&a):["origin","start","end"].indexOf(n)>=0&&n}Ot.set("plugins",{filler:{propagate:!0}});var Da=function(){function t(i){e(this,t),this.x=i.x,this.y=i.y,this.radius=i.radius}return n(t,[{key:"pathSegment",value:function(t,e,i){var n=this.x,a=this.y,r=this.radius;return e=e||{start:0,end:2*Math.PI},i.reverse?t.arc(n,a,r,e.end,e.start,!0):t.arc(n,a,r,e.start,e.end),!i.bounds}},{key:"interpolate",value:function(t,e){var i=this.x,n=this.y,a=this.radius,r=t.angle;if("angle"===e)return{x:i+Math.cos(r)*a,y:n+Math.sin(r)*a,angle:r}}}]),t}();function Oa(t){return(t.scale||{}).getPointPositionForValue?function(t){var e,i,n=t.scale,a=t.fill,r=n.options,o=n.getLabels().length,s=[],l=r.reverse?n.max:n.min,u=r.reverse?n.min:n.max,c="start"===a?l:"end"===a?u:n.getBaseValue();if(r.gridLines.circular)return i=n.getPointPositionForValue(0,l),new Da({x:i.x,y:i.y,radius:n.getDistanceFromCenterForValue(c)});for(e=0;e=0;--e)(i=n[e].$filler)&&i.line.updateControlPoints(a)},beforeDatasetDraw:function(t,e){var i=t.chartArea,n=t.ctx,a=e.meta.$filler;if(a&&!1!==a.fill){var r=a.line,o=a.target,s=a.scale,l=r.options,u=l.fill,c=l.backgroundColor||Ot.color,h=u||{},d=h.above,f=void 0===d?c:d,v=h.below,p=void 0===v?c:v;o&&r.points.length&&(H(n,i),function(t,e){var i=e.line,n=e.target,a=e.above,r=e.below,o=e.area,s=e.scale,l=i._loop?"angle":"x";t.save(),"x"===l&&r!==a&&(Ca(t,n,o.top),Ra(t,{line:i,target:n,color:a,scale:s,property:l}),t.restore(),t.save(),Ca(t,n,o.bottom)),Ra(t,{line:i,target:n,color:r,scale:s,property:l}),t.restore()}(n,{line:r,target:o,above:f,below:p,area:i,scale:s}),j(n))}}};function Ba(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}Ot.set("legend",{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var i=e.datasetIndex,n=this.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,i=t.options.legend||{},n=i.labels&&i.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(t){var i=t.controller.getStyle(n?0:void 0);return{text:e[t.index].label,fillStyle:i.backgroundColor,hidden:!t.visible,lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:i.borderWidth,strokeStyle:i.borderColor,pointStyle:i.pointStyle,rotation:i.rotation,datasetIndex:t.index}}),this)}},title:{display:!1,position:"center",text:""}});var Va=function(t){function i(t){var n;return e(this,i),r(c(n=h(this,l(i).call(this))),t),n.legendHitBoxes=[],n._hoveredItem=null,n.doughnutMode=!1,n.chart=t.chart,n.options=t.options,n.ctx=t.ctx,n.legendItems=void 0,n.columnWidths=void 0,n.columnHeights=void 0,n.lineWidths=void 0,n._minSize=void 0,n.maxHeight=void 0,n.maxWidth=void 0,n.top=void 0,n.bottom=void 0,n.left=void 0,n.right=void 0,n.height=void 0,n.width=void 0,n._margins=void 0,n.paddingTop=void 0,n.paddingBottom=void 0,n.paddingLeft=void 0,n.paddingRight=void 0,n.position=void 0,n.weight=void 0,n.fullWidth=void 0,n}return s(i,t),n(i,[{key:"beforeUpdate",value:function(){}},{key:"update",value:function(t,e,i){var n=this;n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n._margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate()}},{key:"afterUpdate",value:function(){}},{key:"beforeSetDimensions",value:function(){}},{key:"setDimensions",value:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t._minSize={width:0,height:0}}},{key:"afterSetDimensions",value:function(){}},{key:"beforeBuildLabels",value:function(){}},{key:"buildLabels",value:function(){var t=this,e=t.options.labels||{},i=k(e.generateLabels,[t.chart],t)||[];e.filter&&(i=i.filter((function(i){return e.filter(i,t.chart.data)}))),t.options.reverse&&i.reverse(),t.legendItems=i}},{key:"afterBuildLabels",value:function(){}},{key:"beforeFit",value:function(){}},{key:"fit",value:function(){var t=this,e=t.options,i=e.labels,n=e.display,a=t.ctx,r=Ct(i),o=r.size,s=t.legendHitBoxes=[],l=t._minSize,u=t.isHorizontal(),c=t._computeTitleHeight();if(u?(l.width=t.maxWidth,l.height=n?10:0):(l.width=n?10:0,l.height=t.maxHeight),n){if(a.font=r.string,u){var h=t.lineWidths=[0],d=c;a.textAlign="left",a.textBaseline="middle",t.legendItems.forEach((function(t,e){var n=Ba(i,o)+o/2+a.measureText(t.text).width;(0===e||h[h.length-1]+n+2*i.padding>l.width)&&(d+=o+i.padding,h[h.length-(e>0?0:1)]=0),s[e]={left:0,top:0,width:n,height:o},h[h.length-1]+=n+i.padding})),l.height+=d}else{var f=i.padding,v=t.columnWidths=[],p=t.columnHeights=[],g=i.padding,y=0,m=0,b=l.height-c;t.legendItems.forEach((function(t,e){var n=Ba(i,o)+o/2+a.measureText(t.text).width;e>0&&m+o+2*f>b&&(g+=y+i.padding,v.push(y),p.push(m),y=0,m=0),y=Math.max(y,n),m+=o+f,s[e]={left:0,top:0,width:n,height:o}})),g+=y,v.push(y),p.push(m),l.width+=g}t.width=l.width,t.height=l.height}else t.width=l.width=t.height=l.height=0}},{key:"afterFit",value:function(){}},{key:"isHorizontal",value:function(){return"top"===this.options.position||"bottom"===this.options.position}},{key:"draw",value:function(){var t=this,e=t.options,i=e.labels,n=Ot.color,a=Ot.elements.line,r=t.height,o=t.columnHeights,s=t.width,l=t.lineWidths;if(e.display){t.drawTitle();var u,c=It(e.rtl,t.left,t._minSize.width),h=t.ctx,d=_(i.fontColor,Ot.fontColor),f=Ct(i),v=f.size;h.textAlign=c.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=d,h.fillStyle=d,h.font=f.string;var p=Ba(i,v),g=t.legendHitBoxes,y=function(t,n){switch(e.align){case"start":return i.padding;case"end":return t-n;default:return(t-n+i.padding)/2}},m=t.isHorizontal(),b=this._computeTitleHeight();u=m?{x:t.left+y(s,l[0]),y:t.top+i.padding+b,line:0}:{x:t.left+i.padding,y:t.top+y(r,o[0])+b,line:0},Lt(t.ctx,e.textDirection);var x=v+i.padding;t.legendItems.forEach((function(e,d){var f=h.measureText(e.text).width,b=p+v/2+f,k=u.x,M=u.y;c.setWidth(t._minSize.width),m?d>0&&k+b+i.padding>t.left+t._minSize.width&&(M=u.y+=x,u.line++,k=u.x=t.left+y(s,l[u.line])):d>0&&M+x>t.top+t._minSize.height&&(k=u.x=k+t.columnWidths[u.line]+i.padding,u.line++,M=u.y=t.top+y(r,o[u.line]));var w=c.x(k);!function(t,e,r){if(!(isNaN(p)||p<=0)){h.save();var o=_(r.lineWidth,a.borderWidth);if(h.fillStyle=_(r.fillStyle,n),h.lineCap=_(r.lineCap,a.borderCapStyle),h.lineDashOffset=_(r.lineDashOffset,a.borderDashOffset),h.lineJoin=_(r.lineJoin,a.borderJoinStyle),h.lineWidth=o,h.strokeStyle=_(r.strokeStyle,n),h.setLineDash&&h.setLineDash(_(r.lineDash,a.borderDash)),i&&i.usePointStyle){var s={radius:p*Math.SQRT2/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:o},l=c.xPlus(t,p/2);W(h,s,l,e+v/2)}else h.fillRect(c.leftForLtr(t,p),e,p,v),0!==o&&h.strokeRect(c.leftForLtr(t,p),e,p,v);h.restore()}}(w,M,e),g[d].left=c.leftForLtr(w,g[d].width),g[d].top=M,function(t,e,i,n){var a=v/2,r=c.xPlus(t,p+a),o=e+a;h.fillText(i.text,r,o),i.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(r,o),h.lineTo(c.xPlus(r,n),o),h.stroke())}(w,M,e,f),m?u.x+=b+i.padding:u.y+=x})),Rt(t.ctx,e.textDirection)}}},{key:"drawTitle",value:function(){var t=this,e=t.options,i=e.title,n=Ct(i),a=Tt(i.padding);if(i.display){var r,o,s=It(e.rtl,t.left,t._minSize.width),l=t.ctx,u=_(i.fontColor,Ot.fontColor),c=i.position,h=n.size/2,d=t.top+a.top+h,v=t.left,p=t.width;if(this.isHorizontal())switch(p=Math.max.apply(Math,f(t.lineWidths)),e.align){case"start":break;case"end":v=t.right-p;break;default:v=(t.left+t.right)/2-p/2}else{var g=Math.max.apply(Math,f(t.columnHeights));switch(e.align){case"start":break;case"end":d+=t.height-g;break;default:d+=(t.height-g)/2}}switch(c){case"start":r=v,o="left";break;case"end":r=v+p,o="right";break;default:r=v+p/2,o="center"}l.textAlign=s.textAlign(o),l.textBaseline="middle",l.strokeStyle=u,l.fillStyle=u,l.font=n.string,l.fillText(i.text,r,d)}}},{key:"_computeTitleHeight",value:function(){var t=this.options.title,e=Ct(t),i=Tt(t.padding);return t.display?e.lineHeight+i.height:0}},{key:"_getLegendItemAt",value:function(t,e){var i,n,a,r=this;if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)for(a=r.legendHitBoxes,i=0;i=(n=a[i]).left&&t<=n.left+n.width&&e>=n.top&&e<=n.top+n.height)return r.legendItems[i];return null}},{key:"handleEvent",value:function(t){var e=this,i=e.options,n="mouseup"===t.type?"click":t.type;if("mousemove"===n){if(!i.onHover&&!i.onLeave)return}else{if("click"!==n)return;if(!i.onClick)return}var a=e._getLegendItemAt(t.x,t.y);"click"===n?a&&i.onClick&&i.onClick.call(e,t.native,a):(i.onLeave&&a!==e._hoveredItem&&(e._hoveredItem&&i.onLeave.call(e,t.native,e._hoveredItem),e._hoveredItem=a),i.onHover&&a&&i.onHover.call(e,t.native,a))}}]),i}(Fe);function Wa(t,e){var i=new Va({ctx:t.ctx,options:e,chart:t});Vi.configure(t,i,e),Vi.addBox(t,i),t.legend=i}var Na={id:"legend",_element:Va,beforeInit:function(t){var e=t.options.legend;e&&Wa(t,e)},afterUpdate:function(t){var e=t.options.legend,i=t.legend;e?(D(e,Ot.legend),i?(Vi.configure(t,i,e),i.options=e,i.buildLabels()):Wa(t,e)):i&&(Vi.removeBox(t,i),delete t.legend)},afterEvent:function(t,e){var i=t.legend;i&&i.handleEvent(e)}};Ot.set("title",{align:"center",display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3});var Ha=function(t){function i(t){var n;return e(this,i),r(c(n=h(this,l(i).call(this))),t),n.chart=t.chart,n.options=t.options,n.ctx=t.ctx,n._margins=void 0,n._padding=void 0,n.legendHitBoxes=[],n.top=void 0,n.bottom=void 0,n.left=void 0,n.right=void 0,n.width=void 0,n.height=void 0,n.maxWidth=void 0,n.maxHeight=void 0,n.position=void 0,n.weight=void 0,n.fullWidth=void 0,n}return s(i,t),n(i,[{key:"beforeUpdate",value:function(){}},{key:"update",value:function(t,e,i){var n=this;n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n._margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate()}},{key:"afterUpdate",value:function(){}},{key:"beforeSetDimensions",value:function(){}},{key:"setDimensions",value:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height)}},{key:"afterSetDimensions",value:function(){}},{key:"beforeBuildLabels",value:function(){}},{key:"buildLabels",value:function(){}},{key:"afterBuildLabels",value:function(){}},{key:"beforeFit",value:function(){}},{key:"fit",value:function(){var t=this,e=t.options,i={},n=t.isHorizontal();if(e.display){var a=pe.isArray(e.text)?e.text.length:1;t._padding=pe.options.toPadding(e.padding);var r=a*pe.options._parseFont(e).lineHeight+t._padding.height;t.width=i.width=n?t.maxWidth:r,t.height=i.height=n?r:t.maxHeight}else t.width=i.width=t.height=i.height=0}},{key:"afterFit",value:function(){}},{key:"isHorizontal",value:function(){var t=this.options.position;return"top"===t||"bottom"===t}},{key:"draw",value:function(){var t=this,e=t.ctx,i=t.options;if(i.display){var n,a,r,o,s=pe.options._parseFont(i),l=s.lineHeight,u=l/2+t._padding.top,c=0,h=t.top,d=t.left,f=t.bottom,v=t.right;if(t.isHorizontal()){switch(i.align){case"start":a=d,o="left";break;case"end":a=v,o="right";break;default:a=d+(v-d)/2,o="center"}r=h+u,n=v-d}else{switch(a="left"===i.position?d+u:v-u,i.align){case"start":r="left"===i.position?f:h,o="left";break;case"end":r="left"===i.position?h:f,o="right";break;default:r=h+(f-h)/2,o="center"}n=f-h,c=Math.PI*("left"===i.position?-.5:.5)}e.save(),e.fillStyle=pe.valueOrDefault(i.fontColor,Ot.fontColor),e.font=s.string,e.translate(a,r),e.rotate(c),e.textAlign=o,e.textBaseline="middle";var p=i.text;if(pe.isArray(p))for(var g=0,y=0;y0){var r=t[0];r.label?i=r.label:a>0&&r.index-1?t.split("\n"):t}function Ka(t,e){var i=e.datasetIndex,n=e.index,a=t.getDatasetMeta(i).controller.getLabelAndValue(n);return{label:a.label,value:a.value,index:n,datasetIndex:i}}function Za(t){var e=t._chart.ctx,i=t.body,n=t.footer,a=t.options,r=t.title,o=a.bodyFontSize,s=a.footerFontSize,l=a.titleFontSize,u=a.boxWidth,c=a.boxHeight,h=r.length,d=n.length,f=i.length,v=2*a.yPadding,p=0,g=i.reduce((function(t,e){return t+e.before.length+e.lines.length+e.after.length}),0);(g+=t.beforeBody.length+t.afterBody.length,h&&(v+=h*l+(h-1)*a.titleSpacing+a.titleMarginBottom),g)&&(v+=f*(a.displayColors?Math.max(c,o):o)+(g-f)*o+(g-1)*a.bodySpacing);d&&(v+=a.footerMarginTop+d*s+(d-1)*a.footerSpacing);var y=0,m=function(t){p=Math.max(p,e.measureText(t).width+y)};return e.save(),e.font=pe.fontString(l,a.titleFontStyle,a.titleFontFamily),pe.each(t.title,m),e.font=pe.fontString(o,a.bodyFontStyle,a.bodyFontFamily),pe.each(t.beforeBody.concat(t.afterBody),m),y=a.displayColors?u+2:0,pe.each(i,(function(t){pe.each(t.before,m),pe.each(t.lines,m),pe.each(t.after,m)})),y=0,e.font=pe.fontString(s,a.footerFontStyle,a.footerFontFamily),pe.each(t.footer,m),e.restore(),{width:p+=2*a.xPadding,height:v}}function Qa(t,e,i){var n,a,r=i.x,o=i.y,s=i.width,l=i.height,u=t.chartArea,c="center",h="center";ot.height-l&&(h="bottom");var d=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===h?(n=function(t){return t<=d},a=function(t){return t>d}):(n=function(t){return t<=s/2},a=function(e){return e>=t.width-s/2});var v=function(t){return t<=f?"top":"bottom"};return n(r)?(c="left",r+s+e.caretSize+e.caretPadding>t.width&&(c="center",h=v(o))):a(r)&&(c="right",function(t){return t-s-e.caretSize-e.caretPadding<0}(r)&&(c="center",h=v(o))),{xAlign:e.xAlign?e.xAlign:c,yAlign:e.yAlign?e.yAlign:h}}function Ja(t,e,i,n){var a=t.caretSize,r=t.caretPadding,o=t.cornerRadius,s=i.xAlign,l=i.yAlign,u=a+r,c=o+r,h=function(t,e,i){var n=t.x,a=t.width;return"right"===e?n-=a:"center"===e&&((n-=a/2)+a>i&&(n=i-a),n<0&&(n=0)),n}(e,s,n.width);return"center"===l?"left"===s?h+=u:"right"===s&&(h-=u):"left"===s?h-=c:"right"===s&&(h+=c),{x:h,y:function(t,e,i){var n=t.y,a=t.height;return"top"===e?n+=i:n-="bottom"===e?a+i:a/2,n}(e,l,u)}}function tr(t,e){var i=t.options;return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.xPadding:t.x+i.xPadding}function er(t){return $a([],Ga(t))}var ir=function(t){function i(t){var n;return e(this,i),(n=h(this,l(i).call(this))).opacity=0,n._active=[],n._chart=t._chart,n._eventPosition=void 0,n._size=void 0,n._cachedAnimations=void 0,n.$animations=void 0,n.options=void 0,n.dataPoints=void 0,n.title=void 0,n.beforeBody=void 0,n.body=void 0,n.afterBody=void 0,n.footer=void 0,n.xAlign=void 0,n.yAlign=void 0,n.x=void 0,n.y=void 0,n.height=void 0,n.width=void 0,n.caretX=void 0,n.caretY=void 0,n.labelColors=void 0,n.labelTextColors=void 0,n.initialize(),n}return s(i,t),n(i,[{key:"initialize",value:function(){this.options=function(t){return(t=r({},Ot.tooltips,t)).bodyFontFamily=Ua(t.bodyFontFamily,Ot.fontFamily),t.bodyFontStyle=Ua(t.bodyFontStyle,Ot.fontStyle),t.bodyFontSize=Ua(t.bodyFontSize,Ot.fontSize),t.boxHeight=Ua(t.boxHeight,t.bodyFontSize),t.boxWidth=Ua(t.boxWidth,t.bodyFontSize),t.titleFontFamily=Ua(t.titleFontFamily,Ot.fontFamily),t.titleFontStyle=Ua(t.titleFontStyle,Ot.fontStyle),t.titleFontSize=Ua(t.titleFontSize,Ot.fontSize),t.footerFontFamily=Ua(t.footerFontFamily,Ot.fontFamily),t.footerFontStyle=Ua(t.footerFontStyle,Ot.fontStyle),t.footerFontSize=Ua(t.footerFontSize,Ot.fontSize),t}(this._chart.options.tooltips)}},{key:"_resolveAnimations",value:function(){var t=this,e=t._cachedAnimations;if(e)return e;var i=t._chart.options.animation&&t.options.animation,n=new xe(t._chart,i);return t._cachedAnimations=Object.freeze(n),n}},{key:"getTitle",value:function(t,e){var i=this.options.callbacks,n=i.beforeTitle.apply(this,[t,e]),a=i.title.apply(this,[t,e]),r=i.afterTitle.apply(this,[t,e]),o=[];return o=$a(o,Ga(n)),o=$a(o,Ga(a)),o=$a(o,Ga(r))}},{key:"getBeforeBody",value:function(t,e){return er(this.options.callbacks.beforeBody.apply(this,[t,e]))}},{key:"getBody",value:function(t,e){var i=this,n=i.options.callbacks,a=[];return pe.each(t,(function(t){var r={before:[],lines:[],after:[]};$a(r.before,Ga(n.beforeLabel.call(i,t,e))),$a(r.lines,n.label.call(i,t,e)),$a(r.after,Ga(n.afterLabel.call(i,t,e))),a.push(r)})),a}},{key:"getAfterBody",value:function(t,e){return er(this.options.callbacks.afterBody.apply(this,[t,e]))}},{key:"getFooter",value:function(t,e){var i=this.options.callbacks,n=i.beforeFooter.apply(this,[t,e]),a=i.footer.apply(this,[t,e]),r=i.afterFooter.apply(this,[t,e]),o=[];return o=$a(o,Ga(n)),o=$a(o,Ga(a)),o=$a(o,Ga(r))}},{key:"_createItems",value:function(){var t,e,i=this,n=i._active,a=i.options,r=i._chart.data,o=[],s=[],l=[];for(t=0,e=n.length;t0&&e.stroke()}},{key:"_updateAnimationTarget",value:function(){var t=this,e=t._chart,i=t.options,n=t.$animations,a=n&&n.x,o=n&&n.y;if(a||o){var s=qa[i.position].call(t,t._active,t._eventPosition);if(!s)return;var l=t._size=Za(t),u=r({},s,t._size),c=Qa(e,i,u),h=Ja(i,u,c,e);a._to===h.x&&o._to===h.y||(t.xAlign=c.xAlign,t.yAlign=c.yAlign,t.width=l.width,t.height=l.height,t.caretX=s.x,t.caretY=s.y,t._resolveAnimations().update(t,h))}}},{key:"draw",value:function(t){var e=this,i=e.options,n=e.opacity;if(n){e._updateAnimationTarget();var a={width:e.width,height:e.height},r={x:e.x,y:e.y};n=Math.abs(n)<.001?0:n;var o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;i.enabled&&o&&(t.save(),t.globalAlpha=n,e.drawBackground(r,t,a),pe.rtl.overrideTextDirection(t,i.textDirection),r.y+=i.yPadding,e.drawTitle(r,t),e.drawBody(r,t),e.drawFooter(r,t),pe.rtl.restoreTextDirection(t,i.textDirection),t.restore())}}},{key:"handleEvent",value:function(t,e){var i,n=this,a=n.options,r=n._active||[],o=[];return"mouseout"!==t.type&&(o=n._chart.getElementsAtEventForMode(t,a.mode,a,e),a.reverse&&o.reverse()),(i=e||!pe._elementsEqual(o,r))&&(n._active=o,(a.enabled||a.custom)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0))),i}}]),i}(Fe);ir.positioners=qa;var nr={filler:za,legend:Na,title:Ya,tooltip:{id:"tooltip",_element:ir,positioners:qa,afterInit:function(t){t.options.tooltips&&(t.tooltip=new ir({_chart:t}))},beforeUpdate:function(t){t.tooltip&&t.tooltip.initialize()},reset:function(t){t.tooltip&&t.tooltip.initialize()},afterDraw:function(t){var e=t.tooltip,i={tooltip:e};!1!==kn.notify(t,"beforeTooltipDraw",[i])&&(e.draw(t.ctx),kn.notify(t,"afterTooltipDraw",[i]))},afterEvent:function(t,e,i){if(t.tooltip){var n=i;t.tooltip.handleEvent(e,n)}}}};for(var ar in En.helpers=pe,En._adapters=Rn,En.Animation=me,En.Animator=ge,En.animationService=xe,En.controllers=xi,En.DatasetController=Ce,En.defaults=Ot,En.Element=Fe,En.elements=ri,En.Interaction=Ai,En.layouts=Vi,En.platforms=_n,En.plugins=kn,En.Scale=jn,En.scaleService=Mn,En.Ticks=zn,Object.keys(Sa).forEach((function(t){return En.scaleService.registerScale(Sa[t])})),nr)Object.prototype.hasOwnProperty.call(nr,ar)&&En.plugins.register(nr[ar]);return"undefined"!=typeof window&&(window.Chart=En),En})); 14 | -------------------------------------------------------------------------------- /pie.php: -------------------------------------------------------------------------------- 1 | 35 |