diff --git a/src/features/history-chart/historyChartAvgLineSeries.ts b/src/features/history-chart/historyChartAvgLineSeries.ts index 9dd2080..a22e220 100644 --- a/src/features/history-chart/historyChartAvgLineSeries.ts +++ b/src/features/history-chart/historyChartAvgLineSeries.ts @@ -41,7 +41,7 @@ function createAvgLineData(points: HistoryPoint[], granulate: string, breakOnGap } const previousTime = new Date(finitePoints[index - 1].time).getTime(); - const hasAcceptableGap = currentTime - previousTime <= slotMs * 24; + const hasAcceptableGap = currentTime - previousTime <= slotMs * 50; return hasAcceptableGap ? [currentPoint] : [null, currentPoint]; }); diff --git a/src/features/history-chart/historyChartFormat.ts b/src/features/history-chart/historyChartFormat.ts index c7dd9ce..7dc2407 100644 --- a/src/features/history-chart/historyChartFormat.ts +++ b/src/features/history-chart/historyChartFormat.ts @@ -56,7 +56,12 @@ export function formatAxisDate(value: number, labelFormat: HistoryAxisLabelForma function formatChartValue(value: number): string { return new Intl.NumberFormat('ru-RU', { - maximumFractionDigits: Math.abs(value) >= 100 ? 2 : 3, + maximumFractionDigits: + Math.abs(value) >= 1000 ? 0 + : Math.abs(value) >= 100 ? 1 + : Math.abs(value) >= 10 ? 2 + : Math.abs(value) >= 1 ? 3 + : 4, }).format(value); } @@ -141,7 +146,8 @@ export function formatTooltip(params: unknown): string { return ''; } - const header = formatTooltipInterval(firstValue); + const time = firstValue[0]; + const header = formatTooltipDateTime(time); const rows = avgItems.map((item) => { const value = item.value as AvgPointValue; @@ -149,8 +155,7 @@ export function formatTooltip(params: unknown): string { '