diff --git a/src/features/history-chart/historyChartFormat.ts b/src/features/history-chart/historyChartFormat.ts index aeb4a74..8f6f42f 100644 --- a/src/features/history-chart/historyChartFormat.ts +++ b/src/features/history-chart/historyChartFormat.ts @@ -60,6 +60,19 @@ function formatChartValue(value: number): string { }).format(value); } +/** Показывает одно значение, если min/avg/max визуально совпадают. */ +function formatTooltipValue(value: AvgPointValue): string { + const avg = formatChartValue(value[1]); + const min = formatChartValue(value[2]); + const max = formatChartValue(value[3]); + + if (min === avg && avg === max) { + return avg; + } + + return `min ${min} · avg ${avg} · max ${max}`; +} + function isAvgPointValue(value: unknown): value is AvgPointValue { return Array.isArray(value) && value.length >= 5 && value.every((item) => typeof item === 'number'); } @@ -91,7 +104,7 @@ export function formatTooltip(params: unknown): string { '