PageSourceSearch

https://www.markdowntools.com/_nuxt/pieDiagram-E7YTZNPT.6b882b1c.js

js markdowntools.com collected 2026-09-25 21:18:19 UTC 6,406 bytes, 39 lines download raw bytes

1import{p as nt}from"./chunk-JWPE2WC7.217ecfbf.js";import{$ as T,S as G,b6 as it,I as ot,p as st,q as lt,s as ct,g as ut,c as gt,b as dt,_ as d,l as B,y as pt,h as ht,K as ft,O as mt,a8 as vt,j as xt}from"./mermaid.core.ef83f6c9.js";import{v as St}from"./mermaid-parser.core.78d6a5b1.js";import{d as Z}from"./arc.505b8479.js";import{o as yt}from"./ordinal.b935e931.js";import"./entry.8449285a.js";import"./_commonjsHelpers.de833af9.js";import"./init.77b53fdd.js";function wt(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function At(t){return t}function $t(){var t=At,n=wt,y=null,b=T(0),l=T(G),p=T(0);function i(e){var r,s=(e=it(e)).length,h,w,C=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(G,Math.max(-G,l.apply(this,arguments)-D)),k,L=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=L*(E<0?-1:1),A;for(r=0;r<s;++r)(A=o[f[r]=r]=+t(e[r],r,e))>0&&(C+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=C?(E-s*u)/C:0;r<s;++r,D=k)h=f[r],A=o[h],k=D+(A>0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:L};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var J=ot.pie,I={sections:new Map,showData:!1,config:J},_=I.sections,V=I.showData,Ct=structuredClone(J),Dt=d(()=>structuredClone(Ct),"getConfig"),Tt=d(()=>{_=new Map,V=I.showData,pt()},"clear"),bt=d(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);_.has(t)||(_.set(t,n),B.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),kt=d(()=>_,"getSections"),zt=d(t=>{V=t},"setShowData"),Et=d(()=>V,"getShowData"),Q={getConfig:Dt,clear:Tt,setDiagramTitle:st,getDiagramTitle:lt,setAccTitle:ct,getAccTitle:ut,setAccDescription:gt,getAccDescription:dt,addSection:bt,getSections:kt,setShowData:zt,getShowData:Et},Mt=d((t,n)=>{nt(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Rt={parse:d(async t=>{const n=await St("pie",t);B.debug(n),Mt(n,Q)},"parse")},Lt=d(t=>`
2  .pieCircle{
3    stroke: ${t.pieStrokeColor};
4    stroke-width : ${t.pieStrokeWidth};
5    opacity : ${t.pieOpacity};
6  }
7  .pieCircle.highlighted{
8    scale: 1.05;
9    opacity: 1;
10  }
11  .pieCircle.highlightedOnHover:hover{
12    transition-duration: 250ms;
13    scale: 1.05;
14    opacity: 1;
15  }
16  .pieOuterCircle{
17    stroke: ${t.pieOuterStrokeColor};
18    stroke-width: ${t.pieOuterStrokeWidth};
19    fill: none;
20  }
21  .pieTitleText {
22    text-anchor: middle;
23    font-size: ${t.pieTitleTextSize};
24    fill: ${t.pieTitleTextColor};
25    font-family: ${t.fontFamily};
26  }
27  .slice {
28    font-family: ${t.fontFamily};
29    fill: ${t.pieSectionTextColor};
30    font-size:${t.pieSectionTextSize};
31    // fill: white;
32  }
33  .legend text {
34    fill: ${t.pieLegendTextColor};
35    font-family: ${t.fontFamily};
36    font-size: ${t.pieLegendTextSize};
37  }
38`,"getStyles"),Ot=Lt,Wt=d(t=>{const n=[...t.values()].reduce((l,p)=>l+p,0),y=[...t.entries()].map(([l,p])=>({label:l,value:p})).filter(l=>l.value/n*100>=1);return $t().value(l=>l.value).sort(null)(y)},"createPieArcs"),_t=d((t,n,y,b)=>{var X;B.debug(`rendering pie chart
39`+t);const l=b.db,p=ht(),i=ft(l.getConfig(),p.pie),e=40,r=18,s=4,h=450,w=h,C=mt(n),f=C.append("g");f.attr("transform","translate("+w/2+","+h/2+")");const{themeVariables:o}=p;let[D]=vt(o.pieOuterStrokeWidth);D??(D=2);const E=i.legendPosition,k=i.textPosition,L=i.donutHole>0&&i.donutHole<=.9?i.donutHole:0,u=Math.min(w,h)/2-e,A=Z().innerRadius(L*u).outerRadius(u),M=Z().innerRadius(u*k).outerRadius(u*k),m=f.append("g");m.append("circle").attr("cx",0).attr("cy",0).attr("r",u+D/2).attr("class","pieOuterCircle");const O=l.getSections(),Y=Wt(O),tt=[o.pie1,o.pie2,o.pie3,o.pie4,o.pie5,o.pie6,o.pie7,o.pie8,o.pie9,o.pie10,o.pie11,o.pie12];let F=0;O.forEach(a=>{F+=a});const j=Y.filter(a=>(a.data.value/F*100).toFixed(0)!=="0"),H=yt(tt).domain([...O.keys()]);m.selectAll("mySlices").data(j).enter().append("path").attr("d",A).attr("fill",a=>H(a.data.label)).attr("class",a=>
39{let c="pieCircle";return i.highlightSlice==="hover"?c+=" highlightedOnHover":i.highlightSlice===a.data.label&&(c+=" highlighted"),c}),m.selectAll("mySlices").data(j).enter().append("text").text(a=>(a.data.value/F*100).toFixed(0)+"%").attr("transform",a=>"translate("+M.centroid(a)+")").style("text-anchor","middle").attr("class","slice");const et=f.append("text").text(l.getDiagramTitle()).attr("x",0).attr("y",-(h-50)/2).attr("class","pieTitleText"),R=[...O.entries()].map(([a,c])=>({label:a,value:c})),$=f.selectAll(".legend").data(R).enter().append("g").attr("class","legend");$.append("rect").attr("width",r).attr("height",r).style("fill",a=>H(a.label)).style("stroke",a=>H(a.label)),$.append("text").attr("x",r+s).attr("y",r-s).text(a=>l.getShowData()?`${a.label} [${a.value}]`:a.label);const z=Math.max(...$.selectAll("text").nodes().map(a=>(a==null?void 0:a.getBoundingClientRect().width)??0));let W=h,N=w+e;const g=r+s,P=R.length*g;switch(E){case"center":$.attr("transform",(a,c)=>{const v=g*R.length/2,x=-z/2-(r+s),S=c*g-v;return"translate("+x+","+S+")"});break;case"top":W+=P,$.attr("transform",(a,c)=>{const v=u,x=-z/2-(r+s),S=c*g-v;return`translate(${x}, ${S})`}),m.attr("transform",()=>`translate(0, ${P+g})`);break;case"bottom":W+=P,$.attr("transform",(a,c)=>{const v=-u-g,x=-z/2-(r+s),S=c*g-v;return"translate("+x+","+S+")"});break;case"left":N+=r+s+z,$.attr("transform",(a,c)=>{const v=g*R.length/2,x=-u-(r+s),S=c*g-v;return"translate("+x+","+S+")"}),m.attr("transform",()=>`translate(${z+r+s}, 0)`);break;case"right":default:N+=r+s+z,$.attr("transform",(a,c)=>{const v=g*R.length/2,x=12*r,S=c*g-v;return"translate("+x+","+S+")"});break}const U=((X=et.node())==null?void 0:X.getBoundingClientRect().width)??0,at=w/2-U/2,rt=w/2+U/2,q=Math.min(0,at),K=Math.max(N,rt)-q;C.attr("viewBox",`${q} 0 ${K} ${W}`),xt(C,W,K,i.useMaxWidth)},"draw"),Ft={draw:_t},qt={parser:Rt,db:Q,renderer:Ft,styles:Ot};export{qt as diagram};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.