import{C as u,E as h}from"./hooks-DMyQYazF.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./print-js@1.6.0-BdoEj60G.js";import"./vue-hooks-plus@2.2.1_vue@3.5.8-DdMBTcyt.js";import"./lodash@4.17.21-Cw59kuJw.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./screenfull@5.2.0-DmMZCkhi.js";import"./lodash-es@4.17.21-BALnwRTu.js";import"./@vueuse_core@10.9.0_vue@3.5.8-C_86Yqwm.js";import"./@vueuse_shared@10.9.0_vue@3.5.8-BTLxKjPf.js";import"./utils-CPRm4XW8.js";import"./interactjs@1.10.26-DZL_TZzP.js";import"./call-bind@1.0.7-Cpj98o6Y.js";import"./pinia-plugin-persistedstate@4.0.1_pinia@2.1.7-MNUqeAcu.js";import"./destr@2.0.3-CVtkxrq9.js";import"./deep-pick-omit@1.2.0-DyxInw53.js";import"./html-to-image@1.11.11-BOFdlgi9.js";import"./echarts@5.5.0-CezqL3m-.js";import"./zrender@5.5.0-DW8ownf1.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-core@3.5.8-rrkW69pg.js";import"./@vue_reactivity@3.5.8-Bdjt7y-I.js";import"./@vue_shared@3.5.8-BZqwzCoV.js";const H=Vue.defineComponent({name:"REchart",setup(){const[i,{getChartInstance:l,dispose:o,render:r,isDisposed:s}]=h(),[n,{getChartInstance:t,dispose:p,render:V,isDisposed:m}]=h(),g=Vue.ref(!1),c=Vue.ref(!1),a=Vue.reactive({loading:!1,loading1:!1}),N={legend:{},tooltip:{},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{name:"日期",data:[120,200,150,80,70,110,130],type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}},{name:"数量",data:[12,220,250,180,20,10,190],type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}]},f={title:{text:"Referer of a Website",subtext:"Fake Data",left:"center"},tooltip:{trigger:"item"},legend:{orient:"vertical",left:"left"},series:[{name:"Access From",type:"pie",radius:"50%",data:[{value:1048,name:"Search Engine"},{value:735,name:"Direct"},{value:580,name:"Email"},{value:484,name:"Union Ads"},{value:300,name:"Video Ads"}],emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},d=Vue.ref({tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},legend:{data:["Email","Union Ads","Video Ads","Direct","Search Engine"]},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}],yAxis:[{type:"value"}],series:[{name:"Email",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[120,132,101,134,90,230,210]},{name:"Union Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[220,182,191,234,290,330,310]},{name:"Video Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[150,232,201,154,190,330,410]},{name:"Direct",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[320,332,301,334,390,330,320]},{name:"Search Engine",type:"line",stack:"Total",label:{show:!0,position:"top"},areaStyle:{},emphasis:{focus:"series"},data:[820,932,901,934,1290,1330,1320]}]}),C=e=>{a.loading=e},E=e=>{c.value=e},A=()=>{s()?r():window.$message.warning("图表已渲染~")},F=()=>{o()},v=()=>{a.loading1=!0;const e=()=>Math.floor((Math.random()+1)*100);setTimeout(()=>{d.value.series[0].data=new Array(7).fill(0).map(()=>e()),d.value.series[1].data=new Array(7).fill(0).map(()=>e()),a.loading1=!1},1e3)};return{baseOptions:N,chartLoading:g,handleLoadingShow:C,chartAria:c,handleAriaShow:E,basePieOptions:f,baseLineOptions:d,...Vue.toRefs(a),mountChart:A,unmountChart:F,updateChartOptions:v,register:i,register2:n,dispose2:p,render2:V,isDisposed2:m}},render(){const{register:i,register2:l,dispose2:o,render2:r,isDisposed2:s,loading1:n}=this;return Vue.createVNode("div",{class:"echart"},[Vue.createVNode(naive.NCard,{title:"chart 组件"},{default:()=>[Vue.createVNode("h3",null,[Vue.createTextVNode("该组件基于 ECharts, Vueuse 封装。默认做了最佳的优化封装实践。")]),Vue.createVNode("h3",null,[Vue.createTextVNode("开箱即用的优化策略:节流更新图表、异步渲染、自动销毁、贴花、加载、主题、视窗区域渲染、自动更新尺寸等高级特性。")])]}),Vue.createVNode(naive.NCard,{title:"预设 card 风格图表"},{default:()=>[Vue.createVNode(naive.NFlex,{style:["padding: 18px 0"]},{default:()=>[Vue.createVNode(naive.NButton,{onClick:this.mountChart.bind(this)},{default:()=>[Vue.createTextVNode("渲染")]}),Vue.createVNode(naive.NButton,{onClick:this.unmountChart.bind(this)},{default:()=>[Vue.createTextVNode("卸载")]}),Vue.createVNode(naive.NButton,{onClick:this.updateChartOptions.bind(this)},{default:()=>[Vue.createTextVNode("更新配置项")]}),Vue.createVNode(naive.NButton,{onClick:()=>{this.loading1=!this.loading1}},{default:()=>[`${this.loading1?"关闭":"开启"}`,Vue.createTextVNode("加载动画")]})]}),Vue.createVNode("div",{class:"chart--container"},[Vue.createVNode(u,{onRegister:i,title:"周销售量",autoChangeTheme:!0,options:this.baseLineOptions,showAria:this.chartAria,preset:"card",loading:n},null)])]}),Vue.createVNode(naive.NCard,{title:"不跟随主题切换的暗色主题可视化图,并且手动指定原始主题色"},{default:()=>[Vue.createVNode(naive.NFlex,{vertical:!0},{default:()=>[Vue.createVNode(naive.NFlex,null,{default:()=>[Vue.createVNode(naive.NButton,{onClick:()=>{s()?r():window.$message.warning("不可以重复渲染图表~")}},{default:()=>[Vue.createTextVNode("渲染")]}),Vue.createVNode(naive.NButton,{onClick:o.bind(this)},{default:()=>[Vue.createTextVNode("卸载")]})]}),Vue.createVNode("div",{class:"chart--container"},[Vue.createVNode(u,{onRegister:l,autoChangeTheme:!1,theme:"default",options:this.baseOptions},null)])]})]}),Vue.createVNode(naive.NCard,{title:"加载动画"},{default:()=>[Vue.createVNode(naive.NSwitch,{value:this.chartLoading,"onUpdate:value":t=>this.chartLoading=t,onUpdateValue:this.handleLoadingShow.bind(this),style:["padding: 18px 0"]},{checked:()=>"隐藏加载动画",unchecked:()=>"显示加载动画"}),Vue.createVNode("div",{class:"chart--container"},[Vue.createVNode(u,{loading:this.loading,options:this.baseOptions},null)])]}),Vue.createVNode(naive.NCard,{title:"贴画可视化图"},{default:()=>[Vue.createVNode(naive.NSwitch,{value:this.chartAria,"onUpdate:value":t=>this.chartAria=t,onUpdateValue:this.handleAriaShow.bind(this),style:["padding: 18px 0"]},{checked:()=>"隐藏贴花",unchecked:()=>"显示贴花"}),Vue.createVNode("div",{class:"chart--container"},[Vue.createVNode(u,{options:this.baseOptions,showAria:this.chartAria},null)])]})])}});export{H as default};