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

2 lines
2.1 KiB
JavaScript

var m=(o,d,s)=>new Promise((n,l)=>{var r=t=>{try{f(s.next(t))}catch(e){l(e)}},c=t=>{try{f(s.throw(t))}catch(e){l(e)}},f=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,c);f((s=s.apply(o,d)).next())});import{t as _}from"./other.dd0bab57.js";import{u as g}from"./useECharts.1f074a8e.js";import w from"./Box.1ab62710.js";import{a as B,fG as C,v as k,w as v,bq as D,L as j,k as L,aG as S,o as O,j as $,z as E,i as h,aH as z}from"./index.c32990f8.js";import{a as G,c as N}from"./colors.d19e85ff.js";import{u as P}from"./visualization.8430e20b.js";const A=B({components:{Box:w},props:{data:{type:Object},index:{type:Number}},setup(o){const d=P(),s=C(()=>o.data),n=k(null),{setOptions:l}=g(n),r=v({list:[]});function c(){return m(this,null,function*(){const{id:t}=L(o.data);if(!t)return;const e=yield _({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(o.index)%2,p=e==1?G:N,u=e==1?"bar":"line";r.list.forEach(({name:i,list:x},y)=>{const b=p[y%p.length];t.legendData.push(i),t.series.push({name:i,data:x,type:u,smooth:!0,symbol:"none",itemStyle:{color:b.itemColor}})}),l({grid:{left:"2%",right:"2%",top:"10%",bottom:"2%",containLabel:!0},legend:{show:!1,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 D(()=>{c()}),{propsData:s,chartRef:n}}}),F={class:"h-full flex flex-col w-full"},R={class:"flex-1",ref:"chartRef"};function T(o,d,s,n,l,r){const c=S("Box");return O(),$(c,z({title:o.propsData.name},o.$attrs),{default:E(()=>[h("div",F,[h("div",R,null,512)])]),_:1},16,["title"])}var J=j(A,[["render",T]]);export{J as default};