import{t as q}from"./debounce-Xd493GvO.js";import{r as k}from"./request-CEvu378m.js";import{d as j}from"./index-M_JNBppB.js";import{ar as A}from"./echarts-DB130vfq.js";import{s as L,r as O,ax as C,c as S,w as _,j as E,n as I,X as W,B as T,z as X}from"./vue-BJk78QHK.js";import"./element-3_pOinej.js";import"./utils-YI6ye1sf.js";import"./threejs-BafxXW5-.js";import"./vxe-Dx3zSILm.js";const Q=Object.assign({name:"WeeklyRunning"},{__name:"WeeklyRunning",props:{propValue:{type:Object,default:()=>({})},request:{type:Object,default:()=>({})},element:{type:Object,default:()=>({})}},setup(B){const e=B,t=L(null),d=O(null),f=O(null),p=C(),z=S(()=>e.propValue.option),K=S(()=>{const a=e.element.style.width,l=e.element.style.height;return{width:a,height:l}});_(K,q(a=>{i()},500),{deep:!0}),_(()=>e.propValue,q(a=>{m()},500),{deep:!0}),E(()=>{var a,l;e.request&&(d.value=k(e.request,e.propValue,"data")),((l=(a=e.request)==null?void 0:a.global)==null?void 0:l.length)>0&&p.watch(()=>p.state.globalKey,()=>{e.request.global.forEach(u=>{const r=p.state.globalKey.findIndex(o=>o.globalKey===u);if(r>-1){const o=[p.state.globalKey[r].globalKey,p.state.globalKey[r].globalValue],n=e.request.data.findIndex(c=>c[0]===o[0]);n>-1?e.request.data[n][1]=o[1]:e.request.data.push(o)}}),d.value(),d.value=k(e.request,e.propValue,"data")},{deep:!0}),t.value=A(f.value,"vintage"),I(()=>{m()}),window.addEventListener("resize",i)}),W(()=>{window.removeEventListener("resize",i),t.value&&(t.value.clear(),t.value=null),e.request&&d.value&&d.value()});function m(){var h,y,g,v,V,w;const a=j(z.value);let l=e.propValue.data.xData.length>0?e.propValue.data.xData:[],u=e.propValue.data.radarData.length>0?e.propValue.data.radarData:[],r=e.propValue.data.radarDataAvg.length>0?e.propValue.data.radarDataAvg:[],o=e.propValue.data.maxData,n=[],c=e.propValue.data.weekLineData.length>0?e.propValue.data.weekLineData:[];for(let s=0;s<l.length;s++)n.push(o);let R={linearGtoB:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#43dfa2"},{offset:1,color:"#28f8de"}]}};a.title.text=((h=e.propValue.data)==null?void 0:h.text)||"一周跑步数据",a.title.subtext=((y=e.propValue.data)==null?void 0:y.subtext)||"2023-04-03",a.xAxis.data=l,a.yAxis.max=o,a.legend.data=((g=e.propValue.data)==null?void 0:g.legend)||[],a.radar.indicator=((v=e.propValue.data)==null?void 0:v.indicator)||[],a.series[0].data[0].value=r[0]||0,a.series[0].data[0].name=((V=e.propValue.data)==null?void 0:V.legend[0])||"",a.series[0].data[1].value=u[0],a.series[0].data[1].name=((w=e.propValue.data)==null?void 0:w.legend[1])||"",a.series[1].data=c,a.series[2].data=n,a.series[3].data=n,t.value.on("click",s=>{var x,b;if(s.componentType==="series"&&s.seriesType==="line"){let D=s.dataIndex;t.value.setOption({series:[{name:"",type:"radar",symbolSize:0,data:[{name:((x=e.propValue.data)==null?void 0:x.legend[0])||"",value:r[D],itemStyle:{normal:{color:"#f8d351"}},lineStyle:{normal:{opacity:0}},areaStyle:{normal:{color:"#f8d351",shadowBlur:25,shadowColor:"rgba(248,211,81,.3)",shadowOffsetX:0,shadowOffsetY:-10,opacity:1}}},{name:((b=e.propValue.data)==null?void 0:b.legend[1])||"",value:u[D],itemStyle:{normal:{color:"#43dfa2"}},lineStyle:{normal:{opacity:0}},areaStyle:{normal:{color:R.linearGtoB,shadowBlur:15,shadowColor:"rgba(0,0,0,.2)",shadowOffsetX:0,shadowOffsetY:5,opacity:.8}}}]}]})}}),t.value.setOption(a,!0)}function i(){t.value&&t.value.resize()}return(a,l)=>(X(),T("div",{ref_key:"chartRef",ref:f,style:{width:"100%",height:"100%"}},null,512))}});export{Q as default};
