diff --git a/app/config/locale/translations/fr.json b/app/config/locale/translations/fr.json index 704cf619e..f5cc15a83 100644 --- a/app/config/locale/translations/fr.json +++ b/app/config/locale/translations/fr.json @@ -5,8 +5,8 @@ "emails.sender": "Équipe %s", "emails.verification.subject": "Vérification du compte", "emails.verification.hello": "Bonjour {{name}}", - "emails.verification.body": "Suivez ce lien pour vérifier votre adresse mail.", - "emails.verification.footer": "Si vous n'avez pas demandé à vérifier cette adresse mail, vous pouvez ignorer ce message.", + "emails.verification.body": "Suivez ce lien pour vérifier votre adresse e-mail.", + "emails.verification.footer": "Si vous n'avez pas demandé à vérifier cette adresse, vous pouvez ignorer ce message.", "emails.verification.thanks": "Merci", "emails.verification.signature": "Équipe {{project}}", "emails.magicSession.subject": "Connexion", @@ -14,19 +14,25 @@ "emails.magicSession.body": "Suivez ce lien pour vous connecter.", "emails.magicSession.footer": "Si vous n'avez pas demandé à vous connecter en utilisant cet e-mail, vous pouvez ignorer ce message.", "emails.magicSession.thanks": "Merci", - "emails.magicSession.signature": "Réinitialisation du mot de passe", - "emails.recovery.subject": "Bonjour {{name}}", + "emails.magicSession.signature": "L'équipe {{project}}", + "emails.recovery.subject": "Réinitialisation du mot de passe", "emails.recovery.hello": "Bonjour {{name}}", - "emails.recovery.body": "Suivez ce lien pour réinitialiser votre mot de passe de {{projet}}.", + "emails.recovery.body": "Suivez ce lien pour réinitialiser votre mot de passe pour {{projet}}.", "emails.recovery.footer": "Si vous n'avez pas demandé à réinitialiser votre mot de passe, vous pouvez ignorer ce message.", "emails.recovery.thanks": "Merci", - "emails.recovery.signature": "Équipe {{project}}", + "emails.recovery.signature": "L'équipe {{project}}", "emails.invitation.subject": "Invitation à l'équipe %s de %s", "emails.invitation.hello": "Bonjour", - "emails.invitation.body": "Ce mail vous a été envoyé parce que {{owner}} voulait vous inviter à devenir membre de l'équipe {{team}} de {{project}}.", + "emails.invitation.body": "Cet e-mail vous a été envoyé parce que {{owner}} souhaite vous inviter à devenir membre de l'équipe {{team}} pour {{project}}.", "emails.invitation.footer": "Si vous n'êtes pas intéressé, vous pouvez ignorer ce message.", "emails.invitation.thanks": "Merci", - "emails.invitation.signature": "Équipe {{project}}", + "emails.invitation.signature": "L'équipe {{project}}", + "emails.certificate.subject": "Échec du certificat pour %s", + "emails.certificate.hello": "Bonjour", + "emails.certificate.body": "Le certificate pour votre domaine '{{domain}}' n'a pas pu être généré. Ceci est la tentative {{tentative}} et l'échec a été causé par : {{erreur}}", + "emails.certificate.footer": "Votre certificat précédent sera valide pendant 30 jours à compter de la première défaillance. Nous vous recommandons fortement d'enquêter sur ce cas, sinon votre domaine se retrouvera sans communication SSL valide.", + "emails.certificate.thanks": "Merci", + "emails.certificate.signature": "L'équipe {{project}}", "locale.country.unknown": "Inconnu", "countries.af": "Afghanistan", "countries.ao": "Angola", @@ -229,4 +235,4 @@ "continents.na": "Amérique du Nord", "continents.oc": "Océanie", "continents.sa": "Amérique du Sud" -} \ No newline at end of file +} diff --git a/app/config/providers.php b/app/config/providers.php index 91728def5..5bb7c925d 100644 --- a/app/config/providers.php +++ b/app/config/providers.php @@ -327,6 +327,7 @@ return [ // Ordered by ABC. // 'beta' => false, // 'mock' => false, // ], + // Keep Last 'mock' => [ 'name' => 'Mock', diff --git a/gulpfile.js b/gulpfile.js index 8bd41ece4..728eee28a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -182,4 +182,4 @@ function concat() { exports.import = series(concatDep); exports.less = series(lessLTR, lessRTL); -exports.build = series(concatApp, concat); \ No newline at end of file +exports.build = series(concatApp, concat); diff --git a/package-lock.json b/package-lock.json index 999afa76a..e6a0f6354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "BSD-3-Clause", "dependencies": { - "chart.js": "^3.7.1", + "chart.js": "^3.8.0", "markdown-it": "^12.3.2", "pell": "^1.0.6", "prismjs": "^1.28.0", @@ -549,9 +549,9 @@ } }, "node_modules/chart.js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.7.1.tgz", - "integrity": "sha512-8knRegQLFnPQAheZV8MjxIXc5gQEfDFD897BJgv/klO/vtIyFFmgMXrNfgrXpbTr/XbTturxRgxIXx/Y+ASJBA==" + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.0.tgz", + "integrity": "sha512-cr8xhrXjLIXVLOBZPkBZVF6NDeiVIrPLHcMhnON7UufudL+CNeRrD+wpYanswlm8NpudMdrt3CHoLMQMxJhHRg==" }, "node_modules/chokidar": { "version": "2.1.8", @@ -5484,9 +5484,9 @@ "dev": true }, "chart.js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.7.1.tgz", - "integrity": "sha512-8knRegQLFnPQAheZV8MjxIXc5gQEfDFD897BJgv/klO/vtIyFFmgMXrNfgrXpbTr/XbTturxRgxIXx/Y+ASJBA==" + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.0.tgz", + "integrity": "sha512-cr8xhrXjLIXVLOBZPkBZVF6NDeiVIrPLHcMhnON7UufudL+CNeRrD+wpYanswlm8NpudMdrt3CHoLMQMxJhHRg==" }, "chokidar": { "version": "2.1.8", diff --git a/package.json b/package.json index 9b8240cf5..c7b3aebd0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "gulp-less": "^5.0.0" }, "dependencies": { - "chart.js": "^3.7.1", + "chart.js": "^3.8.0", "markdown-it": "^12.3.2", "pell": "^1.0.6", "prismjs": "^1.28.0", diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index f07848a3a..6dde83c1f 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -682,25 +682,23 @@ stop(chart){const anims=this._charts.get(chart);if(!anims||!anims.items.length){ const items=anims.items;let i=items.length-1;for(;i>=0;--i){items[i].cancel();} anims.items=[];this._notify(chart,anims,Date.now(),'complete');} remove(chart){return this._charts.delete(chart);}} -var animator=new Animator();const map$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};const hex='0123456789ABCDEF';const h1=(b)=>hex[b&0xF];const h2=(b)=>hex[(b&0xF0)>>4]+hex[b&0xF];const eq=(b)=>(((b&0xF0)>>4)===(b&0xF));function isShort(v){return eq(v.r)&&eq(v.g)&&eq(v.b)&&eq(v.a);} -function hexParse(str){var len=str.length;var ret;if(str[0]==='#'){if(len===4||len===5){ret={r:255&map$1[str[1]]*17,g:255&map$1[str[2]]*17,b:255&map$1[str[3]]*17,a:len===5?map$1[str[4]]*17:255};}else if(len===7||len===9){ret={r:map$1[str[1]]<<4|map$1[str[2]],g:map$1[str[3]]<<4|map$1[str[4]],b:map$1[str[5]]<<4|map$1[str[6]],a:len===9?(map$1[str[7]]<<4|map$1[str[8]]):255};}} -return ret;} -function hexString(v){var f=isShort(v)?h1:h2;return v?'#'+f(v.r)+f(v.g)+f(v.b)+(v.a<255?f(v.a):''):v;} -function round(v){return v+0.5|0;} +var animator=new Animator();function round(v){return v+0.5|0;} const lim=(v,l,h)=>Math.max(Math.min(v,h),l);function p2b(v){return lim(round(v*2.55),0,255);} function n2b(v){return lim(round(v*255),0,255);} function b2n(v){return lim(round(v/2.55)/100,0,1);} function n2p(v){return lim(round(v*100),0,100);} -const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(str){const m=RGB_RE.exec(str);let a=255;let r,g,b;if(!m){return;} -if(m[7]!==r){const v=+m[7];a=255&(m[8]?p2b(v):v*255);} -r=+m[1];g=+m[3];b=+m[5];r=255&(m[2]?p2b(r):r);g=255&(m[4]?p2b(g):g);b=255&(m[6]?p2b(b):b);return{r:r,g:g,b:b,a:a};} -function rgbString(v){return v&&(v.a<255?`rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`:`rgb(${v.r}, ${v.g}, ${v.b})`);} +const map$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};const hex=[...'0123456789ABCDEF'];const h1=b=>hex[b&0xF];const h2=b=>hex[(b&0xF0)>>4]+hex[b&0xF];const eq=b=>((b&0xF0)>>4)===(b&0xF);const isShort=v=>eq(v.r)&&eq(v.g)&&eq(v.b)&&eq(v.a);function hexParse(str){var len=str.length;var ret;if(str[0]==='#'){if(len===4||len===5){ret={r:255&map$1[str[1]]*17,g:255&map$1[str[2]]*17,b:255&map$1[str[3]]*17,a:len===5?map$1[str[4]]*17:255};}else if(len===7||len===9){ret={r:map$1[str[1]]<<4|map$1[str[2]],g:map$1[str[3]]<<4|map$1[str[4]],b:map$1[str[5]]<<4|map$1[str[6]],a:len===9?(map$1[str[7]]<<4|map$1[str[8]]):255};}} +return ret;} +const alpha=(a,f)=>a<255?f(a):'';function hexString(v){var f=isShort(v)?h1:h2;return v?'#'+f(v.r)+f(v.g)+f(v.b)+alpha(v.a,f):undefined;} const HUE_RE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function hsl2rgbn(h,s,l){const a=s*Math.min(l,1-l);const f=(n,k=(n+h/30)%12)=>l-a*Math.max(Math.min(k-3,9-k,1),-1);return[f(0),f(8),f(4)];} function hsv2rgbn(h,s,v){const f=(n,k=(n+h/60)%6)=>v-v*s*Math.max(Math.min(k,4-k,1),0);return[f(5),f(3),f(1)];} function hwb2rgbn(h,w,b){const rgb=hsl2rgbn(h,1,0.5);let i;if(w+b>1){i=1/(w+b);w*=i;b*=i;} for(i=0;i<3;i++){rgb[i]*=1-w-b;rgb[i]+=w;} return rgb;} -function rgb2hsl(v){const range=255;const r=v.r/range;const g=v.g/range;const b=v.b/range;const max=Math.max(r,g,b);const min=Math.min(r,g,b);const l=(max+min)/2;let h,s,d;if(max!==min){d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);h=max===r?((g-b)/d)+(g0.5?d/(2-max-min):d/(max+min);h=hueValue(r,g,b,d,max);h=h*60+0.5;} return[h|0,s||0,l];} function calln(f,a,b,c){return(Array.isArray(a)?f(a[0],a[1],a[2]):f(a,b,c)).map(n2b);} function hsl2rgb(h,s,l){return calln(hsl2rgbn,h,s,l);} @@ -714,11 +712,16 @@ return{r:v[0],g:v[1],b:v[2],a:a};} function rotate(v,deg){var h=rgb2hsl(v);h[0]=hue(h[0]+deg);h=hsl2rgb(h);v.r=h[0];v.g=h[1];v.b=h[2];} function hslString(v){if(!v){return;} const a=rgb2hsl(v);const h=a[0];const s=n2p(a[1]);const l=n2p(a[2]);return v.a<255?`hsla(${h}, ${s}%, ${l}%, ${b2n(v.a)})`:`hsl(${h}, ${s}%, ${l}%)`;} -const map$1$1={x:'dark',Z:'light',Y:'re',X:'blu',W:'gr',V:'medium',U:'slate',A:'ee',T:'ol',S:'or',B:'ra',C:'lateg',D:'ights',R:'in',Q:'turquois',E:'hi',P:'ro',O:'al',N:'le',M:'de',L:'yello',F:'en',K:'ch',G:'arks',H:'ea',I:'ightg',J:'wh'};const names={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 unpack(){const unpacked={};const keys=Object.keys(names);const tkeys=Object.keys(map$1$1);let i,j,k,ok,nk;for(i=0;i>16&0xFF,k>>8&0xFF,k&0xFF];} +const map$2={x:'dark',Z:'light',Y:'re',X:'blu',W:'gr',V:'medium',U:'slate',A:'ee',T:'ol',S:'or',B:'ra',C:'lateg',D:'ights',R:'in',Q:'turquois',E:'hi',P:'ro',O:'al',N:'le',M:'de',L:'yello',F:'en',K:'ch',G:'arks',H:'ea',I:'ightg',J:'wh'};const names$1={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 unpack(){const unpacked={};const keys=Object.keys(names$1);const tkeys=Object.keys(map$2);let i,j,k,ok,nk;for(i=0;i>16&0xFF,k>>8&0xFF,k&0xFF];} return unpacked;} -let names$1;function nameParse(str){if(!names$1){names$1=unpack();names$1.transparent=[0,0,0,0];} -const a=names$1[str.toLowerCase()];return a&&{r:a[0],g:a[1],b:a[2],a:a.length===4?a[3]:255};} +let names;function nameParse(str){if(!names){names=unpack();names.transparent=[0,0,0,0];} +const a=names[str.toLowerCase()];return a&&{r:a[0],g:a[1],b:a[2],a:a.length===4?a[3]:255};} +const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(str){const m=RGB_RE.exec(str);let a=255;let r,g,b;if(!m){return;} +if(m[7]!==r){const v=+m[7];a=m[8]?p2b(v):lim(v*255,0,255);} +r=+m[1];g=+m[3];b=+m[5];r=255&(m[2]?p2b(r):lim(r,0,255));g=255&(m[4]?p2b(g):lim(g,0,255));b=255&(m[6]?p2b(b):lim(b,0,255));return{r:r,g:g,b:b,a:a};} +function rgbString(v){return v&&(v.a<255?`rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`:`rgb(${v.r}, ${v.g}, ${v.b})`);} +const to=v=>v<=0.0031308?v*12.92:Math.pow(v,1.0/2.4)*1.055-0.055;const from=v=>v<=0.04045?v/12.92:Math.pow((v+0.055)/1.055,2.4);function interpolate$1(rgb1,rgb2,t){const r=from(b2n(rgb1.r));const g=from(b2n(rgb1.g));const b=from(b2n(rgb1.b));return{r:n2b(to(r+t*(from(b2n(rgb2.r))-r))),g:n2b(to(g+t*(from(b2n(rgb2.g))-g))),b:n2b(to(b+t*(from(b2n(rgb2.b))-b))),a:rgb1.a+t*(rgb2.a-rgb1.a)};} function modHSL(v,i,ratio){if(v){let tmp=rgb2hsl(v);tmp[i]=Math.max(0,Math.min(tmp[i]+tmp[i]*ratio,i===0?360:1));tmp=hsl2rgb(tmp);v.r=tmp[0];v.g=tmp[1];v.b=tmp[2];}} function clone$1(v,proto){return v?Object.assign(proto||{},v):v;} function fromObject(input){var v={r:0,g:0,b:0,a:255};if(Array.isArray(input)){if(input.length>=3){v={r:input[0],g:input[1],b:input[2],a:255};if(input.length>3){v.a=n2b(input[3]);}}}else{v=clone$1(input,{r:0,g:0,b:0,a:1});v.a=n2b(v.a);} @@ -732,11 +735,13 @@ get valid(){return this._valid;} get rgb(){var v=clone$1(this._rgb);if(v){v.a=b2n(v.a);} return v;} set rgb(obj){this._rgb=fromObject(obj);} -rgbString(){return this._valid?rgbString(this._rgb):this._rgb;} -hexString(){return this._valid?hexString(this._rgb):this._rgb;} -hslString(){return this._valid?hslString(this._rgb):this._rgb;} -mix(color,weight){const me=this;if(color){const c1=me.rgb;const c2=color.rgb;let w2;const p=weight===w2?0.5:weight;const w=2*p-1;const a=c1.a-c2.a;const w1=((w*a===-1?w:(w+a)/(1+w*a))+1)/2.0;w2=1-w1;c1.r=0xFF&w1*c1.r+w2*c2.r+0.5;c1.g=0xFF&w1*c1.g+w2*c2.g+0.5;c1.b=0xFF&w1*c1.b+w2*c2.b+0.5;c1.a=p*c1.a+(1-p)*c2.a;me.rgb=c1;} -return me;} +rgbString(){return this._valid?rgbString(this._rgb):undefined;} +hexString(){return this._valid?hexString(this._rgb):undefined;} +hslString(){return this._valid?hslString(this._rgb):undefined;} +mix(color,weight){if(color){const c1=this.rgb;const c2=color.rgb;let w2;const p=weight===w2?0.5:weight;const w=2*p-1;const a=c1.a-c2.a;const w1=((w*a===-1?w:(w+a)/(1+w*a))+1)/2.0;w2=1-w1;c1.r=0xFF&w1*c1.r+w2*c2.r+0.5;c1.g=0xFF&w1*c1.g+w2*c2.g+0.5;c1.b=0xFF&w1*c1.b+w2*c2.b+0.5;c1.a=p*c1.a+(1-p)*c2.a;this.rgb=c1;} +return this;} +interpolate(color,t){if(color){this._rgb=interpolate$1(this._rgb,color._rgb,t);} +return this;} clone(){return new Color(this.rgb);} alpha(a){this._rgb.a=n2b(a);return this;} clearer(ratio){const rgb=this._rgb;rgb.a*=1-ratio;return this;} @@ -749,12 +754,14 @@ saturate(ratio){modHSL(this._rgb,1,ratio);return this;} desaturate(ratio){modHSL(this._rgb,1,-ratio);return this;} rotate(deg){rotate(this._rgb,deg);return this;}} function index_esm(input){return new Color(input);} -const isPatternOrGradient=(value)=>value instanceof CanvasGradient||value instanceof CanvasPattern;function color(value){return isPatternOrGradient(value)?value:index_esm(value);} +function isPatternOrGradient(value){if(value&&typeof value==='object'){const type=value.toString();return type==='[object CanvasPattern]'||type==='[object CanvasGradient]';} +return false;} +function color(value){return isPatternOrGradient(value)?value:index_esm(value);} function getHoverColor(value){return isPatternOrGradient(value)?value:index_esm(value).saturate(0.5).darken(0.1).hexString();} function noop(){} const uid=(function(){let id=0;return function(){return id++;};}());function isNullOrUndef(value){return value===null||typeof value==='undefined';} function isArray(value){if(Array.isArray&&Array.isArray(value)){return true;} -const type=Object.prototype.toString.call(value);if(type.substr(0,7)==='[object'&&type.substr(-6)==='Array]'){return true;} +const type=Object.prototype.toString.call(value);if(type.slice(0,7)==='[object'&&type.slice(-6)==='Array]'){return true;} return false;} function isObject(value){return value!==null&&Object.prototype.toString.call(value)==='[object Object]';} const isNumberFinite=(value)=>(typeof value==='number'||value instanceof Number)&&isFinite(+value);function finiteOrDefault(value,defaultValue){return isNumberFinite(value)?value:defaultValue;} @@ -781,7 +788,7 @@ const tval=target[key];const sval=source[key];if(isObject(tval)&&isObject(sval)) function _deprecated(scope,value,previous,current){if(value!==undefined){console.warn(scope+': "'+previous+'" is deprecated. Please use "'+current+'" instead');}} const emptyString='';const dot='.';function indexOfDotOrLength(key,start){const idx=key.indexOf(dot,start);return idx===-1?key.length:idx;} function resolveObjectKey(obj,key){if(key===emptyString){return obj;} -let pos=0;let idx=indexOfDotOrLength(key,pos);while(obj&&idx>pos){obj=obj[key.substr(pos,idx-pos)];pos=idx+1;idx=indexOfDotOrLength(key,pos);} +let pos=0;let idx=indexOfDotOrLength(key,pos);while(obj&&idx>pos){obj=obj[key.slice(pos,idx)];pos=idx+1;idx=indexOfDotOrLength(key,pos);} return obj;} function _capitalize(str){return str.charAt(0).toUpperCase()+str.slice(1);} const defined=(value)=>typeof value!=='undefined';const isFunction=(value)=>typeof value==='function';const setsEqual=(a,b)=>{if(a.size!==b.size){return false;} @@ -792,14 +799,28 @@ const keys=key.split('.');for(let i=0,n=keys.length;icontext.chart.platform.getDevicePixelRatio();this.elements={};this.events=['mousemove','mouseout','click','touchstart','touchmove'];this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:'normal',lineHeight:1.2,weight:null};this.hover={};this.hoverBackgroundColor=(ctx,options)=>getHoverColor(options.backgroundColor);this.hoverBorderColor=(ctx,options)=>getHoverColor(options.borderColor);this.hoverColor=(ctx,options)=>getHoverColor(options.color);this.indexAxis='x';this.interaction={mode:'nearest',intersect:true};this.maintainAspectRatio=true;this.onHover=null;this.onClick=null;this.parsing=true;this.plugins={};this.responsive=true;this.scale=undefined;this.scales={};this.showLine=true;this.drawActiveElementsOnTop=true;this.describe(_descriptors);} +class Defaults{constructor(_descriptors){this.animation=undefined;this.backgroundColor='rgba(0,0,0,0.1)';this.borderColor='rgba(0,0,0,0.1)';this.color='#666';this.datasets={};this.devicePixelRatio=(context)=>context.chart.platform.getDevicePixelRatio();this.elements={};this.events=['mousemove','mouseout','click','touchstart','touchmove'];this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:'normal',lineHeight:1.2,weight:null};this.hover={};this.hoverBackgroundColor=(ctx,options)=>getHoverColor(options.backgroundColor);this.hoverBorderColor=(ctx,options)=>getHoverColor(options.borderColor);this.hoverColor=(ctx,options)=>getHoverColor(options.color);this.indexAxis='x';this.interaction={mode:'nearest',intersect:true,includeInvisible:false};this.maintainAspectRatio=true;this.onHover=null;this.onClick=null;this.parsing=true;this.plugins={};this.responsive=true;this.scale=undefined;this.scales={};this.showLine=true;this.drawActiveElementsOnTop=true;this.describe(_descriptors);} set(scope,values){return set(this,scope,values);} get(scope){return getScope$1(this,scope);} describe(scope,values){return set(descriptors,scope,values);} override(scope,values){return set(overrides,scope,values);} route(scope,name,targetScope,targetName){const scopeObject=getScope$1(this,scope);const targetScopeObject=getScope$1(this,targetScope);const privateName='_'+name;Object.defineProperties(scopeObject,{[privateName]:{value:scopeObject[name],writable:true},[name]:{enumerable:true,get(){const local=this[privateName];const target=targetScopeObject[targetName];if(isObject(local)){return Object.assign({},target,local);} return valueOrDefault(local,target);},set(value){this[privateName]=value;}}});}} -var defaults=new Defaults({_scriptable:(name)=>!name.startsWith('on'),_indexable:(name)=>name!=='events',hover:{_fallback:'interaction'},interaction:{_scriptable:false,_indexable:false,}});const PI=Math.PI;const TAU=2*PI;const PITAU=TAU+PI;const INFINITY=Number.POSITIVE_INFINITY;const RAD_PER_DEG=PI/180;const HALF_PI=PI/2;const QUARTER_PI=PI/4;const TWO_THIRDS_PI=PI*2/3;const log10=Math.log10;const sign=Math.sign;function niceNum(range){const roundedRange=Math.round(range);range=almostEquals(range,roundedRange,range/1000)?roundedRange:range;const niceRange=Math.pow(10,Math.floor(log10(range)));const fraction=range/niceRange;const niceFraction=fraction<=1?1:fraction<=2?2:fraction<=5?5:10;return niceFraction*niceRange;} +var defaults=new Defaults({_scriptable:(name)=>!name.startsWith('on'),_indexable:(name)=>name!=='events',hover:{_fallback:'interaction'},interaction:{_scriptable:false,_indexable:false,}});function _lookup(table,value,cmp){cmp=cmp||((index)=>table[index]1){mid=(lo+hi)>>1;if(cmp(mid)){lo=mid;}else{hi=mid;}} +return{lo,hi};} +const _lookupByKey=(table,key,value)=>_lookup(table,value,index=>table[index][key]_lookup(table,value,index=>table[index][key]>=value);function _filterBetween(values,min,max){let start=0;let end=values.length;while(startstart&&values[end-1]>max){end--;} +return start>0||end{const method='_onData'+_capitalize(key);const base=array[key];Object.defineProperty(array,key,{configurable:true,enumerable:false,value(...args){const res=base.apply(this,args);array._chartjs.listeners.forEach((object)=>{if(typeof object[method]==='function'){object[method](...args);}});return res;}});});} +function unlistenArrayEvents(array,listener){const stub=array._chartjs;if(!stub){return;} +const listeners=stub.listeners;const index=listeners.indexOf(listener);if(index!==-1){listeners.splice(index,1);} +if(listeners.length>0){return;} +arrayEvents.forEach((key)=>{delete array[key];});delete array._chartjs;} +function _arrayUnique(items){const set=new Set();let i,ilen;for(i=0,ilen=items.length;ia-b).pop();return result;} @@ -821,6 +842,29 @@ function _angleBetween(angle,start,end,sameAngleIsFullCircle){const a=_normalize function _limitValue(value,min,max){return Math.max(min,Math.min(max,value));} function _int16Range(value){return _limitValue(value,-32768,32767);} function _isBetween(value,start,end,epsilon=1e-6){return value>=Math.min(start,end)-epsilon&&value<=Math.max(start,end)+epsilon;} +function _isDomSupported(){return typeof window!=='undefined'&&typeof document!=='undefined';} +function _getParentNode(domNode){let parent=domNode.parentNode;if(parent&&parent.toString()==='[object ShadowRoot]'){parent=parent.host;} +return parent;} +function parseMaxStyle(styleValue,node,parentProperty){let valueInPixels;if(typeof styleValue==='string'){valueInPixels=parseInt(styleValue,10);if(styleValue.indexOf('%')!==-1){valueInPixels=valueInPixels/100*node.parentNode[parentProperty];}}else{valueInPixels=styleValue;} +return valueInPixels;} +const getComputedStyle=(element)=>window.getComputedStyle(element,null);function getStyle(el,property){return getComputedStyle(el).getPropertyValue(property);} +const positions=['top','right','bottom','left'];function getPositionedStyle(styles,style,suffix){const result={};suffix=suffix?'-'+suffix:'';for(let i=0;i<4;i++){const pos=positions[i];result[pos]=parseFloat(styles[style+'-'+pos+suffix])||0;} +result.width=result.left+result.right;result.height=result.top+result.bottom;return result;} +const useOffsetPos=(x,y,target)=>(x>0||y>0)&&(!target||!target.shadowRoot);function getCanvasPosition(e,canvas){const touches=e.touches;const source=touches&&touches.length?touches[0]:e;const{offsetX,offsetY}=source;let box=false;let x,y;if(useOffsetPos(offsetX,offsetY,e.target)){x=offsetX;y=offsetY;}else{const rect=canvas.getBoundingClientRect();x=source.clientX-rect.left;y=source.clientY-rect.top;box=true;} +return{x,y,box};} +function getRelativePosition(evt,chart){if('native'in evt){return evt;} +const{canvas,currentDevicePixelRatio}=chart;const style=getComputedStyle(canvas);const borderBox=style.boxSizing==='border-box';const paddings=getPositionedStyle(style,'padding');const borders=getPositionedStyle(style,'border','width');const{x,y,box}=getCanvasPosition(evt,canvas);const xOffset=paddings.left+(box&&borders.left);const yOffset=paddings.top+(box&&borders.top);let{width,height}=chart;if(borderBox){width-=paddings.width+borders.width;height-=paddings.height+borders.height;} +return{x:Math.round((x-xOffset)/width*canvas.width/currentDevicePixelRatio),y:Math.round((y-yOffset)/height*canvas.height/currentDevicePixelRatio)};} +function getContainerSize(canvas,width,height){let maxWidth,maxHeight;if(width===undefined||height===undefined){const container=_getParentNode(canvas);if(!container){width=canvas.clientWidth;height=canvas.clientHeight;}else{const rect=container.getBoundingClientRect();const containerStyle=getComputedStyle(container);const containerBorder=getPositionedStyle(containerStyle,'border','width');const containerPadding=getPositionedStyle(containerStyle,'padding');width=rect.width-containerPadding.width-containerBorder.width;height=rect.height-containerPadding.height-containerBorder.height;maxWidth=parseMaxStyle(containerStyle.maxWidth,container,'clientWidth');maxHeight=parseMaxStyle(containerStyle.maxHeight,container,'clientHeight');}} +return{width,height,maxWidth:maxWidth||INFINITY,maxHeight:maxHeight||INFINITY};} +const round1=v=>Math.round(v*10)/10;function getMaximumSize(canvas,bbWidth,bbHeight,aspectRatio){const style=getComputedStyle(canvas);const margins=getPositionedStyle(style,'margin');const maxWidth=parseMaxStyle(style.maxWidth,canvas,'clientWidth')||INFINITY;const maxHeight=parseMaxStyle(style.maxHeight,canvas,'clientHeight')||INFINITY;const containerSize=getContainerSize(canvas,bbWidth,bbHeight);let{width,height}=containerSize;if(style.boxSizing==='content-box'){const borders=getPositionedStyle(style,'border','width');const paddings=getPositionedStyle(style,'padding');width-=paddings.width+borders.width;height-=paddings.height+borders.height;} +width=Math.max(0,width-margins.width);height=Math.max(0,aspectRatio?Math.floor(width/aspectRatio):height-margins.height);width=round1(Math.min(width,maxWidth,containerSize.maxWidth));height=round1(Math.min(height,maxHeight,containerSize.maxHeight));if(width&&!height){height=round1(width/2);} +return{width,height};} +function retinaScale(chart,forceRatio,forceStyle){const pixelRatio=forceRatio||1;const deviceHeight=Math.floor(chart.height*pixelRatio);const deviceWidth=Math.floor(chart.width*pixelRatio);chart.height=deviceHeight/pixelRatio;chart.width=deviceWidth/pixelRatio;const canvas=chart.canvas;if(canvas.style&&(forceStyle||(!canvas.style.height&&!canvas.style.width))){canvas.style.height=`${chart.height}px`;canvas.style.width=`${chart.width}px`;} +if(chart.currentDevicePixelRatio!==pixelRatio||canvas.height!==deviceHeight||canvas.width!==deviceWidth){chart.currentDevicePixelRatio=pixelRatio;canvas.height=deviceHeight;canvas.width=deviceWidth;chart.ctx.setTransform(pixelRatio,0,0,pixelRatio,0,0);return true;} +return false;} +const supportsEventListenerOptions=(function(){let passiveSupported=false;try{const options={get passive(){passiveSupported=true;return false;}};window.addEventListener('test',null,options);window.removeEventListener('test',null,options);}catch(e){} +return passiveSupported;}());function readUsedSize(element,property){const value=getStyle(element,property);const matches=value&&value.match(/^(\d+)(\.\d+)?px$/);return matches?+matches[1]:undefined;} function toFontString(font){if(!font||isNullOrUndef(font.size)||isNullOrUndef(font.family)){return null;} return(font.style?font.style+' ':'') +(font.weight?font.weight+' ':'') @@ -861,116 +905,7 @@ if(opts.textAlign){ctx.textAlign=opts.textAlign;} if(opts.textBaseline){ctx.textBaseline=opts.textBaseline;}} function decorateText(ctx,x,y,line,opts){if(opts.strikethrough||opts.underline){const metrics=ctx.measureText(line);const left=x-metrics.actualBoundingBoxLeft;const right=x+metrics.actualBoundingBoxRight;const top=y-metrics.actualBoundingBoxAscent;const bottom=y+metrics.actualBoundingBoxDescent;const yDecoration=opts.strikethrough?(top+bottom)/2:bottom;ctx.strokeStyle=ctx.fillStyle;ctx.beginPath();ctx.lineWidth=opts.decorationWidth||2;ctx.moveTo(left,yDecoration);ctx.lineTo(right,yDecoration);ctx.stroke();}} function addRoundedRectPath(ctx,rect){const{x,y,w,h,radius}=rect;ctx.arc(x+radius.topLeft,y+radius.topLeft,radius.topLeft,-HALF_PI,PI,true);ctx.lineTo(x,y+h-radius.bottomLeft);ctx.arc(x+radius.bottomLeft,y+h-radius.bottomLeft,radius.bottomLeft,PI,HALF_PI,true);ctx.lineTo(x+w-radius.bottomRight,y+h);ctx.arc(x+w-radius.bottomRight,y+h-radius.bottomRight,radius.bottomRight,HALF_PI,0,true);ctx.lineTo(x+w,y+radius.topRight);ctx.arc(x+w-radius.topRight,y+radius.topRight,radius.topRight,0,-HALF_PI,true);ctx.lineTo(x+radius.topLeft,y);} -function _lookup(table,value,cmp){cmp=cmp||((index)=>table[index]1){mid=(lo+hi)>>1;if(cmp(mid)){lo=mid;}else{hi=mid;}} -return{lo,hi};} -const _lookupByKey=(table,key,value)=>_lookup(table,value,index=>table[index][key]_lookup(table,value,index=>table[index][key]>=value);function _filterBetween(values,min,max){let start=0;let end=values.length;while(startstart&&values[end-1]>max){end--;} -return start>0||end{const method='_onData'+_capitalize(key);const base=array[key];Object.defineProperty(array,key,{configurable:true,enumerable:false,value(...args){const res=base.apply(this,args);array._chartjs.listeners.forEach((object)=>{if(typeof object[method]==='function'){object[method](...args);}});return res;}});});} -function unlistenArrayEvents(array,listener){const stub=array._chartjs;if(!stub){return;} -const listeners=stub.listeners;const index=listeners.indexOf(listener);if(index!==-1){listeners.splice(index,1);} -if(listeners.length>0){return;} -arrayEvents.forEach((key)=>{delete array[key];});delete array._chartjs;} -function _arrayUnique(items){const set=new Set();let i,ilen;for(i=0,ilen=items.length;iwindow.getComputedStyle(element,null);function getStyle(el,property){return getComputedStyle(el).getPropertyValue(property);} -const positions=['top','right','bottom','left'];function getPositionedStyle(styles,style,suffix){const result={};suffix=suffix?'-'+suffix:'';for(let i=0;i<4;i++){const pos=positions[i];result[pos]=parseFloat(styles[style+'-'+pos+suffix])||0;} -result.width=result.left+result.right;result.height=result.top+result.bottom;return result;} -const useOffsetPos=(x,y,target)=>(x>0||y>0)&&(!target||!target.shadowRoot);function getCanvasPosition(evt,canvas){const e=evt.native||evt;const touches=e.touches;const source=touches&&touches.length?touches[0]:e;const{offsetX,offsetY}=source;let box=false;let x,y;if(useOffsetPos(offsetX,offsetY,e.target)){x=offsetX;y=offsetY;}else{const rect=canvas.getBoundingClientRect();x=source.clientX-rect.left;y=source.clientY-rect.top;box=true;} -return{x,y,box};} -function getRelativePosition$1(evt,chart){const{canvas,currentDevicePixelRatio}=chart;const style=getComputedStyle(canvas);const borderBox=style.boxSizing==='border-box';const paddings=getPositionedStyle(style,'padding');const borders=getPositionedStyle(style,'border','width');const{x,y,box}=getCanvasPosition(evt,canvas);const xOffset=paddings.left+(box&&borders.left);const yOffset=paddings.top+(box&&borders.top);let{width,height}=chart;if(borderBox){width-=paddings.width+borders.width;height-=paddings.height+borders.height;} -return{x:Math.round((x-xOffset)/width*canvas.width/currentDevicePixelRatio),y:Math.round((y-yOffset)/height*canvas.height/currentDevicePixelRatio)};} -function getContainerSize(canvas,width,height){let maxWidth,maxHeight;if(width===undefined||height===undefined){const container=_getParentNode(canvas);if(!container){width=canvas.clientWidth;height=canvas.clientHeight;}else{const rect=container.getBoundingClientRect();const containerStyle=getComputedStyle(container);const containerBorder=getPositionedStyle(containerStyle,'border','width');const containerPadding=getPositionedStyle(containerStyle,'padding');width=rect.width-containerPadding.width-containerBorder.width;height=rect.height-containerPadding.height-containerBorder.height;maxWidth=parseMaxStyle(containerStyle.maxWidth,container,'clientWidth');maxHeight=parseMaxStyle(containerStyle.maxHeight,container,'clientHeight');}} -return{width,height,maxWidth:maxWidth||INFINITY,maxHeight:maxHeight||INFINITY};} -const round1=v=>Math.round(v*10)/10;function getMaximumSize(canvas,bbWidth,bbHeight,aspectRatio){const style=getComputedStyle(canvas);const margins=getPositionedStyle(style,'margin');const maxWidth=parseMaxStyle(style.maxWidth,canvas,'clientWidth')||INFINITY;const maxHeight=parseMaxStyle(style.maxHeight,canvas,'clientHeight')||INFINITY;const containerSize=getContainerSize(canvas,bbWidth,bbHeight);let{width,height}=containerSize;if(style.boxSizing==='content-box'){const borders=getPositionedStyle(style,'border','width');const paddings=getPositionedStyle(style,'padding');width-=paddings.width+borders.width;height-=paddings.height+borders.height;} -width=Math.max(0,width-margins.width);height=Math.max(0,aspectRatio?Math.floor(width/aspectRatio):height-margins.height);width=round1(Math.min(width,maxWidth,containerSize.maxWidth));height=round1(Math.min(height,maxHeight,containerSize.maxHeight));if(width&&!height){height=round1(width/2);} -return{width,height};} -function retinaScale(chart,forceRatio,forceStyle){const pixelRatio=forceRatio||1;const deviceHeight=Math.floor(chart.height*pixelRatio);const deviceWidth=Math.floor(chart.width*pixelRatio);chart.height=deviceHeight/pixelRatio;chart.width=deviceWidth/pixelRatio;const canvas=chart.canvas;if(canvas.style&&(forceStyle||(!canvas.style.height&&!canvas.style.width))){canvas.style.height=`${chart.height}px`;canvas.style.width=`${chart.width}px`;} -if(chart.currentDevicePixelRatio!==pixelRatio||canvas.height!==deviceHeight||canvas.width!==deviceWidth){chart.currentDevicePixelRatio=pixelRatio;canvas.height=deviceHeight;canvas.width=deviceWidth;chart.ctx.setTransform(pixelRatio,0,0,pixelRatio,0,0);return true;} -return false;} -const supportsEventListenerOptions=(function(){let passiveSupported=false;try{const options={get passive(){passiveSupported=true;return false;}};window.addEventListener('test',null,options);window.removeEventListener('test',null,options);}catch(e){} -return passiveSupported;}());function readUsedSize(element,property){const value=getStyle(element,property);const matches=value&&value.match(/^(\d+)(\.\d+)?px$/);return matches?+matches[1]:undefined;} -function getRelativePosition(e,chart){if('native'in e){return{x:e.x,y:e.y};} -return getRelativePosition$1(e,chart);} -function evaluateAllVisibleItems(chart,handler){const metasets=chart.getSortedVisibleDatasetMetas();let index,data,element;for(let i=0,ilen=metasets.length;i{if(element[rangeMethod](position[axis],useFinalPosition)){items.push({element,datasetIndex,index});} -if(element.inRange(position.x,position.y,useFinalPosition)){intersectsItem=true;}});if(options.intersect&&!intersectsItem){return[];} -return items;} -var Interaction={modes:{index(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'x';const items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition):getNearestItems(chart,position,axis,false,useFinalPosition);const elements=[];if(!items.length){return[];} -chart.getSortedVisibleDatasetMetas().forEach((meta)=>{const index=items[0].index;const element=meta.data[index];if(element&&!element.skip){elements.push({element,datasetIndex:meta.index,index});}});return elements;},dataset(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'xy';let items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition):getNearestItems(chart,position,axis,false,useFinalPosition);if(items.length>0){const datasetIndex=items[0].datasetIndex;const data=chart.getDatasetMeta(datasetIndex).data;items=[];for(let i=0;i+v||0;function _readValueToProps(value,props){const ret={};const objProps=isObject(props);const keys=objProps?Object.keys(props):props;const read=isObject(value)?objProps?prop=>valueOrDefault(value[prop],value[props[prop]]):prop=>value[prop]:()=>value;for(const prop of keys){ret[prop]=numberOrZero(read(prop));} -return ret;} -function toTRBL(value){return _readValueToProps(value,{top:'y',right:'x',bottom:'y',left:'x'});} -function toTRBLCorners(value){return _readValueToProps(value,['topLeft','topRight','bottomLeft','bottomRight']);} -function toPadding(value){const obj=toTRBL(value);obj.width=obj.left+obj.right;obj.height=obj.top+obj.bottom;return obj;} -function toFont(options,fallback){options=options||{};fallback=fallback||defaults.font;let size=valueOrDefault(options.size,fallback.size);if(typeof size==='string'){size=parseInt(size,10);} -let style=valueOrDefault(options.style,fallback.style);if(style&&!(''+style).match(FONT_STYLE)){console.warn('Invalid font style specified: "'+style+'"');style='';} -const font={family:valueOrDefault(options.family,fallback.family),lineHeight:toLineHeight(valueOrDefault(options.lineHeight,fallback.lineHeight),size),size,style,weight:valueOrDefault(options.weight,fallback.weight),string:''};font.string=toFontString(font);return font;} -function resolve(inputs,context,index,info){let cacheable=true;let i,ilen,value;for(i=0,ilen=inputs.length;ibeginAtZero&&value===0?0:value+add;return{min:keepZero(min,-Math.abs(change)),max:keepZero(max,change)};} -function createContext(parentContext,context){return Object.assign(Object.create(parentContext),context);} -const STATIC_POSITIONS=['left','top','right','bottom'];function filterByPosition(array,position){return array.filter(v=>v.pos===position);} -function filterDynamicPositionByAxis(array,axis){return array.filter(v=>STATIC_POSITIONS.indexOf(v.pos)===-1&&v.box.axis===axis);} -function sortByWeight(array,reverse){return array.sort((a,b)=>{const v0=reverse?b:a;const v1=reverse?a:b;return v0.weight===v1.weight?v0.index-v1.index:v0.weight-v1.weight;});} -function wrapBoxes(boxes){const layoutBoxes=[];let i,ilen,box,pos,stack,stackWeight;for(i=0,ilen=(boxes||[]).length;iwrap.box.fullSize),true);const left=sortByWeight(filterByPosition(layoutBoxes,'left'),true);const right=sortByWeight(filterByPosition(layoutBoxes,'right'));const top=sortByWeight(filterByPosition(layoutBoxes,'top'),true);const bottom=sortByWeight(filterByPosition(layoutBoxes,'bottom'));const centerHorizontal=filterDynamicPositionByAxis(layoutBoxes,'x');const centerVertical=filterDynamicPositionByAxis(layoutBoxes,'y');return{fullSize,leftAndTop:left.concat(top),rightAndBottom:right.concat(centerVertical).concat(bottom).concat(centerHorizontal),chartArea:filterByPosition(layoutBoxes,'chartArea'),vertical:left.concat(right).concat(centerVertical),horizontal:top.concat(bottom).concat(centerHorizontal)};} -function getCombinedMax(maxPadding,chartArea,a,b){return Math.max(maxPadding[a],chartArea[a])+Math.max(maxPadding[b],chartArea[b]);} -function updateMaxPadding(maxPadding,boxPadding){maxPadding.top=Math.max(maxPadding.top,boxPadding.top);maxPadding.left=Math.max(maxPadding.left,boxPadding.left);maxPadding.bottom=Math.max(maxPadding.bottom,boxPadding.bottom);maxPadding.right=Math.max(maxPadding.right,boxPadding.right);} -function updateDims(chartArea,params,layout,stacks){const{pos,box}=layout;const maxPadding=chartArea.maxPadding;if(!isObject(pos)){if(layout.size){chartArea[pos]-=layout.size;} -const stack=stacks[layout.stack]||{size:0,count:1};stack.size=Math.max(stack.size,layout.horizontal?box.height:box.width);layout.size=stack.size/stack.count;chartArea[pos]+=layout.size;} -if(box.getPadding){updateMaxPadding(maxPadding,box.getPadding());} -const newWidth=Math.max(0,params.outerWidth-getCombinedMax(maxPadding,chartArea,'left','right'));const newHeight=Math.max(0,params.outerHeight-getCombinedMax(maxPadding,chartArea,'top','bottom'));const widthChanged=newWidth!==chartArea.w;const heightChanged=newHeight!==chartArea.h;chartArea.w=newWidth;chartArea.h=newHeight;return layout.horizontal?{same:widthChanged,other:heightChanged}:{same:heightChanged,other:widthChanged};} -function handleMaxPadding(chartArea){const maxPadding=chartArea.maxPadding;function updatePos(pos){const change=Math.max(maxPadding[pos]-chartArea[pos],0);chartArea[pos]+=change;return change;} -chartArea.y+=updatePos('top');chartArea.x+=updatePos('left');updatePos('right');updatePos('bottom');} -function getMargins(horizontal,chartArea){const maxPadding=chartArea.maxPadding;function marginForPositions(positions){const margin={left:0,top:0,right:0,bottom:0};positions.forEach((pos)=>{margin[pos]=Math.max(chartArea[pos],maxPadding[pos]);});return margin;} -return horizontal?marginForPositions(['left','right']):marginForPositions(['top','bottom']);} -function fitBoxes(boxes,chartArea,params,stacks){const refitBoxes=[];let i,ilen,layout,box,refit,changed;for(i=0,ilen=boxes.length,refit=0;i{if(typeof box.beforeLayout==='function'){box.beforeLayout();}});const visibleVerticalBoxCount=verticalBoxes.reduce((total,wrap)=>wrap.box.options&&wrap.box.options.display===false?total:total+1,0)||1;const params=Object.freeze({outerWidth:width,outerHeight:height,padding,availableWidth,availableHeight,vBoxMaxWidth:availableWidth/2/visibleVerticalBoxCount,hBoxMaxHeight:availableHeight/2});const maxPadding=Object.assign({},padding);updateMaxPadding(maxPadding,toPadding(minPadding));const chartArea=Object.assign({maxPadding,w:availableWidth,h:availableHeight,x:padding.left,y:padding.top},padding);const stacks=setLayoutDims(verticalBoxes.concat(horizontalBoxes),params);fitBoxes(boxes.fullSize,chartArea,params,stacks);fitBoxes(verticalBoxes,chartArea,params,stacks);if(fitBoxes(horizontalBoxes,chartArea,params,stacks)){fitBoxes(verticalBoxes,chartArea,params,stacks);} -handleMaxPadding(chartArea);placeBoxes(boxes.leftAndTop,chartArea,params,stacks);chartArea.x+=chartArea.w;chartArea.y+=chartArea.h;placeBoxes(boxes.rightAndBottom,chartArea,params,stacks);chart.chartArea={left:chartArea.left,top:chartArea.top,right:chartArea.left+chartArea.w,bottom:chartArea.top+chartArea.h,height:chartArea.h,width:chartArea.w,};each(boxes.chartArea,(layout)=>{const box=layout.box;Object.assign(box,chart.chartArea);box.update(chartArea.w,chartArea.h,{left:0,top:0,right:0,bottom:0});});}};function _createResolver(scopes,prefixes=[''],rootScopes=scopes,fallback,getTarget=()=>scopes[0]){if(!defined(fallback)){fallback=_resolve('_fallback',scopes);} +function _createResolver(scopes,prefixes=[''],rootScopes=scopes,fallback,getTarget=()=>scopes[0]){if(!defined(fallback)){fallback=_resolve('_fallback',scopes);} const cache={[Symbol.toStringTag]:'Object',_cacheable:true,_scopes:scopes,_rootScopes:rootScopes,_fallback:fallback,_getTarget:getTarget,override:(scope)=>_createResolver([scope,...scopes],prefixes,rootScopes,fallback),};return new Proxy(cache,{deleteProperty(target,prop){delete target[prop];delete target._keys;delete scopes[0][prop];return true;},get(target,prop){return _cached(target,prop,()=>_resolveWithPrefixes(prop,prefixes,scopes,target));},getOwnPropertyDescriptor(target,prop){return Reflect.getOwnPropertyDescriptor(target._scopes[0],prop);},getPrototypeOf(){return Reflect.getPrototypeOf(scopes[0]);},has(target,prop){return getKeysFromAllScopes(target).includes(prop);},ownKeys(target){return getKeysFromAllScopes(target);},set(target,prop,value){const storage=target._storage||(target._storage=getTarget());target[prop]=storage[prop]=value;delete target._keys;return true;}});} function _attachContext(proxy,context,subProxy,descriptorDefaults){const cache={_cacheable:false,_proxy:proxy,_context:context,_subProxy:subProxy,_stack:new Set(),_descriptors:_descriptors(proxy,descriptorDefaults),setContext:(ctx)=>_attachContext(proxy,ctx,subProxy,descriptorDefaults),override:(scope)=>_attachContext(proxy.override(scope),context,subProxy,descriptorDefaults)};return new Proxy(cache,{deleteProperty(target,prop){delete target[prop];delete proxy[prop];return true;},get(target,prop,receiver){return _cached(target,prop,()=>_resolveWithContext(target,prop,receiver));},getOwnPropertyDescriptor(target,prop){return target._descriptors.allKeys?Reflect.has(proxy,prop)?{enumerable:true,configurable:true}:undefined:Reflect.getOwnPropertyDescriptor(proxy,prop);},getPrototypeOf(){return Reflect.getPrototypeOf(proxy);},has(target,prop){return Reflect.has(proxy,prop);},ownKeys(){return Reflect.ownKeys(proxy);},set(target,prop,value){proxy[prop]=value;delete target[prop];return true;}});} function _descriptors(proxy,defaults={scriptable:true,indexable:true}){const{_scriptable=defaults.scriptable,_indexable=defaults.indexable,_allKeys=defaults.allKeys}=proxy;return{allKeys:_allKeys,scriptable:_scriptable,indexable:_indexable,isScriptable:isFunction(_scriptable)?_scriptable:()=>_scriptable,isIndexable:isFunction(_indexable)?_indexable:()=>_indexable};} @@ -1003,6 +938,8 @@ function getKeysFromAllScopes(target){let keys=target._keys;if(!keys){keys=targe return keys;} function resolveKeysFromAllScopes(scopes){const set=new Set();for(const scope of scopes){for(const key of Object.keys(scope).filter(k=>!k.startsWith('_'))){set.add(key);}} return Array.from(set);} +function _parseObjectDataRadialScale(meta,data,start,count){const{iScale}=meta;const{key='r'}=this._parsing;const parsed=new Array(count);let i,ilen,index,item;for(i=0,ilen=count;iiindexAxis==='x'?'y':'x';function splineCurve(firstPoint,middlePoint,afterPoint,t){const previous=firstPoint.skip?middlePoint:firstPoint;const current=middlePoint;const next=afterPoint.skip?middlePoint:afterPoint;const d01=distanceBetweenPoints(current,previous);const d12=distanceBetweenPoints(next,current);let s01=d01/(d01+d12);let s12=d12/(d01+d12);s01=isNaN(s01)?0:s01;s12=isNaN(s12)?0:s12;const fa=t*s01;const fb=t*s12;return{previous:{x:current.x-fa*(next.x-previous.x),y:current.y-fa*(next.y-previous.y)},next:{x:current.x+fb*(next.x-previous.x),y:current.y+fb*(next.y-previous.y)}};} function monotoneAdjust(points,deltaK,mK){const pointsLen=points.length;let alphaK,betaK,tauK,squaredMagnitude,pointCurrent;let pointAfter=getPoint(points,0);for(let i=0;i+v||0;function _readValueToProps(value,props){const ret={};const objProps=isObject(props);const keys=objProps?Object.keys(props):props;const read=isObject(value)?objProps?prop=>valueOrDefault(value[prop],value[props[prop]]):prop=>value[prop]:()=>value;for(const prop of keys){ret[prop]=numberOrZero(read(prop));} +return ret;} +function toTRBL(value){return _readValueToProps(value,{top:'y',right:'x',bottom:'y',left:'x'});} +function toTRBLCorners(value){return _readValueToProps(value,['topLeft','topRight','bottomLeft','bottomRight']);} +function toPadding(value){const obj=toTRBL(value);obj.width=obj.left+obj.right;obj.height=obj.top+obj.bottom;return obj;} +function toFont(options,fallback){options=options||{};fallback=fallback||defaults.font;let size=valueOrDefault(options.size,fallback.size);if(typeof size==='string'){size=parseInt(size,10);} +let style=valueOrDefault(options.style,fallback.style);if(style&&!(''+style).match(FONT_STYLE)){console.warn('Invalid font style specified: "'+style+'"');style='';} +const font={family:valueOrDefault(options.family,fallback.family),lineHeight:toLineHeight(valueOrDefault(options.lineHeight,fallback.lineHeight),size),size,style,weight:valueOrDefault(options.weight,fallback.weight),string:''};font.string=toFontString(font);return font;} +function resolve(inputs,context,index,info){let cacheable=true;let i,ilen,value;for(i=0,ilen=inputs.length;ibeginAtZero&&value===0?0:value+add;return{min:keepZero(min,-Math.abs(change)),max:keepZero(max,change)};} +function createContext(parentContext,context){return Object.assign(Object.create(parentContext),context);} const getRightToLeftAdapter=function(rectX,width){return{x(x){return rectX+rectX+width-x;},setWidth(w){width=w;},textAlign(align){if(align==='center'){return align;} return align==='right'?'left':'right';},xPlus(x,value){return x-value;},leftForLtr(x,itemWidth){return x-itemWidth;},};};const getLeftToRightAdapter=function(){return{x(x){return x;},setWidth(w){},textAlign(align){return align;},xPlus(x,value){return x+value;},leftForLtr(x,_itemWidth){return x;},};};function getRtlAdapter(rtl,rectX,width){return rtl?getRightToLeftAdapter(rectX,width):getLeftToRightAdapter();} function overrideTextDirection(ctx,direction){let style,original;if(direction==='ltr'||direction==='rtl'){style=ctx.canvas.style;original=[style.getPropertyValue('direction'),style.getPropertyPriority('direction'),];style.setProperty('direction',direction,'important');ctx.prevTextDirection=original;}} @@ -1078,7 +1033,59 @@ if(start{if(element[rangeMethod](position[axis],useFinalPosition)){items.push({element,datasetIndex,index});intersectsItem=intersectsItem||element.inRange(position.x,position.y,useFinalPosition);}});if(intersect&&!intersectsItem){return[];} +return items;} +var Interaction={evaluateInteractionItems,modes:{index(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'x';const includeInvisible=options.includeInvisible||false;const items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition,includeInvisible):getNearestItems(chart,position,axis,false,useFinalPosition,includeInvisible);const elements=[];if(!items.length){return[];} +chart.getSortedVisibleDatasetMetas().forEach((meta)=>{const index=items[0].index;const element=meta.data[index];if(element&&!element.skip){elements.push({element,datasetIndex:meta.index,index});}});return elements;},dataset(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'xy';const includeInvisible=options.includeInvisible||false;let items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition,includeInvisible):getNearestItems(chart,position,axis,false,useFinalPosition,includeInvisible);if(items.length>0){const datasetIndex=items[0].datasetIndex;const data=chart.getDatasetMeta(datasetIndex).data;items=[];for(let i=0;iv.pos===position);} +function filterDynamicPositionByAxis(array,axis){return array.filter(v=>STATIC_POSITIONS.indexOf(v.pos)===-1&&v.box.axis===axis);} +function sortByWeight(array,reverse){return array.sort((a,b)=>{const v0=reverse?b:a;const v1=reverse?a:b;return v0.weight===v1.weight?v0.index-v1.index:v0.weight-v1.weight;});} +function wrapBoxes(boxes){const layoutBoxes=[];let i,ilen,box,pos,stack,stackWeight;for(i=0,ilen=(boxes||[]).length;iwrap.box.fullSize),true);const left=sortByWeight(filterByPosition(layoutBoxes,'left'),true);const right=sortByWeight(filterByPosition(layoutBoxes,'right'));const top=sortByWeight(filterByPosition(layoutBoxes,'top'),true);const bottom=sortByWeight(filterByPosition(layoutBoxes,'bottom'));const centerHorizontal=filterDynamicPositionByAxis(layoutBoxes,'x');const centerVertical=filterDynamicPositionByAxis(layoutBoxes,'y');return{fullSize,leftAndTop:left.concat(top),rightAndBottom:right.concat(centerVertical).concat(bottom).concat(centerHorizontal),chartArea:filterByPosition(layoutBoxes,'chartArea'),vertical:left.concat(right).concat(centerVertical),horizontal:top.concat(bottom).concat(centerHorizontal)};} +function getCombinedMax(maxPadding,chartArea,a,b){return Math.max(maxPadding[a],chartArea[a])+Math.max(maxPadding[b],chartArea[b]);} +function updateMaxPadding(maxPadding,boxPadding){maxPadding.top=Math.max(maxPadding.top,boxPadding.top);maxPadding.left=Math.max(maxPadding.left,boxPadding.left);maxPadding.bottom=Math.max(maxPadding.bottom,boxPadding.bottom);maxPadding.right=Math.max(maxPadding.right,boxPadding.right);} +function updateDims(chartArea,params,layout,stacks){const{pos,box}=layout;const maxPadding=chartArea.maxPadding;if(!isObject(pos)){if(layout.size){chartArea[pos]-=layout.size;} +const stack=stacks[layout.stack]||{size:0,count:1};stack.size=Math.max(stack.size,layout.horizontal?box.height:box.width);layout.size=stack.size/stack.count;chartArea[pos]+=layout.size;} +if(box.getPadding){updateMaxPadding(maxPadding,box.getPadding());} +const newWidth=Math.max(0,params.outerWidth-getCombinedMax(maxPadding,chartArea,'left','right'));const newHeight=Math.max(0,params.outerHeight-getCombinedMax(maxPadding,chartArea,'top','bottom'));const widthChanged=newWidth!==chartArea.w;const heightChanged=newHeight!==chartArea.h;chartArea.w=newWidth;chartArea.h=newHeight;return layout.horizontal?{same:widthChanged,other:heightChanged}:{same:heightChanged,other:widthChanged};} +function handleMaxPadding(chartArea){const maxPadding=chartArea.maxPadding;function updatePos(pos){const change=Math.max(maxPadding[pos]-chartArea[pos],0);chartArea[pos]+=change;return change;} +chartArea.y+=updatePos('top');chartArea.x+=updatePos('left');updatePos('right');updatePos('bottom');} +function getMargins(horizontal,chartArea){const maxPadding=chartArea.maxPadding;function marginForPositions(positions){const margin={left:0,top:0,right:0,bottom:0};positions.forEach((pos)=>{margin[pos]=Math.max(chartArea[pos],maxPadding[pos]);});return margin;} +return horizontal?marginForPositions(['left','right']):marginForPositions(['top','bottom']);} +function fitBoxes(boxes,chartArea,params,stacks){const refitBoxes=[];let i,ilen,layout,box,refit,changed;for(i=0,ilen=boxes.length,refit=0;i{if(typeof box.beforeLayout==='function'){box.beforeLayout();}});const visibleVerticalBoxCount=verticalBoxes.reduce((total,wrap)=>wrap.box.options&&wrap.box.options.display===false?total:total+1,0)||1;const params=Object.freeze({outerWidth:width,outerHeight:height,padding,availableWidth,availableHeight,vBoxMaxWidth:availableWidth/2/visibleVerticalBoxCount,hBoxMaxHeight:availableHeight/2});const maxPadding=Object.assign({},padding);updateMaxPadding(maxPadding,toPadding(minPadding));const chartArea=Object.assign({maxPadding,w:availableWidth,h:availableHeight,x:padding.left,y:padding.top},padding);const stacks=setLayoutDims(verticalBoxes.concat(horizontalBoxes),params);fitBoxes(boxes.fullSize,chartArea,params,stacks);fitBoxes(verticalBoxes,chartArea,params,stacks);if(fitBoxes(horizontalBoxes,chartArea,params,stacks)){fitBoxes(verticalBoxes,chartArea,params,stacks);} +handleMaxPadding(chartArea);placeBoxes(boxes.leftAndTop,chartArea,params,stacks);chartArea.x+=chartArea.w;chartArea.y+=chartArea.h;placeBoxes(boxes.rightAndBottom,chartArea,params,stacks);chart.chartArea={left:chartArea.left,top:chartArea.top,right:chartArea.left+chartArea.w,bottom:chartArea.top+chartArea.h,height:chartArea.h,width:chartArea.w,};each(boxes.chartArea,(layout)=>{const box=layout.box;Object.assign(box,chart.chartArea);box.update(chartArea.w,chartArea.h,{left:0,top:0,right:0,bottom:0});});}};class BasePlatform{acquireContext(canvas,aspectRatio){} releaseContext(context){return false;} addEventListener(chart,type,listener){} removeEventListener(chart,type,listener){} @@ -1093,7 +1100,7 @@ if(isNullOrEmpty(renderHeight)){if(canvas.style.height===''){canvas.height=canva return canvas;} const eventListenerOptions=supportsEventListenerOptions?{passive:true}:false;function addListener(node,type,listener){node.addEventListener(type,listener,eventListenerOptions);} function removeListener(chart,type,listener){chart.canvas.removeEventListener(type,listener,eventListenerOptions);} -function fromNativeEvent(event,chart){const type=EVENT_TYPES[event.type]||event.type;const{x,y}=getRelativePosition$1(event,chart);return{type,chart,native:event,x:x!==undefined?x:null,y:y!==undefined?y:null,};} +function fromNativeEvent(event,chart){const type=EVENT_TYPES[event.type]||event.type;const{x,y}=getRelativePosition(event,chart);return{type,chart,native:event,x:x!==undefined?x:null,y:y!==undefined?y:null,};} function nodeListContains(nodeList,canvas){for(const node of nodeList){if(node===canvas||node.contains(canvas)){return true;}}} function createAttachObserver(chart,type,listener){const canvas=chart.canvas;const observer=new MutationObserver(entries=>{let trigger=false;for(const entry of entries){trigger=trigger||nodeListContains(entry.addedNodes,canvas);trigger=trigger&&!nodeListContains(entry.removedNodes,canvas);} if(trigger){listener();}});observer.observe(document,{childList:true,subtree:true});return observer;} @@ -1180,7 +1187,7 @@ function createDataContext(parent,index,element){return createContext(parent,{ac function clearStacks(meta,items){const datasetIndex=meta.controller.index;const axis=meta.vScale&&meta.vScale.axis;if(!axis){return;} items=items||meta._parsed;for(const parsed of items){const stacks=parsed._stacks;if(!stacks||stacks[axis]===undefined||stacks[axis][datasetIndex]===undefined){return;} delete stacks[axis][datasetIndex];}} -const isDirectUpdateMode=(mode)=>mode==='reset'||mode==='none';const cloneIfNotShared=(cached,shared)=>shared?cached:Object.assign({},cached);const createStack=(canStack,meta,chart)=>canStack&&!meta.hidden&&meta._stacked&&{keys:getSortedDatasetIndices(chart,true),values:null};class DatasetController{constructor(chart,datasetIndex){this.chart=chart;this._ctx=chart.ctx;this.index=datasetIndex;this._cachedDataOpts={};this._cachedMeta=this.getMeta();this._type=this._cachedMeta.type;this.options=undefined;this._parsing=false;this._data=undefined;this._objectData=undefined;this._sharedOptions=undefined;this._drawStart=undefined;this._drawCount=undefined;this.enableOptionSharing=false;this.$context=undefined;this._syncList=[];this.initialize();} +const isDirectUpdateMode=(mode)=>mode==='reset'||mode==='none';const cloneIfNotShared=(cached,shared)=>shared?cached:Object.assign({},cached);const createStack=(canStack,meta,chart)=>canStack&&!meta.hidden&&meta._stacked&&{keys:getSortedDatasetIndices(chart,true),values:null};class DatasetController{constructor(chart,datasetIndex){this.chart=chart;this._ctx=chart.ctx;this.index=datasetIndex;this._cachedDataOpts={};this._cachedMeta=this.getMeta();this._type=this._cachedMeta.type;this.options=undefined;this._parsing=false;this._data=undefined;this._objectData=undefined;this._sharedOptions=undefined;this._drawStart=undefined;this._drawCount=undefined;this.enableOptionSharing=false;this.supportsDecimation=false;this.$context=undefined;this._syncList=[];this.initialize();} initialize(){const meta=this._cachedMeta;this.configure();this.linkScales();meta._stacked=isStacked(meta.vScale,meta);this.addElements();} updateIndex(datasetIndex){if(this.index!==datasetIndex){clearStacks(this._cachedMeta);} this.index=datasetIndex;} @@ -1331,7 +1338,7 @@ getLabels(){const data=this.chart.data;return this.options.labels||(this.isHoriz beforeLayout(){this._cache={};this._dataLimitsCached=false;} beforeUpdate(){callback(this.options.beforeUpdate,[this]);} update(maxWidth,maxHeight,margins){const{beginAtZero,grace,ticks:tickOpts}=this.options;const sampleSize=tickOpts.sampleSize;this.beforeUpdate();this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins=Object.assign({left:0,right:0,top:0,bottom:0},margins);this.ticks=null;this._labelSizes=null;this._gridLineItems=null;this._labelItems=null;this.beforeSetDimensions();this.setDimensions();this.afterSetDimensions();this._maxLength=this.isHorizontal()?this.width+margins.left+margins.right:this.height+margins.top+margins.bottom;if(!this._dataLimitsCached){this.beforeDataLimits();this.determineDataLimits();this.afterDataLimits();this._range=_addGrace(this,grace,beginAtZero);this._dataLimitsCached=true;} -this.beforeBuildTicks();this.ticks=this.buildTicks()||[];this.afterBuildTicks();const samplingEnabled=sampleSizeisObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}} return false;} -var version="3.7.1";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} +var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};} function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);} function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);} @@ -1629,6 +1638,7 @@ _drawDataset(meta){const ctx=this.ctx;const clip=meta._clip;const useClip=!clip. if(useClip){clipArea(ctx,{left:clip.left===false?0:area.left-clip.left,right:clip.right===false?this.width:area.right+clip.right,top:clip.top===false?0:area.top-clip.top,bottom:clip.bottom===false?this.height:area.bottom+clip.bottom});} meta.controller.draw();if(useClip){unclipArea(ctx);} args.cancelable=false;this.notifyPlugins('afterDatasetDraw',args);} +isPointInArea(point){return _isPointInArea(point,this.chartArea,this._minPadding);} getElementsAtEventForMode(e,mode,options,useFinalPosition){const method=Interaction.modes[mode];if(typeof method==='function'){return method(this,e,options,useFinalPosition);} return[];} getDatasetMeta(datasetIndex){const dataset=this.data.datasets[datasetIndex];const metasets=this._metasets;let meta=metasets.filter(x=>x&&x._dataset===dataset).pop();if(!meta){meta={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:dataset&&dataset.order||0,index:datasetIndex,_dataset:dataset,_parsed:[],_sorted:false};metasets.push(meta);} @@ -1662,7 +1672,7 @@ return{datasetIndex,element:meta.data[index],index,};});const changed=!_elements notifyPlugins(hook,args,filter){return this._plugins.notify(this,hook,args,filter);} _updateHoverStyles(active,lastActive,replay){const hoverOptions=this.options.hover;const diff=(a,b)=>a.filter(x=>!b.some(y=>x.datasetIndex===y.datasetIndex&&x.index===y.index));const deactivated=diff(lastActive,active);const activated=replay?active:diff(active,lastActive);if(deactivated.length){this.updateHoverStyle(deactivated,hoverOptions.mode,false);} if(activated.length&&hoverOptions.mode){this.updateHoverStyle(activated,hoverOptions.mode,true);}} -_eventHandler(e,replay){const args={event:e,replay,cancelable:true,inChartArea:_isPointInArea(e,this.chartArea,this._minPadding)};const eventFilter=(plugin)=>(plugin.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins('beforeEvent',args,eventFilter)===false){return;} +_eventHandler(e,replay){const args={event:e,replay,cancelable:true,inChartArea:this.isPointInArea(e)};const eventFilter=(plugin)=>(plugin.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins('beforeEvent',args,eventFilter)===false){return;} const changed=this._handleEvent(e,replay,args.inChartArea);args.cancelable=false;this.notifyPlugins('afterEvent',args,eventFilter);if(changed||args.changed){this.render();} return this;} _handleEvent(e,replay,inChartArea){const{_active:lastActive=[],options}=this;const useFinalPosition=replay;const active=this._getActiveElements(e,lastActive,inChartArea,useFinalPosition);const isClick=_isClickEvent(e);const lastEvent=determineLastEvent(e,this._lastEvent,inChartArea,isClick);if(inChartArea){this._lastEvent=null;callback(options.onHover,[e,active,this],this);if(isClick){callback(options.onClick,[e,active,this],this);}} @@ -1739,7 +1749,7 @@ if(floating){value=custom.barStart;length=custom.barEnd-custom.barStart;if(value start+=value;} const startValue=!isNullOrUndef(baseValue)&&!floating?baseValue:start;let base=vScale.getPixelForValue(startValue);if(this.chart.getDataVisibility(index)){head=vScale.getPixelForValue(start+length);}else{head=base;} size=head-base;if(Math.abs(size)name!=='spacing',_indexable:(name)=>name!=='spacing',};DoughnutController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(chart){const data=chart.data;if(data.labels.length&&data.datasets.length){const{labels:{pointStyle}}=chart.legend.options;return data.labels.map((label,i)=>{const meta=chart.getDatasetMeta(0);const style=meta.controller.getStyle(i);return{text:label,fillStyle:style.backgroundColor,strokeStyle:style.borderColor,lineWidth:style.borderWidth,pointStyle:pointStyle,hidden:!chart.getDataVisibility(i),index:i};});} return[];}},onClick(e,legendItem,legend){legend.chart.toggleDataVisibility(legendItem.index);legend.chart.update();}},tooltip:{callbacks:{title(){return'';},label(tooltipItem){let dataLabel=tooltipItem.label;const value=': '+tooltipItem.formattedValue;if(isArray(dataLabel)){dataLabel=dataLabel.slice();dataLabel[0]+=value;}else{dataLabel+=value;} -return dataLabel;}}}}};class LineController extends DatasetController{initialize(){this.enableOptionSharing=true;super.initialize();} +return dataLabel;}}}}};class LineController extends DatasetController{initialize(){this.enableOptionSharing=true;this.supportsDecimation=true;super.initialize();} update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;} line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(parsed[iAxis]-prevParsed[iAxis])>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} +updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);} if(!directUpdate){this.updateElement(point,i,properties,mode);} prevParsed=parsed;} @@ -1815,21 +1825,25 @@ function scaleRangesChanged(meta){const{xScale,yScale,_scaleRanges}=meta;const n const changed=_scaleRanges.xmin!==xScale.min||_scaleRanges.xmax!==xScale.max||_scaleRanges.ymin!==yScale.min||_scaleRanges.ymax!==yScale.max;Object.assign(_scaleRanges,newRanges);return changed;} class PolarAreaController extends DatasetController{constructor(chart,datasetIndex){super(chart,datasetIndex);this.innerRadius=undefined;this.outerRadius=undefined;} getLabelAndValue(index){const meta=this._cachedMeta;const chart=this.chart;const labels=chart.data.labels||[];const value=formatNumber(meta._parsed[index].r,chart.options.locale);return{label:labels[index]||'',value,};} +parseObjectData(meta,data,start,count){return _parseObjectDataRadialScale.bind(this)(meta,data,start,count);} update(mode){const arcs=this._cachedMeta.data;this._updateRadius();this.updateElements(arcs,0,arcs.length,mode);} +getMinMax(){const meta=this._cachedMeta;const range={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};meta.data.forEach((element,index)=>{const parsed=this.getParsed(index).r;if(!isNaN(parsed)&&this.chart.getDataVisibility(index)){if(parsedrange.max){range.max=parsed;}}});return range;} _updateRadius(){const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const minSize=Math.min(chartArea.right-chartArea.left,chartArea.bottom-chartArea.top);const outerRadius=Math.max(minSize/2,0);const innerRadius=Math.max(opts.cutoutPercentage?(outerRadius/100)*(opts.cutoutPercentage):1,0);const radiusLength=(outerRadius-innerRadius)/chart.getVisibleDatasetCount();this.outerRadius=outerRadius-(radiusLength*this.index);this.innerRadius=this.outerRadius-radiusLength;} -updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const dataset=this.getDataset();const opts=chart.options;const animationOpts=opts.animation;const scale=this._cachedMeta.rScale;const centerX=scale.xCenter;const centerY=scale.yCenter;const datasetStartAngle=scale.getIndexAngle(0)-0.5*PI;let angle=datasetStartAngle;let i;const defaultAngle=360/this.countVisibleElements();for(i=0;i{if(!isNaN(dataset.data[index])&&this.chart.getDataVisibility(index)){count++;}});return count;} +countVisibleElements(){const meta=this._cachedMeta;let count=0;meta.data.forEach((element,index)=>{if(!isNaN(this.getParsed(index).r)&&this.chart.getDataVisibility(index)){count++;}});return count;} _computeAngle(index,mode,defaultAngle){return this.chart.getDataVisibility(index)?toRadians(this.resolveDataElementOptions(index,mode).angle||defaultAngle):0;}} PolarAreaController.id='polarArea';PolarAreaController.defaults={dataElementType:'arc',animation:{animateRotate:true,animateScale:true},animations:{numbers:{type:'number',properties:['x','y','startAngle','endAngle','innerRadius','outerRadius']},},indexAxis:'r',startAngle:0,};PolarAreaController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(chart){const data=chart.data;if(data.labels.length&&data.datasets.length){const{labels:{pointStyle}}=chart.legend.options;return data.labels.map((label,i)=>{const meta=chart.getDatasetMeta(0);const style=meta.controller.getStyle(i);return{text:label,fillStyle:style.backgroundColor,strokeStyle:style.borderColor,lineWidth:style.borderWidth,pointStyle:pointStyle,hidden:!chart.getDataVisibility(i),index:i};});} return[];}},onClick(e,legendItem,legend){legend.chart.toggleDataVisibility(legendItem.index);legend.chart.update();}},tooltip:{callbacks:{title(){return'';},label(context){return context.chart.data.labels[context.dataIndex]+': '+context.formattedValue;}}}},scales:{r:{type:'radialLinear',angleLines:{display:false},beginAtZero:true,grid:{circular:true},pointLabels:{display:false},startAngle:0}}};class PieController extends DoughnutController{} PieController.id='pie';PieController.defaults={cutout:0,rotation:0,circumference:360,radius:'100%'};class RadarController extends DatasetController{getLabelAndValue(index){const vScale=this._cachedMeta.vScale;const parsed=this.getParsed(index);return{label:vScale.getLabels()[index],value:''+vScale.getLabelForValue(parsed[vScale.axis])};} +parseObjectData(meta,data,start,count){return _parseObjectDataRadialScale.bind(this)(meta,data,start,count);} update(mode){const meta=this._cachedMeta;const line=meta.dataset;const points=meta.data||[];const labels=meta.iScale.getLabels();line.points=points;if(mode!=='resize'){const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} const properties={_loop:true,_fullLoop:labels.length===points.length,options};this.updateElement(line,undefined,properties,mode);} this.updateElements(points,0,points.length,mode);} -updateElements(points,start,count,mode){const dataset=this.getDataset();const scale=this._cachedMeta.rScale;const reset=mode==='reset';for(let i=start;ipixelMargin){angleMargin=pixelMargin/innerRadius;ctx.arc(x,y,innerRadius,endAngle+angleMargin,startAngle-angleMargin,true);}else{ctx.arc(x,y,pixelMargin,endAngle+HALF_PI,startAngle-HALF_PI);} ctx.closePath();ctx.clip();} @@ -1948,38 +1962,46 @@ if(maxDefined){count=_limitValue(_lookupByKey(points,iScale.axis,max).hi+1,start return{start,count};} var plugin_decimation={id:'decimation',defaults:{algorithm:'min-max',enabled:false,},beforeElementsUpdate:(chart,args,options)=>{if(!options.enabled){cleanDecimatedData(chart);return;} const availableWidth=chart.width;chart.data.datasets.forEach((dataset,datasetIndex)=>{const{_data,indexAxis}=dataset;const meta=chart.getDatasetMeta(datasetIndex);const data=_data||dataset.data;if(resolve([indexAxis,chart.options.indexAxis])==='y'){return;} -if(meta.type!=='line'){return;} +if(!meta.controller.supportsDecimation){return;} const xAxis=chart.scales[meta.xAxisID];if(xAxis.type!=='linear'&&xAxis.type!=='time'){return;} if(chart.options.parsing){return;} let{start,count}=getStartAndCountOfVisiblePointsSimplified(meta,data);const threshold=options.threshold||4*availableWidth;if(count<=threshold){cleanDecimatedDataset(dataset);return;} if(isNullOrUndef(_data)){dataset._data=data;delete dataset.data;Object.defineProperty(dataset,'data',{configurable:true,enumerable:true,get:function(){return this._decimated;},set:function(d){this._data=d;}});} let decimated;switch(options.algorithm){case'lttb':decimated=lttbDecimation(data,start,count,availableWidth,options);break;case'min-max':decimated=minMaxDecimation(data,start,count,availableWidth);break;default:throw new Error(`Unsupported decimation algorithm '${options.algorithm}'`);} -dataset._decimated=decimated;});},destroy(chart){cleanDecimatedData(chart);}};function getLineByIndex(chart,index){const meta=chart.getDatasetMeta(index);const visible=meta&&chart.isDatasetVisible(index);return visible?meta.dataset:null;} +dataset._decimated=decimated;});},destroy(chart){cleanDecimatedData(chart);}};function _segments(line,target,property){const segments=line.segments;const points=line.points;const tpoints=target.points;const parts=[];for(const segment of segments){let{start,end}=segment;end=_findSegmentEnd(start,end,points);const bounds=_getBounds(property,points[start],points[end],segment.loop);if(!target.segments){parts.push({source:segment,target:bounds,start:points[start],end:points[end]});continue;} +const targetSegments=_boundSegments(target,bounds);for(const tgt of targetSegments){const subBounds=_getBounds(property,tpoints[tgt.start],tpoints[tgt.end],tgt.loop);const fillSources=_boundSegment(segment,points,subBounds);for(const fillSource of fillSources){parts.push({source:fillSource,target:tgt,start:{[property]:_getEdge(bounds,subBounds,'start',Math.max)},end:{[property]:_getEdge(bounds,subBounds,'end',Math.min)}});}}} +return parts;} +function _getBounds(property,first,last,loop){if(loop){return;} +let start=first[property];let end=last[property];if(property==='angle'){start=_normalizeAngle(start);end=_normalizeAngle(end);} +return{property,start,end};} +function _pointsFromSegments(boundary,line){const{x=null,y=null}=boundary||{};const linePoints=line.points;const points=[];line.segments.forEach(({start,end})=>{end=_findSegmentEnd(start,end,linePoints);const first=linePoints[start];const last=linePoints[end];if(y!==null){points.push({x:first.x,y});points.push({x:last.x,y});}else if(x!==null){points.push({x,y:first.y});points.push({x,y:last.y});}});return points;} +function _findSegmentEnd(start,end,points){for(;end>start;end--){const point=points[end];if(!isNaN(point.x)&&!isNaN(point.y)){break;}} +return end;} +function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);} +return a?a[prop]:b?b[prop]:0;} +function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);} +return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;} +function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;} +while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;} +target=sources[fill];if(!target){return false;} +if(target.visible){return fill;} +visited.push(fill);fill=target.fill;} +return false;} +function _decodeFill(line,index,count){const fill=parseFillOption(line);if(isObject(fill)){return isNaN(fill.value)?false:fill;} +let target=parseFloat(fill);if(isNumberFinite(target)&&Math.floor(target)===target){return decodeTargetIndex(fill[0],index,target,count);} +return['origin','start','end','stack','shape'].indexOf(fill)>=0&&fill;} +function decodeTargetIndex(firstCh,index,target,count){if(firstCh==='-'||firstCh==='+'){target=index+target;} +if(target===index||target<0||target>=count){return false;} +return target;} +function _getTargetPixel(fill,scale){let pixel=null;if(fill==='start'){pixel=scale.bottom;}else if(fill==='end'){pixel=scale.top;}else if(isObject(fill)){pixel=scale.getPixelForValue(fill.value);}else if(scale.getBasePixel){pixel=scale.getBasePixel();} +return pixel;} +function _getTargetValue(fill,scale,startValue){let value;if(fill==='start'){value=startValue;}else if(fill==='end'){value=scale.options.reverse?scale.min:scale.max;}else if(isObject(fill)){value=fill.value;}else{value=scale.getBaseValue();} +return value;} function parseFillOption(line){const options=line.options;const fillOption=options.fill;let fill=valueOrDefault(fillOption&&fillOption.target,fillOption);if(fill===undefined){fill=!!options.backgroundColor;} if(fill===false||fill===null){return false;} if(fill===true){return'origin';} return fill;} -function decodeFill(line,index,count){const fill=parseFillOption(line);if(isObject(fill)){return isNaN(fill.value)?false:fill;} -let target=parseFloat(fill);if(isNumberFinite(target)&&Math.floor(target)===target){if(fill[0]==='-'||fill[0]==='+'){target=index+target;} -if(target===index||target<0||target>=count){return false;} -return target;} -return['origin','start','end','stack','shape'].indexOf(fill)>=0&&fill;} -function computeLinearBoundary(source){const{scale={},fill}=source;let target=null;let horizontal;if(fill==='start'){target=scale.bottom;}else if(fill==='end'){target=scale.top;}else if(isObject(fill)){target=scale.getPixelForValue(fill.value);}else if(scale.getBasePixel){target=scale.getBasePixel();} -if(isNumberFinite(target)){horizontal=scale.isHorizontal();return{x:horizontal?target:null,y:horizontal?null:target};} -return null;} -class simpleArc{constructor(opts){this.x=opts.x;this.y=opts.y;this.radius=opts.radius;} -pathSegment(ctx,bounds,opts){const{x,y,radius}=this;bounds=bounds||{start:0,end:TAU};ctx.arc(x,y,radius,bounds.end,bounds.start,true);return!opts.bounds;} -interpolate(point){const{x,y,radius}=this;const angle=point.angle;return{x:x+Math.cos(angle)*radius,y:y+Math.sin(angle)*radius,angle};}} -function computeCircularBoundary(source){const{scale,fill}=source;const options=scale.options;const length=scale.getLabels().length;const target=[];const start=options.reverse?scale.max:scale.min;const end=options.reverse?scale.min:scale.max;let i,center,value;if(fill==='start'){value=start;}else if(fill==='end'){value=end;}else if(isObject(fill)){value=fill.value;}else{value=scale.getBaseValue();} -if(options.grid.circular){center=scale.getPointPositionForValue(0,start);return new simpleArc({x:center.x,y:center.y,radius:scale.getDistanceFromCenterForValue(value)});} -for(i=0;istart;end--){const point=points[end];if(!isNaN(point.x)&&!isNaN(point.y)){break;}} -return end;} -function pointsFromSegments(boundary,line){const{x=null,y=null}=boundary||{};const linePoints=line.points;const points=[];line.segments.forEach(({start,end})=>{end=findSegmentEnd(start,end,linePoints);const first=linePoints[start];const last=linePoints[end];if(y!==null){points.push({x:first.x,y});points.push({x:last.x,y});}else if(x!==null){points.push({x,y:first.y});points.push({x,y:last.y});}});return points;} -function buildStackLine(source){const{scale,index,line}=source;const points=[];const segments=line.segments;const sourcePoints=line.points;const linesBelow=getLinesBelow(scale,index);linesBelow.push(createBoundaryLine({x:null,y:scale.bottom},line));for(let i=0;i=0;--i){const source=metasets[i].$filler;if(!source){continue;} -source.line.updateControlPoints(area,source.axis);if(draw){drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} -const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} -drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} +source.fill=_resolveTarget(sources,i,options.propagate);}},beforeDraw(chart,_args,options){const draw=options.drawTime==='beforeDraw';const metasets=chart.getSortedVisibleDatasetMetas();const area=chart.chartArea;for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(!source){continue;} +source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} +const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} +_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();} setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}} @@ -2062,9 +2079,9 @@ _computeTitleHeight(){const titleOpts=this.options.title;const titleFont=toFont( _getLegendItemAt(x,y){let i,hitBox,lh;if(_isBetween(x,this.left,this.right)&&_isBetween(y,this.top,this.bottom)){lh=this.legendHitBoxes;for(i=0;ictx.chart.options.color,boxWidth:40,padding:10,generateLabels(chart){const datasets=chart.data.datasets;const{labels:{usePointStyle,pointStyle,textAlign,color}}=chart.legend.options;return chart._getSortedDatasetMetas().map((meta)=>{const style=meta.controller.getStyle(usePointStyle?0:undefined);const borderWidth=toPadding(style.borderWidth);return{text:datasets[meta.index].label,fillStyle:style.backgroundColor,fontColor:color,hidden:!meta.visible,lineCap:style.borderCapStyle,lineDash:style.borderDash,lineDashOffset:style.borderDashOffset,lineJoin:style.borderJoinStyle,lineWidth:(borderWidth.width+borderWidth.height)/4,strokeStyle:style.borderColor,pointStyle:pointStyle||style.pointStyle,rotation:style.rotation,textAlign:textAlign||style.textAlign,borderRadius:0,datasetIndex:meta.index};},this);}},title:{color:(ctx)=>ctx.chart.options.color,display:false,position:'center',text:'',}},descriptors:{_scriptable:(name)=>!name.startsWith('on'),labels:{_scriptable:(name)=>!['generateLabels','filter','sort'].includes(name),}},};class Title extends Element{constructor(config){super();this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this._padding=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.width=undefined;this.height=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} @@ -2154,6 +2171,7 @@ ctx.lineTo(x+bottomLeft,y+height);ctx.quadraticCurveTo(x,y+height,x,y+height-bot ctx.lineTo(x,y+topLeft);ctx.quadraticCurveTo(x,y,x+topLeft,y);ctx.closePath();ctx.fill();if(options.borderWidth>0){ctx.stroke();}} _updateAnimationTarget(options){const chart=this.chart;const anims=this.$animations;const animX=anims&&anims.x;const animY=anims&&anims.y;if(animX||animY){const position=positioners[options.position].call(this,this._active,this._eventPosition);if(!position){return;} const size=this._size=getTooltipSize(this,options);const positionAndSize=Object.assign({},position,this._size);const alignment=determineAlignment(chart,options,positionAndSize);const point=getBackgroundPoint(options,positionAndSize,alignment,chart);if(animX._to!==point.x||animY._to!==point.y){this.xAlign=alignment.xAlign;this.yAlign=alignment.yAlign;this.width=size.width;this.height=size.height;this.caretX=position.x;this.caretY=position.y;this._resolveAnimations().update(this,point);}}} +_willRender(){return!!this.opacity;} draw(ctx){const options=this.options.setContext(this.getContext());let opacity=this.opacity;if(!opacity){return;} this._updateAnimationTarget(options);const tooltipSize={width:this.width,height:this.height};const pt={x:this.x,y:this.y};opacity=Math.abs(opacity)<1e-3?0:opacity;const padding=toPadding(options.padding);const hasTooltipContent=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;if(options.enabled&&hasTooltipContent){ctx.save();ctx.globalAlpha=opacity;this.drawBackground(pt,ctx,tooltipSize,options);overrideTextDirection(ctx,options.textDirection);pt.y+=padding.top;this.drawTitle(pt,ctx,options);this.drawBody(pt,ctx,options);this.drawFooter(pt,ctx,options);restoreTextDirection(ctx,options.textDirection);ctx.restore();}} getActiveElements(){return this._active||[];} @@ -2167,13 +2185,12 @@ if(!inChartArea){return lastActive;} const active=this.chart.getElementsAtEventForMode(e,options.mode,options,replay);if(options.reverse){active.reverse();} return active;} _positionChanged(active,e){const{caretX,caretY,options}=this;const position=positioners[options.position].call(this,active,e);return position!==false&&(caretX!==position.x||caretY!==position.y);}} -Tooltip.positioners=positioners;var plugin_tooltip={id:'tooltip',_element:Tooltip,positioners,afterInit(chart,_args,options){if(options){chart.tooltip=new Tooltip({chart,options});}},beforeUpdate(chart,_args,options){if(chart.tooltip){chart.tooltip.initialize(options);}},reset(chart,_args,options){if(chart.tooltip){chart.tooltip.initialize(options);}},afterDraw(chart){const tooltip=chart.tooltip;const args={tooltip};if(chart.notifyPlugins('beforeTooltipDraw',args)===false){return;} -if(tooltip){tooltip.draw(chart.ctx);} -chart.notifyPlugins('afterTooltipDraw',args);},afterEvent(chart,args){if(chart.tooltip){const useFinalPosition=args.replay;if(chart.tooltip.handleEvent(args.event,useFinalPosition,args.inChartArea)){args.changed=true;}}},defaults:{enabled:true,external:null,position:'average',backgroundColor:'rgba(0,0,0,0.8)',titleColor:'#fff',titleFont:{weight:'bold',},titleSpacing:2,titleMarginBottom:6,titleAlign:'left',bodyColor:'#fff',bodySpacing:2,bodyFont:{},bodyAlign:'left',footerColor:'#fff',footerSpacing:2,footerMarginTop:6,footerFont:{weight:'bold',},footerAlign:'left',padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(ctx,opts)=>opts.bodyFont.size,boxWidth:(ctx,opts)=>opts.bodyFont.size,multiKeyBackground:'#fff',displayColors:true,boxPadding:0,borderColor:'rgba(0,0,0,0)',borderWidth:0,animation:{duration:400,easing:'easeOutQuart',},animations:{numbers:{type:'number',properties:['x','y','width','height','caretX','caretY'],},opacity:{easing:'linear',duration:200}},callbacks:{beforeTitle:noop,title(tooltipItems){if(tooltipItems.length>0){const item=tooltipItems[0];const labels=item.chart.data.labels;const labelCount=labels?labels.length:0;if(this&&this.options&&this.options.mode==='dataset'){return item.dataset.label||'';}else if(item.label){return item.label;}else if(labelCount>0&&item.dataIndexopts.bodyFont.size,boxWidth:(ctx,opts)=>opts.bodyFont.size,multiKeyBackground:'#fff',displayColors:true,boxPadding:0,borderColor:'rgba(0,0,0,0)',borderWidth:0,animation:{duration:400,easing:'easeOutQuart',},animations:{numbers:{type:'number',properties:['x','y','width','height','caretX','caretY'],},opacity:{easing:'linear',duration:200}},callbacks:{beforeTitle:noop,title(tooltipItems){if(tooltipItems.length>0){const item=tooltipItems[0];const labels=item.chart.data.labels;const labelCount=labels?labels.length:0;if(this&&this.options&&this.options.mode==='dataset'){return item.dataset.label||'';}else if(item.label){return item.label;}else if(labelCount>0&&item.dataIndexname!=='filter'&&name!=='itemSort'&&name!=='external',_indexable:false,callbacks:{_scriptable:false,_indexable:false,},animation:{_fallback:false},animations:{_fallback:'animation'}},additionalOptionScopes:['interaction']};var plugins=Object.freeze({__proto__:null,Decimation:plugin_decimation,Filler:plugin_filler,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(labels,raw,index,addedLabels)=>{if(typeof raw==='string'){index=labels.push(raw)-1;addedLabels.unshift({index,label:raw});}else if(isNaN(raw)){index=null;} +return label;},labelColor(tooltipItem){const meta=tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);const options=meta.controller.getStyle(tooltipItem.dataIndex);return{borderColor:options.borderColor,backgroundColor:options.backgroundColor,borderWidth:options.borderWidth,borderDash:options.borderDash,borderDashOffset:options.borderDashOffset,borderRadius:0,};},labelTextColor(){return this.options.bodyColor;},labelPointStyle(tooltipItem){const meta=tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);const options=meta.controller.getStyle(tooltipItem.dataIndex);return{pointStyle:options.pointStyle,rotation:options.rotation,};},afterLabel:noop,afterBody:noop,beforeFooter:noop,footer:noop,afterFooter:noop}},defaultRoutes:{bodyFont:'font',footerFont:'font',titleFont:'font'},descriptors:{_scriptable:(name)=>name!=='filter'&&name!=='itemSort'&&name!=='external',_indexable:false,callbacks:{_scriptable:false,_indexable:false,},animation:{_fallback:false},animations:{_fallback:'animation'}},additionalOptionScopes:['interaction']};var plugins=Object.freeze({__proto__:null,Decimation:plugin_decimation,Filler:index,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(labels,raw,index,addedLabels)=>{if(typeof raw==='string'){index=labels.push(raw)-1;addedLabels.unshift({index,label:raw});}else if(isNaN(raw)){index=null;} return index;};function findOrAddLabel(labels,raw,index,addedLabels){const first=labels.indexOf(raw);if(first===-1){return addIfString(labels,raw,index,addedLabels);} const last=labels.lastIndexOf(raw);return first!==last?index:first;} const validIndex=(index,max)=>index===null?null:_limitValue(Math.round(index),0,max);class CategoryScale extends Scale{constructor(cfg){super(cfg);this._startValue=undefined;this._valueRange=0;this._addedLabels=[];} @@ -2268,7 +2285,7 @@ function leftForTextAlign(x,w,align){if(align==='right'){x-=w;}else if(align===' return x;} function yForAngle(y,h,angle){if(angle===90||angle===270){y-=(h/2);}else if(angle>270||angle<90){y-=h;} return y;} -function drawPointLabels(scale,labelCount){const{ctx,options:{pointLabels}}=scale;for(let i=labelCount-1;i>=0;i--){const optsAtIndex=pointLabels.setContext(scale.getPointLabelContext(i));const plFont=toFont(optsAtIndex.font);const{x,y,textAlign,left,top,right,bottom}=scale._pointLabelItems[i];const{backdropColor}=optsAtIndex;if(!isNullOrUndef(backdropColor)){const padding=toPadding(optsAtIndex.backdropPadding);ctx.fillStyle=backdropColor;ctx.fillRect(left-padding.left,top-padding.top,right-left+padding.width,bottom-top+padding.height);} +function drawPointLabels(scale,labelCount){const{ctx,options:{pointLabels}}=scale;for(let i=labelCount-1;i>=0;i--){const optsAtIndex=pointLabels.setContext(scale.getPointLabelContext(i));const plFont=toFont(optsAtIndex.font);const{x,y,textAlign,left,top,right,bottom}=scale._pointLabelItems[i];const{backdropColor}=optsAtIndex;if(!isNullOrUndef(backdropColor)){const borderRadius=toTRBLCorners(optsAtIndex.borderRadius);const padding=toPadding(optsAtIndex.backdropPadding);ctx.fillStyle=backdropColor;const backdropLeft=left-padding.left;const backdropTop=top-padding.top;const backdropWidth=right-left+padding.width;const backdropHeight=bottom-top+padding.height;if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();addRoundedRectPath(ctx,{x:backdropLeft,y:backdropTop,w:backdropWidth,h:backdropHeight,radius:borderRadius,});ctx.fill();}else{ctx.fillRect(backdropLeft,backdropTop,backdropWidth,backdropHeight);}} renderText(ctx,scale._pointLabels[i],x,y+(plFont.lineHeight/2),plFont,{color:optsAtIndex.color,textAlign:textAlign,textBaseline:'middle'});}} function pathRadiusLine(scale,radius,circular,labelCount){const{ctx}=scale;if(circular){ctx.arc(scale.xCenter,scale.yCenter,radius,0,TAU);}else{let pointPosition=scale.getPointPosition(0,radius);ctx.moveTo(pointPosition.x,pointPosition.y);for(let i=1;i+tick.value));}} initOffsets(timestamps){let start=0;let end=0;let first,last;if(this.options.offset&×tamps.length){first=this.getDecimalForValue(timestamps[0]);if(timestamps.length===1){start=1-first;}else{start=(this.getDecimalForValue(timestamps[1])-first)/2;} last=this.getDecimalForValue(timestamps[timestamps.length-1]);if(timestamps.length===1){end=last;}else{end=(last-this.getDecimalForValue(timestamps[timestamps.length-2]))/2;}} const limit=timestamps.length<3?0.5:0.25;start=_limitValue(start,0,limit);end=_limitValue(end,0,limit);this._offsets={start,end,factor:1/(start+1+end)};} diff --git a/public/dist/scripts/app-dep.js b/public/dist/scripts/app-dep.js index 1a30b4c70..c84a91937 100644 --- a/public/dist/scripts/app-dep.js +++ b/public/dist/scripts/app-dep.js @@ -682,25 +682,23 @@ stop(chart){const anims=this._charts.get(chart);if(!anims||!anims.items.length){ const items=anims.items;let i=items.length-1;for(;i>=0;--i){items[i].cancel();} anims.items=[];this._notify(chart,anims,Date.now(),'complete');} remove(chart){return this._charts.delete(chart);}} -var animator=new Animator();const map$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};const hex='0123456789ABCDEF';const h1=(b)=>hex[b&0xF];const h2=(b)=>hex[(b&0xF0)>>4]+hex[b&0xF];const eq=(b)=>(((b&0xF0)>>4)===(b&0xF));function isShort(v){return eq(v.r)&&eq(v.g)&&eq(v.b)&&eq(v.a);} -function hexParse(str){var len=str.length;var ret;if(str[0]==='#'){if(len===4||len===5){ret={r:255&map$1[str[1]]*17,g:255&map$1[str[2]]*17,b:255&map$1[str[3]]*17,a:len===5?map$1[str[4]]*17:255};}else if(len===7||len===9){ret={r:map$1[str[1]]<<4|map$1[str[2]],g:map$1[str[3]]<<4|map$1[str[4]],b:map$1[str[5]]<<4|map$1[str[6]],a:len===9?(map$1[str[7]]<<4|map$1[str[8]]):255};}} -return ret;} -function hexString(v){var f=isShort(v)?h1:h2;return v?'#'+f(v.r)+f(v.g)+f(v.b)+(v.a<255?f(v.a):''):v;} -function round(v){return v+0.5|0;} +var animator=new Animator();function round(v){return v+0.5|0;} const lim=(v,l,h)=>Math.max(Math.min(v,h),l);function p2b(v){return lim(round(v*2.55),0,255);} function n2b(v){return lim(round(v*255),0,255);} function b2n(v){return lim(round(v/2.55)/100,0,1);} function n2p(v){return lim(round(v*100),0,100);} -const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(str){const m=RGB_RE.exec(str);let a=255;let r,g,b;if(!m){return;} -if(m[7]!==r){const v=+m[7];a=255&(m[8]?p2b(v):v*255);} -r=+m[1];g=+m[3];b=+m[5];r=255&(m[2]?p2b(r):r);g=255&(m[4]?p2b(g):g);b=255&(m[6]?p2b(b):b);return{r:r,g:g,b:b,a:a};} -function rgbString(v){return v&&(v.a<255?`rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`:`rgb(${v.r}, ${v.g}, ${v.b})`);} +const map$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};const hex=[...'0123456789ABCDEF'];const h1=b=>hex[b&0xF];const h2=b=>hex[(b&0xF0)>>4]+hex[b&0xF];const eq=b=>((b&0xF0)>>4)===(b&0xF);const isShort=v=>eq(v.r)&&eq(v.g)&&eq(v.b)&&eq(v.a);function hexParse(str){var len=str.length;var ret;if(str[0]==='#'){if(len===4||len===5){ret={r:255&map$1[str[1]]*17,g:255&map$1[str[2]]*17,b:255&map$1[str[3]]*17,a:len===5?map$1[str[4]]*17:255};}else if(len===7||len===9){ret={r:map$1[str[1]]<<4|map$1[str[2]],g:map$1[str[3]]<<4|map$1[str[4]],b:map$1[str[5]]<<4|map$1[str[6]],a:len===9?(map$1[str[7]]<<4|map$1[str[8]]):255};}} +return ret;} +const alpha=(a,f)=>a<255?f(a):'';function hexString(v){var f=isShort(v)?h1:h2;return v?'#'+f(v.r)+f(v.g)+f(v.b)+alpha(v.a,f):undefined;} const HUE_RE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function hsl2rgbn(h,s,l){const a=s*Math.min(l,1-l);const f=(n,k=(n+h/30)%12)=>l-a*Math.max(Math.min(k-3,9-k,1),-1);return[f(0),f(8),f(4)];} function hsv2rgbn(h,s,v){const f=(n,k=(n+h/60)%6)=>v-v*s*Math.max(Math.min(k,4-k,1),0);return[f(5),f(3),f(1)];} function hwb2rgbn(h,w,b){const rgb=hsl2rgbn(h,1,0.5);let i;if(w+b>1){i=1/(w+b);w*=i;b*=i;} for(i=0;i<3;i++){rgb[i]*=1-w-b;rgb[i]+=w;} return rgb;} -function rgb2hsl(v){const range=255;const r=v.r/range;const g=v.g/range;const b=v.b/range;const max=Math.max(r,g,b);const min=Math.min(r,g,b);const l=(max+min)/2;let h,s,d;if(max!==min){d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);h=max===r?((g-b)/d)+(g0.5?d/(2-max-min):d/(max+min);h=hueValue(r,g,b,d,max);h=h*60+0.5;} return[h|0,s||0,l];} function calln(f,a,b,c){return(Array.isArray(a)?f(a[0],a[1],a[2]):f(a,b,c)).map(n2b);} function hsl2rgb(h,s,l){return calln(hsl2rgbn,h,s,l);} @@ -714,11 +712,16 @@ return{r:v[0],g:v[1],b:v[2],a:a};} function rotate(v,deg){var h=rgb2hsl(v);h[0]=hue(h[0]+deg);h=hsl2rgb(h);v.r=h[0];v.g=h[1];v.b=h[2];} function hslString(v){if(!v){return;} const a=rgb2hsl(v);const h=a[0];const s=n2p(a[1]);const l=n2p(a[2]);return v.a<255?`hsla(${h}, ${s}%, ${l}%, ${b2n(v.a)})`:`hsl(${h}, ${s}%, ${l}%)`;} -const map$1$1={x:'dark',Z:'light',Y:'re',X:'blu',W:'gr',V:'medium',U:'slate',A:'ee',T:'ol',S:'or',B:'ra',C:'lateg',D:'ights',R:'in',Q:'turquois',E:'hi',P:'ro',O:'al',N:'le',M:'de',L:'yello',F:'en',K:'ch',G:'arks',H:'ea',I:'ightg',J:'wh'};const names={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 unpack(){const unpacked={};const keys=Object.keys(names);const tkeys=Object.keys(map$1$1);let i,j,k,ok,nk;for(i=0;i>16&0xFF,k>>8&0xFF,k&0xFF];} +const map$2={x:'dark',Z:'light',Y:'re',X:'blu',W:'gr',V:'medium',U:'slate',A:'ee',T:'ol',S:'or',B:'ra',C:'lateg',D:'ights',R:'in',Q:'turquois',E:'hi',P:'ro',O:'al',N:'le',M:'de',L:'yello',F:'en',K:'ch',G:'arks',H:'ea',I:'ightg',J:'wh'};const names$1={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 unpack(){const unpacked={};const keys=Object.keys(names$1);const tkeys=Object.keys(map$2);let i,j,k,ok,nk;for(i=0;i>16&0xFF,k>>8&0xFF,k&0xFF];} return unpacked;} -let names$1;function nameParse(str){if(!names$1){names$1=unpack();names$1.transparent=[0,0,0,0];} -const a=names$1[str.toLowerCase()];return a&&{r:a[0],g:a[1],b:a[2],a:a.length===4?a[3]:255};} +let names;function nameParse(str){if(!names){names=unpack();names.transparent=[0,0,0,0];} +const a=names[str.toLowerCase()];return a&&{r:a[0],g:a[1],b:a[2],a:a.length===4?a[3]:255};} +const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(str){const m=RGB_RE.exec(str);let a=255;let r,g,b;if(!m){return;} +if(m[7]!==r){const v=+m[7];a=m[8]?p2b(v):lim(v*255,0,255);} +r=+m[1];g=+m[3];b=+m[5];r=255&(m[2]?p2b(r):lim(r,0,255));g=255&(m[4]?p2b(g):lim(g,0,255));b=255&(m[6]?p2b(b):lim(b,0,255));return{r:r,g:g,b:b,a:a};} +function rgbString(v){return v&&(v.a<255?`rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`:`rgb(${v.r}, ${v.g}, ${v.b})`);} +const to=v=>v<=0.0031308?v*12.92:Math.pow(v,1.0/2.4)*1.055-0.055;const from=v=>v<=0.04045?v/12.92:Math.pow((v+0.055)/1.055,2.4);function interpolate$1(rgb1,rgb2,t){const r=from(b2n(rgb1.r));const g=from(b2n(rgb1.g));const b=from(b2n(rgb1.b));return{r:n2b(to(r+t*(from(b2n(rgb2.r))-r))),g:n2b(to(g+t*(from(b2n(rgb2.g))-g))),b:n2b(to(b+t*(from(b2n(rgb2.b))-b))),a:rgb1.a+t*(rgb2.a-rgb1.a)};} function modHSL(v,i,ratio){if(v){let tmp=rgb2hsl(v);tmp[i]=Math.max(0,Math.min(tmp[i]+tmp[i]*ratio,i===0?360:1));tmp=hsl2rgb(tmp);v.r=tmp[0];v.g=tmp[1];v.b=tmp[2];}} function clone$1(v,proto){return v?Object.assign(proto||{},v):v;} function fromObject(input){var v={r:0,g:0,b:0,a:255};if(Array.isArray(input)){if(input.length>=3){v={r:input[0],g:input[1],b:input[2],a:255};if(input.length>3){v.a=n2b(input[3]);}}}else{v=clone$1(input,{r:0,g:0,b:0,a:1});v.a=n2b(v.a);} @@ -732,11 +735,13 @@ get valid(){return this._valid;} get rgb(){var v=clone$1(this._rgb);if(v){v.a=b2n(v.a);} return v;} set rgb(obj){this._rgb=fromObject(obj);} -rgbString(){return this._valid?rgbString(this._rgb):this._rgb;} -hexString(){return this._valid?hexString(this._rgb):this._rgb;} -hslString(){return this._valid?hslString(this._rgb):this._rgb;} -mix(color,weight){const me=this;if(color){const c1=me.rgb;const c2=color.rgb;let w2;const p=weight===w2?0.5:weight;const w=2*p-1;const a=c1.a-c2.a;const w1=((w*a===-1?w:(w+a)/(1+w*a))+1)/2.0;w2=1-w1;c1.r=0xFF&w1*c1.r+w2*c2.r+0.5;c1.g=0xFF&w1*c1.g+w2*c2.g+0.5;c1.b=0xFF&w1*c1.b+w2*c2.b+0.5;c1.a=p*c1.a+(1-p)*c2.a;me.rgb=c1;} -return me;} +rgbString(){return this._valid?rgbString(this._rgb):undefined;} +hexString(){return this._valid?hexString(this._rgb):undefined;} +hslString(){return this._valid?hslString(this._rgb):undefined;} +mix(color,weight){if(color){const c1=this.rgb;const c2=color.rgb;let w2;const p=weight===w2?0.5:weight;const w=2*p-1;const a=c1.a-c2.a;const w1=((w*a===-1?w:(w+a)/(1+w*a))+1)/2.0;w2=1-w1;c1.r=0xFF&w1*c1.r+w2*c2.r+0.5;c1.g=0xFF&w1*c1.g+w2*c2.g+0.5;c1.b=0xFF&w1*c1.b+w2*c2.b+0.5;c1.a=p*c1.a+(1-p)*c2.a;this.rgb=c1;} +return this;} +interpolate(color,t){if(color){this._rgb=interpolate$1(this._rgb,color._rgb,t);} +return this;} clone(){return new Color(this.rgb);} alpha(a){this._rgb.a=n2b(a);return this;} clearer(ratio){const rgb=this._rgb;rgb.a*=1-ratio;return this;} @@ -749,12 +754,14 @@ saturate(ratio){modHSL(this._rgb,1,ratio);return this;} desaturate(ratio){modHSL(this._rgb,1,-ratio);return this;} rotate(deg){rotate(this._rgb,deg);return this;}} function index_esm(input){return new Color(input);} -const isPatternOrGradient=(value)=>value instanceof CanvasGradient||value instanceof CanvasPattern;function color(value){return isPatternOrGradient(value)?value:index_esm(value);} +function isPatternOrGradient(value){if(value&&typeof value==='object'){const type=value.toString();return type==='[object CanvasPattern]'||type==='[object CanvasGradient]';} +return false;} +function color(value){return isPatternOrGradient(value)?value:index_esm(value);} function getHoverColor(value){return isPatternOrGradient(value)?value:index_esm(value).saturate(0.5).darken(0.1).hexString();} function noop(){} const uid=(function(){let id=0;return function(){return id++;};}());function isNullOrUndef(value){return value===null||typeof value==='undefined';} function isArray(value){if(Array.isArray&&Array.isArray(value)){return true;} -const type=Object.prototype.toString.call(value);if(type.substr(0,7)==='[object'&&type.substr(-6)==='Array]'){return true;} +const type=Object.prototype.toString.call(value);if(type.slice(0,7)==='[object'&&type.slice(-6)==='Array]'){return true;} return false;} function isObject(value){return value!==null&&Object.prototype.toString.call(value)==='[object Object]';} const isNumberFinite=(value)=>(typeof value==='number'||value instanceof Number)&&isFinite(+value);function finiteOrDefault(value,defaultValue){return isNumberFinite(value)?value:defaultValue;} @@ -781,7 +788,7 @@ const tval=target[key];const sval=source[key];if(isObject(tval)&&isObject(sval)) function _deprecated(scope,value,previous,current){if(value!==undefined){console.warn(scope+': "'+previous+'" is deprecated. Please use "'+current+'" instead');}} const emptyString='';const dot='.';function indexOfDotOrLength(key,start){const idx=key.indexOf(dot,start);return idx===-1?key.length:idx;} function resolveObjectKey(obj,key){if(key===emptyString){return obj;} -let pos=0;let idx=indexOfDotOrLength(key,pos);while(obj&&idx>pos){obj=obj[key.substr(pos,idx-pos)];pos=idx+1;idx=indexOfDotOrLength(key,pos);} +let pos=0;let idx=indexOfDotOrLength(key,pos);while(obj&&idx>pos){obj=obj[key.slice(pos,idx)];pos=idx+1;idx=indexOfDotOrLength(key,pos);} return obj;} function _capitalize(str){return str.charAt(0).toUpperCase()+str.slice(1);} const defined=(value)=>typeof value!=='undefined';const isFunction=(value)=>typeof value==='function';const setsEqual=(a,b)=>{if(a.size!==b.size){return false;} @@ -792,14 +799,28 @@ const keys=key.split('.');for(let i=0,n=keys.length;icontext.chart.platform.getDevicePixelRatio();this.elements={};this.events=['mousemove','mouseout','click','touchstart','touchmove'];this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:'normal',lineHeight:1.2,weight:null};this.hover={};this.hoverBackgroundColor=(ctx,options)=>getHoverColor(options.backgroundColor);this.hoverBorderColor=(ctx,options)=>getHoverColor(options.borderColor);this.hoverColor=(ctx,options)=>getHoverColor(options.color);this.indexAxis='x';this.interaction={mode:'nearest',intersect:true};this.maintainAspectRatio=true;this.onHover=null;this.onClick=null;this.parsing=true;this.plugins={};this.responsive=true;this.scale=undefined;this.scales={};this.showLine=true;this.drawActiveElementsOnTop=true;this.describe(_descriptors);} +class Defaults{constructor(_descriptors){this.animation=undefined;this.backgroundColor='rgba(0,0,0,0.1)';this.borderColor='rgba(0,0,0,0.1)';this.color='#666';this.datasets={};this.devicePixelRatio=(context)=>context.chart.platform.getDevicePixelRatio();this.elements={};this.events=['mousemove','mouseout','click','touchstart','touchmove'];this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:'normal',lineHeight:1.2,weight:null};this.hover={};this.hoverBackgroundColor=(ctx,options)=>getHoverColor(options.backgroundColor);this.hoverBorderColor=(ctx,options)=>getHoverColor(options.borderColor);this.hoverColor=(ctx,options)=>getHoverColor(options.color);this.indexAxis='x';this.interaction={mode:'nearest',intersect:true,includeInvisible:false};this.maintainAspectRatio=true;this.onHover=null;this.onClick=null;this.parsing=true;this.plugins={};this.responsive=true;this.scale=undefined;this.scales={};this.showLine=true;this.drawActiveElementsOnTop=true;this.describe(_descriptors);} set(scope,values){return set(this,scope,values);} get(scope){return getScope$1(this,scope);} describe(scope,values){return set(descriptors,scope,values);} override(scope,values){return set(overrides,scope,values);} route(scope,name,targetScope,targetName){const scopeObject=getScope$1(this,scope);const targetScopeObject=getScope$1(this,targetScope);const privateName='_'+name;Object.defineProperties(scopeObject,{[privateName]:{value:scopeObject[name],writable:true},[name]:{enumerable:true,get(){const local=this[privateName];const target=targetScopeObject[targetName];if(isObject(local)){return Object.assign({},target,local);} return valueOrDefault(local,target);},set(value){this[privateName]=value;}}});}} -var defaults=new Defaults({_scriptable:(name)=>!name.startsWith('on'),_indexable:(name)=>name!=='events',hover:{_fallback:'interaction'},interaction:{_scriptable:false,_indexable:false,}});const PI=Math.PI;const TAU=2*PI;const PITAU=TAU+PI;const INFINITY=Number.POSITIVE_INFINITY;const RAD_PER_DEG=PI/180;const HALF_PI=PI/2;const QUARTER_PI=PI/4;const TWO_THIRDS_PI=PI*2/3;const log10=Math.log10;const sign=Math.sign;function niceNum(range){const roundedRange=Math.round(range);range=almostEquals(range,roundedRange,range/1000)?roundedRange:range;const niceRange=Math.pow(10,Math.floor(log10(range)));const fraction=range/niceRange;const niceFraction=fraction<=1?1:fraction<=2?2:fraction<=5?5:10;return niceFraction*niceRange;} +var defaults=new Defaults({_scriptable:(name)=>!name.startsWith('on'),_indexable:(name)=>name!=='events',hover:{_fallback:'interaction'},interaction:{_scriptable:false,_indexable:false,}});function _lookup(table,value,cmp){cmp=cmp||((index)=>table[index]1){mid=(lo+hi)>>1;if(cmp(mid)){lo=mid;}else{hi=mid;}} +return{lo,hi};} +const _lookupByKey=(table,key,value)=>_lookup(table,value,index=>table[index][key]_lookup(table,value,index=>table[index][key]>=value);function _filterBetween(values,min,max){let start=0;let end=values.length;while(startstart&&values[end-1]>max){end--;} +return start>0||end{const method='_onData'+_capitalize(key);const base=array[key];Object.defineProperty(array,key,{configurable:true,enumerable:false,value(...args){const res=base.apply(this,args);array._chartjs.listeners.forEach((object)=>{if(typeof object[method]==='function'){object[method](...args);}});return res;}});});} +function unlistenArrayEvents(array,listener){const stub=array._chartjs;if(!stub){return;} +const listeners=stub.listeners;const index=listeners.indexOf(listener);if(index!==-1){listeners.splice(index,1);} +if(listeners.length>0){return;} +arrayEvents.forEach((key)=>{delete array[key];});delete array._chartjs;} +function _arrayUnique(items){const set=new Set();let i,ilen;for(i=0,ilen=items.length;ia-b).pop();return result;} @@ -821,6 +842,29 @@ function _angleBetween(angle,start,end,sameAngleIsFullCircle){const a=_normalize function _limitValue(value,min,max){return Math.max(min,Math.min(max,value));} function _int16Range(value){return _limitValue(value,-32768,32767);} function _isBetween(value,start,end,epsilon=1e-6){return value>=Math.min(start,end)-epsilon&&value<=Math.max(start,end)+epsilon;} +function _isDomSupported(){return typeof window!=='undefined'&&typeof document!=='undefined';} +function _getParentNode(domNode){let parent=domNode.parentNode;if(parent&&parent.toString()==='[object ShadowRoot]'){parent=parent.host;} +return parent;} +function parseMaxStyle(styleValue,node,parentProperty){let valueInPixels;if(typeof styleValue==='string'){valueInPixels=parseInt(styleValue,10);if(styleValue.indexOf('%')!==-1){valueInPixels=valueInPixels/100*node.parentNode[parentProperty];}}else{valueInPixels=styleValue;} +return valueInPixels;} +const getComputedStyle=(element)=>window.getComputedStyle(element,null);function getStyle(el,property){return getComputedStyle(el).getPropertyValue(property);} +const positions=['top','right','bottom','left'];function getPositionedStyle(styles,style,suffix){const result={};suffix=suffix?'-'+suffix:'';for(let i=0;i<4;i++){const pos=positions[i];result[pos]=parseFloat(styles[style+'-'+pos+suffix])||0;} +result.width=result.left+result.right;result.height=result.top+result.bottom;return result;} +const useOffsetPos=(x,y,target)=>(x>0||y>0)&&(!target||!target.shadowRoot);function getCanvasPosition(e,canvas){const touches=e.touches;const source=touches&&touches.length?touches[0]:e;const{offsetX,offsetY}=source;let box=false;let x,y;if(useOffsetPos(offsetX,offsetY,e.target)){x=offsetX;y=offsetY;}else{const rect=canvas.getBoundingClientRect();x=source.clientX-rect.left;y=source.clientY-rect.top;box=true;} +return{x,y,box};} +function getRelativePosition(evt,chart){if('native'in evt){return evt;} +const{canvas,currentDevicePixelRatio}=chart;const style=getComputedStyle(canvas);const borderBox=style.boxSizing==='border-box';const paddings=getPositionedStyle(style,'padding');const borders=getPositionedStyle(style,'border','width');const{x,y,box}=getCanvasPosition(evt,canvas);const xOffset=paddings.left+(box&&borders.left);const yOffset=paddings.top+(box&&borders.top);let{width,height}=chart;if(borderBox){width-=paddings.width+borders.width;height-=paddings.height+borders.height;} +return{x:Math.round((x-xOffset)/width*canvas.width/currentDevicePixelRatio),y:Math.round((y-yOffset)/height*canvas.height/currentDevicePixelRatio)};} +function getContainerSize(canvas,width,height){let maxWidth,maxHeight;if(width===undefined||height===undefined){const container=_getParentNode(canvas);if(!container){width=canvas.clientWidth;height=canvas.clientHeight;}else{const rect=container.getBoundingClientRect();const containerStyle=getComputedStyle(container);const containerBorder=getPositionedStyle(containerStyle,'border','width');const containerPadding=getPositionedStyle(containerStyle,'padding');width=rect.width-containerPadding.width-containerBorder.width;height=rect.height-containerPadding.height-containerBorder.height;maxWidth=parseMaxStyle(containerStyle.maxWidth,container,'clientWidth');maxHeight=parseMaxStyle(containerStyle.maxHeight,container,'clientHeight');}} +return{width,height,maxWidth:maxWidth||INFINITY,maxHeight:maxHeight||INFINITY};} +const round1=v=>Math.round(v*10)/10;function getMaximumSize(canvas,bbWidth,bbHeight,aspectRatio){const style=getComputedStyle(canvas);const margins=getPositionedStyle(style,'margin');const maxWidth=parseMaxStyle(style.maxWidth,canvas,'clientWidth')||INFINITY;const maxHeight=parseMaxStyle(style.maxHeight,canvas,'clientHeight')||INFINITY;const containerSize=getContainerSize(canvas,bbWidth,bbHeight);let{width,height}=containerSize;if(style.boxSizing==='content-box'){const borders=getPositionedStyle(style,'border','width');const paddings=getPositionedStyle(style,'padding');width-=paddings.width+borders.width;height-=paddings.height+borders.height;} +width=Math.max(0,width-margins.width);height=Math.max(0,aspectRatio?Math.floor(width/aspectRatio):height-margins.height);width=round1(Math.min(width,maxWidth,containerSize.maxWidth));height=round1(Math.min(height,maxHeight,containerSize.maxHeight));if(width&&!height){height=round1(width/2);} +return{width,height};} +function retinaScale(chart,forceRatio,forceStyle){const pixelRatio=forceRatio||1;const deviceHeight=Math.floor(chart.height*pixelRatio);const deviceWidth=Math.floor(chart.width*pixelRatio);chart.height=deviceHeight/pixelRatio;chart.width=deviceWidth/pixelRatio;const canvas=chart.canvas;if(canvas.style&&(forceStyle||(!canvas.style.height&&!canvas.style.width))){canvas.style.height=`${chart.height}px`;canvas.style.width=`${chart.width}px`;} +if(chart.currentDevicePixelRatio!==pixelRatio||canvas.height!==deviceHeight||canvas.width!==deviceWidth){chart.currentDevicePixelRatio=pixelRatio;canvas.height=deviceHeight;canvas.width=deviceWidth;chart.ctx.setTransform(pixelRatio,0,0,pixelRatio,0,0);return true;} +return false;} +const supportsEventListenerOptions=(function(){let passiveSupported=false;try{const options={get passive(){passiveSupported=true;return false;}};window.addEventListener('test',null,options);window.removeEventListener('test',null,options);}catch(e){} +return passiveSupported;}());function readUsedSize(element,property){const value=getStyle(element,property);const matches=value&&value.match(/^(\d+)(\.\d+)?px$/);return matches?+matches[1]:undefined;} function toFontString(font){if(!font||isNullOrUndef(font.size)||isNullOrUndef(font.family)){return null;} return(font.style?font.style+' ':'') +(font.weight?font.weight+' ':'') @@ -861,116 +905,7 @@ if(opts.textAlign){ctx.textAlign=opts.textAlign;} if(opts.textBaseline){ctx.textBaseline=opts.textBaseline;}} function decorateText(ctx,x,y,line,opts){if(opts.strikethrough||opts.underline){const metrics=ctx.measureText(line);const left=x-metrics.actualBoundingBoxLeft;const right=x+metrics.actualBoundingBoxRight;const top=y-metrics.actualBoundingBoxAscent;const bottom=y+metrics.actualBoundingBoxDescent;const yDecoration=opts.strikethrough?(top+bottom)/2:bottom;ctx.strokeStyle=ctx.fillStyle;ctx.beginPath();ctx.lineWidth=opts.decorationWidth||2;ctx.moveTo(left,yDecoration);ctx.lineTo(right,yDecoration);ctx.stroke();}} function addRoundedRectPath(ctx,rect){const{x,y,w,h,radius}=rect;ctx.arc(x+radius.topLeft,y+radius.topLeft,radius.topLeft,-HALF_PI,PI,true);ctx.lineTo(x,y+h-radius.bottomLeft);ctx.arc(x+radius.bottomLeft,y+h-radius.bottomLeft,radius.bottomLeft,PI,HALF_PI,true);ctx.lineTo(x+w-radius.bottomRight,y+h);ctx.arc(x+w-radius.bottomRight,y+h-radius.bottomRight,radius.bottomRight,HALF_PI,0,true);ctx.lineTo(x+w,y+radius.topRight);ctx.arc(x+w-radius.topRight,y+radius.topRight,radius.topRight,0,-HALF_PI,true);ctx.lineTo(x+radius.topLeft,y);} -function _lookup(table,value,cmp){cmp=cmp||((index)=>table[index]1){mid=(lo+hi)>>1;if(cmp(mid)){lo=mid;}else{hi=mid;}} -return{lo,hi};} -const _lookupByKey=(table,key,value)=>_lookup(table,value,index=>table[index][key]_lookup(table,value,index=>table[index][key]>=value);function _filterBetween(values,min,max){let start=0;let end=values.length;while(startstart&&values[end-1]>max){end--;} -return start>0||end{const method='_onData'+_capitalize(key);const base=array[key];Object.defineProperty(array,key,{configurable:true,enumerable:false,value(...args){const res=base.apply(this,args);array._chartjs.listeners.forEach((object)=>{if(typeof object[method]==='function'){object[method](...args);}});return res;}});});} -function unlistenArrayEvents(array,listener){const stub=array._chartjs;if(!stub){return;} -const listeners=stub.listeners;const index=listeners.indexOf(listener);if(index!==-1){listeners.splice(index,1);} -if(listeners.length>0){return;} -arrayEvents.forEach((key)=>{delete array[key];});delete array._chartjs;} -function _arrayUnique(items){const set=new Set();let i,ilen;for(i=0,ilen=items.length;iwindow.getComputedStyle(element,null);function getStyle(el,property){return getComputedStyle(el).getPropertyValue(property);} -const positions=['top','right','bottom','left'];function getPositionedStyle(styles,style,suffix){const result={};suffix=suffix?'-'+suffix:'';for(let i=0;i<4;i++){const pos=positions[i];result[pos]=parseFloat(styles[style+'-'+pos+suffix])||0;} -result.width=result.left+result.right;result.height=result.top+result.bottom;return result;} -const useOffsetPos=(x,y,target)=>(x>0||y>0)&&(!target||!target.shadowRoot);function getCanvasPosition(evt,canvas){const e=evt.native||evt;const touches=e.touches;const source=touches&&touches.length?touches[0]:e;const{offsetX,offsetY}=source;let box=false;let x,y;if(useOffsetPos(offsetX,offsetY,e.target)){x=offsetX;y=offsetY;}else{const rect=canvas.getBoundingClientRect();x=source.clientX-rect.left;y=source.clientY-rect.top;box=true;} -return{x,y,box};} -function getRelativePosition$1(evt,chart){const{canvas,currentDevicePixelRatio}=chart;const style=getComputedStyle(canvas);const borderBox=style.boxSizing==='border-box';const paddings=getPositionedStyle(style,'padding');const borders=getPositionedStyle(style,'border','width');const{x,y,box}=getCanvasPosition(evt,canvas);const xOffset=paddings.left+(box&&borders.left);const yOffset=paddings.top+(box&&borders.top);let{width,height}=chart;if(borderBox){width-=paddings.width+borders.width;height-=paddings.height+borders.height;} -return{x:Math.round((x-xOffset)/width*canvas.width/currentDevicePixelRatio),y:Math.round((y-yOffset)/height*canvas.height/currentDevicePixelRatio)};} -function getContainerSize(canvas,width,height){let maxWidth,maxHeight;if(width===undefined||height===undefined){const container=_getParentNode(canvas);if(!container){width=canvas.clientWidth;height=canvas.clientHeight;}else{const rect=container.getBoundingClientRect();const containerStyle=getComputedStyle(container);const containerBorder=getPositionedStyle(containerStyle,'border','width');const containerPadding=getPositionedStyle(containerStyle,'padding');width=rect.width-containerPadding.width-containerBorder.width;height=rect.height-containerPadding.height-containerBorder.height;maxWidth=parseMaxStyle(containerStyle.maxWidth,container,'clientWidth');maxHeight=parseMaxStyle(containerStyle.maxHeight,container,'clientHeight');}} -return{width,height,maxWidth:maxWidth||INFINITY,maxHeight:maxHeight||INFINITY};} -const round1=v=>Math.round(v*10)/10;function getMaximumSize(canvas,bbWidth,bbHeight,aspectRatio){const style=getComputedStyle(canvas);const margins=getPositionedStyle(style,'margin');const maxWidth=parseMaxStyle(style.maxWidth,canvas,'clientWidth')||INFINITY;const maxHeight=parseMaxStyle(style.maxHeight,canvas,'clientHeight')||INFINITY;const containerSize=getContainerSize(canvas,bbWidth,bbHeight);let{width,height}=containerSize;if(style.boxSizing==='content-box'){const borders=getPositionedStyle(style,'border','width');const paddings=getPositionedStyle(style,'padding');width-=paddings.width+borders.width;height-=paddings.height+borders.height;} -width=Math.max(0,width-margins.width);height=Math.max(0,aspectRatio?Math.floor(width/aspectRatio):height-margins.height);width=round1(Math.min(width,maxWidth,containerSize.maxWidth));height=round1(Math.min(height,maxHeight,containerSize.maxHeight));if(width&&!height){height=round1(width/2);} -return{width,height};} -function retinaScale(chart,forceRatio,forceStyle){const pixelRatio=forceRatio||1;const deviceHeight=Math.floor(chart.height*pixelRatio);const deviceWidth=Math.floor(chart.width*pixelRatio);chart.height=deviceHeight/pixelRatio;chart.width=deviceWidth/pixelRatio;const canvas=chart.canvas;if(canvas.style&&(forceStyle||(!canvas.style.height&&!canvas.style.width))){canvas.style.height=`${chart.height}px`;canvas.style.width=`${chart.width}px`;} -if(chart.currentDevicePixelRatio!==pixelRatio||canvas.height!==deviceHeight||canvas.width!==deviceWidth){chart.currentDevicePixelRatio=pixelRatio;canvas.height=deviceHeight;canvas.width=deviceWidth;chart.ctx.setTransform(pixelRatio,0,0,pixelRatio,0,0);return true;} -return false;} -const supportsEventListenerOptions=(function(){let passiveSupported=false;try{const options={get passive(){passiveSupported=true;return false;}};window.addEventListener('test',null,options);window.removeEventListener('test',null,options);}catch(e){} -return passiveSupported;}());function readUsedSize(element,property){const value=getStyle(element,property);const matches=value&&value.match(/^(\d+)(\.\d+)?px$/);return matches?+matches[1]:undefined;} -function getRelativePosition(e,chart){if('native'in e){return{x:e.x,y:e.y};} -return getRelativePosition$1(e,chart);} -function evaluateAllVisibleItems(chart,handler){const metasets=chart.getSortedVisibleDatasetMetas();let index,data,element;for(let i=0,ilen=metasets.length;i{if(element[rangeMethod](position[axis],useFinalPosition)){items.push({element,datasetIndex,index});} -if(element.inRange(position.x,position.y,useFinalPosition)){intersectsItem=true;}});if(options.intersect&&!intersectsItem){return[];} -return items;} -var Interaction={modes:{index(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'x';const items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition):getNearestItems(chart,position,axis,false,useFinalPosition);const elements=[];if(!items.length){return[];} -chart.getSortedVisibleDatasetMetas().forEach((meta)=>{const index=items[0].index;const element=meta.data[index];if(element&&!element.skip){elements.push({element,datasetIndex:meta.index,index});}});return elements;},dataset(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'xy';let items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition):getNearestItems(chart,position,axis,false,useFinalPosition);if(items.length>0){const datasetIndex=items[0].datasetIndex;const data=chart.getDatasetMeta(datasetIndex).data;items=[];for(let i=0;i+v||0;function _readValueToProps(value,props){const ret={};const objProps=isObject(props);const keys=objProps?Object.keys(props):props;const read=isObject(value)?objProps?prop=>valueOrDefault(value[prop],value[props[prop]]):prop=>value[prop]:()=>value;for(const prop of keys){ret[prop]=numberOrZero(read(prop));} -return ret;} -function toTRBL(value){return _readValueToProps(value,{top:'y',right:'x',bottom:'y',left:'x'});} -function toTRBLCorners(value){return _readValueToProps(value,['topLeft','topRight','bottomLeft','bottomRight']);} -function toPadding(value){const obj=toTRBL(value);obj.width=obj.left+obj.right;obj.height=obj.top+obj.bottom;return obj;} -function toFont(options,fallback){options=options||{};fallback=fallback||defaults.font;let size=valueOrDefault(options.size,fallback.size);if(typeof size==='string'){size=parseInt(size,10);} -let style=valueOrDefault(options.style,fallback.style);if(style&&!(''+style).match(FONT_STYLE)){console.warn('Invalid font style specified: "'+style+'"');style='';} -const font={family:valueOrDefault(options.family,fallback.family),lineHeight:toLineHeight(valueOrDefault(options.lineHeight,fallback.lineHeight),size),size,style,weight:valueOrDefault(options.weight,fallback.weight),string:''};font.string=toFontString(font);return font;} -function resolve(inputs,context,index,info){let cacheable=true;let i,ilen,value;for(i=0,ilen=inputs.length;ibeginAtZero&&value===0?0:value+add;return{min:keepZero(min,-Math.abs(change)),max:keepZero(max,change)};} -function createContext(parentContext,context){return Object.assign(Object.create(parentContext),context);} -const STATIC_POSITIONS=['left','top','right','bottom'];function filterByPosition(array,position){return array.filter(v=>v.pos===position);} -function filterDynamicPositionByAxis(array,axis){return array.filter(v=>STATIC_POSITIONS.indexOf(v.pos)===-1&&v.box.axis===axis);} -function sortByWeight(array,reverse){return array.sort((a,b)=>{const v0=reverse?b:a;const v1=reverse?a:b;return v0.weight===v1.weight?v0.index-v1.index:v0.weight-v1.weight;});} -function wrapBoxes(boxes){const layoutBoxes=[];let i,ilen,box,pos,stack,stackWeight;for(i=0,ilen=(boxes||[]).length;iwrap.box.fullSize),true);const left=sortByWeight(filterByPosition(layoutBoxes,'left'),true);const right=sortByWeight(filterByPosition(layoutBoxes,'right'));const top=sortByWeight(filterByPosition(layoutBoxes,'top'),true);const bottom=sortByWeight(filterByPosition(layoutBoxes,'bottom'));const centerHorizontal=filterDynamicPositionByAxis(layoutBoxes,'x');const centerVertical=filterDynamicPositionByAxis(layoutBoxes,'y');return{fullSize,leftAndTop:left.concat(top),rightAndBottom:right.concat(centerVertical).concat(bottom).concat(centerHorizontal),chartArea:filterByPosition(layoutBoxes,'chartArea'),vertical:left.concat(right).concat(centerVertical),horizontal:top.concat(bottom).concat(centerHorizontal)};} -function getCombinedMax(maxPadding,chartArea,a,b){return Math.max(maxPadding[a],chartArea[a])+Math.max(maxPadding[b],chartArea[b]);} -function updateMaxPadding(maxPadding,boxPadding){maxPadding.top=Math.max(maxPadding.top,boxPadding.top);maxPadding.left=Math.max(maxPadding.left,boxPadding.left);maxPadding.bottom=Math.max(maxPadding.bottom,boxPadding.bottom);maxPadding.right=Math.max(maxPadding.right,boxPadding.right);} -function updateDims(chartArea,params,layout,stacks){const{pos,box}=layout;const maxPadding=chartArea.maxPadding;if(!isObject(pos)){if(layout.size){chartArea[pos]-=layout.size;} -const stack=stacks[layout.stack]||{size:0,count:1};stack.size=Math.max(stack.size,layout.horizontal?box.height:box.width);layout.size=stack.size/stack.count;chartArea[pos]+=layout.size;} -if(box.getPadding){updateMaxPadding(maxPadding,box.getPadding());} -const newWidth=Math.max(0,params.outerWidth-getCombinedMax(maxPadding,chartArea,'left','right'));const newHeight=Math.max(0,params.outerHeight-getCombinedMax(maxPadding,chartArea,'top','bottom'));const widthChanged=newWidth!==chartArea.w;const heightChanged=newHeight!==chartArea.h;chartArea.w=newWidth;chartArea.h=newHeight;return layout.horizontal?{same:widthChanged,other:heightChanged}:{same:heightChanged,other:widthChanged};} -function handleMaxPadding(chartArea){const maxPadding=chartArea.maxPadding;function updatePos(pos){const change=Math.max(maxPadding[pos]-chartArea[pos],0);chartArea[pos]+=change;return change;} -chartArea.y+=updatePos('top');chartArea.x+=updatePos('left');updatePos('right');updatePos('bottom');} -function getMargins(horizontal,chartArea){const maxPadding=chartArea.maxPadding;function marginForPositions(positions){const margin={left:0,top:0,right:0,bottom:0};positions.forEach((pos)=>{margin[pos]=Math.max(chartArea[pos],maxPadding[pos]);});return margin;} -return horizontal?marginForPositions(['left','right']):marginForPositions(['top','bottom']);} -function fitBoxes(boxes,chartArea,params,stacks){const refitBoxes=[];let i,ilen,layout,box,refit,changed;for(i=0,ilen=boxes.length,refit=0;i{if(typeof box.beforeLayout==='function'){box.beforeLayout();}});const visibleVerticalBoxCount=verticalBoxes.reduce((total,wrap)=>wrap.box.options&&wrap.box.options.display===false?total:total+1,0)||1;const params=Object.freeze({outerWidth:width,outerHeight:height,padding,availableWidth,availableHeight,vBoxMaxWidth:availableWidth/2/visibleVerticalBoxCount,hBoxMaxHeight:availableHeight/2});const maxPadding=Object.assign({},padding);updateMaxPadding(maxPadding,toPadding(minPadding));const chartArea=Object.assign({maxPadding,w:availableWidth,h:availableHeight,x:padding.left,y:padding.top},padding);const stacks=setLayoutDims(verticalBoxes.concat(horizontalBoxes),params);fitBoxes(boxes.fullSize,chartArea,params,stacks);fitBoxes(verticalBoxes,chartArea,params,stacks);if(fitBoxes(horizontalBoxes,chartArea,params,stacks)){fitBoxes(verticalBoxes,chartArea,params,stacks);} -handleMaxPadding(chartArea);placeBoxes(boxes.leftAndTop,chartArea,params,stacks);chartArea.x+=chartArea.w;chartArea.y+=chartArea.h;placeBoxes(boxes.rightAndBottom,chartArea,params,stacks);chart.chartArea={left:chartArea.left,top:chartArea.top,right:chartArea.left+chartArea.w,bottom:chartArea.top+chartArea.h,height:chartArea.h,width:chartArea.w,};each(boxes.chartArea,(layout)=>{const box=layout.box;Object.assign(box,chart.chartArea);box.update(chartArea.w,chartArea.h,{left:0,top:0,right:0,bottom:0});});}};function _createResolver(scopes,prefixes=[''],rootScopes=scopes,fallback,getTarget=()=>scopes[0]){if(!defined(fallback)){fallback=_resolve('_fallback',scopes);} +function _createResolver(scopes,prefixes=[''],rootScopes=scopes,fallback,getTarget=()=>scopes[0]){if(!defined(fallback)){fallback=_resolve('_fallback',scopes);} const cache={[Symbol.toStringTag]:'Object',_cacheable:true,_scopes:scopes,_rootScopes:rootScopes,_fallback:fallback,_getTarget:getTarget,override:(scope)=>_createResolver([scope,...scopes],prefixes,rootScopes,fallback),};return new Proxy(cache,{deleteProperty(target,prop){delete target[prop];delete target._keys;delete scopes[0][prop];return true;},get(target,prop){return _cached(target,prop,()=>_resolveWithPrefixes(prop,prefixes,scopes,target));},getOwnPropertyDescriptor(target,prop){return Reflect.getOwnPropertyDescriptor(target._scopes[0],prop);},getPrototypeOf(){return Reflect.getPrototypeOf(scopes[0]);},has(target,prop){return getKeysFromAllScopes(target).includes(prop);},ownKeys(target){return getKeysFromAllScopes(target);},set(target,prop,value){const storage=target._storage||(target._storage=getTarget());target[prop]=storage[prop]=value;delete target._keys;return true;}});} function _attachContext(proxy,context,subProxy,descriptorDefaults){const cache={_cacheable:false,_proxy:proxy,_context:context,_subProxy:subProxy,_stack:new Set(),_descriptors:_descriptors(proxy,descriptorDefaults),setContext:(ctx)=>_attachContext(proxy,ctx,subProxy,descriptorDefaults),override:(scope)=>_attachContext(proxy.override(scope),context,subProxy,descriptorDefaults)};return new Proxy(cache,{deleteProperty(target,prop){delete target[prop];delete proxy[prop];return true;},get(target,prop,receiver){return _cached(target,prop,()=>_resolveWithContext(target,prop,receiver));},getOwnPropertyDescriptor(target,prop){return target._descriptors.allKeys?Reflect.has(proxy,prop)?{enumerable:true,configurable:true}:undefined:Reflect.getOwnPropertyDescriptor(proxy,prop);},getPrototypeOf(){return Reflect.getPrototypeOf(proxy);},has(target,prop){return Reflect.has(proxy,prop);},ownKeys(){return Reflect.ownKeys(proxy);},set(target,prop,value){proxy[prop]=value;delete target[prop];return true;}});} function _descriptors(proxy,defaults={scriptable:true,indexable:true}){const{_scriptable=defaults.scriptable,_indexable=defaults.indexable,_allKeys=defaults.allKeys}=proxy;return{allKeys:_allKeys,scriptable:_scriptable,indexable:_indexable,isScriptable:isFunction(_scriptable)?_scriptable:()=>_scriptable,isIndexable:isFunction(_indexable)?_indexable:()=>_indexable};} @@ -1003,6 +938,8 @@ function getKeysFromAllScopes(target){let keys=target._keys;if(!keys){keys=targe return keys;} function resolveKeysFromAllScopes(scopes){const set=new Set();for(const scope of scopes){for(const key of Object.keys(scope).filter(k=>!k.startsWith('_'))){set.add(key);}} return Array.from(set);} +function _parseObjectDataRadialScale(meta,data,start,count){const{iScale}=meta;const{key='r'}=this._parsing;const parsed=new Array(count);let i,ilen,index,item;for(i=0,ilen=count;iiindexAxis==='x'?'y':'x';function splineCurve(firstPoint,middlePoint,afterPoint,t){const previous=firstPoint.skip?middlePoint:firstPoint;const current=middlePoint;const next=afterPoint.skip?middlePoint:afterPoint;const d01=distanceBetweenPoints(current,previous);const d12=distanceBetweenPoints(next,current);let s01=d01/(d01+d12);let s12=d12/(d01+d12);s01=isNaN(s01)?0:s01;s12=isNaN(s12)?0:s12;const fa=t*s01;const fb=t*s12;return{previous:{x:current.x-fa*(next.x-previous.x),y:current.y-fa*(next.y-previous.y)},next:{x:current.x+fb*(next.x-previous.x),y:current.y+fb*(next.y-previous.y)}};} function monotoneAdjust(points,deltaK,mK){const pointsLen=points.length;let alphaK,betaK,tauK,squaredMagnitude,pointCurrent;let pointAfter=getPoint(points,0);for(let i=0;i+v||0;function _readValueToProps(value,props){const ret={};const objProps=isObject(props);const keys=objProps?Object.keys(props):props;const read=isObject(value)?objProps?prop=>valueOrDefault(value[prop],value[props[prop]]):prop=>value[prop]:()=>value;for(const prop of keys){ret[prop]=numberOrZero(read(prop));} +return ret;} +function toTRBL(value){return _readValueToProps(value,{top:'y',right:'x',bottom:'y',left:'x'});} +function toTRBLCorners(value){return _readValueToProps(value,['topLeft','topRight','bottomLeft','bottomRight']);} +function toPadding(value){const obj=toTRBL(value);obj.width=obj.left+obj.right;obj.height=obj.top+obj.bottom;return obj;} +function toFont(options,fallback){options=options||{};fallback=fallback||defaults.font;let size=valueOrDefault(options.size,fallback.size);if(typeof size==='string'){size=parseInt(size,10);} +let style=valueOrDefault(options.style,fallback.style);if(style&&!(''+style).match(FONT_STYLE)){console.warn('Invalid font style specified: "'+style+'"');style='';} +const font={family:valueOrDefault(options.family,fallback.family),lineHeight:toLineHeight(valueOrDefault(options.lineHeight,fallback.lineHeight),size),size,style,weight:valueOrDefault(options.weight,fallback.weight),string:''};font.string=toFontString(font);return font;} +function resolve(inputs,context,index,info){let cacheable=true;let i,ilen,value;for(i=0,ilen=inputs.length;ibeginAtZero&&value===0?0:value+add;return{min:keepZero(min,-Math.abs(change)),max:keepZero(max,change)};} +function createContext(parentContext,context){return Object.assign(Object.create(parentContext),context);} const getRightToLeftAdapter=function(rectX,width){return{x(x){return rectX+rectX+width-x;},setWidth(w){width=w;},textAlign(align){if(align==='center'){return align;} return align==='right'?'left':'right';},xPlus(x,value){return x-value;},leftForLtr(x,itemWidth){return x-itemWidth;},};};const getLeftToRightAdapter=function(){return{x(x){return x;},setWidth(w){},textAlign(align){return align;},xPlus(x,value){return x+value;},leftForLtr(x,_itemWidth){return x;},};};function getRtlAdapter(rtl,rectX,width){return rtl?getRightToLeftAdapter(rectX,width):getLeftToRightAdapter();} function overrideTextDirection(ctx,direction){let style,original;if(direction==='ltr'||direction==='rtl'){style=ctx.canvas.style;original=[style.getPropertyValue('direction'),style.getPropertyPriority('direction'),];style.setProperty('direction',direction,'important');ctx.prevTextDirection=original;}} @@ -1078,7 +1033,59 @@ if(start{if(element[rangeMethod](position[axis],useFinalPosition)){items.push({element,datasetIndex,index});intersectsItem=intersectsItem||element.inRange(position.x,position.y,useFinalPosition);}});if(intersect&&!intersectsItem){return[];} +return items;} +var Interaction={evaluateInteractionItems,modes:{index(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'x';const includeInvisible=options.includeInvisible||false;const items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition,includeInvisible):getNearestItems(chart,position,axis,false,useFinalPosition,includeInvisible);const elements=[];if(!items.length){return[];} +chart.getSortedVisibleDatasetMetas().forEach((meta)=>{const index=items[0].index;const element=meta.data[index];if(element&&!element.skip){elements.push({element,datasetIndex:meta.index,index});}});return elements;},dataset(chart,e,options,useFinalPosition){const position=getRelativePosition(e,chart);const axis=options.axis||'xy';const includeInvisible=options.includeInvisible||false;let items=options.intersect?getIntersectItems(chart,position,axis,useFinalPosition,includeInvisible):getNearestItems(chart,position,axis,false,useFinalPosition,includeInvisible);if(items.length>0){const datasetIndex=items[0].datasetIndex;const data=chart.getDatasetMeta(datasetIndex).data;items=[];for(let i=0;iv.pos===position);} +function filterDynamicPositionByAxis(array,axis){return array.filter(v=>STATIC_POSITIONS.indexOf(v.pos)===-1&&v.box.axis===axis);} +function sortByWeight(array,reverse){return array.sort((a,b)=>{const v0=reverse?b:a;const v1=reverse?a:b;return v0.weight===v1.weight?v0.index-v1.index:v0.weight-v1.weight;});} +function wrapBoxes(boxes){const layoutBoxes=[];let i,ilen,box,pos,stack,stackWeight;for(i=0,ilen=(boxes||[]).length;iwrap.box.fullSize),true);const left=sortByWeight(filterByPosition(layoutBoxes,'left'),true);const right=sortByWeight(filterByPosition(layoutBoxes,'right'));const top=sortByWeight(filterByPosition(layoutBoxes,'top'),true);const bottom=sortByWeight(filterByPosition(layoutBoxes,'bottom'));const centerHorizontal=filterDynamicPositionByAxis(layoutBoxes,'x');const centerVertical=filterDynamicPositionByAxis(layoutBoxes,'y');return{fullSize,leftAndTop:left.concat(top),rightAndBottom:right.concat(centerVertical).concat(bottom).concat(centerHorizontal),chartArea:filterByPosition(layoutBoxes,'chartArea'),vertical:left.concat(right).concat(centerVertical),horizontal:top.concat(bottom).concat(centerHorizontal)};} +function getCombinedMax(maxPadding,chartArea,a,b){return Math.max(maxPadding[a],chartArea[a])+Math.max(maxPadding[b],chartArea[b]);} +function updateMaxPadding(maxPadding,boxPadding){maxPadding.top=Math.max(maxPadding.top,boxPadding.top);maxPadding.left=Math.max(maxPadding.left,boxPadding.left);maxPadding.bottom=Math.max(maxPadding.bottom,boxPadding.bottom);maxPadding.right=Math.max(maxPadding.right,boxPadding.right);} +function updateDims(chartArea,params,layout,stacks){const{pos,box}=layout;const maxPadding=chartArea.maxPadding;if(!isObject(pos)){if(layout.size){chartArea[pos]-=layout.size;} +const stack=stacks[layout.stack]||{size:0,count:1};stack.size=Math.max(stack.size,layout.horizontal?box.height:box.width);layout.size=stack.size/stack.count;chartArea[pos]+=layout.size;} +if(box.getPadding){updateMaxPadding(maxPadding,box.getPadding());} +const newWidth=Math.max(0,params.outerWidth-getCombinedMax(maxPadding,chartArea,'left','right'));const newHeight=Math.max(0,params.outerHeight-getCombinedMax(maxPadding,chartArea,'top','bottom'));const widthChanged=newWidth!==chartArea.w;const heightChanged=newHeight!==chartArea.h;chartArea.w=newWidth;chartArea.h=newHeight;return layout.horizontal?{same:widthChanged,other:heightChanged}:{same:heightChanged,other:widthChanged};} +function handleMaxPadding(chartArea){const maxPadding=chartArea.maxPadding;function updatePos(pos){const change=Math.max(maxPadding[pos]-chartArea[pos],0);chartArea[pos]+=change;return change;} +chartArea.y+=updatePos('top');chartArea.x+=updatePos('left');updatePos('right');updatePos('bottom');} +function getMargins(horizontal,chartArea){const maxPadding=chartArea.maxPadding;function marginForPositions(positions){const margin={left:0,top:0,right:0,bottom:0};positions.forEach((pos)=>{margin[pos]=Math.max(chartArea[pos],maxPadding[pos]);});return margin;} +return horizontal?marginForPositions(['left','right']):marginForPositions(['top','bottom']);} +function fitBoxes(boxes,chartArea,params,stacks){const refitBoxes=[];let i,ilen,layout,box,refit,changed;for(i=0,ilen=boxes.length,refit=0;i{if(typeof box.beforeLayout==='function'){box.beforeLayout();}});const visibleVerticalBoxCount=verticalBoxes.reduce((total,wrap)=>wrap.box.options&&wrap.box.options.display===false?total:total+1,0)||1;const params=Object.freeze({outerWidth:width,outerHeight:height,padding,availableWidth,availableHeight,vBoxMaxWidth:availableWidth/2/visibleVerticalBoxCount,hBoxMaxHeight:availableHeight/2});const maxPadding=Object.assign({},padding);updateMaxPadding(maxPadding,toPadding(minPadding));const chartArea=Object.assign({maxPadding,w:availableWidth,h:availableHeight,x:padding.left,y:padding.top},padding);const stacks=setLayoutDims(verticalBoxes.concat(horizontalBoxes),params);fitBoxes(boxes.fullSize,chartArea,params,stacks);fitBoxes(verticalBoxes,chartArea,params,stacks);if(fitBoxes(horizontalBoxes,chartArea,params,stacks)){fitBoxes(verticalBoxes,chartArea,params,stacks);} +handleMaxPadding(chartArea);placeBoxes(boxes.leftAndTop,chartArea,params,stacks);chartArea.x+=chartArea.w;chartArea.y+=chartArea.h;placeBoxes(boxes.rightAndBottom,chartArea,params,stacks);chart.chartArea={left:chartArea.left,top:chartArea.top,right:chartArea.left+chartArea.w,bottom:chartArea.top+chartArea.h,height:chartArea.h,width:chartArea.w,};each(boxes.chartArea,(layout)=>{const box=layout.box;Object.assign(box,chart.chartArea);box.update(chartArea.w,chartArea.h,{left:0,top:0,right:0,bottom:0});});}};class BasePlatform{acquireContext(canvas,aspectRatio){} releaseContext(context){return false;} addEventListener(chart,type,listener){} removeEventListener(chart,type,listener){} @@ -1093,7 +1100,7 @@ if(isNullOrEmpty(renderHeight)){if(canvas.style.height===''){canvas.height=canva return canvas;} const eventListenerOptions=supportsEventListenerOptions?{passive:true}:false;function addListener(node,type,listener){node.addEventListener(type,listener,eventListenerOptions);} function removeListener(chart,type,listener){chart.canvas.removeEventListener(type,listener,eventListenerOptions);} -function fromNativeEvent(event,chart){const type=EVENT_TYPES[event.type]||event.type;const{x,y}=getRelativePosition$1(event,chart);return{type,chart,native:event,x:x!==undefined?x:null,y:y!==undefined?y:null,};} +function fromNativeEvent(event,chart){const type=EVENT_TYPES[event.type]||event.type;const{x,y}=getRelativePosition(event,chart);return{type,chart,native:event,x:x!==undefined?x:null,y:y!==undefined?y:null,};} function nodeListContains(nodeList,canvas){for(const node of nodeList){if(node===canvas||node.contains(canvas)){return true;}}} function createAttachObserver(chart,type,listener){const canvas=chart.canvas;const observer=new MutationObserver(entries=>{let trigger=false;for(const entry of entries){trigger=trigger||nodeListContains(entry.addedNodes,canvas);trigger=trigger&&!nodeListContains(entry.removedNodes,canvas);} if(trigger){listener();}});observer.observe(document,{childList:true,subtree:true});return observer;} @@ -1180,7 +1187,7 @@ function createDataContext(parent,index,element){return createContext(parent,{ac function clearStacks(meta,items){const datasetIndex=meta.controller.index;const axis=meta.vScale&&meta.vScale.axis;if(!axis){return;} items=items||meta._parsed;for(const parsed of items){const stacks=parsed._stacks;if(!stacks||stacks[axis]===undefined||stacks[axis][datasetIndex]===undefined){return;} delete stacks[axis][datasetIndex];}} -const isDirectUpdateMode=(mode)=>mode==='reset'||mode==='none';const cloneIfNotShared=(cached,shared)=>shared?cached:Object.assign({},cached);const createStack=(canStack,meta,chart)=>canStack&&!meta.hidden&&meta._stacked&&{keys:getSortedDatasetIndices(chart,true),values:null};class DatasetController{constructor(chart,datasetIndex){this.chart=chart;this._ctx=chart.ctx;this.index=datasetIndex;this._cachedDataOpts={};this._cachedMeta=this.getMeta();this._type=this._cachedMeta.type;this.options=undefined;this._parsing=false;this._data=undefined;this._objectData=undefined;this._sharedOptions=undefined;this._drawStart=undefined;this._drawCount=undefined;this.enableOptionSharing=false;this.$context=undefined;this._syncList=[];this.initialize();} +const isDirectUpdateMode=(mode)=>mode==='reset'||mode==='none';const cloneIfNotShared=(cached,shared)=>shared?cached:Object.assign({},cached);const createStack=(canStack,meta,chart)=>canStack&&!meta.hidden&&meta._stacked&&{keys:getSortedDatasetIndices(chart,true),values:null};class DatasetController{constructor(chart,datasetIndex){this.chart=chart;this._ctx=chart.ctx;this.index=datasetIndex;this._cachedDataOpts={};this._cachedMeta=this.getMeta();this._type=this._cachedMeta.type;this.options=undefined;this._parsing=false;this._data=undefined;this._objectData=undefined;this._sharedOptions=undefined;this._drawStart=undefined;this._drawCount=undefined;this.enableOptionSharing=false;this.supportsDecimation=false;this.$context=undefined;this._syncList=[];this.initialize();} initialize(){const meta=this._cachedMeta;this.configure();this.linkScales();meta._stacked=isStacked(meta.vScale,meta);this.addElements();} updateIndex(datasetIndex){if(this.index!==datasetIndex){clearStacks(this._cachedMeta);} this.index=datasetIndex;} @@ -1331,7 +1338,7 @@ getLabels(){const data=this.chart.data;return this.options.labels||(this.isHoriz beforeLayout(){this._cache={};this._dataLimitsCached=false;} beforeUpdate(){callback(this.options.beforeUpdate,[this]);} update(maxWidth,maxHeight,margins){const{beginAtZero,grace,ticks:tickOpts}=this.options;const sampleSize=tickOpts.sampleSize;this.beforeUpdate();this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins=Object.assign({left:0,right:0,top:0,bottom:0},margins);this.ticks=null;this._labelSizes=null;this._gridLineItems=null;this._labelItems=null;this.beforeSetDimensions();this.setDimensions();this.afterSetDimensions();this._maxLength=this.isHorizontal()?this.width+margins.left+margins.right:this.height+margins.top+margins.bottom;if(!this._dataLimitsCached){this.beforeDataLimits();this.determineDataLimits();this.afterDataLimits();this._range=_addGrace(this,grace,beginAtZero);this._dataLimitsCached=true;} -this.beforeBuildTicks();this.ticks=this.buildTicks()||[];this.afterBuildTicks();const samplingEnabled=sampleSizeisObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}} return false;} -var version="3.7.1";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} +var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};} function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);} function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);} @@ -1629,6 +1638,7 @@ _drawDataset(meta){const ctx=this.ctx;const clip=meta._clip;const useClip=!clip. if(useClip){clipArea(ctx,{left:clip.left===false?0:area.left-clip.left,right:clip.right===false?this.width:area.right+clip.right,top:clip.top===false?0:area.top-clip.top,bottom:clip.bottom===false?this.height:area.bottom+clip.bottom});} meta.controller.draw();if(useClip){unclipArea(ctx);} args.cancelable=false;this.notifyPlugins('afterDatasetDraw',args);} +isPointInArea(point){return _isPointInArea(point,this.chartArea,this._minPadding);} getElementsAtEventForMode(e,mode,options,useFinalPosition){const method=Interaction.modes[mode];if(typeof method==='function'){return method(this,e,options,useFinalPosition);} return[];} getDatasetMeta(datasetIndex){const dataset=this.data.datasets[datasetIndex];const metasets=this._metasets;let meta=metasets.filter(x=>x&&x._dataset===dataset).pop();if(!meta){meta={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:dataset&&dataset.order||0,index:datasetIndex,_dataset:dataset,_parsed:[],_sorted:false};metasets.push(meta);} @@ -1662,7 +1672,7 @@ return{datasetIndex,element:meta.data[index],index,};});const changed=!_elements notifyPlugins(hook,args,filter){return this._plugins.notify(this,hook,args,filter);} _updateHoverStyles(active,lastActive,replay){const hoverOptions=this.options.hover;const diff=(a,b)=>a.filter(x=>!b.some(y=>x.datasetIndex===y.datasetIndex&&x.index===y.index));const deactivated=diff(lastActive,active);const activated=replay?active:diff(active,lastActive);if(deactivated.length){this.updateHoverStyle(deactivated,hoverOptions.mode,false);} if(activated.length&&hoverOptions.mode){this.updateHoverStyle(activated,hoverOptions.mode,true);}} -_eventHandler(e,replay){const args={event:e,replay,cancelable:true,inChartArea:_isPointInArea(e,this.chartArea,this._minPadding)};const eventFilter=(plugin)=>(plugin.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins('beforeEvent',args,eventFilter)===false){return;} +_eventHandler(e,replay){const args={event:e,replay,cancelable:true,inChartArea:this.isPointInArea(e)};const eventFilter=(plugin)=>(plugin.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins('beforeEvent',args,eventFilter)===false){return;} const changed=this._handleEvent(e,replay,args.inChartArea);args.cancelable=false;this.notifyPlugins('afterEvent',args,eventFilter);if(changed||args.changed){this.render();} return this;} _handleEvent(e,replay,inChartArea){const{_active:lastActive=[],options}=this;const useFinalPosition=replay;const active=this._getActiveElements(e,lastActive,inChartArea,useFinalPosition);const isClick=_isClickEvent(e);const lastEvent=determineLastEvent(e,this._lastEvent,inChartArea,isClick);if(inChartArea){this._lastEvent=null;callback(options.onHover,[e,active,this],this);if(isClick){callback(options.onClick,[e,active,this],this);}} @@ -1739,7 +1749,7 @@ if(floating){value=custom.barStart;length=custom.barEnd-custom.barStart;if(value start+=value;} const startValue=!isNullOrUndef(baseValue)&&!floating?baseValue:start;let base=vScale.getPixelForValue(startValue);if(this.chart.getDataVisibility(index)){head=vScale.getPixelForValue(start+length);}else{head=base;} size=head-base;if(Math.abs(size)name!=='spacing',_indexable:(name)=>name!=='spacing',};DoughnutController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(chart){const data=chart.data;if(data.labels.length&&data.datasets.length){const{labels:{pointStyle}}=chart.legend.options;return data.labels.map((label,i)=>{const meta=chart.getDatasetMeta(0);const style=meta.controller.getStyle(i);return{text:label,fillStyle:style.backgroundColor,strokeStyle:style.borderColor,lineWidth:style.borderWidth,pointStyle:pointStyle,hidden:!chart.getDataVisibility(i),index:i};});} return[];}},onClick(e,legendItem,legend){legend.chart.toggleDataVisibility(legendItem.index);legend.chart.update();}},tooltip:{callbacks:{title(){return'';},label(tooltipItem){let dataLabel=tooltipItem.label;const value=': '+tooltipItem.formattedValue;if(isArray(dataLabel)){dataLabel=dataLabel.slice();dataLabel[0]+=value;}else{dataLabel+=value;} -return dataLabel;}}}}};class LineController extends DatasetController{initialize(){this.enableOptionSharing=true;super.initialize();} +return dataLabel;}}}}};class LineController extends DatasetController{initialize(){this.enableOptionSharing=true;this.supportsDecimation=true;super.initialize();} update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;} line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(parsed[iAxis]-prevParsed[iAxis])>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} +updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);} if(!directUpdate){this.updateElement(point,i,properties,mode);} prevParsed=parsed;} @@ -1815,21 +1825,25 @@ function scaleRangesChanged(meta){const{xScale,yScale,_scaleRanges}=meta;const n const changed=_scaleRanges.xmin!==xScale.min||_scaleRanges.xmax!==xScale.max||_scaleRanges.ymin!==yScale.min||_scaleRanges.ymax!==yScale.max;Object.assign(_scaleRanges,newRanges);return changed;} class PolarAreaController extends DatasetController{constructor(chart,datasetIndex){super(chart,datasetIndex);this.innerRadius=undefined;this.outerRadius=undefined;} getLabelAndValue(index){const meta=this._cachedMeta;const chart=this.chart;const labels=chart.data.labels||[];const value=formatNumber(meta._parsed[index].r,chart.options.locale);return{label:labels[index]||'',value,};} +parseObjectData(meta,data,start,count){return _parseObjectDataRadialScale.bind(this)(meta,data,start,count);} update(mode){const arcs=this._cachedMeta.data;this._updateRadius();this.updateElements(arcs,0,arcs.length,mode);} +getMinMax(){const meta=this._cachedMeta;const range={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};meta.data.forEach((element,index)=>{const parsed=this.getParsed(index).r;if(!isNaN(parsed)&&this.chart.getDataVisibility(index)){if(parsedrange.max){range.max=parsed;}}});return range;} _updateRadius(){const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const minSize=Math.min(chartArea.right-chartArea.left,chartArea.bottom-chartArea.top);const outerRadius=Math.max(minSize/2,0);const innerRadius=Math.max(opts.cutoutPercentage?(outerRadius/100)*(opts.cutoutPercentage):1,0);const radiusLength=(outerRadius-innerRadius)/chart.getVisibleDatasetCount();this.outerRadius=outerRadius-(radiusLength*this.index);this.innerRadius=this.outerRadius-radiusLength;} -updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const dataset=this.getDataset();const opts=chart.options;const animationOpts=opts.animation;const scale=this._cachedMeta.rScale;const centerX=scale.xCenter;const centerY=scale.yCenter;const datasetStartAngle=scale.getIndexAngle(0)-0.5*PI;let angle=datasetStartAngle;let i;const defaultAngle=360/this.countVisibleElements();for(i=0;i{if(!isNaN(dataset.data[index])&&this.chart.getDataVisibility(index)){count++;}});return count;} +countVisibleElements(){const meta=this._cachedMeta;let count=0;meta.data.forEach((element,index)=>{if(!isNaN(this.getParsed(index).r)&&this.chart.getDataVisibility(index)){count++;}});return count;} _computeAngle(index,mode,defaultAngle){return this.chart.getDataVisibility(index)?toRadians(this.resolveDataElementOptions(index,mode).angle||defaultAngle):0;}} PolarAreaController.id='polarArea';PolarAreaController.defaults={dataElementType:'arc',animation:{animateRotate:true,animateScale:true},animations:{numbers:{type:'number',properties:['x','y','startAngle','endAngle','innerRadius','outerRadius']},},indexAxis:'r',startAngle:0,};PolarAreaController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(chart){const data=chart.data;if(data.labels.length&&data.datasets.length){const{labels:{pointStyle}}=chart.legend.options;return data.labels.map((label,i)=>{const meta=chart.getDatasetMeta(0);const style=meta.controller.getStyle(i);return{text:label,fillStyle:style.backgroundColor,strokeStyle:style.borderColor,lineWidth:style.borderWidth,pointStyle:pointStyle,hidden:!chart.getDataVisibility(i),index:i};});} return[];}},onClick(e,legendItem,legend){legend.chart.toggleDataVisibility(legendItem.index);legend.chart.update();}},tooltip:{callbacks:{title(){return'';},label(context){return context.chart.data.labels[context.dataIndex]+': '+context.formattedValue;}}}},scales:{r:{type:'radialLinear',angleLines:{display:false},beginAtZero:true,grid:{circular:true},pointLabels:{display:false},startAngle:0}}};class PieController extends DoughnutController{} PieController.id='pie';PieController.defaults={cutout:0,rotation:0,circumference:360,radius:'100%'};class RadarController extends DatasetController{getLabelAndValue(index){const vScale=this._cachedMeta.vScale;const parsed=this.getParsed(index);return{label:vScale.getLabels()[index],value:''+vScale.getLabelForValue(parsed[vScale.axis])};} +parseObjectData(meta,data,start,count){return _parseObjectDataRadialScale.bind(this)(meta,data,start,count);} update(mode){const meta=this._cachedMeta;const line=meta.dataset;const points=meta.data||[];const labels=meta.iScale.getLabels();line.points=points;if(mode!=='resize'){const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} const properties={_loop:true,_fullLoop:labels.length===points.length,options};this.updateElement(line,undefined,properties,mode);} this.updateElements(points,0,points.length,mode);} -updateElements(points,start,count,mode){const dataset=this.getDataset();const scale=this._cachedMeta.rScale;const reset=mode==='reset';for(let i=start;ipixelMargin){angleMargin=pixelMargin/innerRadius;ctx.arc(x,y,innerRadius,endAngle+angleMargin,startAngle-angleMargin,true);}else{ctx.arc(x,y,pixelMargin,endAngle+HALF_PI,startAngle-HALF_PI);} ctx.closePath();ctx.clip();} @@ -1948,38 +1962,46 @@ if(maxDefined){count=_limitValue(_lookupByKey(points,iScale.axis,max).hi+1,start return{start,count};} var plugin_decimation={id:'decimation',defaults:{algorithm:'min-max',enabled:false,},beforeElementsUpdate:(chart,args,options)=>{if(!options.enabled){cleanDecimatedData(chart);return;} const availableWidth=chart.width;chart.data.datasets.forEach((dataset,datasetIndex)=>{const{_data,indexAxis}=dataset;const meta=chart.getDatasetMeta(datasetIndex);const data=_data||dataset.data;if(resolve([indexAxis,chart.options.indexAxis])==='y'){return;} -if(meta.type!=='line'){return;} +if(!meta.controller.supportsDecimation){return;} const xAxis=chart.scales[meta.xAxisID];if(xAxis.type!=='linear'&&xAxis.type!=='time'){return;} if(chart.options.parsing){return;} let{start,count}=getStartAndCountOfVisiblePointsSimplified(meta,data);const threshold=options.threshold||4*availableWidth;if(count<=threshold){cleanDecimatedDataset(dataset);return;} if(isNullOrUndef(_data)){dataset._data=data;delete dataset.data;Object.defineProperty(dataset,'data',{configurable:true,enumerable:true,get:function(){return this._decimated;},set:function(d){this._data=d;}});} let decimated;switch(options.algorithm){case'lttb':decimated=lttbDecimation(data,start,count,availableWidth,options);break;case'min-max':decimated=minMaxDecimation(data,start,count,availableWidth);break;default:throw new Error(`Unsupported decimation algorithm '${options.algorithm}'`);} -dataset._decimated=decimated;});},destroy(chart){cleanDecimatedData(chart);}};function getLineByIndex(chart,index){const meta=chart.getDatasetMeta(index);const visible=meta&&chart.isDatasetVisible(index);return visible?meta.dataset:null;} +dataset._decimated=decimated;});},destroy(chart){cleanDecimatedData(chart);}};function _segments(line,target,property){const segments=line.segments;const points=line.points;const tpoints=target.points;const parts=[];for(const segment of segments){let{start,end}=segment;end=_findSegmentEnd(start,end,points);const bounds=_getBounds(property,points[start],points[end],segment.loop);if(!target.segments){parts.push({source:segment,target:bounds,start:points[start],end:points[end]});continue;} +const targetSegments=_boundSegments(target,bounds);for(const tgt of targetSegments){const subBounds=_getBounds(property,tpoints[tgt.start],tpoints[tgt.end],tgt.loop);const fillSources=_boundSegment(segment,points,subBounds);for(const fillSource of fillSources){parts.push({source:fillSource,target:tgt,start:{[property]:_getEdge(bounds,subBounds,'start',Math.max)},end:{[property]:_getEdge(bounds,subBounds,'end',Math.min)}});}}} +return parts;} +function _getBounds(property,first,last,loop){if(loop){return;} +let start=first[property];let end=last[property];if(property==='angle'){start=_normalizeAngle(start);end=_normalizeAngle(end);} +return{property,start,end};} +function _pointsFromSegments(boundary,line){const{x=null,y=null}=boundary||{};const linePoints=line.points;const points=[];line.segments.forEach(({start,end})=>{end=_findSegmentEnd(start,end,linePoints);const first=linePoints[start];const last=linePoints[end];if(y!==null){points.push({x:first.x,y});points.push({x:last.x,y});}else if(x!==null){points.push({x,y:first.y});points.push({x,y:last.y});}});return points;} +function _findSegmentEnd(start,end,points){for(;end>start;end--){const point=points[end];if(!isNaN(point.x)&&!isNaN(point.y)){break;}} +return end;} +function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);} +return a?a[prop]:b?b[prop]:0;} +function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);} +return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;} +function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;} +while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;} +target=sources[fill];if(!target){return false;} +if(target.visible){return fill;} +visited.push(fill);fill=target.fill;} +return false;} +function _decodeFill(line,index,count){const fill=parseFillOption(line);if(isObject(fill)){return isNaN(fill.value)?false:fill;} +let target=parseFloat(fill);if(isNumberFinite(target)&&Math.floor(target)===target){return decodeTargetIndex(fill[0],index,target,count);} +return['origin','start','end','stack','shape'].indexOf(fill)>=0&&fill;} +function decodeTargetIndex(firstCh,index,target,count){if(firstCh==='-'||firstCh==='+'){target=index+target;} +if(target===index||target<0||target>=count){return false;} +return target;} +function _getTargetPixel(fill,scale){let pixel=null;if(fill==='start'){pixel=scale.bottom;}else if(fill==='end'){pixel=scale.top;}else if(isObject(fill)){pixel=scale.getPixelForValue(fill.value);}else if(scale.getBasePixel){pixel=scale.getBasePixel();} +return pixel;} +function _getTargetValue(fill,scale,startValue){let value;if(fill==='start'){value=startValue;}else if(fill==='end'){value=scale.options.reverse?scale.min:scale.max;}else if(isObject(fill)){value=fill.value;}else{value=scale.getBaseValue();} +return value;} function parseFillOption(line){const options=line.options;const fillOption=options.fill;let fill=valueOrDefault(fillOption&&fillOption.target,fillOption);if(fill===undefined){fill=!!options.backgroundColor;} if(fill===false||fill===null){return false;} if(fill===true){return'origin';} return fill;} -function decodeFill(line,index,count){const fill=parseFillOption(line);if(isObject(fill)){return isNaN(fill.value)?false:fill;} -let target=parseFloat(fill);if(isNumberFinite(target)&&Math.floor(target)===target){if(fill[0]==='-'||fill[0]==='+'){target=index+target;} -if(target===index||target<0||target>=count){return false;} -return target;} -return['origin','start','end','stack','shape'].indexOf(fill)>=0&&fill;} -function computeLinearBoundary(source){const{scale={},fill}=source;let target=null;let horizontal;if(fill==='start'){target=scale.bottom;}else if(fill==='end'){target=scale.top;}else if(isObject(fill)){target=scale.getPixelForValue(fill.value);}else if(scale.getBasePixel){target=scale.getBasePixel();} -if(isNumberFinite(target)){horizontal=scale.isHorizontal();return{x:horizontal?target:null,y:horizontal?null:target};} -return null;} -class simpleArc{constructor(opts){this.x=opts.x;this.y=opts.y;this.radius=opts.radius;} -pathSegment(ctx,bounds,opts){const{x,y,radius}=this;bounds=bounds||{start:0,end:TAU};ctx.arc(x,y,radius,bounds.end,bounds.start,true);return!opts.bounds;} -interpolate(point){const{x,y,radius}=this;const angle=point.angle;return{x:x+Math.cos(angle)*radius,y:y+Math.sin(angle)*radius,angle};}} -function computeCircularBoundary(source){const{scale,fill}=source;const options=scale.options;const length=scale.getLabels().length;const target=[];const start=options.reverse?scale.max:scale.min;const end=options.reverse?scale.min:scale.max;let i,center,value;if(fill==='start'){value=start;}else if(fill==='end'){value=end;}else if(isObject(fill)){value=fill.value;}else{value=scale.getBaseValue();} -if(options.grid.circular){center=scale.getPointPositionForValue(0,start);return new simpleArc({x:center.x,y:center.y,radius:scale.getDistanceFromCenterForValue(value)});} -for(i=0;istart;end--){const point=points[end];if(!isNaN(point.x)&&!isNaN(point.y)){break;}} -return end;} -function pointsFromSegments(boundary,line){const{x=null,y=null}=boundary||{};const linePoints=line.points;const points=[];line.segments.forEach(({start,end})=>{end=findSegmentEnd(start,end,linePoints);const first=linePoints[start];const last=linePoints[end];if(y!==null){points.push({x:first.x,y});points.push({x:last.x,y});}else if(x!==null){points.push({x,y:first.y});points.push({x,y:last.y});}});return points;} -function buildStackLine(source){const{scale,index,line}=source;const points=[];const segments=line.segments;const sourcePoints=line.points;const linesBelow=getLinesBelow(scale,index);linesBelow.push(createBoundaryLine({x:null,y:scale.bottom},line));for(let i=0;i=0;--i){const source=metasets[i].$filler;if(!source){continue;} -source.line.updateControlPoints(area,source.axis);if(draw){drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} -const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} -drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} +source.fill=_resolveTarget(sources,i,options.propagate);}},beforeDraw(chart,_args,options){const draw=options.drawTime==='beforeDraw';const metasets=chart.getSortedVisibleDatasetMetas();const area=chart.chartArea;for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(!source){continue;} +source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} +const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} +_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();} setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}} @@ -2062,9 +2079,9 @@ _computeTitleHeight(){const titleOpts=this.options.title;const titleFont=toFont( _getLegendItemAt(x,y){let i,hitBox,lh;if(_isBetween(x,this.left,this.right)&&_isBetween(y,this.top,this.bottom)){lh=this.legendHitBoxes;for(i=0;ictx.chart.options.color,boxWidth:40,padding:10,generateLabels(chart){const datasets=chart.data.datasets;const{labels:{usePointStyle,pointStyle,textAlign,color}}=chart.legend.options;return chart._getSortedDatasetMetas().map((meta)=>{const style=meta.controller.getStyle(usePointStyle?0:undefined);const borderWidth=toPadding(style.borderWidth);return{text:datasets[meta.index].label,fillStyle:style.backgroundColor,fontColor:color,hidden:!meta.visible,lineCap:style.borderCapStyle,lineDash:style.borderDash,lineDashOffset:style.borderDashOffset,lineJoin:style.borderJoinStyle,lineWidth:(borderWidth.width+borderWidth.height)/4,strokeStyle:style.borderColor,pointStyle:pointStyle||style.pointStyle,rotation:style.rotation,textAlign:textAlign||style.textAlign,borderRadius:0,datasetIndex:meta.index};},this);}},title:{color:(ctx)=>ctx.chart.options.color,display:false,position:'center',text:'',}},descriptors:{_scriptable:(name)=>!name.startsWith('on'),labels:{_scriptable:(name)=>!['generateLabels','filter','sort'].includes(name),}},};class Title extends Element{constructor(config){super();this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this._padding=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.width=undefined;this.height=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} @@ -2154,6 +2171,7 @@ ctx.lineTo(x+bottomLeft,y+height);ctx.quadraticCurveTo(x,y+height,x,y+height-bot ctx.lineTo(x,y+topLeft);ctx.quadraticCurveTo(x,y,x+topLeft,y);ctx.closePath();ctx.fill();if(options.borderWidth>0){ctx.stroke();}} _updateAnimationTarget(options){const chart=this.chart;const anims=this.$animations;const animX=anims&&anims.x;const animY=anims&&anims.y;if(animX||animY){const position=positioners[options.position].call(this,this._active,this._eventPosition);if(!position){return;} const size=this._size=getTooltipSize(this,options);const positionAndSize=Object.assign({},position,this._size);const alignment=determineAlignment(chart,options,positionAndSize);const point=getBackgroundPoint(options,positionAndSize,alignment,chart);if(animX._to!==point.x||animY._to!==point.y){this.xAlign=alignment.xAlign;this.yAlign=alignment.yAlign;this.width=size.width;this.height=size.height;this.caretX=position.x;this.caretY=position.y;this._resolveAnimations().update(this,point);}}} +_willRender(){return!!this.opacity;} draw(ctx){const options=this.options.setContext(this.getContext());let opacity=this.opacity;if(!opacity){return;} this._updateAnimationTarget(options);const tooltipSize={width:this.width,height:this.height};const pt={x:this.x,y:this.y};opacity=Math.abs(opacity)<1e-3?0:opacity;const padding=toPadding(options.padding);const hasTooltipContent=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;if(options.enabled&&hasTooltipContent){ctx.save();ctx.globalAlpha=opacity;this.drawBackground(pt,ctx,tooltipSize,options);overrideTextDirection(ctx,options.textDirection);pt.y+=padding.top;this.drawTitle(pt,ctx,options);this.drawBody(pt,ctx,options);this.drawFooter(pt,ctx,options);restoreTextDirection(ctx,options.textDirection);ctx.restore();}} getActiveElements(){return this._active||[];} @@ -2167,13 +2185,12 @@ if(!inChartArea){return lastActive;} const active=this.chart.getElementsAtEventForMode(e,options.mode,options,replay);if(options.reverse){active.reverse();} return active;} _positionChanged(active,e){const{caretX,caretY,options}=this;const position=positioners[options.position].call(this,active,e);return position!==false&&(caretX!==position.x||caretY!==position.y);}} -Tooltip.positioners=positioners;var plugin_tooltip={id:'tooltip',_element:Tooltip,positioners,afterInit(chart,_args,options){if(options){chart.tooltip=new Tooltip({chart,options});}},beforeUpdate(chart,_args,options){if(chart.tooltip){chart.tooltip.initialize(options);}},reset(chart,_args,options){if(chart.tooltip){chart.tooltip.initialize(options);}},afterDraw(chart){const tooltip=chart.tooltip;const args={tooltip};if(chart.notifyPlugins('beforeTooltipDraw',args)===false){return;} -if(tooltip){tooltip.draw(chart.ctx);} -chart.notifyPlugins('afterTooltipDraw',args);},afterEvent(chart,args){if(chart.tooltip){const useFinalPosition=args.replay;if(chart.tooltip.handleEvent(args.event,useFinalPosition,args.inChartArea)){args.changed=true;}}},defaults:{enabled:true,external:null,position:'average',backgroundColor:'rgba(0,0,0,0.8)',titleColor:'#fff',titleFont:{weight:'bold',},titleSpacing:2,titleMarginBottom:6,titleAlign:'left',bodyColor:'#fff',bodySpacing:2,bodyFont:{},bodyAlign:'left',footerColor:'#fff',footerSpacing:2,footerMarginTop:6,footerFont:{weight:'bold',},footerAlign:'left',padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(ctx,opts)=>opts.bodyFont.size,boxWidth:(ctx,opts)=>opts.bodyFont.size,multiKeyBackground:'#fff',displayColors:true,boxPadding:0,borderColor:'rgba(0,0,0,0)',borderWidth:0,animation:{duration:400,easing:'easeOutQuart',},animations:{numbers:{type:'number',properties:['x','y','width','height','caretX','caretY'],},opacity:{easing:'linear',duration:200}},callbacks:{beforeTitle:noop,title(tooltipItems){if(tooltipItems.length>0){const item=tooltipItems[0];const labels=item.chart.data.labels;const labelCount=labels?labels.length:0;if(this&&this.options&&this.options.mode==='dataset'){return item.dataset.label||'';}else if(item.label){return item.label;}else if(labelCount>0&&item.dataIndexopts.bodyFont.size,boxWidth:(ctx,opts)=>opts.bodyFont.size,multiKeyBackground:'#fff',displayColors:true,boxPadding:0,borderColor:'rgba(0,0,0,0)',borderWidth:0,animation:{duration:400,easing:'easeOutQuart',},animations:{numbers:{type:'number',properties:['x','y','width','height','caretX','caretY'],},opacity:{easing:'linear',duration:200}},callbacks:{beforeTitle:noop,title(tooltipItems){if(tooltipItems.length>0){const item=tooltipItems[0];const labels=item.chart.data.labels;const labelCount=labels?labels.length:0;if(this&&this.options&&this.options.mode==='dataset'){return item.dataset.label||'';}else if(item.label){return item.label;}else if(labelCount>0&&item.dataIndexname!=='filter'&&name!=='itemSort'&&name!=='external',_indexable:false,callbacks:{_scriptable:false,_indexable:false,},animation:{_fallback:false},animations:{_fallback:'animation'}},additionalOptionScopes:['interaction']};var plugins=Object.freeze({__proto__:null,Decimation:plugin_decimation,Filler:plugin_filler,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(labels,raw,index,addedLabels)=>{if(typeof raw==='string'){index=labels.push(raw)-1;addedLabels.unshift({index,label:raw});}else if(isNaN(raw)){index=null;} +return label;},labelColor(tooltipItem){const meta=tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);const options=meta.controller.getStyle(tooltipItem.dataIndex);return{borderColor:options.borderColor,backgroundColor:options.backgroundColor,borderWidth:options.borderWidth,borderDash:options.borderDash,borderDashOffset:options.borderDashOffset,borderRadius:0,};},labelTextColor(){return this.options.bodyColor;},labelPointStyle(tooltipItem){const meta=tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);const options=meta.controller.getStyle(tooltipItem.dataIndex);return{pointStyle:options.pointStyle,rotation:options.rotation,};},afterLabel:noop,afterBody:noop,beforeFooter:noop,footer:noop,afterFooter:noop}},defaultRoutes:{bodyFont:'font',footerFont:'font',titleFont:'font'},descriptors:{_scriptable:(name)=>name!=='filter'&&name!=='itemSort'&&name!=='external',_indexable:false,callbacks:{_scriptable:false,_indexable:false,},animation:{_fallback:false},animations:{_fallback:'animation'}},additionalOptionScopes:['interaction']};var plugins=Object.freeze({__proto__:null,Decimation:plugin_decimation,Filler:index,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(labels,raw,index,addedLabels)=>{if(typeof raw==='string'){index=labels.push(raw)-1;addedLabels.unshift({index,label:raw});}else if(isNaN(raw)){index=null;} return index;};function findOrAddLabel(labels,raw,index,addedLabels){const first=labels.indexOf(raw);if(first===-1){return addIfString(labels,raw,index,addedLabels);} const last=labels.lastIndexOf(raw);return first!==last?index:first;} const validIndex=(index,max)=>index===null?null:_limitValue(Math.round(index),0,max);class CategoryScale extends Scale{constructor(cfg){super(cfg);this._startValue=undefined;this._valueRange=0;this._addedLabels=[];} @@ -2268,7 +2285,7 @@ function leftForTextAlign(x,w,align){if(align==='right'){x-=w;}else if(align===' return x;} function yForAngle(y,h,angle){if(angle===90||angle===270){y-=(h/2);}else if(angle>270||angle<90){y-=h;} return y;} -function drawPointLabels(scale,labelCount){const{ctx,options:{pointLabels}}=scale;for(let i=labelCount-1;i>=0;i--){const optsAtIndex=pointLabels.setContext(scale.getPointLabelContext(i));const plFont=toFont(optsAtIndex.font);const{x,y,textAlign,left,top,right,bottom}=scale._pointLabelItems[i];const{backdropColor}=optsAtIndex;if(!isNullOrUndef(backdropColor)){const padding=toPadding(optsAtIndex.backdropPadding);ctx.fillStyle=backdropColor;ctx.fillRect(left-padding.left,top-padding.top,right-left+padding.width,bottom-top+padding.height);} +function drawPointLabels(scale,labelCount){const{ctx,options:{pointLabels}}=scale;for(let i=labelCount-1;i>=0;i--){const optsAtIndex=pointLabels.setContext(scale.getPointLabelContext(i));const plFont=toFont(optsAtIndex.font);const{x,y,textAlign,left,top,right,bottom}=scale._pointLabelItems[i];const{backdropColor}=optsAtIndex;if(!isNullOrUndef(backdropColor)){const borderRadius=toTRBLCorners(optsAtIndex.borderRadius);const padding=toPadding(optsAtIndex.backdropPadding);ctx.fillStyle=backdropColor;const backdropLeft=left-padding.left;const backdropTop=top-padding.top;const backdropWidth=right-left+padding.width;const backdropHeight=bottom-top+padding.height;if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();addRoundedRectPath(ctx,{x:backdropLeft,y:backdropTop,w:backdropWidth,h:backdropHeight,radius:borderRadius,});ctx.fill();}else{ctx.fillRect(backdropLeft,backdropTop,backdropWidth,backdropHeight);}} renderText(ctx,scale._pointLabels[i],x,y+(plFont.lineHeight/2),plFont,{color:optsAtIndex.color,textAlign:textAlign,textBaseline:'middle'});}} function pathRadiusLine(scale,radius,circular,labelCount){const{ctx}=scale;if(circular){ctx.arc(scale.xCenter,scale.yCenter,radius,0,TAU);}else{let pointPosition=scale.getPointPosition(0,radius);ctx.moveTo(pointPosition.x,pointPosition.y);for(let i=1;i+tick.value));}} initOffsets(timestamps){let start=0;let end=0;let first,last;if(this.options.offset&×tamps.length){first=this.getDecimalForValue(timestamps[0]);if(timestamps.length===1){start=1-first;}else{start=(this.getDecimalForValue(timestamps[1])-first)/2;} last=this.getDecimalForValue(timestamps[timestamps.length-1]);if(timestamps.length===1){end=last;}else{end=(last-this.getDecimalForValue(timestamps[timestamps.length-2]))/2;}} const limit=timestamps.length<3?0.5:0.25;start=_limitValue(start,0,limit);end=_limitValue(end,0,limit);this._offsets={start,end,factor:1/(start+1+end)};}