import{d as y}from"./debounce-Xd493GvO.js";import{r as g}from"./request-CEvu378m.js";import{ar as x}from"./echarts-DB130vfq.js";import{ax as V,r as q,s as _,c,j as k,w as v,S as z,B as C,z as K}from"./vue-BJk78QHK.js";import"./index-M_JNBppB.js";import"./element-3_pOinej.js";import"./utils-YI6ye1sf.js";import"./threejs-BafxXW5-.js";import"./vxe-Dx3zSILm.js";const L=Object.assign({name:"Bar3"},{__name:"Bar3",props:{propValue:{type:Object,required:!0},request:{type:Object,default:()=>{}},element:{type:Object,default:()=>{}}},setup(w){const t=w,u=V(),m=q(null),a=_(null),n=q(null),b=c(()=>t.propValue.data),h=c(()=>t.propValue.styleConfig),S=c(()=>{const o=t.element.style.width,l=t.element.style.height;return{width:o,height:l}}),p=c(()=>{const o=JSON.parse(JSON.stringify(t.propValue.option)),l=[],i=[];let r=0;return b.value.forEach(e=>{const s={name:e.name,type:"bar",barWidth:h.value.barWidth,stack:"total-stack",label:{normal:{borderWidth:10,distance:20,align:"center",verticalAlign:"middle",borderRadius:1,borderColor:e.color,backgroundColor:e.color,show:!0,position:"top",formatter:"{c}%",color:"#000"}},itemStyle:{color:e.color},data:[{value:e.value,itemStyle:{color:{type:"bar",colorStops:[{offset:0,color:e.color},{offset:1,color:e.color}]}}}]},f={name:`${e.name}-triangle`,type:"line",markPoint:{symbol:"triangle",symbolRotate:"180",itemStyle:{color:e.color},symbolSize:h.value.symbolSize,symbolOffset:[0,-15],data:[{coord:[r+e.value/2]}],label:{show:!1}}};l.push(s),l.push(f),i.push({name:e.name}),r+=e.value}),o.series=l,o.legend.data=i,o.xAxis[0].max=b.value.reduce((e,s)=>e+s.value,0),o});function O(){a.value&&a.value.dispose(),a.value=x(m.value),a.value.setOption(p.value)}function d(){a.value&&a.value.resize()}return k(()=>{var o,l;t.request&&(n.value=g(t.request,t.propValue,"data")),((l=(o=t.request)==null?void 0:o.global)==null?void 0:l.length)>0&&v(()=>u.state.globalKey,()=>{t.request.global.forEach(i=>{const r=u.state.globalKey.findIndex(e=>e.globalKey===i);if(r>-1){const e=[u.state.globalKey[r].globalKey,u.state.globalKey[r].globalValue],s=t.request.data.findIndex(f=>f[0]===e[0]);s>-1?t.request.data[s][1]=e[1]:t.request.data.push(e)}}),n.value(),n.value=g(t.request,t.propValue,"data")},{deep:!0}),O(),window.addEventListener("resize",d)}),z(()=>{window.removeEventListener("resize",d),t.propValue.request&&n.value&&n.value(),a.value&&(a.value.dispose(),a.value=null)}),v(()=>p,y(()=>{a.value&&a.value.setOption(p.value,!0)},300),{deep:!0}),v(S,y(()=>{d()},300),{deep:!0}),(o,l)=>(K(),C("div",{ref_key:"chartRef",ref:m,style:{width:"100%",height:"100%"}},null,512))}});export{L as default};
