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