| | |
| | | const source = selectedRecords() |
| | | const cellIndexes = selectedCells.value.map(cell => props.cells.findIndex(item => item.no === cell.no)) |
| | | const seriesData = selectedCells.value.map(cell => { |
| | | return source.filter(record => record.batteryNo === cell.no && metricMatches(metric.key, record)) |
| | | const points = source.filter(record => record.batteryNo === cell.no && metricMatches(metric.key, record)) |
| | | .map(record => ({ time: recordTime(record), value: metricValue(metric.key, record) })) |
| | | .filter(point => point.time !== null && Number.isFinite(point.value)) |
| | | .sort((a, b) => (a.time as number) - (b.time as number)) |
| | | const zero = points[0]?.time |
| | | return points.map(point => ({ ...point, time: zero == null ? null : (point.time as number) - zero })) |
| | | }) |
| | | const timestamps = [...new Set(seriesData.flat().map(point => point.time as number))].sort((a, b) => a - b) |
| | | const start = timestamps[0] |
| | | const values = seriesData.flat().map(point => point.value) |
| | | const dataMin = values.length ? Math.min(...values) : 0 |
| | | const dataMax = values.length ? Math.max(...values) : 1 |
| | |
| | | name: '设备时间', |
| | | nameLocation: 'middle', |
| | | nameGap: 29, |
| | | data: timestamps.map(value => start == null ? new Date(value).toISOString() : `${((value - start) / 3600000).toFixed(3)} h`), |
| | | data: timestamps.map(value => `${(value / 3600000).toFixed(3)} h`), |
| | | axisLine: { lineStyle: { color: '#cbd8e4' } }, |
| | | axisLabel: { color: '#8795a3', fontSize: 10, interval: 4 }, |
| | | nameTextStyle: { color: '#52606d', fontSize: 10 }, |