2 lines
2.3 KiB
JavaScript
2 lines
2.3 KiB
JavaScript
var h=(u,s,a)=>new Promise((n,l)=>{var c=o=>{try{e(a.next(o))}catch(r){l(r)}},i=o=>{try{e(a.throw(o))}catch(r){l(r)}},e=o=>o.done?n(o.value):Promise.resolve(o.value).then(c,i);e((a=a.apply(u,s)).next())});import D from"./Box.677eba3c.js";import{u as S}from"./useECharts.23f6a822.js";import{i as b}from"./other.28ada98a.js";import{u as w}from"./visualization.0240d581.js";import{c as g}from"./colors.d19e85ff.js";import{u as B}from"./useVContext.623a42dc.js";import{a as C,s as E,r as F,bp as L,H as A,J as I,aA as k,o as $,j as X,x as R,i as y}from"./index.cb3e2d30.js";const T=C({components:{Box:D},setup(){const{rootEmitter:u}=B(),s=E({x_axis:[],series:[]}),a=F(null),n=w(),{setOptions:l,getInstance:c}=S(a);function i(){return h(this,null,function*(){const t=yield b({year:n.getYear});s.x_axis=t.x_axis,s.series=t.series,o()})}let e=[];const o=()=>{const t={legendData:[],series:[]};s.series.forEach(({name:f,data:x},d)=>{const _=g[d%g.length];t.legendData.push(f),t.series.push({name:f,data:x.map(p=>p&&Number((p/2e3).toFixed(2))),smooth:!1,type:"line",stack:"Total",itemStyle:{color:_.itemColor},areaStyle:{color:_.areaColor}})}),e=t.legendData,l({grid:{left:"2%",right:"2%",top:"10%",bottom:"2%",containLabel:!0},legend:{data:t.legendData,top:"0%",right:"0",textStyle:{color:"#ffffff"}},tooltip:{trigger:"axis",axisPointer:{lineStyle:{width:1,color:"#019680"}}},xAxis:{type:"category",data:s.x_axis,boundaryGap:!1,axisTick:{show:!1},axisLine:{show:!1},axisLabel:{color:"#fff"}},yAxis:[{type:"value",axisTick:{show:!1},splitLine:{lineStyle:{type:"solid",color:"#8EEEFF",opacity:.3}},axisLabel:{color:"#fff"}}],series:t.series,animationDuration:2e3}),v()};let r=null;function v(){let t=0;r&&clearInterval(r),r=setInterval(()=>{var d;if(e.length==0)return;const f=t%e.length,x=t%(e.length*2);f==0&&x!=0&&e.forEach((_,p)=>{var m;(m=c())==null||m.dispatchAction({type:"legendUnSelect",name:e[p]})}),(d=c())==null||d.dispatchAction({type:"legendSelect",name:e[f]}),t++},3e3)}return L(()=>{i(),u.on("interval:auto",()=>{i()})}),A(()=>n.getYear,()=>i()),{chartRef:a}}}),V={class:"h-full flex flex-col"},j={class:"flex-1",ref:"chartRef"};function z(u,s,a,n,l,c){const i=k("Box");return $(),X(i,{title:"\u7A3B\u867E\u6D41\u5411\uFF08\u5428\uFF09"},{default:R(()=>[y("div",V,[y("div",j,null,512)])]),_:1})}var U=I(T,[["render",z],["__scopeId","data-v-5e31c34f"]]);export{U as default};
|