Newer
Older
Nanping_sponge_JXKH / spongePerformanceDist / assets / barChart.0f07440b.js
import{ao as u,ap as d,al as p,C as y,o as f,c as h,h as x,v as g}from"./index.82404a61.js";const m=["id"],A={__name:"barChart",props:{refresh:{type:[String,Number],default:1},echartData:{type:Object,default:{}},title:{type:String,default:""},xAxisType:{type:String,default:"category"},yAxisType:{type:String,default:"value"},stack:{type:String,default:""},legend:{type:Object,default:{top:"2%",orient:"horizontal",left:"center"}},yAxisName:{type:String,default:""},xAxisName:{type:String,default:""},grid:{type:Object,default:{left:"3%",right:"7%",top:"25%",bottom:"3%",containLabel:!0}},tooltipFormatter:{type:Function,default:null},event:{type:String,default:""}},setup(o,{emit:l}){const t=o,{proxy:s}=g(),i=u(),e=d("");p(()=>t.refresh,a=>{e.value&&e.value.dispose(),r()});function c(){e.value&&e.value.resize()}function r(){const a=document.getElementById(i);!a||a.clientWidth===0||a.clientHeight===0||(e.value=s.echarts.init(a),e.value.setOption({title:{text:t.title},tooltip:{trigger:"axis",showDelay:0,axisPointer:{type:"shadow"},formatter:t.tooltipFormatter},grid:t.grid,legend:t.legend,xAxis:{type:t.xAxisType,boundaryGap:[0,.01],data:t.echartData.xAxisData,name:t.xAxisName,axisLabel:{color:"#222"}},yAxis:{type:t.yAxisType,data:t.echartData.yAxisData,name:t.yAxisName,minInterval:1,nameTextStyle:{color:"#222",fontSize:12},axisLabel:{color:"#222",fontSize:12},...t.echartData.yAxisOption||{}},series:t.echartData.seriesData}),t.event&&e.value.on(t.event,function(n){l(`${t.event}-callback`,{chart:e.value,params:n})}))}return y(()=>{r(),window.addEventListener("resize",c)}),(a,n)=>(f(),h("div",{id:x(i),style:{width:"100%",height:"100%"}},null,8,m))}};export{A as _};