2 lines
2.4 KiB
JavaScript
2 lines
2.4 KiB
JavaScript
import{e as y,S as p}from"./index.esm.min-2eecdcbd.js";import"./chartEditStore-bfc6c223.js";import{bI as _,d as $,bx as w,bB as v,by as A,bC as C,bH as H,bD as L,bE as k,bF as S,j as m,J as z,r as l,o as d,D as h,w as r,b as i,u as f,a6 as B}from"./index-4ec2ce15.js";import"./plugin-ae137233.js";import"./icon-42fa39e7.js";const I=["legend","xAxis","yAxis","grid"],O=e=>{const o=(a,n)=>parseInt(`${a*Math.random()}`,10)*2,t=[260,251,200,334,366,256,253];return e.map((a,n)=>({name:`data${n+1}`,type:"bar",data:t.map((s,c)=>o(s))}))},P=e=>y({tooltip:{trigger:"axis",showContent:!1,axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:e.map((o,t)=>`data${t+1}`),axisTick:{alignWithLabel:!0}},yAxis:{show:!0,type:"value"},series:O(e||[])},I),G=["legend","xAxis","yAxis","grid"],M=e=>{const o=(a,n)=>parseInt(`${a*Math.random()}`,10)*2,t=[130,251,200,334,366,456,223];return e.map((a,n)=>({name:`data${n+1}`,type:"line",smooth:!0,lineStyle:{width:1,type:"solid"},emphasis:{focus:"series"},areaStyle:{opacity:.8,color:new _(0,0,0,1,[{offset:1,color:a},{offset:0,color:a}])},showSymbol:!1,data:t.reverse().map((s,c)=>o(s))}))},N=e=>y({tooltip:{trigger:"axis",showContent:!1,axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:e.map((o,t)=>`data${t+1}`),axisTick:{alignWithLabel:!0}},yAxis:{show:!0,type:"value"},series:M(e||[])},G),q=$({__name:"index",props:{color:{type:Array,required:!0}},setup(e){const o=e;w([v,A,C,H,L,k,S]);const t=m(),a=m(),n={width:"528px",height:"200px"};return z(()=>o.color,s=>{t.value=P(s),a.value=N(s)},{immediate:!0,deep:!0}),(s,c)=>{const u=l("n-tab-pane"),b=l("n-tabs"),x=l("n-card"),g=l("n-space");return d(),h(g,null,{default:r(()=>[t.value?(d(),h(x,{key:0,class:"go-mt-3",bordered:!1,role:"dialog",size:"small","aria-modal":"true"},{default:r(()=>[i(b,{type:"segment",size:"small",animated:""},{default:r(()=>[i(u,{name:"柱状图",tab:"柱状图"},{default:r(()=>[i(f(p),{ref:"vChartRefBar",theme:{color:e.color},option:t.value,"manual-update":!0,autoresize:"",style:n},null,8,["theme","option"])]),_:1}),i(u,{name:"折线图",tab:"折线图"},{default:r(()=>[i(f(p),{ref:"vChartRefLine",theme:{color:e.color},option:a.value,"manual-update":!0,autoresize:"",style:n},null,8,["theme","option"])]),_:1})]),_:1})]),_:1})):B("",!0)]),_:1})}}});export{q as default};
|