You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
venv/PyCharm 2025.2.1.1/plugins/python/jupyter-web/4698.js

1 line
3.6 KiB

"use strict";(self.webpackChunkjupyter_web=self.webpackChunkjupyter_web||[]).push([[4698],{34698:(ce,y,n)=>{n.r(y),n.d(y,{diagram:()=>te});var U=n(53420),b=n(23854),W=n(62477),B=n(39624),t=n(3685),G=n(32928),u=n(31083),M=t.vZ.pie,D={sections:new Map,showData:!1,config:M},_=D.sections,E=D.showData,N=structuredClone(M),j=(0,t.eW)(()=>structuredClone(N),"getConfig"),K=(0,t.eW)(()=>{_=new Map,E=D.showData,(0,t.ZH)()},"clear"),F=(0,t.eW)(({label:e,value:a})=>{_.has(e)||(_.set(e,a),t.cM.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),z=(0,t.eW)(()=>_,"getSections"),Z=(0,t.eW)(e=>{E=e},"setShowData"),V=(0,t.eW)(()=>E,"getShowData"),A={getConfig:j,clear:K,setDiagramTitle:t.g2,getDiagramTitle:t.Kr,setAccTitle:t.GN,getAccTitle:t.eu,setAccDescription:t.U$,getAccDescription:t.Mx,addSection:F,getSections:z,setShowData:Z,getShowData:V},H=(0,t.eW)((e,a)=>{(0,b.A)(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),Q={parse:(0,t.eW)(function(){var e=(0,U.Z)(function*(a){const g=yield(0,G.Qc)("pie",a);t.cM.debug(g),H(g,A)});return function(a){return e.apply(this,arguments)}}(),"parse")},J=(0,t.eW)(e=>`\n .pieCircle{\n stroke: ${e.pieStrokeColor};\n stroke-width : ${e.pieStrokeWidth};\n opacity : ${e.pieOpacity};\n }\n .pieOuterCircle{\n stroke: ${e.pieOuterStrokeColor};\n stroke-width: ${e.pieOuterStrokeWidth};\n fill: none;\n }\n .pieTitleText {\n text-anchor: middle;\n font-size: ${e.pieTitleTextSize};\n fill: ${e.pieTitleTextColor};\n font-family: ${e.fontFamily};\n }\n .slice {\n font-family: ${e.fontFamily};\n fill: ${e.pieSectionTextColor};\n font-size:${e.pieSectionTextSize};\n // fill: white;\n }\n .legend text {\n fill: ${e.pieLegendTextColor};\n font-family: ${e.fontFamily};\n font-size: ${e.pieLegendTextSize};\n }\n`,"getStyles"),X=(0,t.eW)(e=>{const a=[...e.entries()].map(s=>({label:s[0],value:s[1]})).sort((s,l)=>l.value-s.value);return(0,u.ve8)().value(s=>s.value)(a)},"createPieArcs"),te={parser:Q,db:A,renderer:{draw:(0,t.eW)((e,a,g,s)=>{t.cM.debug("rendering pie chart\n"+e);const l=s.db,P=(0,t.nV)(),O=(0,W.Rb)(l.getConfig(),P.pie),o=18,c=450,T=(0,B.P)(a),d=T.append("g");d.attr("transform","translate(225,225)");const{themeVariables:r}=P;let[$]=(0,W.VG)(r.pieOuterStrokeWidth);$??=2;const R=O.textPosition,f=Math.min(450,c)/2-40,ae=(0,u.Nb1)().innerRadius(0).outerRadius(f),re=(0,u.Nb1)().innerRadius(f*R).outerRadius(f*R);d.append("circle").attr("cx",0).attr("cy",0).attr("r",f+$/2).attr("class","pieOuterCircle");const I=l.getSections(),S=X(I),ie=[r.pie1,r.pie2,r.pie3,r.pie4,r.pie5,r.pie6,r.pie7,r.pie8,r.pie9,r.pie10,r.pie11,r.pie12],p=(0,u.PKp)(ie);d.selectAll("mySlices").data(S).enter().append("path").attr("d",ae).attr("fill",i=>p(i.data.label)).attr("class","pieCircle");let k=0;I.forEach(i=>{k+=i}),d.selectAll("mySlices").data(S).enter().append("text").text(i=>(i.data.value/k*100).toFixed(0)+"%").attr("transform",i=>"translate("+re.centroid(i)+")").style("text-anchor","middle").attr("class","slice"),d.append("text").text(l.getDiagramTitle()).attr("x",0).attr("y",-200).attr("class","pieTitleText");const x=d.selectAll(".legend").data(p.domain()).enter().append("g").attr("class","legend").attr("transform",(i,v)=>"translate(216,"+(22*v-22*p.domain().length/2)+")");x.append("rect").attr("width",o).attr("height",o).style("fill",p).style("stroke",p),x.data(S).append("text").attr("x",22).attr("y",14).text(i=>{const{label:v,value:m}=i.data;return l.getShowData()?`${v} [${m}]`:v});const L=512+Math.max(...x.selectAll("text").nodes().map(i=>i?.getBoundingClientRect().width??0));T.attr("viewBox",`0 0 ${L} 450`),(0,t.v2)(T,c,L,O.useMaxWidth)},"draw")},styles:J}}}]);