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.
1 line
6.0 KiB
1 line
6.0 KiB
"use strict";(self.webpackChunkjupyter_web=self.webpackChunkjupyter_web||[]).push([[6866],{6866:(et,M,p)=>{p.r(M),p.d(M,{diagram:()=>X});var L=p(53420),O=p(23854),f=p(62477),T=p(39624),s=p(3685),D=p(32928),x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},C={axes:[],curves:[],options:x},m=structuredClone(C),R=s.vZ.radar,P=(0,s.eW)(()=>(0,f.Rb)({...R,...(0,s.iE)().radar}),"getConfig"),W=(0,s.eW)(()=>m.axes,"getAxes"),I=(0,s.eW)(()=>m.curves,"getCurves"),k=(0,s.eW)(()=>m.options,"getOptions"),S=(0,s.eW)(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),j=(0,s.eW)(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:B(t.entries)}))},"setCurves"),B=(0,s.eW)(a=>{if(null==a[0].axis)return a.map(e=>e.value);const t=W();if(0===t.length)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(n=>n.axis?.$refText===e.name);if(void 0===r)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),v={getAxes:W,getCurves:I,getOptions:k,setAxes:S,setCurves:j,setOptions:(0,s.eW)(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});m.options={showLegend:t.showLegend?.value??x.showLegend,ticks:t.ticks?.value??x.ticks,max:t.max?.value??x.max,min:t.min?.value??x.min,graticule:t.graticule?.value??x.graticule}},"setOptions"),getConfig:P,clear:(0,s.eW)(()=>{(0,s.ZH)(),m=structuredClone(C)},"clear"),setAccTitle:s.GN,getAccTitle:s.eu,setDiagramTitle:s.g2,getDiagramTitle:s.Kr,getAccDescription:s.Mx,setAccDescription:s.U$},G=(0,s.eW)(a=>{(0,O.A)(a,v);const{axes:t,curves:e,options:r}=a;v.setAxes(t),v.setCurves(e),v.setOptions(r)},"populate"),K={parse:(0,s.eW)(function(){var a=(0,L.Z)(function*(t){const e=yield(0,D.Qc)("radar",t);s.cM.debug(e),G(e)});return function(t){return a.apply(this,arguments)}}(),"parse")},z=(0,s.eW)((a,t,e,r)=>{const n=r.db,i=n.getAxes(),l=n.getCurves(),o=n.getOptions(),c=n.getConfig(),d=n.getDiagramTitle(),h=(0,T.P)(t),u=N(h,c),g=o.max??Math.max(...l.map(y=>Math.max(...y.entries))),_=o.min,$=Math.min(c.width,c.height)/2;H(u,i,$,o.ticks,o.graticule),Z(u,i,$,c),b(u,i,l,_,g,o.graticule,c),E(u,l,o.showLegend,c),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),N=(0,s.eW)((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,n_x=t.marginLeft+t.width/2,n_y=t.marginTop+t.height/2;return a.attr("viewbox",`0 0 ${e} ${r}`).attr("width",e).attr("height",r),a.append("g").attr("transform",`translate(${n_x}, ${n_y})`)},"drawFrame"),H=(0,s.eW)((a,t,e,r,n)=>{if("circle"===n)for(let i=0;i<r;i++){const l=e*(i+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if("polygon"===n){const i=t.length;for(let l=0;l<r;l++){const o=e*(l+1)/r,c=t.map((d,h)=>{const u=2*h*Math.PI/i-Math.PI/2;return`${o*Math.cos(u)},${o*Math.sin(u)}`}).join(" ");a.append("polygon").attr("points",c).attr("class","radarGraticule")}}},"drawGraticule"),Z=(0,s.eW)((a,t,e,r)=>{const n=t.length;for(let i=0;i<n;i++){const l=t[i].label,o=2*i*Math.PI/n-Math.PI/2;a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*Math.cos(o)).attr("y2",e*r.axisScaleFactor*Math.sin(o)).attr("class","radarAxisLine"),a.append("text").text(l).attr("x",e*r.axisLabelFactor*Math.cos(o)).attr("y",e*r.axisLabelFactor*Math.sin(o)).attr("class","radarAxisLabel")}},"drawAxes");function b(a,t,e,r,n,i,l){const o=t.length,c=Math.min(l.width,l.height)/2;e.forEach((d,h)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,_)=>{const $=2*Math.PI*_/o-Math.PI/2,y=w(g,r,n,c);return{x:y*Math.cos($),y:y*Math.sin($)}});"circle"===i?a.append("path").attr("d",A(u,l.curveTension)).attr("class",`radarCurve-${h}`):"polygon"===i&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${h}`)})}function w(a,t,e,r){return r*(Math.min(Math.max(a,t),e)-t)/(e-t)}function A(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let n=0;n<e;n++){const i=a[(n-1+e)%e],l=a[n],o=a[(n+1)%e],c=a[(n+2)%e],d={x:l.x+(o.x-i.x)*t,y:l.y+(o.y-i.y)*t},h={x:o.x-(c.x-l.x)*t,y:o.y-(c.y-l.y)*t};r+=` C${d.x},${d.y} ${h.x},${h.y} ${o.x},${o.y}`}return`${r} Z`}function E(a,t,e,r){if(!e)return;const n=3*(r.width/2+r.marginRight)/4,i=3*-(r.height/2+r.marginTop)/4;t.forEach((o,c)=>{const d=a.append("g").attr("transform",`translate(${n}, ${i+20*c})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${c}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}(0,s.eW)(b,"drawCurves"),(0,s.eW)(w,"relativeRadius"),(0,s.eW)(A,"closedRoundCurve"),(0,s.eW)(E,"drawLegend");var V={draw:z},Y=(0,s.eW)((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const n=a[`cScale${r}`];e+=`\n\t\t.radarCurve-${r} {\n\t\t\tcolor: ${n};\n\t\t\tfill: ${n};\n\t\t\tfill-opacity: ${t.curveOpacity};\n\t\t\tstroke: ${n};\n\t\t\tstroke-width: ${t.curveStrokeWidth};\n\t\t}\n\t\t.radarLegendBox-${r} {\n\t\t\tfill: ${n};\n\t\t\tfill-opacity: ${t.curveOpacity};\n\t\t\tstroke: ${n};\n\t\t}\n\t\t`}return e},"genIndexStyles"),Q=(0,s.eW)(a=>{const t=(0,s.xN)(),e=(0,s.iE)(),r=(0,f.Rb)(t,e.themeVariables);return{themeVariables:r,radarOptions:(0,f.Rb)(r.radar,a)}},"buildRadarStyleOptions"),X={parser:K,db:v,renderer:V,styles:(0,s.eW)(({radar:a}={})=>{const{themeVariables:t,radarOptions:e}=Q(a);return`\n\t.radarTitle {\n\t\tfont-size: ${t.fontSize};\n\t\tcolor: ${t.titleColor};\n\t\tdominant-baseline: hanging;\n\t\ttext-anchor: middle;\n\t}\n\t.radarAxisLine {\n\t\tstroke: ${e.axisColor};\n\t\tstroke-width: ${e.axisStrokeWidth};\n\t}\n\t.radarAxisLabel {\n\t\tdominant-baseline: middle;\n\t\ttext-anchor: middle;\n\t\tfont-size: ${e.axisLabelFontSize}px;\n\t\tcolor: ${e.axisColor};\n\t}\n\t.radarGraticule {\n\t\tfill: ${e.graticuleColor};\n\t\tfill-opacity: ${e.graticuleOpacity};\n\t\tstroke: ${e.graticuleColor};\n\t\tstroke-width: ${e.graticuleStrokeWidth};\n\t}\n\t.radarLegendText {\n\t\ttext-anchor: start;\n\t\tfont-size: ${e.legendFontSize}px;\n\t\tdominant-baseline: hanging;\n\t}\n\t${Y(t,e)}\n\t`},"styles")}}}]); |