PageSourceSearch

https://aecharts.com/assets/hbarchart-yLSiK-xV.js

js aecharts.com collected 2026-09-24 12:57:29 UTC 13,061 bytes, 1 lines download raw bytes

1import{C as Ne,a as Re}from"./data-Dm9M-1xE.js";import{o as ve,L as Le,C as _e,Q as Ce,a as fe,b as Ee,D as Be,R as De,S as Ie,n as Se,d as we,m as H,e as Me,f as Te,T as Oe,h as Ge,r as Ye,i as Pe,a6 as We,g as Fe,j as He,q as de,u as he,v as Ke,k as xe,l as $e,t as ce,p as Ue,Y as ke,Z as ge,x as ye,y as me,$ as ze,U as Xe,a0 as Ve,w as ue,a1 as qe,B as X,E as Qe,G as Ze,F as je,H as Je,I as et,J as tt,a2 as st,a3 as at,a4 as ot,a5 as it}from"./chartUtils-ClGoyG7d.js";import{m as rt,c as nt,a as ct,b as lt,d as dt}from"./validation-BkU9VOiW.js";import{m as ht,b as mt,a as ut}from"./nodeUtils-QlcqxozC.js";import{b as pt}from"./annotationUtils-Bobrv6Il.js";(function(){try{var x=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};x.SENTRY_RELEASE={id:"acc43460c2f2119eb9918d4f2e6bbb38a1784977"};var c=new x.Error().stack;c&&(x._sentryDebugIds=x._sentryDebugIds||{},x._sentryDebugIds[c]="37e53815-646d-4dd5-a634-0d520b979179",x._sentryDebugIdIdentifier="sentry-dbid-37e53815-646d-4dd5-a634-0d520b979179")}catch{}})();ve({animationSpeed:Se(),spacing:Se(),bar:Ie,label:De,stackTotalLabel:Be,stackConnector:fe,xaxis:Ee,yaxis:fe,xgrid:fe,xticks:Ce,yticks:_e,legend:Le});function bt(x){return{animationSpeed:x.animationSpeed??1,spacing:x.spacing??1,bar:X(it,{width:70,...x.bar}),label:X(ot,x.label),stackTotalLabel:X(at,{visible:!1,...x.stackTotalLabel}),stackConnector:X(st,{visible:!1,...x.stackConnector}),xaxis:X(tt,{count:8,visible:!1,...x.xaxis}),yaxis:X(et,{visible:!1,...x.yaxis}),xgrid:X(Je,x.xgrid),xticks:X(je,{fontSize:14,...x.xticks}),yticks:X(Ze,{fontSize:16,...x.yticks}),legend:X(Qe,x.legend)}}class Tt extends Ne{static chartType="HBarChart";static schema=Re;xIsCategorical=!1;static validateReport(c){const s=Object.keys(c[0]??{}).filter(a=>a==="y"||/^y\d+$/.test(a));return rt([nt(c),ct(c),lt(c,"x",'"x" (category)'),dt(c,s)])}getColorDomain(){return this.seriesKeys?.length?we("bar",this.seriesKeys):this.categories.map((c,s)=>({role:"bar",key:H("bar",s)}))}rowsToColumns(c,s){if(!Array.isArray(c))return c;const a=c[0]||{},e=Me(a);if(this.isMultiSeries=e.length>1,!this.isMultiSeries){const o={xs:c.map(b=>b.x),ys:c.map(b=>b.y)};return this.categories=o.xs,this.seriesNames=[],o}this.categories=c.map(o=>o.x),this.seriesKeys=e,this.seriesNames=e.map(o=>s?.find(b=>b.key===o)?.name||o);const i=[],A=[],g=[],p=[];return c.forEach((o,b)=>{e.forEach((k,N)=>{i.push(o.x),A.push(o[k]??0),g.push(N),p.push(b)})}),{xs:i,ys:A,seriesIndices:g,categoryIndices:p,categories:this.categories,seriesNames:this.seriesNames,isMultiSeries:!0}}update(c,s){super.update(c,s);const a=this._data,e=bt(s);this._resolvedStyle=e;const{width:i,height:A}=this,{w:g,h:p}=$e(i,A),o=[],b=a.categories||a.xs,k=a.isMultiSeries&&e.bar.mode==="stacked-100",N=this.seriesNames.length,w=k?(()=>{const m=[...a.ys],d=a.categoryIndices?Math.max(...a.categoryIndices)+1:1;for(let T=0;T<d;T++){let ae=0;for(let I=0;I<N;I++)ae+=Math.max(0,a.ys[T*N+I]);for(let I=0;I<N;I++){const oe=a.ys[T*N+I];m[T*N+I]=ae>0?Math.max(0,oe)/ae*100:0}}return{...a,ys:m}})():a,V=w.ys;let u,R;if(k)u=0,R=100;else if(u=e.xaxis.min??Te(Math.min(0,...V)),a.isMultiSeries&&a.categoryIndices&&e.bar.mode==="stacked"){const m=Oe(a.ys,a.categoryIndices);R=e.xaxis.max??Math.max(0,m.niceMax)}else R=e.xaxis.max??Math.max(0,Te(Math.max(...a.ys)));const y=R-u,M={prefix:e.xticks.prefix,suffix:k&&!e.xticks.suffix?"%":e.xticks.suffix,decimals:e.xticks.decimals},P=Ge(u,y,e.xaxis.count,M),K=!!(a.isMultiSeries&&this.seriesNames.length>0),{resolved:U,labels:z}=Ye(P,()=>e.xticks),h=b.map(()=>e.yticks),O=b.map((m,d)=>h[d].text??String(m));this.parents={},this.displayNames={},this.dataFieldsByNodeId={};const v=this.seriesNames.map((m,d)=>this.seriesKeys?.[d]??m),C=K?this.seriesNames.map((m,d)=>e.legend.text??m):[],n=Pe({canvasWidth:i,canvasHeight:A,spacing:e.spacing,title:s.title??null,subtitle:s.subtitle??null,footer:s.footer??null,xlabel:s.xlabel??null,ylabel:s.ylabel??null,yTickLabels:O,yTickStyle:e.yticks,xTickLabels:z,xTickStyle:e.xticks,xTickVisible:e.xticks.visible,yTickVisible:e.yticks.visible,xTickEdgeReserve:We(u,R,e.xaxis.count),legend:{visible:K&&e.legend.visible,items:C,fontSize:e.legend.fontSize,fontFamily:e.legend.fontFamily,fontWeight:e.legend.fontWeight,position:e.legend.position}});this._plotBounds=n.plot;const t=Fe(e.animationSpeed),{norm:r}=n,l=r.left,f=r.right,L=r.bottom,S=r.top,W=l,E=f,B=E-W,F=l+B*((0-u)/y),_=He(u,R,e.xaxis.count,W,E,M),G=b.length,D=L,Y=S,Q=(Y-D)/G,ee=b.map((m,d)=>Y-Q*d-Q/2),ie=[{start:.1,duration:t.GRID_DURATION,from:{attr:{opacity:0}
1},to:{attr:{opacity:1}},ease:"power2.out"}];if(o.push(...ht(n,s,t)),K&&this.seriesNames.length>0){const m=e.legend.color??s.title?.color??"#000000",d=s.title?.align??"right",T=this.seriesNames.map((I,oe)=>{const be=v[oe],Ae=de(e.bar,s.bar,s,"bar",be);return{text:C[oe],color:Ae.color??he(oe,s),id:be}}),ae=this.seriesNames.map((I,oe)=>[{start:.35+.03*oe,duration:t.TITLE_DURATION,from:{attr:{opacity:0}},to:{attr:{opacity:1}},ease:"power2.out"}]);o.push(...Ke(T,n,this.defs,{fontSize:e.legend.fontSize,fontFamily:e.legend.fontFamily,fontWeight:e.legend.fontWeight,color:m,swatchSize:e.legend.swatchSize,gap:e.legend.gap,itemSpacing:e.legend.itemSpacing,visible:e.legend.visible,align:d,position:e.legend.position,animations:ae}));for(const I of T)this.displayNames[H("legend",I.id)]=I.text,this.dataFieldsByNodeId[H("legend",I.id)]={kind:"metadata",metaKey:String(I.id),required:!0}}o.push(...mt(n,g,p,s,t)),o.push(...ut(n,s,t));const q=p(D),Z=p(Y);_.positions.forEach((m,d)=>{if(d===0)return;const T=e.xgrid,ae=xe(H("xgrid",d),g(m),q,g(m),Z,T.color,T.strokeWidth,T.visible,ie,T.dash,"xgrid",T.startArrow,T.endArrow);o.push(ae)});const j=u<0,te=g(F);o.push(xe("xaxis",te,p(D),te,p(Y),e.xaxis.color,1,j,[{start:.1,duration:t.AXIS_DURATION,from:{attr:{opacity:0}
1},to:{attr:{opacity:j?.8:0}},ease:"power2.out"}],e.xaxis.dash,"xaxis",e.xaxis.startArrow,e.xaxis.endArrow));const se=m=>[{start:.2+t.TICK_STAGGER*m,duration:t.TICK_DURATION,from:{attr:{opacity:0}},to:{attr:{opacity:1}},ease:"power2.out"}],J=n.yTickStripWidth-n.tickLabelPad,pe=n.yTickX-J;b.forEach((m,d)=>{const T=ce(H("yticks",d),pe,p(ee[d]),O[d],h[d],"right","middle",h[d].visible,se(d),1,J,"yticks");this.dataFieldsByNodeId[T.id]={kind:"row",rowIndex:d,field:"x",valueType:"string",required:!0},o.push(T)});const le=Ue({labels:z,positions:_.positions,resolvedStyles:U,baseTickStyle:e.xticks,screenw:g,tickY:n.xTickY,screenWidthPx:i,animFn:se});o.push(...le);const re={categories:b,categoryYs:ee,categoryHeight:Q,xmin:u,xmax:R,xrange:y,pixelxmin:W,pixelxrange:B,xZeroNorm:F,normLeft:l,width:i,height:A,screenw:g,screenh:p};this.anchorPoints=[],a.isMultiSeries?e.bar.mode==="stacked"||e.bar.mode==="stacked-100"?this.buildBarsStacked(w,s,e,re,t,o):this.buildBarsGrouped(w,s,e,re,t,o):this.buildBarsSingleSeries(w,s,e,re,t,o);const ne={plotLeft:g(l),plotRight:g(f),plotTop:p(D),plotBottom:p(Y),dataToPixelX:m=>g(l+B*((m-u)/y)),defaultFontFamily:s.title?.fontFamily||"Inter",defaultFontSize:e.xticks.fontSize,anchorPoints:this.anchorPoints,chartOrientation:"horizontal",revealAnimation:{start:t.DATA_START_DELAY+t.ANNOTATION_REVEAL_DELAY,duration:t.ANNOTATION_DURATION}};o.push(...pt(s.annotations,ne)),this.nodes=o}buildBarsSingleSeries(c,s,a,e,i,A){const{categoryYs:g,categoryHeight:p,xmin:o,xmax:b,xrange:k,pixelxrange:N,normLeft:w,height:V,screenw:u,screenh:R}=e,y=Math.max(0,o),M=w+N*((y-o)/k),P=u(M),K=i.DATA_START_DELAY,U=ke(p*V,1,a.bar.width).barSize;c.ys.forEach((z,h)=>{const O=de(a.bar,s.bar,s,"bar",void 0,h),v=a.label,C={prefix:v.prefix,suffix:v.suffix,decimals:v.decimals},n=Math.max(o,Math.min(z,b)),t=N*((n-y)/k),r=u(t),l=Math.abs(r),f=r>=0?P:P+r,L=R(g[h])-U/2,S=O.color??he(0,s),W=K+i.BAR_STAGGER*h,E=H("bar",h);A.push(ge(E,f,L,l,U,ye(E,S,this.defs),O.borderRadius,O.strokeColor,O.strokeWidth,!0,[{start:W,duration:i.BAR_DURATION,from:{attr:{x:P,width:0}},to:{attr:{x:f,width:l}},ease:"power2.out"}],"bar",O.dash)),this.displayNames[E]=String(e.categories[h]),this.anchorPoints.push({id:`anchor-0-${h}`,x:P+r,y:R(g[h]),categoryIndex:h,seriesIndex:0,value:z,isTotalAnchor:!0});const B=M+t/2,F=v.position==="outside"?r>=0?P+r+6:P+r-6:u(B),_=v.position==="outside"?r>=0?"left":"right":"center",G=ce(H("label",h),F,R(g[h]),v.text??me(z,C),v,_,"middle",v.visible,[{start:W+i.BAR_DURATION*.5,duration:i.LABEL_DURATION*2,from:{attr:{opacity:0}
1},to:{attr:{opacity:1}},ease:"power2.out"}],0,0,"label");this.displayNames[G.id]=String(e.categories[h]),this.dataFieldsByNodeId[G.id]={kind:"row",rowIndex:h,field:"y",valueType:"number",required:!0,formatOptions:C},A.push(G)})}buildBarsGrouped(c,s,a,e,i,A){const{categories:g,categoryYs:p,categoryHeight:o,xmin:b,xmax:k,xrange:N,pixelxmin:w,pixelxrange:V,height:u,screenw:R,screenh:y}=e,M=this.seriesNames.length,P=i.DATA_START_DELAY,K=o*u,U=ze*Xe(u,a.spacing),{clusterSize:z,barSize:h}=Ve(K,M,a.bar.width,U);let O=0;g.forEach((v,C)=>{const n=y(p[C]);this.seriesNames.forEach((t,r)=>{const l=this.seriesKeys?.[r]??t,f=`${C}-${l}`,L=de(a.bar,s.bar,s,"bar",l,f),S=a.label,W={prefix:S.prefix,suffix:S.suffix,decimals:S.decimals},E=c.ys[O],B=Math.max(b,Math.min(E,k)),F=V*((B-b)/N),_=R(F),G=Math.abs(_),D=R(w),Y=_>=0?D:D+_,$=n+qe(z,h,U,r),Q=$-h/2,ee=L.color??he(r,s),ie=P+i.CATEGORY_STAGGER*C+i.SERIES_STAGGER*r,q=H("bar",f),Z=ge(q,Y,Q,G,h,ye(q,ee,this.defs),L.borderRadius,L.strokeColor,L.strokeWidth,!0,[{start:ie,duration:i.BAR_DURATION,from:{attr:{x:D,width:0}},to:{attr:{x:Y,width:G}},ease:"power2.out"}],"bar",L.dash);this.parents[Z.id]=ue("bar",l),this.displayNames[ue("bar",l)]=t,this.displayNames[Z.id]=`${String(v)} · ${t}`,A.push(Z),this.anchorPoints.push({id:`anchor-${r}-${C}`,x:D+_,y:$,categoryIndex:C,seriesIndex:r,value:E,isTotalAnchor:!0});const j=w+F/2,te=S.position==="outside"?_>=0?D+_+6:D+_-6:R(j),se=S.position==="outside"?_>=0?"left":"right":"center",J=ce(H("label",f),te,$,S.text??me(E,W),S,se,"middle",S.visible,[{start:ie+i.CATEGORY_STAGGER,duration:i.LABEL_DURATION*2,from:{attr:{opacity:0}
1},to:{attr:{opacity:1}},ease:"power2.out"}],0,0,"label");this.displayNames[J.id]=`${String(v)} · ${t}`,this.dataFieldsByNodeId[J.id]={kind:"row",rowIndex:C,field:l,valueType:"number",required:!0,formatOptions:W},A.push(J),O++})})}buildBarsStacked(c,s,a,e,i,A){if(c.ys.some(n=>n<0)){console.warn("HBarChart: Stacked mode does not support negative values.");return}const{categories:p,categoryYs:o,categoryHeight:b,xmin:k,xmax:N,xrange:w,pixelxmin:V,pixelxrange:u,height:R,screenw:y,screenh:M}=e,P=i.DATA_START_DELAY,K=this.seriesNames.length,U=p.map((n,t)=>{const r=t*K,l=[];let f=0;for(let L=0;L<K;L++){f+=c.ys[r+L];const S=Math.min(Math.max(f,k),N);l.push(V+u*((S-k)/w))}return l}),z=[{start:.1,duration:i.GRID_DURATION,from:{attr:{opacity:0}},to:{attr:{opacity:1}},ease:"power2.out"}],h=ke(b*R,1,a.bar.width).barSize,O=Math.abs(h),v=a.bar.mode==="stacked-100";if(p.length>1)for(let n=0;n<p.length-1;n++)for(let t=0;t<K;t++){const r=this.seriesKeys?.[t]??this.seriesNames[t],l=`${n}-${r}`,f=a.stackConnector,L=y(U[n][t]),S=M(o[n])+O/2,W=y(U[n+1][t]),E=M(o[n+1])-O/2,B=xe(H("stackConnector",l),L,S,W,E,f.color,f.strokeWidth,f.visible,z,f.dash??"dashed","stackConnector",f.startArrow,f.endArrow),F=this.seriesNames[t];this.displayNames[B.id]=F,A.push(B)}let C=0;p.forEach((n,t)=>{let r=0;this.seriesNames.forEach((B,F)=>{const _=c.ys[C],G=this.seriesKeys?.[F]??B,D=`${t}-${G}`,Y=de(a.bar,s.bar,s,"bar",G,D),$=a.label,Q={prefix:$.prefix,suffix:$.suffix,decimals:$.decimals??(v?0:void 0)},ee=Math.min(Math.max(r,k),N),ie=Math.min(Math.max(r+_,k),N),q=V+u*((ee-k)/w),Z=u*((ie-ee)/w),j=y(Z),te=Math.abs(j),se=j>=0?y(q):y(q)+j,J=M(o[t])-h/2,pe=Y.color??he(F,s),le=P+i.CATEGORY_STAGGER*t+i.STACKED_STAGGER*F,re=H("bar",D),ne=ge(re,se,J,te,h,ye(re,pe,this.defs),Y.borderRadius,Y.strokeColor,Y.strokeWidth,!0,[{start:le,duration:i.BAR_DURATION,from:{attr:{x:y(q),width:0}},to:{attr:{x:se,width:te}},ease:"power2.out"}],"bar",Y.dash);this.parents[ne.id]=ue("bar",G),this.displayNames[ue("bar",G)]=B,this.displayNames[ne.id]=`${String(n)} · ${B}`,A.push(ne);const m=q+Z/2,d=ce(H("label",D),y(m),M(o[t]),$.text??me(_,Q),$,"center","middle",$.visible,[{start:le+i.CATEGORY_STAGGER,duration:i.LABEL_DURATION*2,from:{attr:{opacity:0}
1},to:{attr:{opacity:1}},ease:"power2.out"}],0,0,"label");this.displayNames[d.id]=`${String(n)} · ${B}`,v||(this.dataFieldsByNodeId[d.id]={kind:"row",rowIndex:t,field:G,valueType:"number",required:!0,formatOptions:Q}),A.push(d),r+=_,C++});const l=a.stackTotalLabel,f={prefix:l.prefix,suffix:l.suffix,decimals:l.decimals??(v?0:void 0)},L=Math.min(Math.max(r,k),N),S=V+u*((L-k)/w);this.anchorPoints.push({id:`anchor-0-${t}`,x:y(S),y:M(o[t]),categoryIndex:t,seriesIndex:0,value:r,isTotalAnchor:!0});const W=P+i.CATEGORY_STAGGER*t+i.BAR_DURATION*.8,E=ce(H("stackTotalLabel",t),y(S)+6,M(o[t]),l.text??me(r,f),l,"left","middle",l.visible,[{start:W,duration:i.LABEL_DURATION,from:{attr:{opacity:0}},to:{attr:{opacity:1}},ease:"power2.out"}],1,0,"stackTotalLabel");this.displayNames[E.id]=String(n),A.push(E)})}}export{Tt as H};

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.