2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
|
import{i as y}from"./index-06v0hgpB.js";import{d as h,r as n,o as g,e as _,G as C,a as S,c as w,i as p,x as z,N as O}from"./index-BRRhBORR.js";const A={class:"flex justify-center"},k=h({__name:"KoiTradeChart",setup(L){const l=n("边牧"),v=["边牧","金毛","萨摩耶"],u=n(),t=n(),s=n(),a=n(),c=n();g(()=>{f(),d(),i(),window.addEventListener("resize",i)}),_(()=>{t.value.dispose(),t.value=null,clearInterval(c.value),c.value=null,window.removeEventListener("resize",i)});const f=()=>{var e;t.value=y(u.value);const o={grid:{top:"20%",left:"0",bottom:"18%",right:"0"},tooltip:{show:!0},legend:{right:"5%"},xAxis:[{type:"category",axisPointer:{type:"shadow"},axisLabel:{interval:0,rotate:"70"}}],yAxis:[{type:"value",splitLine:{show:!1}}],series:[{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(r){return r+"笔"}},smooth:!0,itemStyle:{color:"#2992ff"},markPoint:{data:[{type:"max",name:"最大值"},{type:"min",name:"最小值"}]},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#3e9dff"},{offset:1,color:"#d4e9ff"}],global:!1}}}]};(e=t.value)==null||e.setOption(o)},d=()=>{s.value=[],a.value=[],s.value=["20240901","20240902","20240903","20240904","20240905","20240906","20240907","20240908","20240909","20240910","20240911","20240912","20240913","20240914","20240915"],m()},m=()=>{var e;a.value=[],l.value=="边牧"&&(a.value=[72,33,66,26,77,36,59,35,62,27,55,33,69,37,52]),l.value=="金毛"&&(a.value=[66,52,36,55,75,48,59,73,56,66,45,62,70,63,65]),l.value==="萨摩耶"&&(a.value=[70,62,56,60,72,55,61,46,58,52,60,54,52,59,57]);const o={xAxis:{data:s.value},series:[{name:"交易笔数",type:"line",data:a.value}]};(e=t.value)==null||e.setOption(o)},i=()=>{var e;const o={title:{textStyle:{fontSize:16}},legend:{textStyle:{fontSize:12}},xAxis:{axisLabel:{fontSize:12}},yAxis:{axisLabel:{fontSize:12}}};(e=t.value)==null||e.setOption(o),t.value.resize()};return(o,e)=>{const r=C("el-segmented");return S(),w(O,null,[p("div",A,[z(r,{modelValue:l.value,"onUpdate:modelValue":e[0]||(e[0]=x=>l.value=x),options:v,onChange:d},null,8,["modelValue"])]),p("div",{ref_key:"refChart",ref:u,style:{width:"100%",height:"360px"}},null,512)],64)}}});export{k as default};
|