Сглаживающая линия #28

Merged
NBizyaev merged 9 commits from dev into main 2026-07-08 10:50:54 +00:00
Showing only changes of commit 88d628b696 - Show all commits

View File

@@ -28,8 +28,8 @@ type HistoryChartProps = {
const DAY_MS = 24 * 60 * 60 * 1000; const DAY_MS = 24 * 60 * 60 * 1000;
/** Определяет видимость соединительной avg-линии с учетом ручного режима и текущей грануляции. */ /** Определяет видимость соединительной avg-линии с учетом ручного режима и масштаба X-шкалы. */
function shouldShowAvgLine(mode: AvgLineMode, granulate: string): boolean { function shouldShowAvgLine(mode: AvgLineMode, range: HistoryZoomRange): boolean {
if (mode === 'show') { if (mode === 'show') {
return true; return true;
} }
@@ -38,7 +38,7 @@ function shouldShowAvgLine(mode: AvgLineMode, granulate: string): boolean {
return false; return false;
} }
return parseGranulateMs(granulate) < DAY_MS; return (range.tickIntervalMs ?? parseGranulateMs(range.granulate)) < DAY_MS;
} }
export function HistoryChart({ export function HistoryChart({
@@ -71,7 +71,7 @@ export function HistoryChart({
to: zoomRange.to, to: zoomRange.to,
tagLabels, tagLabels,
}); });
const showAvgLine = shouldShowAvgLine(avgLineMode, zoomRange.granulate); const showAvgLine = shouldShowAvgLine(avgLineMode, zoomRange);
const series = useHistoryChartSeries(lines, zoomRange.granulate, showAvgLine); const series = useHistoryChartSeries(lines, zoomRange.granulate, showAvgLine);
const legendData = useMemo(() => lines.map((line) => line.label), [lines]); const legendData = useMemo(() => lines.map((line) => line.label), [lines]);
const loading = lines.some((line) => line.loading); const loading = lines.some((line) => line.loading);