From 262c4f34a084cae2b67c31daf1606f6d5cd0b691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=BE=D0=B2=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D0=BC?= Date: Sun, 5 Jul 2026 04:34:48 +0300 Subject: [PATCH] =?UTF-8?q?BUR-37=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=B4=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=D1=8B=D1=85=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D1=82=D1=83=D0=BB=D1=82=D0=B8?= =?UTF-8?q?=D0=BF=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/history-chart/historyChartFormat.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 { '
', `${item.seriesName ?? ''}`, '', - `min ${formatChartValue(value[2])} · avg ${formatChartValue(value[1])} · max ${formatChartValue(value[3])}`, + formatTooltipValue(value), value[4] > 1 ? ` · ${value[4]} точек` : '', '', '
', -- 2.49.1