import{d as y}from"./debounce-Xd493GvO.js";import{r as h}from"./request-CEvu378m.js";import{as as O,ar as x}from"./echarts-DB130vfq.js";import{r as b,s as V,c as p,j as z,w as c,S,B as _,z as j}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 I=Object.assign({name:"Bar4"},{__name:"Bar4",props:{propValue:{type:Object,required:!0},request:{type:Object,default:()=>({})},element:{type:Object,default:()=>({})}},setup(g){const t=g,d=b(null),r=V(null),l=b(null),f=p(()=>{var e,a;return((a=(e=t.propValue)==null?void 0:e.data)==null?void 0:a.data)||[]}),m=p(()=>{var e,a;return((a=(e=t.propValue)==null?void 0:e.data)==null?void 0:a.color)||["#4fd8dd","#3377ff"]}),i=p(()=>{var o;const e=JSON.parse(JSON.stringify(t.propValue.option)),a=f.value.map(s=>s.name),n=f.value.map(s=>s.value);return e.xAxis.data=a,((o=e.series)==null?void 0:o.length)>0&&(e.series[0]=Object.assign(e.series[0],{data:n,itemStyle:{color:new O(0,0,0,1,[{offset:0,color:m.value[0]},{offset:1,color:m.value[1]}])},z:10}),e.series[1]||(e.series[1]={type:"line",showSymbol:!1,silent:!0,lineStyle:{width:0},areaStyle:{color:"rgba(51, 119, 255, 0.1)"},z:1}),e.series[1].data=n),e});function q(){r.value&&r.value.dispose(),r.value=x(d.value),r.value.setOption(i.value)}function u(){var e;(e=r.value)==null||e.resize()}return z(()=>{var e,a;t.request&&(l.value=h(t.request,t.propValue,"data")),((a=(e=t.request)==null?void 0:e.global)==null?void 0:a.length)>0&&c(()=>store.state.globalKey,()=>{t.request.global.forEach(n=>{const o=store.state.globalKey.findIndex(s=>s.globalKey===n);if(o>-1){const s=[store.state.globalKey[o].globalKey,store.state.globalKey[o].globalValue],v=t.request.data.findIndex(w=>w[0]===s[0]);v>-1?t.request.data[v][1]=s[1]:t.request.data.push(s)}}),l.value(),l.value=h(t.request,t.propValue,"data")},{deep:!0}),q(),window.addEventListener("resize",u)}),S(()=>{var e;window.removeEventListener("resize",u),t.propValue.request&&l.value&&l.value(),(e=r.value)==null||e.dispose()}),c(i,y(()=>{var e;(e=r.value)==null||e.setOption(i.value,!0)},300),{deep:!0}),c(()=>[t.element.style.width,t.element.style.height],y(u,300)),(e,a)=>(j(),_("div",{ref_key:"chartRef",ref:d,style:{width:"100%",height:"100%"}},null,512))}});export{I as default};
