2 lines
2.3 KiB
JavaScript
2 lines
2.3 KiB
JavaScript
import{i as g,L as w}from"./index-06v0hgpB.js";import{d as A,r as u,o as C,e as z,a as _,c as b}from"./index-BRRhBORR.js";function r(i,s){var o=Math.floor(Math.random()*(i-s)+s);return o}for(let i=0;i<=15;i++)i.toString(16);const L=A({__name:"KoiRightChart",setup(i){const s=u(),o=u(),v=u(),c=u(),p=u();C(()=>{f(),m(),d(),window.addEventListener("resize",d),x()}),z(()=>{o.value.dispose(),o.value=null,clearInterval(p.value),p.value=null,window.removeEventListener("resize",d)});const f=()=>{var n;o.value=g(s.value);const e={grid:{top:"12%",left:"6%",bottom:"6%",right:"0"},tooltip:{show:!0},legend:{data:["柱形订单量","折线订单量"],right:"5%"},xAxis:[{type:"category",axisPointer:{type:"shadow"}}],yAxis:[{type:"value",splitLine:{show:!1}}],series:[{name:"柱形订单量",type:"bar",tooltip:{valueFormatter:function(t){return t+" V"}},label:{color:"#077EF8",show:!0,position:"top"}},{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(t){return t+" V"}},smooth:!0,itemStyle:{color:"#00f2f1"}}]};(n=o.value)==null||n.setOption(e)},m=()=>{v.value=[],c.value=[];let e=r(100,200),n=r(200,500),t=r(200,500),l=r(500,700),a=r(500,700),y=r(700,800),S=r(800,900),E=r(900,1e3);v.value=["20240903","20240904","20240905","20240906","20240907","20240908","20240909","20240910"],c.value.push(e,n,t,l,a,y,S,E),h()},h=()=>{var t;const e=[["#0BA82C","#4FF778"],["#2E72BF","#23E5E5"],["#5052EE","#AB6EE5"],["hotpink","lightsalmon"]],n={xAxis:{data:v.value},series:[{data:c.value,itemStyle:{label:{show:!0,position:"top",textStyle:{color:"#077EF8"}},color:l=>{let a=null;return l.value>700?a=e[0]:l.value>500?a=e[1]:l.value>200?a=e[2]:a=e[3],new w(0,0,0,1,[{offset:0,color:a[0]},{offset:1,color:a[1]}])}}},{data:c.value}]};(t=o.value)==null||t.setOption(n)},d=()=>{var t,l,a;const e=u(Math.round(((t=s.value)==null?void 0:t.offsetWidth)/50)),n={title:{textStyle:{fontSize:e.value}},legend:{textStyle:{fontSize:e.value*.8}},xAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}},yAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}},series:[{barWidth:Math.round(e.value*1.8),itemStyle:{label:{textStyle:{fontSize:Math.round(e.value*.8)}}}}]};(l=o.value)==null||l.setOption(n),(a=o.value)==null||a.resize()},x=()=>{p.value=setInterval(()=>{m()},3e3)};return(e,n)=>(_(),b("div",{ref_key:"refChart",ref:s,style:{"max-width":"800px",height:"350px"}},null,512))}});export{L as default};
|