import{A as e,D as t,Ht as n,I as r,N as i,X as a,d as o,m as s,st as c,t as l,u}from"./_plugin-vue_export-helper-D1RKUtCV.js";import{t as d}from"./echarts-B4btcaVd.js";var f={class:`curve-box`},p={class:`stats-row`},m={class:`stat-card`},h={class:`stat-value`},g={class:`stat-card`},_={class:`stat-value`},v={class:`stat-card`},y={class:`stat-value`},b=l({__name:`DataCurve`,props:{records:{type:Array,default:()=>[]}},setup(l){let b=l,x=c(null),S=null,C=u(()=>(Array.isArray(b.records)?b.records:[]).map((e,t)=>({idx:t,time:e.time||`第${t+1}条`,current:Number(e.current),voltage:Number(e.voltage),actual_temperature:Number(e.actual_temperature)})).filter(e=>Number.isFinite(e.current)||Number.isFinite(e.voltage)||Number.isFinite(e.actual_temperature))),w=u(()=>{let e=C.value.map(e=>e.actual_temperature).filter(e=>Number.isFinite(e));return{count:C.value.length,max:e.length?Math.max(...e):0,min:e.length?Math.min(...e):0}}),T=e=>Number.isFinite(e)?Number(e).toFixed(2):`--`,E=e=>C.value.map(t=>Number.isFinite(t[e])?t[e]:null),D=()=>{if(!x.value)return;S||=d(x.value);let e=C.value.length>0;S.setOption({animation:!0,color:[`#409EFF`,`#67C23A`,`#FF6B6B`],tooltip:{trigger:`axis`,backgroundColor:`rgba(255,255,255,0.96)`,borderColor:`#e2e8f0`,borderWidth:1,textStyle:{color:`#334155`},extraCssText:`box-shadow: 0 10px 30px rgba(15,23,42,0.16); border-radius: 12px;`,formatter(e){if(!e?.length)return``;let t=[`<div style="margin-bottom:6px;font-weight:600;">${e[0].axisValue}</div>`];return e.forEach(e=>{t.push(`<div style="display:flex;align-items:center;gap:6px;min-width:160px;justify-content:space-between;">
                <span>${e.marker}${e.seriesName}</span>
                <strong>${T(e.data)}</strong>
              </div>`)}),t.join(``)}},legend:{bottom:0,itemWidth:18,itemHeight:10,textStyle:{color:`#475569`},data:[`电流(A)`,`电压(V)`,`温度(℃)`]},grid:{top:24,left:24,right:24,bottom:56,containLabel:!0},xAxis:{type:`category`,boundaryGap:!1,data:C.value.map(e=>e.time),axisLabel:{color:`#64748b`,rotate:35},axisLine:{lineStyle:{color:`#94a3b8`}}},yAxis:{type:`value`,axisLabel:{color:`#64748b`},splitLine:{lineStyle:{type:`dashed`,color:`rgba(148, 163, 184, 0.45)`}}},series:[{name:`电流(A)`,type:`line`,smooth:!0,symbol:`circle`,symbolSize:7,data:E(`current`)},{name:`电压(V)`,type:`line`,smooth:!0,symbol:`circle`,symbolSize:7,data:E(`voltage`)},{name:`温度(℃)`,type:`line`,smooth:!0,symbol:`circle`,symbolSize:7,data:E(`actual_temperature`)}],graphic:e?[]:[{type:`text`,left:`center`,top:`middle`,style:{text:`暂无足够数据生成曲线`,fill:`#64748b`,fontSize:14}}]},!0)},O=()=>{S?.resize()};return i(async()=>{await t(),D(),window.addEventListener(`resize`,O)}),a(()=>b.records,async()=>{await t(),D()},{deep:!0}),e(()=>{window.removeEventListener(`resize`,O),S?.dispose(),S=null}),(e,t)=>(r(),s(`div`,f,[o(`div`,p,[o(`div`,m,[t[0]||=o(`div`,{class:`stat-label`},`总条数`,-1),o(`div`,h,n(w.value.count),1)]),o(`div`,g,[t[1]||=o(`div`,{class:`stat-label`},`最高温度`,-1),o(`div`,_,n(T(w.value.max))+` °C`,1)]),o(`div`,v,[t[2]||=o(`div`,{class:`stat-label`},`最低温度`,-1),o(`div`,y,n(T(w.value.min))+` °C`,1)])]),o(`div`,{ref_key:`chartRef`,ref:x,class:`echarts-box`},null,512)]))}},[[`__scopeId`,`data-v-7c9af9ab`]]);export{b as t};