lcny-vue3-antd-admin/dist/assets/BasicChart.125cc3f2.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 b}from"./other.a0e0a1bb.js";import{u as g}from"./useECharts.7e254417.js";import w from"./Box.a0684c06.js";import{d as B,dA as C,r as D,q as j,aA as k,_ as v,j as S,P as L,o as O,i as $,s as E,h,Q as A}from"./index.600742c0.js";import{a as P,c as N}from"./colors.d19e85ff.js";import{u as z}from"./visualization.b0d62ae5.js";import"ant-design-vue";const F=B({components:{Box:w},props:{data:{type:Object},index:{type:Number}},setup(o){const d=z(),s=C(()=>o.data),n=D(null),{setOptions:l}=g(n),r=j({list:[]});function c(){return m(this,null,function*(){const{id:t}=S(o.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(o.index)%2,p=e==1?P:N,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,smooth:!0,symbol:"none",itemStyle:{color:_.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 k(()=>{c()}),{propsData:s,chartRef:n}}}),Q={class:"h-full flex flex-col w-full"},R={class:"flex-1",ref:"chartRef"};function T(o,d,s,n,l,r){const c=L("Box");return O(),$(c,A({title:o.propsData.name},o.$attrs),{default:E(()=>[h("div",Q,[h("div",R,null,512)])]),_:1},16,["title"])}var K=v(F,[["render",T]]);export{K as default};