import{a5 as k,bL as l,b as S,bM as w,r as y,ah as Y,o as b,y as I,q as H,aH as M,c as F,ay as O,ai as v,bv as z,bH as B,a0 as W,a1 as N,v as $,_ as G}from"./index.8d733f79.js";import{N as P}from"./no-data-to-display.104be120.js";import{A as R}from"./annotations.d7724f2a.js";import{E as U}from"./exporting.83037eec.js";import{g as X}from"./deviceAnalysis.ce7ce4e7.js";const q=d=>(W("data-v-c673b3a8"),d=d(),N(),d),j={class:"chart-container"},Z=q(()=>$("div",{id:"sensor-temp-chart",style:{width:"100%",height:"400px"}},null,-1)),J=[Z],K=k({__name:"sensorTempWaveDialog",setup(d,{expose:_}){P(l),R(l),U(l),l.setOptions({lang:{noData:"\u6682\u65E0\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D..."},loading:{style:{color:"#A9C1E0",fontSize:"14px",backgroundColor:"transparent",opacity:1}},noData:{style:{color:"#A9C1E0",fontSize:"14px"}}}),S();const c=w(),p=y(!1),u=y(!1);let t=null,r=null;const m=Y({startTime:c.atlasTimeRange[0],endTime:c.atlasTimeRange[1]}),D=a=>{p.value=!0,m.startTime=c.atlasTimeRange[0],m.endTime=c.atlasTimeRange[1],O(()=>{C(a)})};function x(a,e){if(a.index,t.xAxis[0].removePlotLine("plotline"),t.removeAnnotation("annotation"),r){const o=r.data.find(s=>new Date(s.time).getTime()===a.x);if(!o)return;t.xAxis[0].addPlotLine({value:a.x,width:2,color:"rgba(255, 0, 0,0.5)",zIndex:9,id:"plotline"});const i=e.unit||"\u2103";t.addAnnotation({id:"annotation",labels:[{backgroundColor:"#004584",color:"#EAF2FF",padding:10,borderColor:"#004584",text:`${o.value}${i}<br>${v(a.x).format("YYYY-MM-DD HH:mm:ss")}`,point:{x:a.x,y:Number(o.value),xAxis:0,yAxis:0}}],labelOptions:{align:"left",x:20}})}}let g,f;function T(){const a=t.container;a.addEventListener("mousedown",e=>{g=e.clientX,f=e.clientY}),a.addEventListener("mouseup",e=>{const o=e.clientX-g,i=e.clientY-f;o<0&&i<0?(t.xAxis[0].zoomEnabled=!1,t.zoomOut()):t.xAxis[0].zoomEnabled=!0})}const C=async a=>{u.value=!0;try{const e=await X({hasFileId:!1,manualUpload:!1,pointId:a.pointId||a.id,startTime:m.startTime,endTime:m.endTime,metrics:"temperature"}),o="temperature";let i=[],s={};e.data&&e.data[o]&&e.data[o][o]&&(r=e.data[o][o],s=r.property||{},i=r.data.map(n=>[new Date(n.time).getTime(),Number(n.value)])),t&&t.destroy(),t=l.chart("sensor-temp-chart",{colors:["#1CEC9C"],title:!1,time:{useUTC:!1},chart:{backgroundColor:"#002042",marginTop:40,marginBottom:40,marginLeft:62,zoomType:"x",animation:!1,events:{click(){!this.hoverPoint||x(this.hoverPoint,s)},selection(n){if(n.xAxis){const h=this.userOptions.series[0].data.length;if(!h)return;const L=n.xAxis[0].min<this.userOptions.series[0].data[0][0]?this.userOptions.series[0].data[0][0]:n.xAxis[0].min,E=n.xAxis[0].max>this.userOptions.series[0].data[h-1][0]?this.userOptions.series[0].data[h-1][0]:n.xAxis[0].max;this.xAxis[0].setExtremes(L,E)}}}},exporting:{enabled:!1},yAxis:{title:{text:null},lineColor:"#445775",gridLineDashStyle:"Dash",gridLineColor:"transparent",gridLineWidth:1,minorGridLineWidth:1,minorTickColor:"rgba(68,87,117,0.3)",minorTickInterval:"auto",minorGridLineColor:"rgba(68,87,117,0.3)",minorGridLineDashStyle:"Dash",labels:{style:{color:"#93B3E0"}}},xAxis:{gridLineDashStyle:"Dash",gridLineColor:"transparent",lineColor:i.length?"#445775":"transparent",gridLineWidth:1,minorGridLineWidth:1,minorTickColor:"rgba(68,87,117,0.3)",minorTickInterval:"auto",minorGridLineColor:"rgba(68,87,117,0.3)",minorGridLineDashStyle:"Dash",tickLength:4,labels:{y:16,style:{color:"#93B3E0",fontSize:"12px"}},crosshair:{color:"#93B3E0",dashStyle:"dash",width:1},type:"datetime",dateTimeLabelFormats:{millisecond:"%H:%M:%S",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%m-%d",week:"%m-%d",month:"%Y-%m",year:"%Y"}},credits:{enabled:!1},legend:{enabled:!1},tooltip:{backgroundColor:"#004584",style:{color:"#EAF2FF"},borderColor:"#004584",shadow:!1,useHTML:!0,shared:!0,shape:"rect",formatter:function(){return`${this.y}${s.unit||"\u2103"}<br>${v(this.x).format("YYYY-MM-DD HH:mm:ss")}`}},plotOptions:{series:{label:{connectorAllowed:!1},marker:{lineWidth:0,width:8,height:8,symbol:"circle",radius:2},cursor:"pointer",point:{events:{click:function(){x(this,s)}}}}},series:[{data:i}]}),i.length?t.hideNoData():t.showNoData(),setTimeout(()=>{T()},0)}catch(e){console.error("Failed to load temperature chart:",e)}finally{u.value=!1}},A=()=>{t&&(t.destroy(),t=null)};return _({open:D}),(a,e)=>{const o=z,i=B;return b(),I(o,{modelValue:p.value,"onUpdate:modelValue":e[0]||(e[0]=s=>p.value=s),title:a.$t("sensorTemp"),width:"1000px","append-to-body":"",onClosed:A},{default:H(()=>[M((b(),F("div",j,J)),[[i,u.value]])]),_:1},8,["modelValue","title"])}}});const oe=G(K,[["__scopeId","data-v-c673b3a8"]]);export{oe as default};
