blockcharts 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +274 -171
- package/package.json +43 -6
- package/release/bc.d.ts +35 -2
- package/release/blocks/guide.axis.js +2 -2
- package/release/blocks/guide.grid.js +2 -2
- package/release/blocks/guide.kpi.js +2 -2
- package/release/blocks/guide.legend.js +2 -2
- package/release/blocks/interaction.animate.js +2 -2
- package/release/blocks/interaction.brush.js +2 -2
- package/release/blocks/interaction.click.js +3 -0
- package/release/blocks/interaction.crosshair.js +2 -2
- package/release/blocks/interaction.legend-filter.js +2 -2
- package/release/blocks/interaction.tooltip.js +2 -2
- package/release/blocks/interaction.zoom-controls.js +2 -2
- package/release/blocks/interaction.zoom.js +2 -2
- package/release/blocks/lib.columns.js +2 -2
- package/release/blocks/lib.curve.js +2 -2
- package/release/blocks/lib.pointer.js +2 -2
- package/release/blocks/lib.stats.js +2 -2
- package/release/blocks/lib.ticks.js +2 -2
- package/release/blocks/lib.view.js +2 -2
- package/release/blocks/mark.arc.js +2 -2
- package/release/blocks/mark.area.js +2 -2
- package/release/blocks/mark.boxplot.js +2 -2
- package/release/blocks/mark.candlestick.js +2 -2
- package/release/blocks/mark.line.js +2 -2
- package/release/blocks/mark.point.js +2 -2
- package/release/blocks/mark.polygon.js +2 -2
- package/release/blocks/mark.rect.js +2 -2
- package/release/blocks/mark.rule.js +2 -2
- package/release/blocks/mark.sankey.js +2 -2
- package/release/blocks/mark.text.js +2 -2
- package/release/blocks/mark.violin.js +2 -2
- package/release/blocks/renderer.canvas.js +2 -2
- package/release/blocks/renderer.svg.js +2 -2
- package/release/blocks/scale.band.js +2 -2
- package/release/blocks/scale.color.js +2 -2
- package/release/blocks/scale.linear.js +2 -2
- package/release/blocks/scale.log.js +2 -2
- package/release/blocks/scale.sequential.js +2 -2
- package/release/blocks/scale.size.js +2 -2
- package/release/blocks/scale.time.js +2 -2
- package/release/blocks/transform.aggregate.js +2 -2
- package/release/blocks/transform.bin.js +2 -2
- package/release/blocks/transform.calculate.js +2 -2
- package/release/blocks/transform.calendar.js +2 -2
- package/release/blocks/transform.contour.js +2 -2
- package/release/blocks/transform.decimate.js +2 -2
- package/release/blocks/transform.density.js +2 -2
- package/release/blocks/transform.filter.js +2 -2
- package/release/blocks/transform.fold.js +2 -2
- package/release/blocks/transform.funnel.js +2 -2
- package/release/blocks/transform.hexbin.js +2 -2
- package/release/blocks/transform.highlight.js +2 -2
- package/release/blocks/transform.marimekko.js +2 -2
- package/release/blocks/transform.quartiles.js +2 -2
- package/release/blocks/transform.sankey.js +2 -2
- package/release/blocks/transform.sort.js +2 -2
- package/release/blocks/transform.stack.js +2 -2
- package/release/blocks/transform.treemap.js +2 -2
- package/release/blocks/transform.waterfall.js +2 -2
- package/release/blocks/transform.window.js +2 -2
- package/release/core.js +3 -3
- package/release/frameworks/controller.d.mts +51 -0
- package/release/frameworks/controller.mjs +181 -0
- package/release/frameworks/element.d.mts +32 -0
- package/release/frameworks/element.mjs +95 -0
- package/release/frameworks/react.d.mts +10 -0
- package/release/frameworks/react.mjs +30 -0
- package/release/frameworks/svelte.d.mts +9 -0
- package/release/frameworks/svelte.mjs +17 -0
- package/release/frameworks/vue.d.mts +40 -0
- package/release/frameworks/vue.mjs +44 -0
- package/release/kits/basic.js +25 -22
- package/release/kits/basic.mjs +25 -22
- package/release/kits/composition.js +39 -36
- package/release/kits/composition.mjs +39 -36
- package/release/kits/dashboard.js +37 -34
- package/release/kits/dashboard.mjs +37 -34
- package/release/kits/full.js +64 -61
- package/release/kits/full.mjs +64 -61
- package/release/kits/timeseries.js +35 -32
- package/release/kits/timeseries.mjs +35 -32
- package/release/loader.js +2 -2
- package/release/manifest.json +326 -221
- package/release/schema/chart.schema.json +4155 -0
- package/release/schema/page.schema.json +4547 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(f){function u(n){const i=n.length;if(i<2)return 0;let e=0;for(let t=0;t<i;t++)e+=n[t];e/=i;let s=0;for(let t=0;t<i;t++)s+=(n[t]-e)*(n[t]-e);const l=Math.sqrt(s/(i-1)),c=t=>{const a=t*(i-1),o=Math.floor(a);return n[o]+(n[Math.min(i-1,o+1)]-n[o])*(a-o)},r=c(.75)-c(.25);return r>0?Math.min(l,r/1.34):l}const h={role:"lib",type:"stats",version:1,exports:{spread:u}};f.define(h)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(M){function h(s,e){const a=s/Math.max(1,e),o=Math.pow(10,Math.floor(Math.log10(a))),t=a/o;return(t<1.5?1:t<3?2:t<7?5:10)*o}const f=1e3;function u(s,e,a){const o=Math.min(s,e),t=Math.max(s,e),i=[];if(!(isFinite(o)&&isFinite(t)&&t-o>1e-12*Math.max(Math.abs(o),Math.abs(t))))return i;const n=h(t-o,a);if(!(n>0&&isFinite(n)))return i;const r=Math.min(100,Math.max(0,-Math.floor(Math.log10(n)))),p=Math.ceil(o/n-1e-9),x=Math.floor(t/n+1e-9);for(let c=p;c<=x&&i.length<f;c++){const l=+(c*n).toFixed(r);i.push({value:l,label:l.toFixed(r)})}return i}const m={role:"lib",type:"ticks",version:2,exports:{niceStep:h,roundTicks:u}};M.define(m)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function b(t){const s=t.baseDomain(),n=t(s[0]),i=t(s[1])-n;return!t.invert||!(isFinite(n)&&isFinite(i)&&i!==0)?null:{to:o=>(t(o)-n)/i,from:o=>o===0?s[0]:o===1?s[1]:t.invert(n+o*i),full:[0,1]}}function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(F){function b(t){const s=t.baseDomain(),n=t(s[0]),i=t(s[1])-n;return!t.invert||!(isFinite(n)&&isFinite(i)&&i!==0)?null:{to:o=>(t(o)-n)/i,from:o=>o===0?s[0]:o===1?s[1]:t.invert(n+o*i),full:[0,1]}}function w(t,s){const n=b(t.scales[s]),i=t.getView()[s];return n?[n.to(i[0]),n.to(i[1])]:[0,1]}function l(t,s,n,i){const o=b(t.scales[s]);if(!o)return;const{from:u,full:c}=o,[f,e]=c;if(i-n>=(e-f)*(1-1e-9)){t.setView(s,null);return}n<f&&(i+=f-n,n=f),i>e&&(n-=i-e,i=e),t.setView(s,[u(n),u(i)])}function M(t,s,n,i,o){const u=b(t.scales[s]);if(!u)return;const[c,f]=u.full,[e,r]=w(t,s),p=Math.min(f-c,Math.max((f-c)/i,(r-e)*n));if(o===void 0||!(r>e)){const g=o===void 0?(e+r)/2:o;return l(t,s,g-p/2,g+p/2)}const V=p/(r-e);l(t,s,o-(o-e)*V,o+(r-o)*V)}const m={role:"lib",type:"view",version:2,exports:{current:w,show:l,zoom:M}};F.define(m)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const $=Math.PI*2,
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(A){const $=Math.PI*2,N="var(--bc-text, #444)",_="var(--bc-kpi, var(--bc-text, #111))",D="var(--bc-grid, #edf0f4)",S=26,U=.03,M=t=>Math.round(t*100)/100,P=(t,e,l)=>Math.max(e,Math.min(l,t)),R=Math.PI/180,x=t=>typeof t=="number"&&isFinite(t)?t:void 0;function q(t){const e=x(t.startAngle)!==void 0?t.startAngle:0,l=x(t.endAngle)!==void 0?t.endAngle:e+360;if(!(l>e)||l-e>360)throw new Error(`mark.arc: endAngle ${l} has to be after startAngle ${e} and at most 360 degrees on (-90 to 90 is a half circle)`);return[e*R-Math.PI/2,l*R-Math.PI/2]}function G(t,e,l){const o=[],s=[],a=(r,n)=>{o.push(r*Math.cos(n)),s.push(r*Math.sin(n))};a(1,t),a(1,e),a(l,t),a(l,e);for(let r=Math.ceil(t/(Math.PI/2));r*(Math.PI/2)<=e;r++)a(1,r*(Math.PI/2));return{x0:Math.min(...o),x1:Math.max(...o),y0:Math.min(...s),y1:Math.max(...s)}}function I(t,e){const l=e.channel(t,"value").raw,o=t.color!==void 0?e.channel(t,"color").mapped:null,{from:s,to:a}=e.rows(t),r=[];let n=0;for(let d=s;d<a;d++){const f=l[d];typeof f!="number"||!isFinite(f)||f<=0||o&&!o[d]||(r.push(d),n+=f)}if(!r.length&&!((x(t.total)||0)>0))return null;t.sort==="desc"?r.sort((d,f)=>l[f]-l[d]||d-f):t.sort==="asc"&&r.sort((d,f)=>l[d]-l[f]||d-f);const h=t.label==="percent"||t.label==="value",{x:u,y:c,w:i,h:y}=e.plot,m=typeof t.innerRadius=="number"?P(t.innerRadius,0,.95):0,[g,v]=q(t),b=G(g,v,m),L=h?S:4,w=Math.max(1,Math.min((i-2*L)/(b.x1-b.x0),(y-2*L)/(b.y1-b.y0))),k=x(t.total);if(t.total!==void 0&&!(k!==void 0&&k>0))throw new Error(`mark.arc: total has to be a positive number (the maximum of a gauge), not ${JSON.stringify(t.total)}`);const T=k!==void 0?k:n,K=v-g;let p=g;const O=[];for(const d of r){if(p>=v)break;const f=l[d],Z=f/T,z={row:d,a0:p,a1:Math.min(v,p+Z*K),frac:Z,value:f};p=z.a1,O.push(z)}return{cx:u+i/2-w*(b.x0+b.x1)/2,cy:c+y/2-w*(b.y0+b.y1)/2,R:w,r0:w*m,slices:O,start:g,end:v,sum:n,whole:T}}function E(t,e,l){const{cx:o,cy:s,R:a,r0:r}=t,n=(c,i)=>`${M(o+c*Math.cos(i))} ${M(s+c*Math.sin(i))}`;if(l-e>=$-1e-6){let c=`M${n(a,e)}A${a} ${a} 0 1 1 ${n(a,e+Math.PI)}A${a} ${a} 0 1 1 ${n(a,e)}Z`;return r>0&&(c+=`M${n(r,e)}A${r} ${r} 0 1 0 ${n(r,e+Math.PI)}A${r} ${r} 0 1 0 ${n(r,e)}Z`),c}const h=l-e>Math.PI?1:0,u=`M${n(a,e)}A${a} ${a} 0 ${h} 1 ${n(a,l)}`;return r>0?`${u}L${n(r,l)}A${r} ${r} 0 ${h} 0 ${n(r,e)}Z`:`${u}L${M(o)} ${M(s)}Z`}function F(t,e,l,o,s){return t.color!==void 0?e.channel(t,"color").mapped[o]||"":typeof t.fill=="string"?t.fill:e.color(l+s)}const J={role:"mark",type:"arc",version:7,enter:"pop",params:{innerRadius:{kind:"number",default:0},startAngle:{kind:"number",default:0},endAngle:{kind:"number"},total:{kind:"number"},center:{kind:"enum",values:["none","value","percent"],default:"none"},padAngle:{kind:"number",default:1},sort:{kind:"enum",values:["none","desc","asc"],default:"none"},label:{kind:"enum",values:["none","percent","value"],default:"none"},labelFormat:{kind:"format"},fill:{kind:"color"},opacity:{kind:"number",default:1}},channels:{value:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,e,l){const o=I(t,e);if(!o)return[];const s=(typeof t.padAngle=="number"?Math.max(0,t.padAngle):1)*Math.PI/180,a=typeof t.opacity=="number"?t.opacity:void 0,r=[];if(x(t.total)!==void 0&&r.push({type:"path",d:E(o,o.start,o.end),style:{fill:D},cls:"bc-arc-track"}),o.slices.forEach((n,h)=>{const u=F(t,e,l,n.row,h),c=o.slices.length>1?Math.min(s,(n.a1-n.a0)*.5):0;if(r.push({type:"path",d:E(o,n.a0+c/2,n.a1-c/2),style:{fill:u,opacity:a},ref:{mark:l,row:n.row}}),(t.label==="percent"||t.label==="value")&&n.frac>=U){const i=(n.a0+n.a1)/2,y=o.cx+(o.R+10)*Math.cos(i),m=o.cy+(o.R+10)*Math.sin(i),g=t.labelFormat!==void 0?A.formatter(t.labelFormat)(t.label==="percent"?n.frac:n.value):t.label==="percent"?`${Math.round(n.frac*100)}%`:String(Number.isInteger(n.value)?n.value:+n.value.toPrecision(6));r.push({type:"text",x:M(y),y:M(m),text:g,size:11,anchor:Math.cos(i)>.2?"start":Math.cos(i)<-.2?"end":"middle",baseline:"middle",style:{fill:N}})}}),t.center==="value"||t.center==="percent"){const n=t.center==="percent"?o.sum/o.whole:o.sum,h=t.labelFormat!==void 0?A.formatter(t.labelFormat)(n):t.center==="percent"?`${Math.round(n*100)}%`:A.formatter("compact")(n),u=o.r0>0?o.r0:o.R*.6;let c=P(u*.45,10,44);const i=e.measure(h,c).w;i>u*1.6&&(c=Math.max(10,c*u*1.6/i));const m=Math.PI/2+Math.ceil((o.start-Math.PI/2)/$)*$<=o.end;r.push({type:"text",x:M(o.cx),y:M(m?o.cy:o.cy-4),text:h,size:M(c),weight:650,anchor:"middle",baseline:m?"middle":"auto",style:{fill:_},cls:"bc-arc-center"})}return r},pick(t,e,l,o,s){const a=I(t,e);if(!a)return null;const r=o-a.cx,n=s-a.cy,h=Math.hypot(r,n);if(h>a.R||h<a.r0)return null;let u=Math.atan2(n,r)-a.start;u=(u%$+$)%$;const c=a.start+u;for(const i of a.slices)if(c>=i.a0&&c<i.a1){const y=(i.a0+i.a1)/2,m=(a.R+a.r0)/2;return{row:i.row,x:a.cx+m*Math.cos(y),y:a.cy+m*Math.sin(y),dist:0}}return null},color(t,e,l,o){const s=I(t,e),a=s?s.slices.findIndex(r=>r.row===o):-1;return a<0?"":F(t,e,l,o,a)}};A.define(J)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const v=t=>Math.round(t*100)/100,
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(B){const v=t=>Math.round(t*100)/100,O=(t,e,l,o)=>B.get("lib.curve").exports.through(t,e,l,o);function C(t,e){const l=t(e);return isFinite(l)?l:t(Math.min(...t.domain()))}const W=new WeakMap,A=new WeakMap;function N(t,e){const l=e.channel(t,"y"),o=e.channel(t,"y2"),a=typeof t.baseline=="number"?t.baseline:0,n=o.raw.length?NaN:t.toBottom===!0?e.plot.y+e.plot.h:l.scale?C(l.scale,a):NaN,r=e.channel(t,"x");let u=r.half?W.get(r):r.mapped;return u||W.set(r,u=Array.from(r.mapped,p=>p+r.half)),{xs:u,top:l.mapped,bottom:p=>o.raw.length?o.mapped[p]:n}}function L(t,e,l,o,a){return typeof t.fill=="string"?t.fill:t.color!==void 0?e.channel(t,"color").mapped[o[0]]||"":e.color(l+a)}const E={role:"mark",type:"area",version:16,requires:["lib.curve"],series:!0,enter:"wipe",narrow:!0,params:{baseline:{kind:"number",default:0},group:{kind:"field"},fill:{kind:"color"},opacity:{kind:"number",default:.85},toBottom:{kind:"boolean",default:!1},fade:{kind:"boolean",default:!1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,e,l){const{xs:o,top:a,bottom:n}=N(t,e),r=t.fade===!0,u=typeof t.opacity=="number"?t.opacity:r?.45:.85,p=t.curve==="smooth"||t.curve==="step"?t.curve:"linear",w=[];return e.series(t,o).forEach(({rows:y},s)=>{const d=L(t,e,l,y,s);if(!d)return;let m="",i=[];const f=()=>{if(i.length){const c=i.map(b=>o[b]),M=i.map(b=>a[b]),g=i.map(b=>n(b)),k=i.length-1;m+="M"+v(c[0])+" "+v(M[0])+O(c,M,p,!1),m+="L"+v(c[k])+" "+v(g[k])+O(c,g,p,!0),m+="Z"}i=[]};for(const c of y)isFinite(o[c])&&isFinite(a[c])&&isFinite(n(c))?i.push(c):f();f(),m&&w.push({type:"path",d:m,style:r?{fill:d,fillOpacity:u,fade:!0}:{fill:d,fillOpacity:u,stroke:d,strokeWidth:1,strokeLinejoin:"round"}})}),w},pick(t,e,l,o,a){const{xs:n,top:r,bottom:u}=N(t,e),p=t.color!==void 0?e.channel(t,"color"):null;let w=null;for(const{rows:y}of e.series(t,n)){if(p&&!p.mapped[y[0]])continue;let s=A.get(y);if(s||A.set(y,s=y.filter(h=>isFinite(n[h])&&isFinite(r[h])&&isFinite(u(h)))),!s.length||o<n[s[0]]||o>n[s[s.length-1]])continue;let d=0,m=s.length-1;for(;d<m;){const h=d+m+1>>1;n[s[h]]<=o?d=h:m=h-1}const i=s[d],f=s[Math.min(d+1,s.length-1)],c=n[f]-n[i],M=c>0?Math.min(1,Math.max(0,(o-n[i])/c)):0,g=o<n[f]?i:f,k=t.curve==="step",b=k?r[g]:r[i]+(r[f]-r[i])*M,T=k?u(g):u(i)+(u(f)-u(i))*M;if(a<Math.min(b,T)-1||a>Math.max(b,T)+1)continue;const j=h=>n[h]>=e.plot.x-.5&&n[h]<=e.plot.x+e.plot.w+.5,q=k?g:Math.abs(o-n[i])<=Math.abs(o-n[f])?i:f,F=j(q)?q:q===i?f:i;j(F)&&(w={row:F,x:n[F],y:r[F],dist:0})}return w},color(t,e,l,o){const a=e.series(t,N(t,e).xs);for(let n=0;n<a.length;n++)if(a[n].rows.includes(o))return L(t,e,l,a[n].rows,n);return""}};B.define(E)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function L(t,n,c){const i=t.color!==void 0?n.channel(t,"color").mapped:null,m=typeof t.fill=="string"&&t.fill||n.color(c);return r=>i?i[r]||"":m}const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(T){function L(t,n,c){const i=t.color!==void 0?n.channel(t,"color").mapped:null,m=typeof t.fill=="string"&&t.fill||n.color(c);return r=>i?i[r]||"":m}const v="var(--bc-text, #333)",B={role:"mark",type:"boxplot",version:5,params:{width:{kind:"number",default:.6},fill:{kind:"color"},fillOpacity:{kind:"number",default:.85},strokeWidth:{kind:"number",default:1.5},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},low:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q1:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},median:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q3:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}}},render(t,n,c){const i=n.channel(t,"x"),m=n.channel(t,"low"),r=n.channel(t,"q1"),W=n.channel(t,"median"),O=n.channel(t,"q3"),S=n.channel(t,"high"),H=L(t,n,c),b=i.scale&&i.scale.bandwidth!==void 0?i.scale.bandwidth:0,a=typeof t.width=="number"&&t.width>0?t.width:.6,s=b?a<=1?b*a:Math.min(a,b):a>1?a:16,$=b/2,Q=typeof t.fillOpacity=="number"?t.fillOpacity:.85,M=typeof t.strokeWidth=="number"?t.strokeWidth:1.5,F=typeof t.opacity=="number"?t.opacity:void 0,{from:y,to:e}=n.rows(t),l=[];for(let o=y;o<e;o++){const u=m.mapped[o],d=r.mapped[o],w=W.mapped[o],h=O.mapped[o],p=S.mapped[o];if(!isFinite(u)||!isFinite(d)||!isFinite(w)||!isFinite(h)||!isFinite(p))continue;const x=i.mapped[o];if(!isFinite(x))continue;const k=H(o);if(!k)continue;const q=x+$,f=q-s/2,g=q+s/2,C=Math.min(d,h),Y=Math.abs(d-h);l.push({type:"path",ref:{mark:c,row:o},d:`M${q} ${u}L${q} ${p}M${f} ${u}L${g} ${u}M${f} ${p}L${g} ${p}`,style:{stroke:k,strokeWidth:M,opacity:F}}),l.push({type:"rect",x:f,y:C,w:s,h:Y,style:{fill:k,fillOpacity:Q,stroke:k,strokeWidth:M,opacity:F},ref:{mark:c,row:o}}),l.push({type:"path",d:`M${f} ${w}L${g} ${w}`,style:{stroke:v,strokeWidth:M+.5,opacity:F}})}return l},pick(t,n,c,i,m){const r=n.channel(t,"x"),W=n.channel(t,"low"),O=n.channel(t,"q1"),S=n.channel(t,"q3"),H=n.channel(t,"high"),b=L(t,n,c),a=r.scale&&r.scale.bandwidth!==void 0?r.scale.bandwidth:0,s=typeof t.width=="number"&&t.width>0?t.width:.6,$=a?s<=1?a*s:Math.min(s,a):s>1?s:16,Q=a/2,{from:M,to:F}=n.rows(t),y=4;for(let e=F-1;e>=M;e--){if(!b(e))continue;const l=W.mapped[e],o=O.mapped[e],u=S.mapped[e],d=H.mapped[e],w=r.mapped[e];if(!isFinite(l)||!isFinite(o)||!isFinite(u)||!isFinite(d)||!isFinite(w))continue;const h=w+Q,p=h-$/2,x=h+$/2,k=Math.min(l,d)-y,q=Math.max(l,d)+y;if(i>=p-y&&i<=x+y&&m>=k&&m<=q){const f=Math.min(o,u),g=Math.abs(o-u);return{row:e,x:h,y:f,dist:0,box:{x:p,y:f,w:$,h:g}}}}return null},color(t,n,c,i){return L(t,n,c)(i)}};T.define(B)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const w="var(--bc-good, #12a150)",y="var(--bc-bad, #e5484d)";function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(x){const w="var(--bc-good, #12a150)",y="var(--bc-bad, #e5484d)";function k(t){const e=t.slice().sort((i,o)=>i-o);let s=1/0;for(let i=1;i<e.length;i++){const o=e[i]-e[i-1];o>1e-6&&o<s&&(s=o)}return s===1/0?0:s}function m(t,e){const s=e.channel(t,"x"),i=e.channel(t,"open"),o=e.channel(t,"high"),a=e.channel(t,"low"),d=e.channel(t,"close"),c=s.scale&&s.scale.bandwidth!==void 0?s.scale.bandwidth:0,{from:n,to:u}=e.rows(t),h=[];for(let r=n;r<u;r++){const l={row:r,x:s.mapped[r]+c/2,open:i.mapped[r],high:o.mapped[r],low:a.mapped[r],close:d.mapped[r]};![i,o,a,d].every(M=>typeof M.raw[r]=="number")||![l.x,l.open,l.high,l.low,l.close].every(isFinite)||h.push({...l,up:l.close<=l.open})}const p=c||k(h.map(r=>r.x))||e.plot.w*.1,f=typeof t.width=="number"&&t.width>0?Math.min(1,t.width):.7;return{candles:h,width:Math.max(1,p*f),step:p}}function b(t,e){return e.up?typeof t.up=="string"?t.up:w:typeof t.down=="string"?t.down:y}const g={role:"mark",type:"candlestick",version:4,params:{width:{kind:"number",default:.7},up:{kind:"color",default:w},down:{kind:"color",default:y},strokeWidth:{kind:"number",default:1},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},open:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},low:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},close:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"}},render(t,e,s){const{candles:i,width:o}=m(t,e),a=typeof t.opacity=="number"?t.opacity:void 0,d=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:1,c=[];for(const n of i){const u=b(t,n);c.push({type:"path",d:`M${n.x} ${n.high}L${n.x} ${n.low}`,style:{stroke:u,strokeWidth:d,opacity:a}}),c.push({type:"rect",x:n.x-o/2,y:Math.min(n.open,n.close),w:o,h:Math.max(1,Math.abs(n.open-n.close)),style:{fill:u,opacity:a},ref:{mark:s,row:n.row}})}return c},pick(t,e,s,i){const{candles:o,width:a,step:d}=m(t,e),c=Math.max(a/2,Math.min(d/2,12));let n=null,u=1/0;for(const f of o){const r=Math.abs(f.x-i);r<=c&&r<u&&(n=f,u=r)}if(!n)return null;const h=Math.min(n.open,n.close),p=Math.max(1,Math.abs(n.open-n.close));return{row:n.row,x:n.x,y:h,dist:u,box:{x:n.x-a/2,y:h,w:a,h:p}}},color(t,e,s,i){const o=m(t,e).candles.find(a=>a.row===i);return o?b(t,o):""}};x.define(g)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(S){const C=n=>Math.round(n*100)/100;function L(n,e){const l=e.channel(n,"x");if(!l.half)return l.mapped;let o=F.get(l);return o||F.set(l,o=Array.from(l.mapped,t=>t+l.half)),o}const F=new WeakMap,W=new WeakMap;function _(n,e,l,o,t){return typeof n.stroke=="string"?n.stroke:n.color!==void 0?e.channel(n,"color").mapped[o[0]]||"":e.color(l+t)}function I(n,e,l){const o=n.label==="name"||n.label==="value"||n.label==="both"?n.label:"none";if(o==="none")return[];const t=L(n,e),r=e.channel(n,"y"),s=r.mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=typeof n.group=="string"||!!(M&&M.field),A=o==="value"||o==="both"?n.format!==void 0?S.formatter(n.format):i=>String(typeof i=="number"?+i.toPrecision(6):i):null,{x:b,y:c,w:a,h:m}=e.plot,v=i=>t[i]<=b+a+.5&&s[i]>=c-.5&&s[i]<=c+m+.5,f=[];return e.series(n,t).forEach(({key:i,rows:h},g)=>{const k=_(n,e,l,h,g);if(!k)return;let d=-1;for(const w of h)isFinite(t[w])&&isFinite(s[w])&&v(w)&&(d=w);if(d<0)return;const y=E?String(i):typeof n.name=="string"?n.name:r.field||"",p=A?A(r.raw[d]):"",u=o==="name"?y:o==="value"?p:y&&p?`${y} ${p}`:y||p;u&&f.push({x:t[d],y:s[d],text:u,color:k,owner:l})}),f}function q(n,e,l){n.sort((t,r)=>t.y-r.y);for(let t=1;t<n.length;t++)n[t].y=Math.max(n[t].y,n[t-1].y+14);const o=n.length?n[n.length-1].y-l:0;if(o>0)for(const t of n)t.y-=o;for(let t=0;t<n.length;t++)n[t].y=Math.max(n[t].y,e+t*14)}const G=(n,e,l,o)=>S.get("lib.curve").exports.through(n,e,l,o),O={role:"mark",type:"line",version:23,requires:["lib.curve"],series:!0,enter:"wipe",narrow:n=>n.label!=="name"&&n.label!=="value"&&n.label!=="both",params:{group:{kind:"field"},stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"},label:{kind:"enum",values:["none","name","value","both"],default:"none"},format:{kind:"format"},name:{kind:"string"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color",input:["category"]}}},render(n,e,l){const o=L(n,e),t=e.channel(n,"y").mapped,r=n.color!==void 0?e.channel(n,"color"):null,s=typeof n.group=="string"||!!(r&&r.field),M=typeof n.strokeWidth=="number"?n.strokeWidth:2,E=Array.isArray(n.dash)?n.dash:void 0,A=typeof n.opacity=="number"?n.opacity:void 0,b=n.curve==="smooth"||n.curve==="step"?n.curve:"linear",c=[];return e.series(n,o).forEach(({key:a,rows:m},v)=>{let f="",i=[],h=[];const g=()=>{i.length&&(f+="M"+C(i[0])+" "+C(h[0])+G(i,h,b,!1)),i=[],h=[]};for(const d of m){const y=o[d],p=t[d];if(!isFinite(y)||!isFinite(p)){g();continue}i.push(y),h.push(p)}if(g(),!f)return;const k=_(n,e,l,m,v);k&&c.push({type:"path",d:f,title:s?String(a):void 0,style:{fill:"none",stroke:k,strokeWidth:M,strokeDash:E,opacity:A,strokeLinejoin:"round",strokeLinecap:"round"}})}),c},labels(n,e,l){if(!I(n,e,l).length)return[];const o=[];return e.spec.marks.forEach((t,r)=>{t.type==="line"&&o.push(...I(t,e,r))}),q(o,e.plot.y,e.plot.y+e.plot.h),o.filter(t=>t.owner===l).map(t=>({type:"text",x:t.x+8,y:t.y,text:t.text,size:11,weight:600,anchor:"start",baseline:"middle",style:{fill:t.color},cls:"bc-line-label"}))},pick(n,e,l,o,t){const r=L(n,e),s=e.channel(n,"y").mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=e.alongX?1/0:14,A=c=>r[c]>=e.plot.x-.5&&r[c]<=e.plot.x+e.plot.w+.5;let b=null;for(const{rows:c}of e.series(n,r)){if(M&&!M.mapped[c[0]])continue;let a=W.get(c);if(a||W.set(c,a=c.filter(u=>isFinite(r[u])&&isFinite(s[u]))),!a.length||o<r[a[0]]-14||o>r[a[a.length-1]]+14)continue;let m=0,v=a.length-1;for(;m<v;){const u=m+v+1>>1;r[a[u]]<=o?m=u:v=u-1}const f=a[m],i=a[Math.min(m+1,a.length-1)];let h,g;if(n.curve==="step"){const u=(R,B)=>t>=Math.min(s[R],s[B])&&t<=Math.max(s[R],s[B])?Math.abs(o-r[B]):1/0,w=Math.abs(t-(o<r[i]?s[f]:s[i])),H=u(a[Math.max(0,m-1)],f),P=u(f,i);h=Math.min(w,H,P),g=P>h&&(o<r[i]||H===h)}else{const u=r[i]-r[f],w=u>0?Math.min(1,Math.max(0,(o-r[f])/u)):0;h=Math.abs(t-(s[f]+(s[i]-s[f])*w)),g=Math.abs(o-r[f])<=Math.abs(o-r[i])}if(h>E||b&&h>=b.dist)continue;A(g?f:i)||(g=!g);const k=g?f:i;if(!A(k))continue;b={row:k,x:r[k],y:s[k],dist:h};let d=g?m:Math.min(m+1,a.length-1),y=d;const p=u=>r[a[u]]===r[k]&&s[a[u]]===s[k];for(;d>0&&p(d-1);)d--;for(;y<a.length-1&&p(y+1);)y++;y>d&&(b.rows=a.slice(d,y+1))}return b},color(n,e,l,o){const t=e.series(n,L(n,e));for(let r=0;r<t.length;r++)if(t[r].rows.includes(o))return _(n,e,l,t[r].rows,r);return""}};S.define(O)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function E(t,o){if(t.size!==void 0){const r=o.channel(t,"size").mapped;return c=>r[c]}const a=typeof t.r=="number"?t.r:3;return()=>a}function W(t,o,a){const r=t.color!==void 0?o.channel(t,"color").mapped:null,c=typeof t.fill=="string"?t.fill:o.color(a);return i=>r?r[i]||"":c}function A(t,o,a){const{from:r,to:c}=o.rows(t),i=[];for(let h=r;h<c;h++)i.push(h);if(t.size!==void 0){const h=m=>{const f=a(m);return isFinite(f)?f:-1};i.sort((m,f)=>h(f)-h(m)||m-f)}return i}const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(L){function E(t,o){if(t.size!==void 0){const r=o.channel(t,"size").mapped;return c=>r[c]}const a=typeof t.r=="number"?t.r:3;return()=>a}function W(t,o,a){const r=t.color!==void 0?o.channel(t,"color").mapped:null,c=typeof t.fill=="string"?t.fill:o.color(a);return i=>r?r[i]||"":c}function A(t,o,a){const{from:r,to:c}=o.rows(t),i=[];for(let h=r;h<c;h++)i.push(h);if(t.size!==void 0){const h=m=>{const f=a(m);return isFinite(f)?f:-1};i.sort((m,f)=>h(f)-h(m)||m-f)}return i}const T=new WeakMap;function D(t,o,a){if(t.swarm!==!0)return null;const r=o.channel(t,"x"),c=o.channel(t,"y"),i=!!(r.scale&&r.scale.bandwidth!==void 0),h=!!(c.scale&&c.scale.bandwidth!==void 0);if(i===h)throw new Error("mark.point: swarm spreads the points of a category across its band, so one of x and y needs a band scale and the other a value");const m=T.get(i?c:r);if(m)return m;const f=i?r.mapped:c.mapped,g=(i?r:c).scale.bandwidth/2,l=i?c.mapped:r.mapped,s=typeof t.swarmGap=="number"&&t.swarmGap>=0?t.swarmGap:1,p=typeof t.swarmShrink=="number"&&t.swarmShrink>=0?Math.min(t.swarmShrink,.9):.5,d=new Float64Array(l.length),u=[],b=new Map,{from:x,to:v}=o.rows(t);for(let n=x;n<v;n++){if(!isFinite(f[n])||!isFinite(l[n])||!isFinite(a(n)))continue;const w=b.get(f[n]);w?w.push(n):(b.set(f[n],[n]),u.push(b.get(f[n])))}for(const n of u)n.sort((w,k)=>l[w]-l[k]||w-k);const y=(n,w)=>{const k=s*n;for(const S of u){let B=0;for(const M of S)B=Math.max(B,a(M)*n);const C=[];let I=0,P=0;for(const M of S){const O=a(M)*n,H=Math.max(0,g-O);for(;I<C.length&&l[C[I]]<l[M]-O-B-k;)I++;const J=C.slice(I),K=X=>J.every(z=>{const Y=O+a(z)*n+k,q=l[M]-l[z],G=X-d[z];return q*q+G*G>=Y*Y-1e-6});let $=0;if(!K(0)){$=1/0;for(const X of J){const z=O+a(X)*n+k,Y=l[M]-l[X];if(Math.abs(Y)>=z)continue;const q=Math.sqrt(z*z-Y*Y);for(const G of[d[X]+q,d[X]-q])Math.abs(G)<=H&&Math.abs(G)<Math.abs($)&&K(G)&&($=G)}}if(isFinite($))d[M]=$,C.push(M);else{if(w)return!1;d[M]=H*(P++*.618034%1*2-1)}}}return!0};let e=1;if(p>0&&!y(1,!0)){let n=1-p;if(y(n,!0)){let w=1;for(let k=0;k<8;k++){const S=(n+w)/2;y(S,!0)?n=S:w=S}}e=n}y(e,!1);const F={across:i?"x":"y",shift:d,k:e};return T.set(i?c:r,F),F}const N={role:"mark",type:"point",version:16,narrow:!0,params:{r:{kind:"number",default:3},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"string"},swarm:{kind:"boolean",default:!1},swarmGap:{kind:"number",default:1},swarmShrink:{kind:"number",default:.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},color:{accepts:{output:"color"}},size:{accepts:{output:"size"}}},render(t,o,a){const r=o.channel(t,"x"),c=o.channel(t,"y"),i=r.half,h=c.half,m=E(t,o),f=typeof t.opacity=="number"?t.opacity:void 0,g=typeof t.stroke=="string"?t.stroke:void 0,l=W(t,o,a),s=D(t,o,m),p=f===void 0||f>=1?new Set:null,d=[];for(const u of A(t,o,m)){const b=r.mapped[u]+(s&&s.across==="x"?s.shift[u]:0),x=c.mapped[u]+(s&&s.across==="y"?s.shift[u]:0),v=m(u)*(s?s.k:1);if(!isFinite(b)||!isFinite(x)||!isFinite(v))continue;const y=l(u);if(y){if(p){const e=`${b},${x},${v},${y}`;if(p.has(e))continue;p.add(e)}d.push({type:"circle",cx:b+i,cy:x+h,r:v,style:g?{fill:y,opacity:f,stroke:g,strokeWidth:1}:{fill:y,opacity:f},ref:{mark:a,row:u}})}}return d},pick(t,o,a,r,c){const i=o.channel(t,"x"),h=o.channel(t,"y"),m=i.half,f=h.half,g=E(t,o),l=W(t,o,a),s=D(t,o,g);let p=-1,d=1/0,u=0,b=0;for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0),w=g(e)*(s?s.k:1);if(!isFinite(F)||!isFinite(n)||!isFinite(w)||!l(e))continue;const k=Math.max(0,Math.hypot(F-r,n-c)-w);k<=d&&(d=k,p=e,u=F,b=n)}if(p<0||d>6)return null;const x=g(p),v=l(p),y=[];for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0);F===u&&n===b&&g(e)===x&&l(e)===v&&y.push(e)}return y.length>1?{row:p,x:u,y:b,dist:d,rows:y}:{row:p,x:u,y:b,dist:d}},color(t,o,a,r){return W(t,o,a)(r)}};L.define(N)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const h=n=>Math.round(n*100)/100;function y(n,t,l){const s=t.channel(n,"x").mapped,e=t.channel(n,"y").mapped,o=n.color!==void 0?t.channel(n,"color").mapped:null,r=typeof n.group=="string"?t.table.columns[n.group]:void 0,i=typeof n.ring=="string"?t.table.columns[n.ring]:void 0,d=typeof n.fill=="string"?n.fill:t.color(l),{from:
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(b){const h=n=>Math.round(n*100)/100;function y(n,t,l){const s=t.channel(n,"x").mapped,e=t.channel(n,"y").mapped,o=n.color!==void 0?t.channel(n,"color").mapped:null,r=typeof n.group=="string"?t.table.columns[n.group]:void 0,i=typeof n.ring=="string"?t.table.columns[n.ring]:void 0,d=typeof n.fill=="string"?n.fill:t.color(l),{from:c,to:a}=t.rows(n),g=new Map;for(let u=c;u<a;u++){const k=r?r[u]:null;let f=g.get(k);f||g.set(k,f={row:u,rings:[],ringKey:{}});const p=i?i[u]:null;(p!==f.ringKey||!f.rings.length)&&(f.rings.push([]),f.ringKey=p),isFinite(s[u])&&isFinite(e[u])&&f.rings[f.rings.length-1].push([s[u],e[u]])}const m=[];return g.forEach((u,k)=>{const f=o?o[u.row]:d;if(!f)return;const p=u.rings.filter(j=>j.length>2);p.length&&m.push({row:u.row,rings:p,color:f,key:k})}),m}function w(n,t,l){let s=0;for(const e of n)for(let o=0,r=e.length-1;o<e.length;r=o++){const[i,d]=e[r],[c,a]=e[o],g=(c-i)*(l-d)-(t-i)*(a-d);d<=l?a>l&&g>0&&s++:a<=l&&g<0&&s--}return s}const W={role:"mark",type:"polygon",version:4,params:{group:{kind:"field"},ring:{kind:"field"},filled:{kind:"boolean",default:!0},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"color"},strokeWidth:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position",input:["number","date"]}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color"}}},render(n,t,l){const s=n.filled!==!1,e=typeof n.opacity=="number"?n.opacity:void 0,o=typeof n.strokeWidth=="number"?n.strokeWidth:1,r=typeof n.stroke=="string"?n.stroke:void 0;return y(n,t,l).map(i=>({type:"path",d:i.rings.map(d=>"M"+d.map(([c,a])=>`${h(c)} ${h(a)}`).join("L")+"Z").join(""),style:s?{fill:i.color,fillOpacity:e,stroke:r,strokeWidth:r?o:void 0,strokeLinejoin:"round"}:{fill:"none",stroke:i.color,strokeWidth:o,strokeLinejoin:"round"},ref:{mark:l,row:i.row}}))},pick(n,t,l,s,e){const o=y(n,t,l);for(let r=o.length-1;r>=0;r--)if(w(o[r].rings,s,e)!==0)return{row:o[r].row,x:s,y:e,dist:0};return null},color(n,t,l,s){const e=typeof n.group=="string"?t.table.columns[n.group]:void 0,o=e?e[s]:null,r=y(n,t,l).find(i=>i.key===o||i.key!==i.key&&o!==o);return r?r.color:""}};b.define(W)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(M){function x(t,n,r,e){if(n.dodge===void 0)return null;const i=t.channel(n,"dodge").raw,o=new Map;for(let c=r;c<e;c++){const d=i[c];d==null||o.has(d)||o.set(d,o.size)}if(o.size<=1)return null;const a=typeof n.dodgePadding=="number"?Math.max(0,Math.min(.9,n.dodgePadding)):.1;return{col:i,order:o,padding:a}}function k(t,n,r){const e=t.color!==void 0?n.channel(t,"color").mapped:null,i=typeof t.fill=="string"?t.fill:n.color(r);return o=>e?e[o]||"":i}function L(t,n){const r=t(n);return isFinite(r)?r:t(Math.min(...t.domain()))}const $=.8,S=.1;function v(t,n,r){const e=r==="x"?"y":"x",i=t.channel(n,r),o=t.channel(n,e);return!i.scale||!o.scale||i.scale.bandwidth!==void 0||o.scale.bandwidth!==void 0||t.channel(n,r+"2").raw.length?!1:r==="y"?i.scale.input==="date"&&o.scale.input!=="date":!!t.channel(n,"y2").raw.length||o.scale.input!=="date"||i.scale.input==="date"}function A(t){const n=t.filter(e=>isFinite(e)).sort((e,i)=>e-i);let r=1/0;for(let e=1;e<n.length;e++)n[e]>n[e-1]&&n[e]-n[e-1]<r&&(r=n[e]-n[e-1]);return{lo:n[0],hi:n[n.length-1],step:r===1/0?0:r}}function F(t,n,r){const e=[];for(let o=n;o<r;o++)isFinite(t[o])&&e.push(t[o]);e.sort((o,a)=>o-a);let i=1/0;for(let o=1;o<e.length;o++)e[o]-e[o-1]>1e-6&&e[o]-e[o-1]<i&&(i=e[o]-e[o-1]);return i===1/0?0:i}function w(t,n,r,e,i){const o=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):1,a=t.channel(n,r),c=t.channel(n,r+"2"),d=a.scale?a.scale.bandwidth:void 0;if(v(t,n,r)){const{from:h,to:m}=t.rows(n),y=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):$,l=Math.max(1,(F(a.mapped,h,m)||t.plot.w*S)*y);return s=>isFinite(a.mapped[s])?[a.mapped[s]-l/2,l]:null}const b=!c.raw.length&&d===void 0&&a.scale?L(a.scale,e):NaN;return h=>{const m=a.mapped[h];let y,l;if(d!==void 0)if(i){const s=i.order.get(i.col[h]);if(s===void 0)return null;const u=d/i.order.size,f=u*i.padding;y=m+s*u+f/2,l=u-f}else y=m+d*(1-o)/2,l=d*o;else c.raw.length?(y=Math.min(m,c.mapped[h]),l=Math.abs(c.mapped[h]-m)):(y=Math.min(m,b),l=Math.abs(m-b));return isFinite(y)&&isFinite(l)?[y,l]:null}}const g=t=>Math.round(t*100)/100;function z(t,n){const[r,e]=t,[i,o]=n,a=g(r+e/2),c=g(r),d=g(r+e),b=g(i+o/4),h=g(i+3*o/4);return`M${a} ${g(i)}L${d} ${b}L${d} ${h}L${a} ${g(i+o)}L${c} ${h}L${c} ${b}Z`}const N={role:"mark",type:"rect",version:17,enter:"grow",narrow:!0,params:{baseline:{kind:"number",default:0},fill:{kind:"color"},opacity:{kind:"number",default:1},radius:{kind:"number",default:0},shape:{kind:"enum",values:["rect","hexagon"],default:"rect"},thickness:{kind:"number",default:1},dodgePadding:{kind:"number",default:.1}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}},dodge:{unscaled:!0}},render(t,n,r){const e=typeof t.baseline=="number"?t.baseline:0,i=typeof t.opacity=="number"?t.opacity:void 0,o=typeof t.radius=="number"&&t.radius>0?t.radius:void 0,a=t.shape==="hexagon",{from:c,to:d}=n.rows(t),b=x(n,t,c,d),h=w(n,t,"x",e,b),m=w(n,t,"y",e,b),y=k(t,n,r),l=[];for(let s=c;s<d;s++){const u=h(s),f=m(s);if(!u||!f)continue;const p=y(s);p&&(a?l.push({type:"path",d:z(u,f),style:{fill:p,opacity:i},ref:{mark:r,row:s}}):l.push({type:"rect",x:u[0],y:f[0],w:u[1],h:f[1],r:o,style:{fill:p,opacity:i},ref:{mark:r,row:s}}))}return l},reach(t,n,r){if(n!=="x"&&n!=="y")return null;const e=n==="x"?"y":"x",i=r.scale(n),o=r.scale(e),a=r.column(n);if(!i||!o||!a||!i.even||o.input==="category"||t[n+"2"]!==void 0||!(n==="y"?i.input==="date"&&o.input!=="date":t.y2!==void 0||o.input!=="date"||i.input==="date"))return null;const d=Array.from(a,s=>i.input==="date"?M.time(s):typeof s=="number"?s:NaN),{lo:b,hi:h,step:m}=A(d);if(!m)return null;const y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):$,l=m*y/2;return[b-l,h+l]},pick(t,n,r,e,i){const o=typeof t.baseline=="number"?t.baseline:0,{from:a,to:c}=n.rows(t),d=x(n,t,a,c),b=w(n,t,"x",o,d),h=w(n,t,"y",o,d),m=k(t,n,r),y=t.shape==="hexagon",l=2;for(let s=c-1;s>=a;s--){if(!m(s))continue;const u=b(s),f=h(s);if(!(!u||!f)){if(y){const p=Math.abs(e-(u[0]+u[1]/2))/(u[1]/2),O=Math.abs(i-(f[0]+f[1]/2))/(f[1]/2);if(p<=1&&O<=1-p/2)return{row:s,x:u[0]+u[1]/2,y:f[0]+f[1]/2,dist:0};continue}if(e>=u[0]-l&&e<=u[0]+u[1]+l&&i>=f[0]-l&&i<=f[0]+f[1]+l)return{row:s,x:u[0]+u[1]/2,y:f[0],dist:0,box:{x:u[0],y:f[0],w:u[1],h:f[1]}}}}return null},color(t,n,r,e){return k(t,n,r)(e)}};M.define(N)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const m=t=>Math.round(t*100)/100;function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(j){const m=t=>Math.round(t*100)/100;function B(t,o){const s=i=>t[i]===void 0?null:o.channel(t,i),r=s("x"),u=s("y"),h=s("x2"),c=s("y2"),y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):.7,{x:e,y:n,w:d,h:a}=o.plot,f=(i,k,x,w,g,M)=>{if(!i)return[g,M];const l=i.mapped[w];if(!isFinite(l))return null;const p=i.scale?i.scale.bandwidth:void 0;if(p!==void 0){if(x)return[l+p/2,l+p/2];const b=p*(1-y)/2;return[l+b,l+p-b]}if(k){const b=k.mapped[w];return isFinite(b)?[l,b]:null}return[l,l]};return i=>{const k=f(r,h,!!c||!u,i,e,e+d),x=f(u,c,!!h||!r,i,n+a,n);return!k||!x||k[0]===k[1]&&x[0]===x[1]?null:[k[0],x[0],k[1],x[1]]}}function v(t,o){const s=t.color!==void 0?o.channel(t,"color").mapped:null,r=typeof t.stroke=="string"?t.stroke:"var(--bc-text, #444)";return u=>s?s[u]||"":r}function W(t,o){if(t.x===void 0&&t.y===void 0)return[];const s=B(t,o),r=v(t,o),u=new Map,h=[],{from:c,to:y}=o.rows(t);for(let e=c;e<y;e++){const n=s(e);if(!n)continue;const d=r(e);if(!d)continue;const a=n.map(m).join(",")+"|"+d,f=u.get(a);if(f){f.rows.push(e);continue}const i={s:n,c:d,row:e,rows:[e]};u.set(a,i),h.push(i)}return h}const C=5,F=8;function O(t,o){return["x","y","x2","y2","color"].some(s=>t[s]!==void 0&&!!o.channel(t,s).field)}function S(t,o){const[s,r,u,h]=t,c=u-s,y=h-r;let e=0,n=1;const d=[[-c,s-o.x],[c,o.x+o.w-s],[-y,r-o.y],[y,o.y+o.h-r]];for(const[a,f]of d){if(a===0){if(f<0)return null;continue}const i=f/a;if(a<0?e=Math.max(e,i):n=Math.min(n,i),e>n)return null}return[s+e*c,r+e*y,s+n*c,r+n*y]}const _={role:"mark",type:"rule",version:12,narrow:t=>typeof t.label!="string"||t.label==="",params:{stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},thickness:{kind:"number",default:.7},label:{kind:"string"}},channels:{x:{accepts:{output:"position"}},y:{accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,o,s){const r=typeof t.strokeWidth=="number"?t.strokeWidth:2,u=Array.isArray(t.dash)?t.dash:void 0,h=typeof t.opacity=="number"?t.opacity:void 0;return W(t,o).map(({s:c,c:y,row:e})=>({type:"path",d:`M${m(c[0])} ${m(c[1])}L${m(c[2])} ${m(c[3])}`,style:{fill:"none",stroke:y,strokeWidth:r,strokeDash:u,opacity:h,strokeLinecap:"butt"},ref:{mark:s,row:e}}))},labels(t,o){const s=typeof t.label=="string"?t.label:"";if(!s)return[];const{x:r,y:u,w:h,h:c}=o.plot,y=(n,d)=>n>=r-.5&&n<=r+h+.5&&d>=u-.5&&d<=u+c+.5,e=[];for(const{s:n,c:d}of W(t,o)){const a={fill:d,stroke:"var(--bc-tooltip-bg, #fff)",strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke"},f=Math.abs(n[2]-n[0])>=Math.abs(n[3]-n[1]),i=f?n[0]>=n[2]?0:2:n[1]<=n[3]?0:2;y(n[i],n[i+1])&&e.push(f?{type:"text",x:n[i],y:n[i+1]-5,text:s,size:11,weight:600,anchor:"end",baseline:"auto",style:a}:{type:"text",x:n[0]+5,y:n[i+1],text:s,size:11,weight:600,anchor:"start",baseline:"hanging",style:a})}return e},pick(t,o,s,r,u){if(!O(t,o))return null;const h=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:2,c=o.plot,y={x:c.x-.5,y:c.y-.5,w:c.w+1,h:c.h+1};let e=null,n=1/0;for(const M of W(t,o)){const l=S(M.s,y);if(!l)continue;const p=l[2]-l[0],b=l[3]-l[1],A=p*p+b*b,$=A?Math.min(1,Math.max(0,((r-l[0])*p+(u-l[1])*b)/A)):0,z=l[0]+$*p,D=l[1]+$*b,L=Math.max(0,Math.hypot(r-z,u-D)-h/2);L<=n&&(n=L,e={line:M,s:l,x:z,y:D})}if(!e||n>C)return null;const{line:d,s:a}=e,f=Math.max(F,h+4),i=Math.min(a[0],a[2]),k=Math.min(a[1],a[3]),x={w:Math.abs(a[2]-a[0]),h:Math.abs(a[3]-a[1])},w=x.h<.5?{x:i,y:a[1]-f/2,w:x.w,h:f}:x.w<.5?{x:a[0]-f/2,y:k,w:f,h:x.h}:null,g=w?{row:d.row,x:w.x+w.w/2,y:w.y,dist:n,box:w}:{row:d.row,x:e.x,y:e.y,dist:n};return d.rows.length>1&&(g.rows=d.rows),g},color(t,o,s,r){return v(t,o)(r)}};j.define(_)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(Y){const J="var(--bc-text, #444)",j=["x0","x1","y0","y1","thickness","waypoints"],b=n=>Math.round(n*100)/100,q=n=>n!=null&&n!=="",F=(n,e)=>typeof n.nodeWidth=="number"&&n.nodeWidth>0?Math.min(n.nodeWidth,e.plot.w/4):12;function V(n,e){const a=n.layout;if(a!==void 0&&!(Array.isArray(a)&&(a.length===5||a.length===6)&&a.every(i=>typeof i=="string"&&i)))throw new Error('mark.sankey: "layout" must be six column names: [x0, x1, y0, y1, thickness, waypoints] (five keep "waypoints")');const l=a===void 0?j:a.concat(a.length===5?[j[5]]:[]),c=l.map(i=>e.table.columns[i]),r=l.slice(0,5).find((i,t)=>!c[t]);if(r!==void 0)throw new Error(`mark.sankey: there is no column "${r}" with the layout of the flows: put a sankey transform before it`);const[m,u,h,o,d,w]=c,k=e.channel(n,"source").raw,x=e.channel(n,"target").raw,p=e.channel(n,"value").raw,{x:g,y:f,w:M,h:v}=e.plot,T=F(n,e),{from:$,to:P}=e.rows(n),B=new Map,H=[],O=i=>typeof i=="number"&&isFinite(i)?i:NaN;for(let i=$;i<P;i++){const t=p[i],[s,y,A,E,L]=[O(m[i]),O(u[i]),O(h[i]),O(o[i]),O(d[i])];if(typeof t!="number"||!(t>0)||!q(k[i])||!q(x[i])||!(isFinite(s)&&isFinite(y)&&isFinite(A)&&isFinite(E)&&L>=0))continue;const G=(_,tt)=>{let W=B.get(_);return W||(W={name:_,order:B.size,value:0,x:g+tt*(M-T),y:0,h:0,color:"",ins:[],outs:[],top:1/0,inH:0,outH:0,inV:0,outV:0},B.set(_,W)),W},I=G(String(k[i]),s),N=G(String(x[i]),y);if(I===N)continue;const S=w?w[i]:null,X=[];if(Array.isArray(S)&&S.length%2===0&&S.every(_=>typeof _=="number"&&isFinite(_)))for(let _=0;_<S.length;_+=2)X.push({x:g+S[_]*(M-T),y:f+(S[_+1]+L/2)*v});const Z={row:i,from:I,to:N,value:t,thick:L*v,y0:f+(A+L/2)*v,y1:f+(E+L/2)*v,via:X};H.push(Z),I.outs.push(Z),N.ins.push(Z),I.top=Math.min(I.top,A),N.top=Math.min(N.top,E),I.outH+=L,N.inH+=L,I.outV+=t,N.inV+=t}if(!H.length)return null;const D=Array.from(B.values());for(const i of D)i.y=f+i.top*v,i.h=Math.max(i.inH,i.outH)*v,i.value=Math.max(i.inV,i.outV),i.color=e.color(i.order);return{nodes:D,links:H}}function U(n,e){const a=[];let l=n.from.x+e,c=n.y0;for(const r of n.via)a.push({xa:l,ya:c,xb:r.x,yb:r.y}),l=r.x+e,c=r.y;return a.push({xa:l,ya:c,xb:n.to.x,yb:n.y1}),a}function z(n,e){const a=n.thick/2,l=U(n,e),c=(u,h,o,d)=>{const w=b((u+o)/2);return`C${w} ${b(h)} ${w} ${b(d)} ${b(o)} ${b(d)}`};let r=`M${b(l[0].xa)} ${b(l[0].ya-a)}`;l.forEach((u,h)=>{h&&(r+=`L${b(u.xa)} ${b(u.ya-a)}`),r+=c(u.xa,u.ya-a,u.xb,u.yb-a)});const m=l[l.length-1];r+=`L${b(m.xb)} ${b(m.yb+a)}`;for(let u=l.length-1;u>=0;u--){const h=l[u];u<l.length-1&&(r+=`L${b(h.xb)} ${b(h.yb+a)}`),r+=c(h.xb,h.yb+a,h.xa,h.ya+a)}return r+"Z"}function K(n,e,a){const l=U(n,e);for(let c=0;c<l.length;c++){const{xa:r,ya:m,xb:u,yb:h}=l[c];if(c&&a<r)return m;if(a<r||a>u)continue;const o=(r+u)/2,d=g=>{const f=1-g;return f*f*f*r+3*f*g*(f+g)*o+g*g*g*u};let w=0,k=1;for(let g=0;g<20;g++){const f=(w+k)/2;d(f)<a?w=f:k=f}const x=(w+k)/2,p=1-x;return(p*p*p+3*p*p*x)*m+(3*p*x*x+x*x*x)*h}return NaN}function C(n,e,a,l,c){const r=o=>n.measure(o,12).w,m=[[e]],u=e.split(/\s+/).filter(Boolean);let h=null;for(let o=1;o<u.length;o++){const d=[u.slice(0,o).join(" "),u.slice(o).join(" ")];(!h||Math.max(...d.map(r))<Math.max(...h.map(r)))&&(h=d)}h&&m.push(h);for(const o of m){const d=o[o.length-1],w=a===null?[o]:[o.slice(0,-1).concat(`${d} ${a}`),o.concat(a)];for(const k of w)if(k.length<=c&&k.every(x=>r(x)<=l))return k}return null}function Q(n,e,a){const l=r=>n.measure(r,12).w<=a;if(l(e))return e;const c=Array.from(e);for(let r=c.length-1;r>0;r--){const m=c.slice(0,r).join("").trimEnd()+"\u2026";if(l(m))return m}return""}const R={role:"mark",type:"sankey",version:7,params:{nodeWidth:{kind:"number",default:12},format:{kind:"format"},linkOpacity:{kind:"number",default:.35},nodeLabels:{kind:"list"},layout:{kind:"list"},labelMin:{kind:"number",default:11}},channels:{source:{required:!0,unscaled:!0},target:{required:!0,unscaled:!0},value:{required:!0,unscaled:!0}},render(n,e,a){const l=V(n,e);if(!l)return[];const c=F(n,e),r=typeof n.linkOpacity=="number"?n.linkOpacity:.35,m=typeof n.labelMin=="number"?n.labelMin:11,u=n.format!==void 0?e.format(n.format):null,h=[];for(const t of l.links.slice().sort((s,y)=>y.thick-s.thick||s.row-y.row))h.push({type:"path",d:z(t,c),style:{fill:t.from.color,opacity:r},ref:{mark:a,row:t.row}});const o=e.plot.x+e.plot.w,d=Array.from(new Set(l.nodes.map(t=>t.x))).sort((t,s)=>t-s),w=(d.length>1?d[1]-d[0]:e.plot.w)-c-12,k=t=>t.x+c>=o-.5&&l.nodes.some(s=>s.x<t.x),x=t=>u?u(t.value):null,p=t=>Math.max(1,Math.floor(t.h/15)),g=l.nodes.filter(t=>t.h>=m),f=new Map(g.map(t=>[t,w])),M=new Map,v=()=>{const t=g.every(s=>C(e,s.name,x(s),f.get(s),p(s))!==null);for(const s of g){const y=f.get(s);M.set(s,C(e,s.name,t?x(s):null,y,p(s))||[Q(e,s.name,y)].filter(Boolean))}};v();const T=d[d.length-2],$=new Map,P=t=>M.get(t).length*15,B=t=>t.y+t.h/2+($.get(t)||0),H=(t,s)=>Math.max(0,(t.h-P(t))/2)*s-($.get(t)||0),O=t=>({w:M.get(t).reduce((s,y)=>Math.max(s,e.measure(y,12).w),0),top:B(t)-P(t)/2,bottom:B(t)+P(t)/2}),D=t=>{for(const s of g.filter(y=>y.x===T&&!k(y)))for(const y of g.filter(k)){const A=O(s),E=O(y),L=Math.min(A.bottom,E.bottom)-Math.max(A.top,E.top);L>0&&A.w+E.w+6>w&&t(s,y,L)}};D((t,s,y)=>{const[A,E]=B(t)<=B(s)?[t,s]:[s,t],L=y+2,G=-H(A,-1),I=H(E,1);if(G+I<L)return;const N=Math.min(G,Math.max(L/2,L-I));$.set(A,($.get(A)||0)-N),$.set(E,($.get(E)||0)+(L-N))});let i=!1;D((t,s)=>{f.set(t,(w-6)/2),f.set(s,(w-6)/2),$.delete(t),$.delete(s),i=!0}),i&&v();for(const t of l.nodes){h.push({type:"rect",x:b(t.x),y:b(t.y),w:c,h:b(Math.max(1,t.h)),style:{fill:t.color}});const s=M.get(t);if(!s)continue;const y=k(t);s.forEach((A,E)=>h.push({type:"text",x:b(y?t.x-6:t.x+c+6),y:b(B(t)+(E-(s.length-1)/2)*15),text:A,size:12,anchor:y?"end":"start",baseline:"middle",style:{fill:J}}))}return h},pick(n,e,a,l,c){const r=V(n,e);if(!r)return null;const m=F(n,e);for(const o of r.nodes){if(l<o.x||l>o.x+m||c<o.y||c>o.y+Math.max(1,o.h))continue;const d=Array.isArray(n.nodeLabels)?n.nodeLabels:[],w=(f,M)=>typeof d[f]=="string"?d[f]:M,k=n.format!==void 0?e.format(n.format):f=>String(+f.toPrecision(6)),x=f=>f.reduce((M,v)=>M+v.value,0),p=[];return o.ins.length&&p.push([w(0,"In"),k(x(o.ins))]),o.outs.length&&p.push([w(1,"Out"),k(x(o.outs))]),{row:(o.outs[0]||o.ins[0]).row,x:o.x+m/2,y:o.y+o.h/2,dist:0,box:{x:o.x,y:o.y,w:m,h:Math.max(1,o.h)},card:{title:o.name,color:o.color,lines:p},flows:o.ins.concat(o.outs).map(f=>({d:z(f,m),fill:f.from.color}))}}let u=null,h=0;for(const o of r.links){const d=K(o,m,l);isNaN(d)||Math.abs(c-d)<=Math.max(o.thick,2)/2&&(!u||o.thick<u.thick)&&(u=o,h=d)}return u?{row:u.row,x:l,y:h,dist:0}:null},color(n,e,a,l){const c=V(n,e),r=c?c.links.find(m=>m.row===l):void 0;return r?r.from.color:""}};Y.define(R)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(H){const sn="var(--bc-text, #444)",dn="#111",un="#fff";function fn(n){const l=cn(n),u=typeof n=="string"?/^var\(--bc-c(\d+),/.exec(n):null;return l&&u?`var(--bc-on-c${u[1]}, ${l})`:l}function cn(n){const l=typeof n=="string"?/#([0-9a-f]{6}|[0-9a-f]{3})\b/i.exec(n):null;if(!l)return null;let u=l[1];u.length===3&&(u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]);const d=D=>{const A=parseInt(u.slice(D,D+2),16)/255;return A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4)},y=.2126*d(0)+.7152*d(2)+.0722*d(4);return(y+.05)/(.0056+.05)>=1.05/(y+.05)?dn:un}function mn(n,l){return n==null?"":typeof n=="number"?isFinite(n)?l!==void 0?n.toFixed(l):Number.isInteger(n)?String(n):String(+n.toPrecision(6)):"":String(n)}const C=4,hn={role:"mark",type:"text",version:14,params:{size:{kind:"number",default:11},weight:{kind:"any"},anchor:{kind:"enum",values:["start","middle","end"],default:"middle"},baseline:{kind:"enum",values:["auto","middle","hanging"],default:"middle"},dx:{kind:"number",default:0},dy:{kind:"number",default:0},rotate:{kind:"number",default:0},decimals:{kind:"number"},format:{kind:"format"},fill:{kind:"color"},negative:{kind:"enum",values:["same","flip"],default:"same"},collide:{kind:"enum",values:["show","hide"],default:"show"},minSize:{kind:"number",default:8}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},text:{required:!0,unscaled:!0},sign:{unscaled:!0},color:{accepts:{output:"color"}},on:{accepts:{output:"color"},sharesScale:"color"}},render(n,l,u){const d=l.channel(n,"x"),y=l.channel(n,"y"),D=l.channel(n,"text").raw,A=n.sign!==void 0?l.channel(n,"sign").raw:null,W=n.color!==void 0?l.channel(n,"color").mapped:null,G=n.on!==void 0?l.channel(n,"on").mapped:null,j=n.format!==void 0?H.formatter(n.format):null,E=d.half,J=y.half,f=typeof n.size=="number"?n.size:11,c=n.anchor==="start"||n.anchor==="end"?n.anchor:"middle",k=n.baseline==="auto"||n.baseline==="hanging"?n.baseline:"middle",R=typeof n.dx=="number"?n.dx:0,T=typeof n.dy=="number"?n.dy:0,I=typeof n.rotate=="number"&&n.rotate!==0?n.rotate:void 0,yn=typeof n.decimals=="number"&&n.decimals>=0?Math.min(20,Math.floor(n.decimals)):void 0,Q=typeof n.weight=="number"||typeof n.weight=="string"?n.weight:void 0,V=typeof n.fill=="string"?n.fill:sn,O=typeof n.minSize=="number"&&n.minSize>0?Math.min(n.minSize,f):Math.min(8,f),g=n.x2!==void 0?l.channel(n,"x2").mapped:null,b=n.y2!==void 0?l.channel(n,"y2").mapped:null,P=(t,e)=>l.textWidth(t,e,Q);let z=0,$=1/0,U=1/0;if(E&&!g&&c==="middle"&&I===void 0&&d.scale){const t=d.scale.domain();z=t.length>1?Math.abs(d.scale(t[1])-d.scale(t[0])):l.plot.w,isFinite(z)&&z>0&&($=z-C,U=b?$:Math.max($,2*(z-E)-C))}const bn=(t,e,s)=>{let m=U,o=1/0;if(g&&I===void 0&&isFinite(g[t])){const a=Math.min(d.mapped[t],g[t]),i=Math.max(d.mapped[t],g[t]),r=Math.abs(R);m=c==="start"?i-e-r:c==="end"?e-a-r:2*Math.min(e-a,i-e)-2*r,m>=0||(m=0)}if(b&&I===void 0&&isFinite(b[t])){const a=Math.min(y.mapped[t],b[t]),i=Math.max(y.mapped[t],b[t]),r=Math.abs(T);o=k==="hanging"?i-s-r:k==="auto"?s-a-r:2*Math.min(s-a,i-s)-2*r,o>=0||(o=0)}return[m,o]},Z=n.negative==="flip",F=Z&&!!y.half&&!d.half,Y=Z?A||(F?d:y).raw:null,xn=n.collide==="hide"&&I===void 0,nn=[],v=(t,e,s,m,o,a=c)=>{const i=P(t,o),r=a==="start"?e:a==="end"?e-i:e-i/2,x=m==="hanging"?s:m==="auto"?s-o:s-o/2;return{x0:r,x1:r+i,y0:x,y1:x+o}},tn=t=>!nn.some(e=>t.x0<e.x1&&e.x0<t.x1&&t.y0<e.y1&&e.y0<t.y1),K=t=>t==="auto"?"hanging":t==="hanging"?"auto":t,{from:gn,to:pn}=l.rows(n);let _=[];const L=[],en=new Set,N=l.plot;for(let t=gn;t<pn;t++){const e=j?j(D[t]):mn(D[t],yn),s=G?G[t]?fn(G[t])||V:"":W?W[t]:V;if(!e||!s)continue;const m=g&&!E&&c==="middle"&&I===void 0&&isFinite(g[t]),o=b&&!J&&k==="middle"&&I===void 0&&isFinite(b[t]),a=m?(d.mapped[t]+g[t])/2:d.mapped[t]+E,i=o?(y.mapped[t]+b[t])/2:y.mapped[t]+J;let r=Y!==null&&typeof Y[t]=="number"&&Y[t]<0;if(r){const M=F?v(e,a-R,i,k,f,c==="start"?"end":c==="end"?"start":c):v(e,a,i-T,K(k),f);(F?M.x0<N.x-.5||M.x1>N.x+N.w+.5:M.y0<N.y-.5||M.y1>N.y+N.h+.5)&&(r=!1)}const x=r&&F?c==="start"?"end":c==="end"?"start":c:c,p=r&&F?-R:R;let h=r&&!F?K(k):k,X=r&&!F?-T:T;const q=a+p;let S=i+X;if(!isFinite(q)||!isFinite(S))continue;const on=`${q},${S},${x},${h},${s}|${e}`;if(en.has(on))continue;en.add(on);let w=f;const[an,ln]=bn(t,q,S);if(an<1/0||ln<1/0){if(w=Math.min(f,f*an/P(e,f),ln),!(w>=O))continue;w=Math.floor(w*2)/2}if(xn){let M=v(e,q,S,h,w);if(!tn(M)){const B=S-2*X,rn=v(e,q,B,K(h),w);if(h==="middle"||!tn(rn))continue;S=B,h=K(h),X=-X,M=rn}nn.push(M)}L.push(U>$?Math.floor(Math.min(f,f*$/P(e,f))*2)/2:w),_.push({type:"text",x:q,y:S,text:e,size:w,weight:Q,anchor:x,baseline:h,rotate:I,style:{fill:s},ref:{mark:u,row:t}})}if($<1/0&&!b){const t=_;let e=f;for(const o of t)e=Math.min(e,o.size);const s=t.map((o,a)=>a).sort((o,a)=>t[o].x-t[a].x),m=o=>{for(let a=0;a<s.length;a++){const i=t[s[a]],r=v(i.text,i.x,i.y,i.baseline,o);for(let x=a+1;x<s.length;x++){const p=t[s[x]];if(p.x-i.x>=2*z)break;if(p.x-i.x<z/2)continue;const h=v(p.text,p.x,p.y,p.baseline,o);if(r.x1+C>h.x0&&r.y0<h.y1&&h.y0<r.y1)return!0}}return!1};for(;e>=O&&m(e);)e-=.5;if(e<O){const o=t.filter((a,i)=>L[i]>=O);e=f,t.forEach((a,i)=>L[i]>=O&&(e=Math.min(e,L[i]))),_=o}for(const o of _)o.size=e}return _}};H.define(hn)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(L){const z=t=>Math.round(t*100)/100,C="var(--bc-tooltip-bg, #fff)";function F(t,n,i){const r=n.channel(t,"x"),a=n.channel(t,"y"),o=!!(r.scale&&r.scale.bandwidth!==void 0);if(!o&&!(a.scale&&a.scale.bandwidth!==void 0))throw new Error("mark.violin: put the categories on a band scale, x for violins standing up or y for ridges lying down");const u=o?r:a,c=o?a:r,h=n.channel(t,"density").raw,e=t.color!==void 0?n.channel(t,"color").mapped:null,f=u.scale.bandwidth,p=t.side!=="one",w=typeof t.extent=="number"&&t.extent>0?t.extent:p?.9:1.6,m=typeof t.fill=="string"?t.fill:"",{from:j,to:v}=n.rows(t),y=c.mapped.length,d=new Float64Array(y),k=new Map;for(let s=j;s<v;s++){const l=u.mapped[s],b=h[s];if(d[s]=c.mapped[s],!isFinite(l)||!isFinite(d[s])||typeof b!="number"||!isFinite(b)||b<0||e&&!e[s])continue;const M=k.get(l);M?M.push(s):k.set(l,[s])}let W=0;k.forEach(s=>s.forEach(l=>W=Math.max(W,h[l])));const q=[];return[...k.keys()].sort((s,l)=>s-l).forEach(s=>{const l=k.get(s).sort((g,x)=>d[g]-d[x]||g-x),b=t.normalize==="each"?l.reduce((g,x)=>Math.max(g,h[x]),0):W,M=(p?f/2:f)*w,A=new Float64Array(y);for(const g of l)A[g]=b>0?h[g]/b*M:0;q.push({rows:l,at:p?s+f/2:o?s:s+f,w:A,color:e?e[l[0]]:m||n.color(i)})}),{upright:o,v:d,both:p,shapes:q}}function E(t,n,i,r){const a=t.both?n.at+r*n.w[i]:t.upright?n.at+(r>0?n.w[i]:0):n.at-(r>0?n.w[i]:0);return t.upright?[a,t.v[i]]:[t.v[i],a]}function B(t,n){const i=(o,u)=>u.map(c=>E(t,n,c,o).map(z).join(" ")),r=i(1,n.rows),a=i(-1,n.rows.slice().reverse());return"M"+r.join("L")+"L"+a.join("L")+"Z"}const D={role:"mark",type:"violin",version:4,params:{side:{kind:"enum",values:["both","one"],default:"both"},extent:{kind:"number"},normalize:{kind:"enum",values:["all","each"],default:"all"},fill:{kind:"color"},opacity:{kind:"number",default:.85},stroke:{kind:"string"},strokeWidth:{kind:"number",default:1.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},density:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,n,i){const r=F(t,n,i),a=typeof t.opacity=="number"?t.opacity:.85,o=typeof t.stroke=="string"?t.stroke:r.both?void 0:C,u=typeof t.strokeWidth=="number"?t.strokeWidth:1.5;return r.shapes.filter(c=>c.rows.length>1).map(c=>({type:"path",d:B(r,c),style:{fill:c.color,fillOpacity:a,stroke:o,strokeWidth:o?u:void 0},ref:{mark:i,row:c.rows[0]}}))},pick(t,n,i,r,a){const o=F(t,n,i),u=o.upright?a:r,c=o.upright?r:a;for(let h=o.shapes.length-1;h>=0;h--){const e=o.shapes[h];if(e.rows.length<2)continue;const f=o.v[e.rows[0]],p=o.v[e.rows[e.rows.length-1]];if(u<Math.min(f,p)||u>Math.max(f,p))continue;let w=e.rows[0];for(const d of e.rows)Math.abs(o.v[d]-u)<Math.abs(o.v[w]-u)&&(w=d);const m=e.w[w]+3;if(!(o.both?Math.abs(c-e.at)<=m:o.upright?c>=e.at-3&&c<=e.at+m:c<=e.at+3&&c>=e.at-m))continue;const[v,y]=E(o,e,w,1);return{row:w,x:o.both&&o.upright?e.at:v,y:o.both?o.upright?y:e.at:y,dist:0}}return null},color(t,n,i,r){const a=F(t,n,i).shapes.find(o=>o.rows.length>1&&o.rows.includes(r));return a?a.color:""}};L.define(D)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const S='system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(W){const S='system-ui, -apple-system, "Segoe UI", sans-serif',z=Math.PI*2,C={role:"renderer",type:"canvas",version:4,render(v,d){const b=d.ownerDocument||document,a=b.createElement("canvas");a.setAttribute("role","img"),a.setAttribute("style","display:block;width:100%;height:auto");const O=a.getContext("2d");if(!O)throw new Error("renderer.canvas: this environment has no 2D canvas context");const t=O;let h=v,k=new Map,A=S,u=null,L=!1;const $=e=>{t.fillStyle="#010203",t.fillStyle=e;const n=t.fillStyle;return t.fillStyle="#040506",t.fillStyle=e,n===t.fillStyle},R=e=>u&&typeof u.getPropertyValue=="function"?u.getPropertyValue(e).trim():"",T=e=>{const n=k.get(e);if(n!==void 0)return n;let r=e.trim();for(let o=0;o<8;o++){const s=/^var\(\s*(--[^\s,)]+)\s*(?:,([\s\S]*))?\)$/.exec(r);if(!s)break;r=R(s[1])||(s[2]!==void 0?s[2].trim():"")}let i=null;return r&&r!=="none"&&(r.toLowerCase()==="currentcolor"&&(r=u&&u.color||"#000"),$(r)&&(i=r)),k.set(e,i),i},_=e=>{t.fillStyle=e;const n=String(t.fillStyle),r=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(n);if(r)return`rgba(${parseInt(r[1],16)}, ${parseInt(r[2],16)}, ${parseInt(r[3],16)}, 0)`;const i=/^rgba?\(([^,]+),([^,]+),([^,)]+)/.exec(n);return i?`rgba(${i[1].trim()}, ${i[2].trim()}, ${i[3].trim()}, 0)`:"rgba(0, 0, 0, 0)"},j=e=>{const n=h.plot,r=t.createLinearGradient(0,n.y,0,n.y+n.h);return r.addColorStop(0,e),r.addColorStop(1,_(e)),r},F=e=>`${e.weight===void 0?"normal":String(e.weight)} ${e.size===void 0?12:e.size}px ${A}`,D=e=>{t.font=F(e),t.textAlign=e.anchor==="middle"?"center":e.anchor==="end"?"right":"left",t.textBaseline=e.baseline==="middle"?"middle":e.baseline==="hanging"?"hanging":"alphabetic"},U=(e,n,r,i,o)=>{const s=Math.max(0,Math.min(o,r/2,i/2));if(t.beginPath(),typeof t.roundRect=="function"){t.roundRect(e,n,r,i,s);return}t.moveTo(e+s,n),t.arcTo(e+r,n,e+r,n+i,s),t.arcTo(e+r,n+i,e,n+i,s),t.arcTo(e,n+i,e,n,s),t.arcTo(e,n,e+r,n,s),t.closePath()},E=(e,n,r)=>{const i=e.style||{},o={fill:i.fill!==void 0?i.fill:r.fill,stroke:i.stroke!==void 0?i.stroke:r.stroke,strokeWidth:i.strokeWidth!==void 0?i.strokeWidth:r.strokeWidth,strokeDash:i.strokeDash!==void 0?i.strokeDash:r.strokeDash,fillOpacity:i.fillOpacity!==void 0?i.fillOpacity:r.fillOpacity,strokeLinejoin:i.strokeLinejoin!==void 0?i.strokeLinejoin:r.strokeLinejoin,strokeLinecap:i.strokeLinecap!==void 0?i.strokeLinecap:r.strokeLinecap,paintOrder:i.paintOrder!==void 0?i.paintOrder:r.paintOrder},s=n*(i.opacity===void 0?1:i.opacity);if(e.type==="g"){t.save(),e.translate&&t.translate(e.translate[0],e.translate[1]),e.clip&&(t.beginPath(),t.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),t.clip());for(const f of e.children)E(f,s,o);t.restore();return}const l=o.fill===void 0?"#000":T(o.fill),c=o.stroke===void 0?null:T(o.stroke);t.lineWidth=o.strokeWidth===void 0?1:o.strokeWidth,t.setLineDash(o.strokeDash||[]),t.lineJoin=o.strokeLinejoin||"miter",t.lineCap=o.strokeLinecap||"butt";const w=o.paintOrder==="stroke",M=f=>{const B=()=>{l&&(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=i.fade?j(l):l,f?t.fill(f):t.fill())},I=()=>{c&&(t.globalAlpha=s,t.strokeStyle=c,f?t.stroke(f):t.stroke())};w&&I(),B(),w||I()};switch(e.type){case"path":M(new Path2D(e.d));break;case"rect":e.r?U(e.x,e.y,e.w,e.h,e.r):(t.beginPath(),t.rect(e.x,e.y,e.w,e.h)),M();break;case"circle":t.beginPath(),t.arc(e.cx,e.cy,e.r,0,z),M();break;case"text":D(e),t.save(),t.translate(e.x,e.y),e.rotate&&t.rotate(e.rotate*Math.PI/180);for(const f of w?["stroke","fill"]:["fill","stroke"])f==="fill"&&l?(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=l,t.fillText(e.text,0,0)):f==="stroke"&&c&&(t.globalAlpha=s,t.strokeStyle=c,t.strokeText(e.text,0,0));t.restore();break}t.globalAlpha=1},x=e=>{if(L)return;h=e,e.label?a.setAttribute("aria-label",e.label):a.removeAttribute("aria-label"),k=new Map,u=typeof getComputedStyle=="function"?getComputedStyle(d):null,A=u&&u.fontFamily||S;const n=d.clientWidth||e.size.w,r=Math.min(3,Math.max(1,globalThis.devicePixelRatio||1)),i=Math.max(1,Math.min(16384,Math.round(n*r))),o=i/e.size.w,s=Math.max(1,Math.min(16384,Math.round(e.size.h*o)));a.width=i,a.height=s,t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i,s),t.setTransform(o,0,0,o,0,0);for(const l of e.layers){t.save(),l.clip&&(t.beginPath(),t.rect(l.clip.x,l.clip.y,l.clip.w,l.clip.h),t.clip());for(const c of l.prims)E(c,1,{});t.restore()}},P=e=>{switch(e.type){case"rect":return[e.x,e.y,e.x+e.w,e.y+e.h];case"circle":return[e.cx-e.r,e.cy-e.r,e.cx+e.r,e.cy+e.r];case"text":{D(e);const n=t.measureText(e.text).width,r=e.size===void 0?12:e.size,i=e.anchor==="middle"?e.x-n/2:e.anchor==="end"?e.x-n:e.x,o=e.baseline==="middle"?e.y-r/2:e.baseline==="hanging"?e.y:e.y-r;return[i,o,i+n,o+r]}case"g":{let n=null;for(const i of e.children){const o=P(i);o&&(n=n?[Math.min(n[0],o[0]),Math.min(n[1],o[1]),Math.max(n[2],o[2]),Math.max(n[3],o[3])]:o)}const r=e.translate||[0,0];return n?[n[0]+r[0],n[1]+r[1],n[2]+r[0],n[3]+r[1]]:null}default:return null}},p=(e,n,r)=>{if(e.type==="g"){const o=e.translate||[0,0];for(let s=e.children.length-1;s>=0;s--){const l=p(e.children[s],n-o[0],r-o[1]);if(l)return l}}if(!e.data)return null;const i=P(e);return i&&n>=i[0]&&n<=i[2]&&r>=i[1]&&r<=i[3]?Object.assign({},e.data):null},X=e=>{const n=a.getBoundingClientRect();if(!n.width||!n.height)return null;const r=(e.clientX-n.left)*h.size.w/n.width,i=(e.clientY-n.top)*h.size.h/n.height;for(let o=h.layers.length-1;o>=0;o--){const s=h.layers[o].prims;for(let l=s.length-1;l>=0;l--){const c=p(s[l],r,i);if(c)return c}}return null},g=[],m=()=>x(h),y=globalThis;if(typeof y.ResizeObserver=="function"){let e=d.clientWidth;const n=new y.ResizeObserver(()=>{d.clientWidth!==e&&(e=d.clientWidth,m())});n.observe(d),g.push(()=>n.disconnect())}if(typeof y.matchMedia=="function"){const e=y.matchMedia("(prefers-color-scheme: dark)");e&&typeof e.addEventListener=="function"&&(e.addEventListener("change",m),g.push(()=>e.removeEventListener("change",m)))}if(typeof y.MutationObserver=="function"&&b.documentElement){const e=new y.MutationObserver(m);e.observe(b.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}),g.push(()=>e.disconnect())}return x(v),d.appendChild(a),{root:a,update:x,dataAt:X,destroy(){L=!0;for(const e of g)e();a.parentNode&&a.parentNode.removeChild(a)}}}};W.define(C)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(k){const x="http://www.w3.org/2000/svg";let w=0,m=0;function s(e){return document.createElementNS(x,e)}function r(e,i,t){t!==void 0&&e.setAttribute(i,String(t))}function C(e,i,t){const n=e+"|"+i,l=t.fades.get(n);if(l)return l;const o=`bc-fade-${++m}`,a=s("linearGradient");a.setAttribute("id",o),a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("x1","0"),a.setAttribute("x2","0"),r(a,"y1",t.plot.y),r(a,"y2",t.plot.y+t.plot.h);for(const[b,c]of[[0,i],[1,0]]){const f=s("stop");f.setAttribute("offset",String(b)),f.setAttribute("style",`stop-color:${e.replace(/[;{}<>]/g,"")};stop-opacity:${c}`),a.appendChild(f)}t.defs.appendChild(a);const u=`url(#${o})`;return t.fades.set(n,u),u}function $(e,i,t){i&&(i.fill!==void 0&&i.fade&&i.fill!=="none"?e.setAttribute("fill",C(i.fill,i.fillOpacity===void 0?1:i.fillOpacity,t)):i.fill!==void 0&&e.setAttribute("fill",i.fill),i.stroke!==void 0&&e.setAttribute("stroke",i.stroke),r(e,"stroke-width",i.strokeWidth),i.strokeDash&&e.setAttribute("stroke-dasharray",i.strokeDash.join(" ")),r(e,"opacity",i.opacity),i.fade||r(e,"fill-opacity",i.fillOpacity),i.strokeLinejoin&&e.setAttribute("stroke-linejoin",i.strokeLinejoin),i.strokeLinecap&&e.setAttribute("stroke-linecap",i.strokeLinecap),i.paintOrder&&e.setAttribute("paint-order",i.paintOrder))}function y(e,i,t){const n=`bc-clip-${++w}`,l=s("clipPath");l.setAttribute("id",n);const o=s("rect");r(o,"x",i.x),r(o,"y",i.y),r(o,"width",i.w),r(o,"height",i.h),l.appendChild(o),t.appendChild(l),e.setAttribute("clip-path",`url(#${n})`)}function g(e,i){let t;switch(e.type){case"path":t=s("path"),t.setAttribute("d",e.d);break;case"rect":t=s("rect"),r(t,"x",e.x),r(t,"y",e.y),r(t,"width",e.w),r(t,"height",e.h),r(t,"rx",e.r);break;case"circle":t=s("circle"),r(t,"cx",e.cx),r(t,"cy",e.cy),r(t,"r",e.r);break;case"text":t=s("text"),r(t,"x",e.x),r(t,"y",e.y),r(t,"font-size",e.size),e.weight!==void 0&&t.setAttribute("font-weight",String(e.weight)),e.anchor&&t.setAttribute("text-anchor",e.anchor),e.baseline&&t.setAttribute("dominant-baseline",e.baseline),e.rotate&&t.setAttribute("transform",`rotate(${e.rotate} ${e.x} ${e.y})`),t.textContent=e.text;break;case"g":t=s("g"),e.translate&&t.setAttribute("transform",`translate(${e.translate[0]} ${e.translate[1]})`),e.clip&&y(t,e.clip,i.defs);for(const n of e.children)t.appendChild(g(n,i));break}if($(t,e.style,i),e.cls&&t.setAttribute("class",e.cls),e.data)for(const n of Object.keys(e.data))t.setAttribute("data-"+n,e.data[n]);if(e.ref&&(t.setAttribute("data-bc-mark",String(e.ref.mark)),t.setAttribute("data-bc-row",String(e.ref.row))),e.pressed!==void 0&&(t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-pressed",e.pressed?"true":"false"),i.controls.push(t)),e.title){const n=s("title");n.textContent=e.title,t.appendChild(n)}return t}const S={role:"renderer",type:"svg",version:6,render(e,i){const t=s("svg");t.setAttribute("width","100%"),t.setAttribute("role","img"),t.setAttribute("style","display:block;height:auto");let n=[];const l=o=>{const a=t.ownerDocument||(typeof document>"u"?null:document),u=a&&a.activeElement?n.indexOf(a.activeElement):-1;t.textContent="",t.setAttribute("viewBox",`0 0 ${o.size.w} ${o.size.h}`);const b=s("defs");t.appendChild(b);const c={defs:b,plot:o.plot,fades:new Map,controls:[]},f=[];for(const d of o.layers){const h=s("g");h.setAttribute("data-bc-layer",d.name),d.clip&&y(h,d.clip,b);for(const v of d.prims){const O=c.controls.length,p=g(v,c);c.controls.length===O&&f.push(p),h.appendChild(p)}t.appendChild(h)}if(n=c.controls,t.setAttribute("role",n.length?"group":"img"),n.length)for(const d of f)d.setAttribute("aria-hidden","true");o.label?t.setAttribute("aria-label",o.label):t.removeAttribute("aria-label");const A=u>=0?n[u]:void 0;A&&typeof A.focus=="function"&&A.focus({preventScroll:!0})};return l(e),i.appendChild(t),{root:t,update:l,destroy(){t.parentNode&&t.parentNode.removeChild(t)}}}};k.define(S)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(y){function M(t){const i=new Set,r=[];for(const u of t)for(let a=0;a<u.length;a++){const e=u[a];e==null||typeof e=="number"&&isNaN(e)||i.has(e)||(i.add(e),r.push(e))}return r}const w={role:"scale",type:"band",version:5,output:"position",input:"category",merge:"union",fieldsOnly:!0,params:{paddingInner:{kind:"number",default:.2},paddingOuter:{kind:"number",default:.1}},create(t,i){const r=typeof t.paddingInner=="number"?t.paddingInner:.2,u=typeof t.paddingOuter=="number"?t.paddingOuter:.1,a=t.domain?t.domain.slice():M(i.sources);let e=a,g=new Map,l=Number(i.range[0]),d=Number(i.range[1]),c=0,f=0;const b=()=>{g=new Map,e.forEach((n,o)=>g.set(n,o))},m=()=>{c=Math.abs(d-l)/Math.max(1,e.length-r+2*u),f=c*(1-r)},h=n=>Math.min(l,d)+u*c+n*c;b(),m();const p=(n=>{const o=g.get(n);return o===void 0?NaN:h(o)});return Object.defineProperties(p,{bandwidth:{get:()=>f},domain:{value:()=>e.slice()},baseDomain:{value:()=>a.slice()},setDomain:{value:n=>{e=n?n.slice():a,b(),m()}},range:{value:()=>[l,d]},setRange:{value:n=>{l=n[0],d=n[1],m()}},ticks:{value:(n=10)=>{const o=Math.max(1,Math.ceil(e.length/Math.max(1,n))),v=[];for(let s=0;s<e.length;s+=o)v.push({value:e[s],pos:h(s)+f/2,label:String(e[s])});return v}}}),p}};y.define(w)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(f){function g(o){const s=new Set,t=[];for(const r of o)for(let a=0;a<r.length;a++){const n=r[a];n==null||typeof n=="number"&&isNaN(n)||s.has(n)||(s.add(n),t.push(n))}return t}const d={role:"scale",type:"color",version:4,output:"color",input:"category",merge:"union",create(o,s){const t=o.domain?o.domain.slice():g(s.sources);let r=t,a=null;const n=Array.isArray(o.range)&&o.range.length?o.range.map(String):null,i=e=>n?n[e%n.length]:s.color(e),u=new Map;t.forEach((e,l)=>u.set(e,l));const c=(e=>{const l=u.get(e);return l===void 0?"var(--bc-axis, #999)":a&&!a.has(e)?"":i(l)});return Object.defineProperties(c,{domain:{value:()=>r.slice()},baseDomain:{value:()=>t.slice()},setDomain:{value:e=>{r=e?e.slice():t,a=e?new Set(r):null}},range:{value:()=>t.map((e,l)=>i(l))},setRange:{value:()=>{}}}),c}};f.define(d)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(m){const b=()=>m.get("lib.ticks").exports,c=(i,o)=>b().niceStep(i,o),g=(i,o,e)=>b().roundTicks(i,o,e);function h(i){let o=1/0,e=-1/0;for(const t of i)for(let r=0;r<t.length;r++){const a=t[r];typeof a!="number"||!isFinite(a)||(a<o&&(o=a),a>e&&(e=a))}return o<=e?[o,e]:[0,1]}const N={role:"scale",type:"linear",version:9,output:"position",input:"number",merge:"extent",even:!0,requires:["lib.ticks"],params:{nice:{kind:"boolean",default:!0},zero:{kind:"boolean",default:!1},padding:{kind:"number",default:0}},create(i,o){let e,t;if(i.domain!==void 0&&i.domain!==null){const n=s=>typeof s=="number"?s:typeof s=="string"&&s.trim()?Number(s):NaN,u=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[];if(e=n(u[0]),t=n(u[1]),!isFinite(e)||!isFinite(t)||e===t)throw new Error(`scale.linear: the domain must be two different numbers, not ${JSON.stringify(i.domain)}`)}else{if([e,t]=h(o.sources),i.zero&&(e=Math.min(e,0),t=Math.max(t,0)),t-e<=1e-12*Math.max(Math.abs(e),Math.abs(t))&&(e-=1,t+=1),typeof i.padding=="number"&&i.padding>0){const n=(t-e)*i.padding;e=i.zero&&e===0?0:e-n,t=i.zero&&t===0?0:t+n}if(i.nice!==!1){const n=c(t-e,6);e=Math.floor(e/n+1e-9)*n,t=Math.ceil(t/n-1e-9)*n}}let r=e,a=t,l=Number(o.range[0]),f=Number(o.range[1]);const d=(n=>l+(n-r)/(a-r)*(f-l));return Object.defineProperties(d,{domain:{value:()=>[r,a]},baseDomain:{value:()=>[e,t]},setDomain:{value:n=>{r=n?n[0]:e,a=n?n[1]:t}},range:{value:()=>[l,f]},setRange:{value:n=>{l=n[0],f=n[1]}},invert:{value:n=>r+(n-l)/(f-l)*(a-r)},ticks:{value:(n=6)=>g(r,a,n).map(u=>({...u,pos:d(u.value)}))}}),d}};m.define(N)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const s=Math.log10;function
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(w){const s=Math.log10;function E(i){throw new Error("scale.log: "+i)}function x(i){let r=1/0,t=-1/0;for(const n of i)for(let a=0;a<n.length;a++){const o=n[a];typeof o!="number"||!(o>0)||o===1/0||(o<r&&(r=o),o>t&&(t=o))}return r<=t?[r,t]:null}const y=i=>i>=1?w.formatter({notation:"compact",maximumSignificantDigits:3})(i):String(+i.toPrecision(3)),C=2,v=(i,r)=>{const t=Math.pow(10,Math.floor(s(i)+1e-9)),n=i/t,a=[1,2,5,10];return t*(r?a.find(o=>o>=n-1e-9):a.slice().reverse().find(o=>o<=n+1e-9))},D={role:"scale",type:"log",version:6,output:"position",input:"number",merge:"extent",params:{nice:{kind:"boolean",default:!0}},create(i,r){let t,n;if(i.domain!==void 0&&i.domain!==null){const e=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[NaN,NaN];t=Number(e[0]),n=Number(e[1]),t>0&&n>0&&isFinite(t)&&isFinite(n)&&t!==n||E(`the domain must be two different positive numbers, not ${JSON.stringify(i.domain)}`)}else{[t,n]=x(r.sources)||[1,10];const c=l=>l>0&&isFinite(l);if(t===n&&(c(t/10)&&(t/=10),c(n*10)&&(n*=10)),i.nice!==!1){const l=s(n)-s(t)<C,m=l?v(t,!1):Math.pow(10,Math.floor(s(t)+1e-9)),d=l?v(n,!0):Math.pow(10,Math.ceil(s(n)-1e-9));c(m)&&(t=m),c(d)&&(n=d)}}let a=t,o=n,u=Number(r.range[0]),g=Number(r.range[1]);const p=(e=>e>0?u+(s(e)-s(a))/(s(o)-s(a))*(g-u):NaN);return Object.defineProperties(p,{domain:{value:()=>[a,o]},baseDomain:{value:()=>[t,n]},setDomain:{value:e=>{a=e&&e[0]>0&&isFinite(e[0])?e[0]:t,o=e&&e[1]>0&&isFinite(e[1])?e[1]:n}},range:{value:()=>[u,g]},setRange:{value:e=>{u=e[0],g=e[1]}},invert:{value:e=>Math.pow(10,s(a)+(e-u)/(g-u)*(s(o)-s(a)))},ticks:{value:(e=6)=>{const c=Math.min(a,o),l=Math.max(a,o),m=Math.floor(s(c)+1e-9),d=Math.ceil(s(l)-1e-9),b=Math.max(1,d-m),M=Math.max(1,e),F=b*3<=M?[1,2,5]:b*2<=M?[1,3]:[1],I=F.length===1?Math.max(1,Math.ceil(b/M)):1,N=[];for(let f=m;f<=d;f++)if(!((f-m)%I))for(const O of F){const h=+(O*Math.pow(10,f)).toPrecision(12);!isFinite(h)||h<c*(1-1e-9)||h>l*(1+1e-9)||N.push({value:h,pos:p(h),label:y(h)})}return N.length<2?[c,l].map(f=>({value:f,pos:p(f),label:y(f)})):N}}}),p}};w.define(D)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(h){const x=["#440154","#3b528b","#21908d","#5dc863","#fde725"];function y(n){const a=typeof n=="string"?/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n.trim()):null;if(!a)throw new Error(`scale.sequential: range colors must be #rgb or #rrggbb, got ${JSON.stringify(n)} (mixing needs real numbers, so CSS variables and names cannot be used)`);let t=a[1];return t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const u=n=>{const a=Math.max(0,Math.min(255,Math.round(n)));return(a<16?"0":"")+a.toString(16)},N=()=>h.get("lib.ticks").exports,w=(n,a,t)=>N().roundTicks(n,a,t),M={role:"scale",type:"sequential",version:7,output:"color",input:"number",merge:"extent",requires:["lib.ticks"],params:{exponent:{kind:"number",default:1}},create(n,a){const t=(Array.isArray(n.range)&&n.range.length?n.range:x).map(y);if(t.length<2)throw new Error("scale.sequential: range needs at least two colors");let i,o;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),o=Number(e[1]),!isFinite(i)||!isFinite(o)||i===o)throw new Error(`scale.sequential: domain must be two different numbers, [min, max], not ${JSON.stringify(n.domain)}; a diverging scale is three colors in "range" and a domain even around the middle, such as [-10, 10]`)}else{i=1/0,o=-1/0;for(const e of a.sources)for(let s=0;s<e.length;s++){const r=e[s];typeof r!="number"||!isFinite(r)||(r<i&&(i=r),r>o&&(o=r))}i>o&&(i=0,o=1),i===o&&(i-=.5,o+=.5)}let l=i,m=o;const d=typeof n.exponent=="number"&&n.exponent>0&&isFinite(n.exponent)?n.exponent:1,f=e=>d===1?e:e<0?-Math.pow(-e,d):Math.pow(e,d),v=e=>{const s=Math.max(0,Math.min(1,e))*(t.length-1),r=Math.min(t.length-2,Math.floor(s)),g=s-r,c=t[r],b=t[r+1];return"#"+u(c[0]+(b[0]-c[0])*g)+u(c[1]+(b[1]-c[1])*g)+u(c[2]+(b[2]-c[2])*g)},p=(e=>typeof e=="number"&&isFinite(e)?v((f(e)-f(l))/(f(m)-f(l))):"");return Object.defineProperties(p,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,o]},setDomain:{value:e=>{l=e?e[0]:i,m=e?e[1]:o}},range:{value:()=>t.map(e=>"#"+u(e[0])+u(e[1])+u(e[2]))},setRange:{value:()=>{}},ticks:{value:(e=5)=>w(l,m,e).map(s=>({...s,pos:(s.value-l)/(m-l)}))}}),p}};h.define(M)})(globalThis.BC);
|
|
3
3
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! blockcharts 0.0.
|
|
2
|
-
"use strict";(function(){const
|
|
1
|
+
/*! blockcharts 0.0.3 | MIT License */
|
|
2
|
+
"use strict";(function(c){const d=[2,24],g=()=>c.get("lib.ticks").exports,y=(n,f,a)=>g().roundTicks(n,f,a),N={role:"scale",type:"size",version:6,output:"size",input:"number",merge:"extent",requires:["lib.ticks"],params:{zero:{kind:"boolean",default:!0}},create(n,f){const a=Array.isArray(n.range)&&n.range.length===2?n.range.map(Number):d;if(!a.every(e=>isFinite(e)&&e>=0)||a[0]>a[1])throw new Error(`scale.size: range must be [smallest, largest] radius in px, got ${JSON.stringify(n.range)}`);let s=a[0],u=a[1],i,r;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),r=Number(e[1]),!isFinite(i)||!isFinite(r)||i>=r||i<0)throw new Error(`scale.size: domain must be [min, max] with 0 <= min < max, not ${JSON.stringify(n.domain)}`)}else{i=1/0,r=-1/0;for(const e of f.sources)for(let t=0;t<e.length;t++){const o=e[t];typeof o!="number"||!isFinite(o)||o<0||(o<i&&(i=o),o>r&&(r=o))}i>r&&(i=0,r=1),n.zero!==!1&&(i=0),i===r&&(i=i>0?0:i,r=r>0?r*2:1)}let l=i,m=r;const b=(e=>{if(typeof e!="number"||!isFinite(e)||e<0)return NaN;const t=Math.max(0,Math.min(1,(e-l)/(m-l)));return Math.sqrt(s*s+t*(u*u-s*s))});return Object.defineProperties(b,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,r]},setDomain:{value:e=>{l=e?Number(e[0]):i,m=e?Number(e[1]):r}},range:{value:()=>[s,u]},setRange:{value:e=>{Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"&&isFinite(t))&&(s=e[0],u=e[1])}},ticks:{value:(e=3)=>y(l,m,e).filter(t=>t.value>0).slice(0,50).map(t=>({...t,pos:b(t.value)}))}}),b}};c.define(N)})(globalThis.BC);
|
|
3
3
|
|