lcny-vue3-antd-admin/dist/assets/BasicChart.b2efdd49.js

2 lines
2.1 KiB
JavaScript

var m=(s,d,o)=>new Promise((n,l)=>{var r=t=>{try{f(o.next(t))}catch(e){l(e)}},c=t=>{try{f(o.throw(t))}catch(e){l(e)}},f=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,c);f((o=o.apply(s,d)).next())});import{t as b}from"./other.28ada98a.js";import{u as g}from"./useECharts.23f6a822.js";import B from"./Box.677eba3c.js";import{a as w,fT as C,r as k,s as D,bp as j,J as v,k as S,aA as L,o as O,j as $,x as E,i as h,aB as A}from"./index.cb3e2d30.js";import{a as N,c as P}from"./colors.d19e85ff.js";import{u as T}from"./visualization.0240d581.js";const z=w({components:{Box:B},props:{data:{type:Object},index:{type:Number}},setup(s){const d=T(),o=C(()=>s.data),n=k(null),{setOptions:l}=g(n),r=D({list:[]});function c(){return m(this,null,function*(){const{id:t}=S(s.data);if(!t)return;const e=yield b({crop_id:t,year:d.getYear}),p=[];for(const u in e)if(Object.prototype.hasOwnProperty.call(e,u)){const a=e[u];p.push({name:a.name,list:Object.keys(a.list).map(i=>a.list[i]),axis:Object.keys(a.list).map(i=>i)})}r.list=p,f()})}function f(){var a;const t={legendData:[],series:[]},e=Number(s.index)%2,p=e==1?N:P,u=e==1?"bar":"line";r.list.forEach(({name:i,list:x},y)=>{const _=p[y%p.length];t.legendData.push(i),t.series.push({name:i,data:x,type:u,itemStyle:{color:_.itemColor}})}),l({grid:{left:"2%",right:"2%",top:"30px",bottom:"2%",containLabel:!0},legend:{show:!0,data:t.legendData,top:"0%",right:"0",textStyle:{color:"#ffffff"}},tooltip:{trigger:"axis",axisPointer:{lineStyle:{width:1,color:"#019680"}}},xAxis:{type:"category",data:(a=r.list[0])==null?void 0:a.axis,boundaryGap:u!="line",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})}return j(()=>{c()}),{propsData:o,chartRef:n}}}),F={class:"h-full flex flex-col w-full"},R={class:"flex-1",ref:"chartRef"};function V(s,d,o,n,l,r){const c=L("Box");return O(),$(c,A({title:s.propsData.name},s.$attrs),{default:E(()=>[h("div",F,[h("div",R,null,512)])]),_:1},16,["title"])}var H=v(z,[["render",V]]);export{H as default};