You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
161 KiB
20 lines
161 KiB
3 months ago
|
/*!
|
||
|
* Chart.js
|
||
|
* http://chartjs.org/
|
||
|
* Version: 2.7.2
|
||
|
*
|
||
|
* Copyright 2018 Chart.js Contributors
|
||
|
* Released under the MIT license
|
||
|
* https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
|
||
|
*/
|
||
|
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function t(e,i,n){function a(r,s){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(o)return o(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[r]={exports:{}};e[r][0].call(d.exports,function(t){var i=e[r][1][t];return a(i||t)},d,d.exports,t,e,i,n)}return i[r].exports}for(var o="function"==typeof require&&require,r=0;r<n.length;r++)a(n[r]);return a}({1:[function(t,e,i){},{}],2:[function(t,e,i){var n=t(6);function a(t){if(t){var e=[0,0,0],i=1,a=t.match(/^#([a-fA-F0-9]{3})$/i);if(a){a=a[1];for(var o=0;o<e.length;o++)e[o]=parseInt(a[o]+a[o],16)}else if(a=t.match(/^#([a-fA-F0-9]{6})$/i)){a=a[1];for(o=0;o<e.length;o++)e[o]=parseInt(a.slice(2*o,2*o+2),16)}else if(a=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(o=0;o<e.length;o++)e[o]=parseInt(a[o+1]);i=parseFloat(a[4])}else if(a=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(o=0;o<e.length;o++)e[o]=Math.round(2.55*parseFloat(a[o+1]));i=parseFloat(a[4])}else if(a=t.match(/(\w+)/)){if("transparent"==a[1])return[0,0,0,0];if(!(e=n[a[1]]))return}for(o=0;o<e.length;o++)e[o]=d(e[o],0,255);return i=i||0==i?d(i,0,1):1,e[3]=i,e}}function o(t){if(t){var e=t.match(/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var i=parseFloat(e[4]);return[d(parseInt(e[1]),0,360),d(parseFloat(e[2]),0,100),d(parseFloat(e[3]),0,100),d(isNaN(i)?1:i,0,1)]}}}function r(t){if(t){var e=t.match(/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var i=parseFloat(e[4]);return[d(parseInt(e[1]),0,360),d(parseFloat(e[2]),0,100),d(parseFloat(e[3]),0,100),d(isNaN(i)?1:i,0,1)]}}}function s(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function l(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function u(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function d(t,e,i){return Math.min(Math.max(e,t),i)}function c(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}e.exports={getRgba:a,getHsla:o,getRgb:function(t){var e=a(t);return e&&e.slice(0,3)},getHsl:function(t){var e=o(t);return e&&e.slice(0,3)},getHwb:r,getAlpha:function(t){var e=a(t);{if(e)return e[3];if(e=o(t))return e[3];if(e=r(t))return e[3]}},hexString:function(t){return"#"+c(t[0])+c(t[1])+c(t[2])},rgbString:function(t,e){if(e<1||t[3]&&t[3]<1)return s(t,e);return"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:s,percentString:function(t,e){if(e<1||t[3]&&t[3]<1)return l(t,e);var i=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+i+"%, "+n+"%, "+a+"%)"},percentaString:l,hslString:function(t,e){if(e<1||t[3]&&t[3]<1)return u(t,e);return"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:u,hwbString:function(t,e){void 0===e&&(e=void 0!==t[3]?t[3]:1);return"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return h[t.slice(0,3)]}};var h={};for(var f in n)h[n[f]]=f},{6:6}],3:[function(t,e,i){var n=t(5),a=t(2),o=function(t){return t instanceof o?t:this instanceof o?(this.valid=!1,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},void("string"==typeof t?(e=a.getRgba(t))?this.setValues("rgb",e):(e=a.getHsla(t))?this.setValues("hsl",e):(e=a.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValu
|
||
|
|
||
|
/**
|
||
|
* [Chart.PieceLabel.js]{@link https://github.com/emn178/Chart.PieceLabel.js}
|
||
|
*
|
||
|
* @version 0.9.0
|
||
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
|
* @copyright Chen, Yi-Cyuan 2017
|
||
|
* @license MIT
|
||
|
*/
|
||
|
!function(){function t(){this.drawDataset=this.drawDataset.bind(this)}"undefined"==typeof Chart?console.warn("Can not find Chart object."):(t.prototype.beforeDatasetsUpdate=function(t){if(this.parseOptions(t)&&"outside"===this.position){var e=1.5*this.fontSize+2;t.chartArea.top+=e,t.chartArea.bottom-=e}},t.prototype.afterDatasetsDraw=function(t){this.parseOptions(t)&&(this.labelBounds=[],t.config.data.datasets.forEach(this.drawDataset))},t.prototype.drawDataset=function(t){for(var e=this.ctx,i=this.chartInstance,o=t._meta[Object.keys(t._meta)[0]],a=0,s=0;s<o.data.length;s++){var r=o.data[s],n=r._view;if(0!==n.circumference||this.showZero){switch(this.render){case"value":var h=t.data[s];this.format&&(h=this.format(h)),h=h.toString();break;case"label":h=i.config.data.labels[s];break;case"image":h=this.images[s]?this.loadImage(this.images[s]):"";break;default:var l=n.circumference/this.options.circumference*100;l=parseFloat(l.toFixed(this.precision)),this.showActualPercentages||100<(a+=l)&&(l-=a-100,l=parseFloat(l.toFixed(this.precision))),h=l+"%"}if("function"==typeof this.render&&("object"==typeof(h=this.render({label:i.config.data.labels[s],value:t.data[s],percentage:l,dataset:t,index:s}))&&(h=this.loadImage(h))),!h)break;if(e.save(),e.beginPath(),e.font=Chart.helpers.fontString(this.fontSize,this.fontStyle,this.fontFamily),"outside"===this.position||"border"===this.position&&"pie"===i.config.type){var f,c=n.outerRadius/2,p=this.fontSize+2,d=n.startAngle+(n.endAngle-n.startAngle)/2;if("border"===this.position?f=(n.outerRadius-c)/2+c:"outside"===this.position&&(f=n.outerRadius-c+c+p),d={x:n.x+Math.cos(d)*f,y:n.y+Math.sin(d)*f},"outside"===this.position){d.x=d.x<n.x?d.x-p:d.x+p;var u=n.outerRadius+p}}else c=n.innerRadius,d=r.tooltipPosition();if("function"==typeof(p=this.fontColor)?p=p({label:i.config.data.labels[s],value:t.data[s],percentage:l,text:h,backgroundColor:t.backgroundColor[s],dataset:t,index:s}):"string"!=typeof p&&(p=p[s]||this.options.defaultFontColor),this.arc)u||(u=(c+n.outerRadius)/2),e.fillStyle=p,e.textBaseline="middle",this.drawArcText(h,u,n,this.overlap);else{c=this.measureText(h),n=d.x-c.width/2,c=d.x+c.width/2;var g=d.y-this.fontSize/2,x=d.y+this.fontSize/2;(this.overlap||("outside"===this.position?this.checkTextBound(n,c,g,x):r.inRange(n,g)&&r.inRange(n,x)&&r.inRange(c,g)&&r.inRange(c,x)))&&this.fillText(h,d,p)}e.restore()}}},t.prototype.parseOptions=function(t){var e=t.options.pieceLabel;return!!e&&(this.chartInstance=t,this.ctx=t.chart.ctx,this.options=t.config.options,this.render=e.render||e.mode,this.position=e.position||"default",this.arc=e.arc,this.format=e.format,this.precision=e.precision||0,this.fontSize=e.fontSize||this.options.defaultFontSize,this.fontColor=e.fontColor||this.options.defaultFontColor,this.fontStyle=e.fontStyle||this.options.defaultFontStyle,this.fontFamily=e.fontFamily||this.options.defaultFontFamily,this.hasTooltip=t.tooltip._active&&t.tooltip._active.length,this.showZero=e.showZero,this.overlap=e.overlap,this.images=e.images||[],this.showActualPercentages=e.showActualPercentages||!1,!0)},t.prototype.checkTextBound=function(t,e,i,o){for(var a=this.labelBounds,s=0;s<a.length;++s){for(var r=a[s],n=[[t,i],[t,o],[e,i],[e,o]],h=0;h<n.length;++h){var l=n[h][0],f=n[h][1];if(l>=r.left&&l<=r.right&&f>=r.top&&f<=r.bottom)return!1}for(n=[[r.left,r.top],[r.left,r.bottom],[r.right,r.top],[r.right,r.bottom]],h=0;h<n.length;++h)if(l=n[h][0],f=n[h][1],l>=t&&l<=e&&f>=i&&f<=o)return!1}return a.push({left:t,right:e,top:i,bottom:o}),!0},t.prototype.measureText=function(t){return"object"==typeof t?{width:t.width,height:t.height}:this.ctx.measureText(t)},t.prototype.fillText=function(t,e,i){var o=this.ctx;"object"==typeof t?o.drawImage(t,e.x-t.width/2,e.y-t.height/2,t.width,t.height):(o.fillStyle=i,o.textBaseline="top",o.textAlign="center",o.fillText(t,e.x,e.y-this.fontSize/2))},t.prototype.loadImage=function(t){var e=new Image;return e.src=t.src,e.width=t.width,e.height=t.height,e},t.prototype.drawArcText=function(t,e,i,o){var a=this.ctx,s=i.x,r=i.y,n=i.startAngle;i=i.endAngle,a.save(),a.tra
|