MCPcopy Create free account
hub / github.com/Rello/analytics / backgroundColor

Function backgroundColor

js/3rdParty/chartjs-plugin-funnel.min.js:15–15  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

13 * https://readtech.org/ARC/
14 */
15const Ze=.022;function Ie(e,t,r){return.2126729*Math.pow(e/255,2.4)+.7151522*Math.pow(t/255,2.4)+.072175*Math.pow(r/255,2.4)}const{sqrt:Fe,pow:We,min:Ke,max:Te,atan2:Ue,abs:Ve,cos:De,sin:He,exp:Je,PI:Qe}=Math;var et={cool:()=>Ae([v.hsl(180,1,.9),v.hsl(250,.7,.4)]),hot:()=>Ae(["#000","#f00","#ff0","#fff"]).mode("rgb")};const tt={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},rt=Object.keys(tt),nt=new Map(rt.map((e=>[e.toLowerCase(),e]))),ot="function"==typeof Proxy?new Proxy(tt,{get(e,t){const r=t.toLowerCase();if(nt.has(r))return e[nt.get(r)]},getOwnPropertyNames:()=>Object.getOwnPropertyNames(rt)}):tt,{max:at}=Math;x.prototype.cmyk=function(){return((...e)=>{let[t,r,n]=c(e,"rgb");t/=255,r/=255,n/=255;const o=1-at(t,at(r,n)),a=o<1?1/(1-o):0;return[(1-t-o)*a,(1-r-o)*a,(1-n-o)*a,o]})(this._rgb)};Object.assign(v,{cmyk:(...e)=>new x(...e,"cmyk")}),M.format.cmyk=(...e)=>{e=c(e,"cmyk");const[t,r,n,o]=e,a=e.length>4?e[4]:1;return 1===o?[0,0,0,a]:[t>=1?0:255*(1-t)*(1-o),r>=1?0:255*(1-r)*(1-o),n>=1?0:255*(1-n)*(1-o),a]},M.autodetect.push({p:2,test:(...e)=>{if("array"===l(e=c(e,"cmyk"))&&4===e.length)return"cmyk"}});const st=(...e)=>{const[t,r,n,...o]=c(e,"rgb"),[a,s,f]=pe(t,r,n),[l,i,u]=Q(a,s,f);return[l,i,u,...o.length>0&&o[0]<1?[o[0]]:[]]},{round:ft}=Math,lt=(...e)=>{const t=c(e,"rgba");let r=i(e)||"rgb";if("hsl"===r.substr(0,3))return((...e)=>{const t=c(e,"hsla");let r=i(e)||"lsa";return t[0]=b(t[0]||0)+"deg",t[1]=b(100*t[1])+"%",t[2]=b(100*t[2])+"%","hsla"===r||t.length>3&&t[3]<1?(t[3]="/ "+(t.length>3?t[3]:1),r="hsla"):t.length=3,`${r.substr(0,3)}(${t.join(" ")})`})(ue(t),r);if("lab"===r.substr(0,3)){const e=B();$("d50");const n=((...e)=>{const t=c(e,"lab");let r=i(e)||"lab";return t[0]=b(t[0])+"%",t[1]=b(t[1]),t[2]=b(t[2]),"laba"===r||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lab(${t.join(" ")})`})(q(t),r);return $(e),n}if("lch"===r.substr(0,3)){const e=B();$("d50");const n=((...e)=>{const t=c(e,"lch");let r=i(e)||"lab";return t[0]=b(t[0])+"%",t[1]=b(t[1]),t[2]=isNaN(t[2])?"none":b(t[2])+"deg","lcha"===r||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lch(${t.join(" ")})`})(ee(t),r);return $(e),n}return"oklab"===r.substr(0,5)?((...e)=>{const t=c(e,"lab");return t[0]=b(100*t[0])+"%",t[1]=g(t[1]),t[2]=g(t[2]),t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklab(${t.join(" ")})`})(pe(t)):"oklch"===r.substr(0,5)?((...e)=>{const t=c(e,"lch");return t[0]=b(100*t[0])+"%",t[1]=g(t[1]),t[2]=isNaN(t[2])?"none":b(t[2])+"deg",t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklch(${t.join(" ")})`})(st(t)):(t[0]=ft(t[0]),t[1]=ft(t[1]),t[2]=ft(t[2]),("rgba"===r||t.length>3&&t[3]<1)&&(t[3]="/ "+(t.length>3?t[3]:1),r="rgba"),`${r.substr(0,3)}(${t.slice(0,"rgb"===r?3:4).join(" ")})`)},ct=(...e)=>{e=c(e,"lch");const[t,r,n,...o]=e,[a,s,f]=U(t,r,n),[l,i,u]=me(a,s,f);return[l,i,u,...o.length>0&&o[0]<1?[o[0]]:[]]},it=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,ut=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,ht=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,dt=/\s*/.source,bt=/\s+/.source,gt=/\s*,\s*/.source,mt=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,pt=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,wt=new RegExp("^rgba?\\("+dt+[it,it,it].join(bt)+pt+"\\)$"),yt=new RegExp("^rgb\\("+dt+[it,it,it].join(gt)+dt+"\\)$"),kt=new RegExp("^rgba\\("+dt+[it,it,it,ut].join(gt)+dt+"\\)$"),Mt=new RegExp("^hsla?\\("+dt+[mt,ht,ht].join(bt)+pt+"\\)$"),xt=new RegExp("^hsl?\\("+dt+[mt,ht,ht].join(gt)+dt+"\\)$"),vt=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Nt=new RegExp("^lab\\("+dt+[ut,ut,ut].join(bt)+pt+"\\)$"),_t=new RegExp("^lch\\("+dt+[ut,ut,mt].join(bt)+pt+"\\)$"),At=new RegExp("^oklab\\("+dt+[ut,ut,ut].join(bt)+pt+"\\)$"),jt=new RegExp("^oklch\\("+dt+[ut,ut,mt].join(bt)+pt+"\\)$"),{round:Et}=Math,Ct=e=>e.map(((e,t)=>t<=2?a(Et(e),0,255):e)),Rt=(e,t=0,r=100,n=!1)=>("string"==typeof e&&e.endsWith("%")&&(e=parseFloat(e.substring(0,e.length-1))/100,e=n?t+.5*(e+1)*(r-t):t+e*(r-t)),+e),Pt=(e,t)=>"none"===e?t:e,$t=e=>{if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t;if(M.format.named)try{return M.format.named(e)}catch(e){}if((t=e.match(wt))||(t=e.match(yt))){let e=t.slice(1,4);for(let t=0;t<3;t++)e[t]=+Rt(Pt(e[t],0),0,255);e=Ct(e);const r=void 0!==t[4]?+Rt(t[4],0,1):1;return e[3]=r,e}if(t=e.match(kt)){const e=t.slice(1,5);for(let t=0;t<4;t++)e[t]=+Rt(e[t],0,255);return e}if((t=e.match(Mt))||(t=e.match(xt))){const e=t.slice(1,4);e[0]=+Pt(e[0].replace("deg",""),0),e[1]=.01*+Rt(Pt(e[1],0),0,100),e[2]=.01*+Rt(Pt(e[2],0),0,100);const r=Ct(ie(e)),n=void 0!==t[4]?+Rt(t[4],0,1):1;return r[3]=n,r}if(t=e.match(vt)){const e=t.slice(1,4);e[1]*=.01,e[2]*=.01;const r=ie(e);for(let e=0;e<3;e++)r[e]=Et(r[e]);return r[3]=+t[4],r}if(t=e.match(Nt)){const e=t.slice(1,4);e[0]=Rt(Pt(e[0],0),0,100),e[1]=Rt(Pt(e[1],0),-125,125,!0),e[2]=Rt(Pt(e[2],0),-125,125,!0);const r=B();$("d50");const n=Ct(O(e));$(r);const o=void 0!==t[4]?+Rt(t[4],0,1):1;return n[3]=o,n}if(t=e.match(_t)){const e=t.slice(1,4);e[0]=Rt(e[0],0,100),e[1]=Rt(Pt(e[1],0),0,150,!1),e[2]=+Pt(e[2].replace("deg",""),0);const r=B();$("d50");const n=Ct(V(e));$(r);const o=void 0!==t[4]?+Rt(t[4],0,1):1;return n[3]=o,n}if(t=e.match(At)){const e=t.slice(1,4);e[0]=Rt(Pt(e[0],0),0,1),e[1]=Rt(Pt(e[1],0),-.4,.4,!0),e[2]=Rt(Pt(e[2],0),-.4,.4,!0);const r=Ct(me(e)),n=void 0!==t[4]?+Rt(t[4],0,1):1;return r[3]=n,r}if(t=e.match(jt)){const e=t.slice(1,4);e[0]=Rt(Pt(e[0],0),0,1),e[1]=Rt(Pt(e[1],0),0,.4,!1),e[2]=+Pt(e[2].replace("deg",""),0);const r=Ct(ct(e)),n=void 0!==t[4]?+Rt(t[4],0,1):1;return r[3]=n,r}};$t.test=e=>wt.test(e)||Mt.test(e)||Nt.test(e)||_t.test(e)||At.test(e)||jt.test(e)||yt.test(e)||kt.test(e)||xt.test(e)||vt.test(e)||"transparent"===e,x.prototype.css=function(e){return lt(this._rgb,e)};v.css=(...e)=>new x(...e,"css"),M.format.css=$t,M.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&"string"===l(e)&&$t.test(e))return"css"}}),M.format.gl=(...e)=>{const t=c(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t};v.gl=(...e)=>new x(...e,"gl"),x.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]},x.prototype.hex=function(e){return C(this._rgb,e)};v.hex=(...e)=>new x(...e,"hex"),M.format.hex=j,M.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&"string"===l(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{log:Bt}=Math,Ot=e=>{const t=e/100;let r,n,o;return t<66?(r=255,n=t<6?0:-155.25485562709179-.44596950469579133*(n=t-2)+104.49216199393888*Bt(n),o=t<20?0:.8274096064007395*(o=t-10)-254.76935184120902+115.67994401066147*Bt(o)):(r=351.97690566805693+.114206453784165*(r=t-55)-40.25366309332127*Bt(r),n=325.4494125711974+.07943456536662342*(n=t-50)-28.0852963507957*Bt(n),o=255),[r,n,o,1]},{round:Lt}=Math;x.prototype.temp=x.prototype.kelvin=x.prototype.temperature=function(){return((...e)=>{const t=c(e,"rgb"),r=t[0],n=t[2];let o,a=1e3,s=4e4;for(;s-a>.4;){o=.5*(s+a);const e=Ot(o);e[2]/e[0]>=n/r?s=o:a=o}return Lt(o)})(this._rgb)};const Yt=(...e)=>new x(...e,"temp");Object.assign(v,{temp:Yt,kelvin:Yt,temperature:Yt}),M.format.temp=M.format.kelvin=M.format.temperature=Ot,x.prototype.oklch=function(){return st(this._rgb)};function Gt(e,t="#000000",r="#ffffff"){return v(e).luminance()>.5?t:r}function qt(e,t){return v.scale("Blues")(e/(t-1)).hex()}function zt(e,t,r,n=1e-5){return e>=Math.min(t,r)-n&&e<=Math.max(t,r)+n}function Xt(e){return{left:e.top,right:e.bottom,top:e.left,bottom:e.right,horizontal:!e.horizontal}}Object.assign(v,{oklch:(...e)=>new x(...e,"oklch")}),M.format.oklch=ct,M.autodetect.push({p:2,test:(...e)=>{if("array"===l(e=c(e,"oklch"))&&3===e.length)return"oklch"}}),Object.assign(v,{analyze:Xe,average:(e,t="lrgb",r=null)=>{const n=e.length;r||(r=Array.from(new Array(n)).map((()=>1)));const o=n/r.reduce((function(e,t){return e+t}));if(r.forEach(((e,t)=>{r[t]*=o})),e=e.map((e=>new x(e))),"lrgb"===t)return Ne(e,r);const a=e.shift(),s=a.get(t),f=[];let l=0,c=0;for(let e=0;e<s.length;e++)if(s[e]=(s[e]||0)*r[0],f.push(isNaN(s[e])?0:r[0]),"h"===t.charAt(e)&&!isNaN(s[e])){const t=s[e]/180*ke;l+=Me(t)*r[0],c+=xe(t)*r[0]}let i=a.alpha()*r[0];e.forEach(((e,n)=>{const o=e.get(t);i+=e.alpha()*r[n+1];for(let e=0;e<s.length;e++)if(!isNaN(o[e]))if(f[e]+=r[n+1],"h"===t.charAt(e)){const t=o[e]/180*ke;l+=Me(t)*r[n+1],c+=xe(t)*r[n+1]}else s[e]+=o[e]*r[n+1]}));for(let e=0;e<s.length;e++)if("h"===t.charAt(e)){let t=ve(c/f[e],l/f[e])/ke*180;for(;t<0;)t+=360;for(;t>=360;)t-=360;s[e]=t}else s[e]=s[e]/f[e];return i/=n,new x(s,t).alpha(i>.99999?1:i,!0)},bezier:e=>{const t=function(e){let t,r,n,o;if(2===(e=e.map((e=>new x(e)))).length)[r,n]=e.map((e=>e.lab())),t=function(e){const t=[0,1,2].map((t=>r[t]+e*(n[t]-r[t])));return new x(t,"lab")};else if(3===e.length)[r,n,o]=e.map((e=>e.lab())),t=function(e){const t=[0,1,2].map((t=>(1-e)*(1-e)*r[t]+2*(1-e)*e*n[t]+e*e*o[t]));return new x(t,"lab")};else if(4===e.length){let a;[r,n,o,a]=e.map((e=>e.lab())),t=function(e){const t=[0,1,2].map((t=>(1-e)*(1-e)*(1-e)*r[t]+3*(1-e)*(1-e)*e*n[t]+3*(1-e)*e*e*o[t]+e*e*e*a[t]));return new x(t,"lab")}}else{if(!(e.length>=5))throw new RangeError("No point in running bezier with only one color.");{let r,n,o;r=e.map((e=>e.lab())),o=e.length-1,n=function(e){let t=[1,1];for(let r=1;r<e;r++){let e=[1];for(let r=1;r<=t.length;r++)e[r]=(t[r]||0)+t[r-1];t=e}return t}(o),t=function(e){const t=1-e,a=[0,1,2].map((a=>r.reduce(((r,s,f)=>r+n[f]*t**(o-f)*e**f*s[a]),0)));return new x(a,"lab")}}}return t}(e);return t.scale=()=>Ae(t),t},blend:Ee,brewer:ot,Color:x,colors:N,contrast:(e,t)=>{e=new x(e),t=new x(t);const r=e.luminance(),n=t.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},contrastAPCA:(e,t)=>{e=new x(e),t=new x(t),e.alpha()<1&&(e=W(t,e,e.alpha(),"rgb"));const r=Ie(...e.rgb()),n=Ie(...t.rgb()),o=r>=Ze?r:r+Math.pow(Ze-r,1.414),a=n>=Ze?n:n+Math.pow(Ze-n,1.414),s=Math.pow(a,.56)-Math.pow(o,.57),f=Math.pow(a,.65)-Math.pow(o,.62),l=Math.abs(a-o)<5e-4?0:o<a?1.14*s:1.14*f;return 100*(Math.abs(l)<.1?0:l>0?l-.027:l+.027)},cubehelix:function(e=300,t=-1.5,r=1,n=1,o=[0,1]){let a,f=0;"array"===l(o)?a=o[1]-o[0]:(a=0,o=[o,o]);const c=function(l){const c=m*((e+120)/360+t*l),i=Pe(o[0]+a*l,n),u=(0!==f?r[0]+l*f:r)*i*(1-i)/2,h=Be(c),d=$e(c);return v(s([255*(i+u*(-.14861*h+1.78277*d)),255*(i+u*(-.29227*h-.90649*d)),255*(i+u*(1.97294*h)),1]))};return c.start=function(t){return null==t?e:(e=t,c)},c.rotations=function(e){return null==e?t:(t=e,c)},c.gamma=function(e){return null==e?n:(n=e,c)},c.hue=function(e){return null==e?r:("array"===l(r=e)?(f=r[1]-r[0],0===f&&(r=r[1])):f=0,c)},c.lightness=function(e){return null==e?o:("array"===l(e)?(o=e,a=e[1]-e[0]):(o=[e,e],a=0),c)},c.scale=()=>v.scale(c),c.hue(r),c},deltaE:function(e,t,r=1,n=1,o=1){var a=function(e){return 360*e/(2*Qe)},s=function(e){return 2*Qe*e/360};e=new x(e),t=new x(t);const[f,l,c]=Array.from(e.lab()),[i,u,h]=Array.from(t.lab()),d=(f+i)/2,b=(Fe(We(l,2)+We(c,2))+Fe(We(u,2)+We(h,2)))/2,g=.5*(1-Fe(We(b,7)/(We(b,7)+We(25,7)))),m=l*(1+g),p=u*(1+g),w=Fe(We(m,2)+We(c,2)),y=Fe(We(p,2)+We(h,2)),k=(w+y)/2,M=a(Ue(c,m)),v=a(Ue(h,p)),N=M>=0?M:M+360,_=v>=0?v:v+360,A=Ve(N-_)>180?(N+_+360)/2:(N+_)/2,j=1-.17*De(s(A-30))+.24*De(s(2*A))+.32*De(s(3*A+6))-.2*De(s(4*A-63));let E=_-N;E=Ve(E)<=180?E:_<=N?E+360:E-360,E=2*Fe(w*y)*He(s(E)/2);const C=i-f,R=y-w,P=1+.015*We(d-50,2)/Fe(20+We(d-50,2)),$=1+.045*k,B=1+.015*k*j,O=30*Je(-We((A-275)/25,2)),L=-(2*Fe(We(k,7)/(We(k,7)+We(25,7))))*He(2*s(O)),Y=Fe(We(C/(r*P),2)+We(R/(n*$),2)+We(E/(o*B),2)+L*(R/(n*$))*(E/(o*B)));return Te(0,Ke(100,Y))},distance:function(e,t,r="lab"){e=new x(e),t=new x(t);const n=e.get(r),o=t.get(r);let a=0;for(let e in n){const t=(n[e]||0)-(o[e]||0);a+=t*t}return Math.sqrt(a)},input:M,interpolate:W,limits:Se,mix:W,random:()=>{let e="#";for(let t=0;t<6;t++)e+="0123456789abcdef".charAt(Oe(16*Le()));return new x(e,"hex")},scale:Ae,scales:et,valid:(...e)=>{try{return new x(...e),!0}catch(e){return!1}}});class St extends t.BarElement{constructor(){super(...arguments),this.align="center",this.next=void 0,this.previous=void 0}getBounds(e=!1){const{x:t,y:r,base:n,width:o,height:a,horizontal:s}=this.getProps(["x","y","base","width","height","horizontal"],e);if(s){const e=Math.abs(t-n),o=a/2;return{left:n-("left"!==this.align?e:0),top:r-o,right:n+("right"!==this.align?e:0),bottom:r+o,horizontal:s}}{const e=Math.abs(r-n),a=o/2,f=t+a;return{left:t-a,top:n-("right"!==this.align?e:0),right:f,bottom:n+("left"!==this.align?e:0),horizontal:s}}}inRange(e,t,r){const n=this.getBounds(r),o=null==e||zt(e,n.left,n.right),a=null==t||zt(t,n.top,n.bottom);return o&&a}inXRange(e,t){return this.inRange(e,null,t)}inYRange(e,t){return this.inRange(null,e,t)}getCenterPoint(e){const{x:t,y:r,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{center:{x:o?n:t,y:o?r:n},left:{x:o?(n+t)/2:t,y:o?r:(n+r)/2},right:{x:o?n-(t-n)/2:t,y:o?r:n-(r+n)/2}}[this.align]}tooltipPosition(e){return this.getCenterPoint(e)}getRange(e){const{width:t,height:r}=this.getProps(["width","height"]);return"x"===e?t:r}computeWayPoints(e=!1){let t=this.options.shrinkAnchor,r=Math.max(Math.min(this.options.shrinkFraction,1),0);0===r&&(t="none",r=1);let n=this.getBounds(e);const o=n.horizontal;let a=!this.next||"top"!==t&&"middle"!==t?n:this.next.getBounds(e),s=!this.previous||"bottom"!==t&&"middle"!==t?n:this.previous.getBounds(e);o||(n=Xt(n),a=Xt(a),s=Xt(s));const f=Math.floor((n.bottom-n.top)*(1-r)),l=Math.floor((n.bottom-n.top-f)/2),c=[],i=[];if("none"===t||"top"===t)c.push([n.left,n.top],[n.right,n.top]);else{let e=1;if("middle"===t){e=l/(Math.floor((s.bottom-s.top)*r*.5)+l)}c.push([n.left+(s.left-n.left)*e,n.top],[n.right+(s.right-n.right)*e,n.top])}if("middle"===t?(c.push([n.right,n.top+l]),c.push([n.right,n.bottom-l]),i.push([n.left,n.top+l]),i.push([n.left,n.bottom-l])):"top"===t&&r<1?(c.push([n.right,n.top+f]),i.push([n.left,n.top+f])):"bottom"===t&&r<1&&(c.push([n.right,n.bottom-f]),i.push([n.left,n.bottom-f])),"none"===t||"bottom"===t)c.push([n.right,n.bottom],[n.left,n.bottom]);else{let e=1;if("middle"===t){e=l/(Math.floor((a.bottom-a.top)*r*.5)+l)}c.push([n.right+(a.right-n.right)*e,n.bottom],[n.left+(a.left-n.left)*e,n.bottom])}return c.push(...i.reverse()),o?c:c.map((([e,t])=>[t,e]))}draw(e){const{options:t}=this;e.save(),e.beginPath();const r=this.computeWayPoints();e.moveTo(r[0][0],r[0][1]);for(const t of r.slice(1))e.lineTo(t[0],t[1]);t.backgroundColor&&(e.fillStyle=t.backgroundColor,e.fill()),t.borderColor&&(e.strokeStyle=t.borderColor,e.lineWidth=t.borderWidth,e.stroke()),e.restore()}}St.id="trapezoid",St.defaults={...t.BarElement.defaults,shrinkAnchor:"top",shrinkFraction:1},St.defaultRoutes=t.BarElement.defaultRoutes;class Zt extends t.BarController{getMinMax(e,t){const{max:r}=super.getMinMax(e,t);return{center:{min:-r,max:r},left:{min:0,max:r},right:{min:-r,max:0}}[this.options.align]}update(e){super.update(e);const t=this._cachedMeta.data||[];for(let e=0;e<t.length;e++)t[e].align=this.options.align,t[e].next=t[e+1],t[e].previous=t[e-1]}}Zt.id="funnel",Zt.defaults=r.merge({},[t.BarController.defaults,{dataElementType:St.id,barPercentage:1,align:"center",categoryPercentage:.98}]),Zt.overrides=r.merge({},[t.BarController.overrides,{plugins:{legend:{display:!1},colors:{enabled:!1},datalabels:{anchor:"start",textAlign:"center",font:{size:20},color:e=>Gt(e.chart.getDatasetMeta(e.datasetIndex).data[e.dataIndex].options.backgroundColor,t.Chart.defaults.color,"#ffffff"),formatter:(e,t)=>{var r,n;return`${null!==(n=null===(r=t.chart.data.labels)||void 0===r?void 0:r[t.dataIndex])&&void 0!==n?n:""}\n${(100*e).toLocaleString()}%`}}},scales:{_index_:{display:!1,padding:10,grid:{display:!1}},_value_:{display:!1,beginAtZero:!1,grace:0,grid:{display:!1}}},elements:{trapezoid:{backgroundColor(e){const t=e.chart.data.datasets[e.datasetIndex].data.length;return qt(e.dataIndex,t)}}}}]);class It extends t.Chart{constructor(e,r){super(e,function(e,r,n,o=[],a=[]){t.registry.addControllers(n),Array.isArray(o)?t.registry.addElements(...o):t.registry.addElements(o),Array.isArray(a)?t.registry.addScales(...a):t.registry.addScales(a);const s=r;return s.type=e,s}("funnel",r,Zt,St,[t.CategoryScale,t.LinearScale]))}}It.id=Zt.id,t.registry.addControllers(Zt),t.registry.addElements(St),e.FunnelChart=It,e.FunnelController=Zt,e.TrapezoidElement=St,e.blues=qt,e.pickForegroundColorToBackgroundColor=Gt}));
16//# sourceMappingURL=index.umd.min.js.map

Callers

nothing calls this directly

Calls 1

qtFunction · 0.70

Tested by

no test coverage detected