2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
var _=(c,a,o)=>new Promise((r,i)=>{var f=e=>{try{n(o.next(e))}catch(l){i(l)}},s=e=>{try{n(o.throw(e))}catch(l){i(l)}},n=e=>e.done?r(e.value):Promise.resolve(e.value).then(f,s);n((o=o.apply(c,a)).next())});import g from"./Box.ee46389c.js";import{u as v}from"./useECharts.7ae6cef3.js";import{i as D}from"./other.06ac4844.js";import{u as w}from"./visualization.fa00b5d5.js";import{c as m}from"./colors.d19e85ff.js";import{u as b}from"./useVContext.563b1b3b.js";import{a as B,s as C,r as F,bp as I,H as L,J as S,aA as E,o as A,j as k,x as $,i as h}from"./index.cd4314d7.js";const T=B({components:{Box:g},setup(){const{rootEmitter:c}=b(),a=C({x_axis:[],series:[]}),o=F(null),r=w(),{setOptions:i,getInstance:f}=v(o);function s(){return _(this,null,function*(){const t=yield D({year:r.getYear});a.x_axis=t.x_axis,a.series=t.series,n()})}const n=()=>{const t={legendData:[],series:[]};a.series.forEach(({name:p,data:u},y)=>{const d=m[y%m.length];t.legendData.push(p),t.series.push({name:p,data:u.map(x=>x&&Number((x/2e3).toFixed(2))),smooth:!1,type:"line",stack:"Total",itemStyle:{color:d.itemColor},areaStyle:{color:d.areaColor}})}),i({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:a.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:3e3}),l()};let e=null;function l(){let t=0;e&&clearInterval(e),e=setInterval(()=>{var u;const p=t%4;(u=f())==null||u.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:p}),t++},3e3)}return I(()=>{s(),c.on("interval:auto",()=>{s()})}),L(()=>r.getYear,()=>s()),{chartRef:o}}}),X={class:"h-full flex flex-col"},R={class:"flex-1",ref:"chartRef"};function V(c,a,o,r,i,f){const s=E("Box");return A(),k(s,{title:"\u7A3B\u867E\u6D41\u5411\uFF08\u5428\uFF09"},{default:$(()=>[h("div",X,[h("div",R,null,512)])]),_:1})}var O=S(T,[["render",V],["__scopeId","data-v-27829d47"]]);export{O as default};
|