1 |
- import{e as b,H as p}from"./index.esm.min-3e14e69f.js";import"./chartEditStore-bf521111.js";import{bA as _,d as $,bp as w,bt as v,bq as A,bu as C,bz as H,bv as L,bw as k,bx as z,h as m,G as S,r as l,o as d,A as h,w as r,b as i,u as f,$ as B}from"./index-ec08eff7.js";import"./plugin-56cc5b01.js";import"./icon-97832eae.js";const G=["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,u)=>o(s))}))},P=e=>b({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||[])},G),q=["legend","xAxis","yAxis","grid"],I=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,u)=>o(s))}))},M=e=>b({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:I(e||[])},q),j=$({__name:"index",props:{color:{type:Array,required:!0}},setup(e){const o=e;w([v,A,C,H,L,k,z]);const t=m(),a=m(),n={width:"528px",height:"200px"};return S(()=>o.color,s=>{t.value=P(s),a.value=M(s)},{immediate:!0,deep:!0}),(s,u)=>{const c=l("n-tab-pane"),y=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(y,{type:"segment",size:"small",animated:""},{default:r(()=>[i(c,{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(c,{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{j as default};
|