1 |
- import{e as y,H as p}from"./index.esm.min-38f8e20c.js";import"./chartEditStore-15504e7d.js";import{bC as _,d as $,br as w,bv as v,bs as A,bw as C,bB as H,bx as L,by as k,bz as z,h as m,G as B,r as l,o as d,A as h,w as r,b as i,u as f,$ as S}from"./index-93381b89.js";import"./plugin-83ab11e4.js";import"./icon-cac1aa16.js";const G=["legend","xAxis","yAxis","grid"],O=e=>{const s=(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((o,c)=>s(o))}))},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((s,t)=>`data${t+1}`),axisTick:{alignWithLabel:!0}},yAxis:{show:!0,type:"value"},series:O(e||[])},G),I=["legend","xAxis","yAxis","grid"],M=e=>{const s=(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((o,c)=>s(o))}))},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((s,t)=>`data${t+1}`),axisTick:{alignWithLabel:!0}},yAxis:{show:!0,type:"value"},series:M(e||[])},I),j=$({__name:"index",props:{color:{type:Array,required:!0}},setup(e){const s=e;w([v,A,C,H,L,k,z]);const t=m(),a=m(),n={width:"528px",height:"200px"};return B(()=>s.color,o=>{t.value=P(o),a.value=N(o)},{immediate:!0,deep:!0}),(o,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})):S("",!0)]),_:1})}}});export{j as default};
|