2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
import{bu as d,am as x,ac as g}from"./bootstrap-peLAqOBq.js";import{f as v}from"./data-H6H7W_MD.js";import{u as _,_ as b}from"./use-echarts-CUydHgm6.js";import{m as w,b9 as N,aa as E,w as C,ad as m,b2 as f,ae as L,ac as M,bL as R,j as u,u as c}from"../jse/index-index-fr7m5rpH.js";const k={class:"area-stay-chart"},$={key:0,class:"chart-empty"},A=w({__name:"area-stay-chart",props:{records:{}},setup(h){const n=h,l=N(),{renderEcharts:p}=_(l),r=E(()=>{var a,s;const e=new Map;for(const t of n.records){const o=e.get(t.areaName);o?(o.totalStay+=(a=t.durationSeconds)!=null?a:0,o.visitCount+=1):e.set(t.areaName,{areaName:t.areaName,totalStay:(s=t.durationSeconds)!=null?s:0,visitCount:1})}return[...e.values()].toSorted((t,o)=>o.totalStay-t.totalStay).slice(0,10)});function y(){const e=r.value;if(e.length===0)return{};const a=e.map(t=>t.areaName).toReversed(),s=e.map(t=>Math.round(t.totalStay/60)).toReversed();return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter(t){const o=t[0],S=e.length-1-o.dataIndex,i=e[S];return i?`${i.areaName}<br/>停留: ${v(i.totalStay)}<br/>进出: ${i.visitCount} 次`:""}},grid:{left:"3%",right:"10%",bottom:"3%",top:"8%",containLabel:!0},xAxis:{type:"value",name:"分钟",nameTextStyle:{color:"#8c8c8c",fontSize:11},axisLabel:{color:"#8c8c8c"},splitLine:{lineStyle:{color:"#f0f0f0",type:"dashed"}}},yAxis:{type:"category",data:a,axisLabel:{color:"#595959",fontSize:11,width:100,overflow:"truncate"},axisLine:{show:!1},axisTick:{show:!1}},series:[{type:"bar",data:s,barMaxWidth:20,itemStyle:{borderRadius:[0,4,4,0],color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#597ef7"},{offset:1,color:"#85a5ff"}]}},label:{show:!0,position:"right",color:"#8c8c8c",fontSize:11,formatter:"{c}m"}}]}}return C(()=>n.records,()=>{r.value.length>0&&p(y())},{immediate:!0,deep:!0}),(e,a)=>(f(),m("div",k,[a[0]||(a[0]=L("div",{class:"chart-title"},"区域停留分布",-1)),r.value.length===0?(f(),m("div",$,[u(c(d),{description:"暂无数据",image:c(d).PRESENTED_IMAGE_SIMPLE},null,8,["image"])])):M("",!0),R(u(c(b),{ref_key:"chartRef",ref:l,height:`${Math.max(200,r.value.length*36+40)}`,width:"100%"},null,8,["height"]),[[x,r.value.length>0]])]))}}),P=g(A,[["__scopeId","data-v-e4986cd6"]]);export{P as default};
|