2024-08-06 15:05:43 +08:00
|
|
|
import"./index.2809c208.js";import{_ as x,r as u,a2 as p,a7 as _,x as y,ah as v,a4 as w,o as b,c as g,q as k,s as z,l as L}from"./index.9f28707e.js";import{ai as h,aj as c}from"./linkSeriesData.e74eae00.js";const B=n=>(k("data-v-f50ade16"),n=n(),z(),n),S={class:"EchartsBox"},E=B(()=>L("div",{id:"myChart"},null,-1)),I=[E],A={__name:"EchartsMJ",props:{mj:{type:Object,default:()=>[]}},setup(n){const f=n;let l=u([]),d=u([]);function m(){var s=document.getElementById("myChart"),t=h(s);window.addEventListener("resize",function(){t.resize()});var a;let o=l.value,i=d.value;for(let e=0;e<i.length;e++);a={title:{text:"",subtext:""},tooltip:{trigger:"axis",formatter:function(e){return e[0].name+"<br/><span style='display:inline-block;width:8px;height:8px;background:#aee7be;border-radius: 4px;margin-right: 6px;'></span>\u9762\u79EF\uFF1A"+e[0].value+" (\u4EA9)"},textStyle:{fontSize:14}},xAxis:{data:o,axisLabel:{inside:!1,color:"#aaa"},axisTick:{show:!1},axisLine:{show:!1},z:10},yAxis:{name:"\u9762\u79EF\uFF08\u4EA9\uFF09",axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#999"}},dataZoom:[{type:"inside"}],series:[{type:"bar",showBackground:!0,itemStyle:{color:new c(0,0,0,1,[{offset:0,color:"#aee7be"},{offset:.5,color:"#c2ebcf"},{offset:1,color:"#d6f0e1"}])},emphasis:{itemStyle:{color:new c(0,0,0,1,[{offset:0,color:"#8cd8a1"},{offset:.7,color:"#a1dcb2"},{offset:1,color:"#caefd5"}])}},data:i}]};const r=6;t.on("click",function(e){t.dispatchAction({type:"dataZoom",startValue:o[Math.max(e.dataIndex-r/2,0)],endValue:o[Math.min(e.dataIndex+r/2,i.length-1)]})}),a&&t.setOption(a)}return p(()=>f.mj,(s,t)=>{l.value=s.map((a,o)=>a.subregionName),d.value=s.map((a,o)=>a.nonFarm),m()}),_(()=>{console.log(f.mj)}),y(()=>{var s=document.getElementById("myChart"),t=h(s);window.addEventListener("resize",function(){t.resize()});var a;let o=l.value,i=d.value;for(let e=0;e<i.length;e++);a={title:{text:"",subtext:""},tooltip:{show:!0,trigger:"axis"},xAxis:{data:o,axisLabel:{inside:!0,color:"#fff"},axisTick:{show:!1},axisLine:{show:!1},z:10},yAxis:{name:"\u9762\u79EF\uFF08\u4EA9\uFF09",axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#999"}},dataZoom:[{type:"inside"}],series:[{type:"bar",showBackground:!0,itemStyle:{color:new c(0,0,0,1,[{offset:0,color:"#aee7be"},{offset:.5,color:"#c2ebcf"},{offset:1,color:"#d6f0e1"}])},emphasis:{itemStyle:{color:new c(0,0,0,1,[{offset:0,color:"#8cd8a1"},{offset:.7,color:"#a1dcb2"},{offset:1,color:"#caefd5"}])}},data:i}]};const r=6;t.on("click",function(e){t.dispatchAction({type:"dataZoom",startValue:o[Math.max(e.dataIndex-r/2,0)],endValue:o[Math.min(e.dataIndex+r/2,i.length-1)]})}),a&&t.setOption(a)}),v(()=>{}),w(()=>{window.removeEventListener("resize",()=>{})}),(s,t)=>(b(),g("div",S,I))}},C=x(A,[["__scopeId","data-v-f50ade16"]]);export{C as default};
|