yeg
2026-09-09 1ab091c3746bce05b968b93b5f612305f06d4cec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import type { SpliceMatrix } from '@/api/spliceReports'
import type { ProjectSeries } from './projectCycleChart'
 
/** 每个测试电池独立成段;即使电池相同也不跨测试合线,累计位置由快照提供。 */
export function spliceProjectSeries(matrix: SpliceMatrix): ProjectSeries[] {
  return matrix.segments.map(segment => {
    const source = segment.source
    const series: ProjectSeries = {
      key: `${source.selection.testId}|${source.selection.testBatteryId}`,
      name: `${source.name} (#${source.selection.testId}) · ${source.group} · ${source.batteryNo}`,
      // 只缩短显示文案;同名来源仍保留各自图例身份和显隐状态。
      legendLabel: `${source.name}-${source.batteryNo}`,
      points: [],
    }
    for (const no of segment.originalCycleNos) {
      const position = segment.cyclePositions?.[String(no)]
      if (position === undefined) continue
      series.points.push({ position, source: `${source.name} (#${source.selection.testId}) · ${source.batteryNo} · 原循环${no}`, values: segment.statistics[String(no)] || {} })
    }
    return series
  })
}