Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Synchronize history chart hover timestamps
Pulse Test93794efa2864
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 6a5023fd0e..93d09186b7 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -129,6 +129,11 @@ plotted scale rather than semantic `Avg` / `Max` placeholders. Byte andbyte-rate axes include their human-readable unit at each gridline, and thecanvas measures both value and time labels into the same plot bounds used bygeometry and hover selection so neither edge clips or drifts from the data.+Related history charts that share a time range must opt into the shared hover+group. The group owns one absolute hovered timestamp, while each chart maps+that timestamp through its own plot geometry and nearest stored sample so+crosshairs and tooltips remain time-aligned without coupling unrelated ranges+or assuming identical value scales.Object-detail navigation follows that same canonical split across platform andfeature owners. `Overview` is the stable landing tab for current operationalfacts, while stored metric charts appear only after selecting an evidence-gateddiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 34673647da..cf5812f20b 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -3292,10 +3292,15 @@ chart must route through the shared `HistoryChart` API contract using the diskresource's canonical history target. Storage must not keep a drawer-local livemetrics collector, agent-id/device fallback stream, or separate real-timehistory store once monitoring and `/api/metrics-store/history` already own the-disk timeline. A disk Overview panel must never collapse into unexplained empty-space: when neither detailed SMART attributes nor a typed collection message-exists, it renders an explicit unavailable-details state while retaining the-bounded model, device, host, source, and serial header facts.+disk timeline. Charts in the disk detail's 30-minute Live I/O set share one+history-chart hover group, and charts in its selectable-range history set share+a separate group. Pointer movement must align crosshairs and nearest-sample+tooltips by absolute timestamp within each set without leaking hover state+between those independent time ranges. A disk Overview panel must never+collapse into unexplained empty space: when neither detailed SMART attributes+nor a typed collection message exists, it renders an explicit+unavailable-details state while retaining the bounded model, device, host,+source, and serial header facts.Storage pool and disk detail range selectors must mirror the shared historychart entitlement sequence. They must expose `14d` between `7d` and `30d` andpass the selected range through to `HistoryChart` unchanged, rather thandiff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex 921bd14a78..9108a19cc1 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,28 +1,35 @@{"version": 1,- "base_sha": "11cbc303d6f9d4abc5d33708d5ccafc82ccec306",- "verified_at": "2026-08-28T08:44:24Z",+ "base_sha": "99d4c4e8d44b2fb39a2f3c7eb0009eb1e8d126c0",+ "verified_at": "2026-08-28T08:51:48Z","result": "passed","changed_paths": [- "frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx",- "frontend-modern/src/utils/alertIncidentPresentation.ts"+ "frontend-modern/src/components/Storage/DiskDetail.tsx",+ "frontend-modern/src/components/shared/HistoryChart.tsx",+ "frontend-modern/src/components/shared/HistoryChartHoverGroup.tsx",+ "frontend-modern/src/components/shared/useHistoryChartState.ts"],"content_sha256": {- "frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx": "b88c28b9e00787aa17f8e714d0066fa201925ef3a492339c501e86bb74947594",- "frontend-modern/src/utils/alertIncidentPresentation.ts": "4055b32de5e6401dcbb3cd79903d4a8afdb31f3e74645877732bcd416ec2ab45"+ "frontend-modern/src/components/Storage/DiskDetail.tsx": "fd604363e37ffd95e2bbfdfb82b36fa94b3a217e6644c4f9591946e9b41fd217",+ "frontend-modern/src/components/shared/HistoryChart.tsx": "eef6172fbc89bdd9ec0f26ec6b71bb2f6344bd16bd5b0f5c6e32d594235d304d",+ "frontend-modern/src/components/shared/HistoryChartHoverGroup.tsx": "58748fba95a4bb7941a08ff9e41c96e8c870b8f6fff9f9ff9767a795802a1632",+ "frontend-modern/src/components/shared/useHistoryChartState.ts": "8b54e7a48c4635e316ab01410ed07b6ddb308f6ea3f339612bb61ec55947c1d4"},- "routes": ["/alerts/history"],+ "routes": ["/proxmox/storage?tab=disks&q=nvme2"],"viewports": [- { "width": 1280, "height": 720 },- { "width": 390, "height": 664 }+ { "width": 1078, "height": 1234 },+ { "width": 390, "height": 844 }],"states": [- "desktop VMware alert-history row with its inline resource-incidents panel loaded",- "narrow VMware alert-history card with its resource-incidents drawer loaded"+ "Proxmox Physical Disks filtered to nvme2 with WD Red Pro 8TB expanded",+ "disk History tab with 30-minute Read, Write, and Busy charts plus selectable-range Temperature history loaded",+ "Read chart hovered with synchronized crosshairs, point markers, and tooltips visible on all three Live I/O charts",+ "pointer moved outside the Live I/O group with all synchronized hover state cleared"],"interactions": [- "opened Resource investigation from the VMware alert-history row and card",- "confirmed the incident message, Resource Health label, and canonical Resource incidents heading were visible",- "confirmed the narrow drawer exposed exactly one matching accessible Resource incidents heading"+ "expanded WD Red Pro 8TB and opened its History tab at desktop width",+ "hovered the rebased desktop Read chart and confirmed Read, Write, and Busy show the same 09:34:00 timestamp while Temperature remains independent",+ "repeated the hover at 390px and confirmed the stacked Read, Write, and Busy charts show the same 09:36:57 timestamp without clipped tooltips",+ "moved the pointer outside the chart group and confirmed all grouped tooltips clear together"]}diff --git a/frontend-modern/src/components/Storage/DiskDetail.tsx b/frontend-modern/src/components/Storage/DiskDetail.tsxindex 707b706567..71c6cedb3a 100644--- a/frontend-modern/src/components/Storage/DiskDetail.tsx+++ b/frontend-modern/src/components/Storage/DiskDetail.tsx@@ -2,7 +2,7 @@ import { Component, For, Show, createEffect, createMemo, createSignal } from 'soimport type { Resource } from '@/types/resource';import { FormSelect } from '@/components/shared/FormSelect';import { filterSelectClass } from '@/components/shared/FilterToolbar';-import { HistoryChart } from '@/components/shared/HistoryChart';+import { HistoryChart, HistoryChartHoverGroup } from '@/components/shared/HistoryChart';import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';import type { HistoryTimeRange } from '@/api/charts';import { maxHistoryDays } from '@/stores/license';@@ -175,32 +175,34 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {Live I/O (30m)<span class={STORAGE_DETAIL_BADGE_CLASS}>{getDiskDetailLiveBadgeLabel()}</span></h4>- <div class={STORAGE_DISK_DETAIL_LIVE_GRID_CLASS}>- <For each={DISK_DETAIL_LIVE_CHARTS}>- {(chart) => (- <div class={STORAGE_DETAIL_CARD_CLASS}>- <HistoryChart- resourceType="disk"- resourceId={metricResourceId()!}- metric={- chart.series === 'read'- ? 'diskread'- : chart.series === 'write'- ? 'diskwrite'- : 'disk'- }- label={chart.label}- unit={chart.unit}- range="30m"- hideSelector- hideLock- height={120}- compact={true}- />- </div>- )}- </For>- </div>+ <HistoryChartHoverGroup>+ <div class={STORAGE_DISK_DETAIL_LIVE_GRID_CLASS}>+ <For each={DISK_DETAIL_LIVE_CHARTS}>+ {(chart) => (+ <div class={STORAGE_DETAIL_CARD_CLASS}>+ <HistoryChart+ resourceType="disk"+ resourceId={metricResourceId()!}+ metric={+ chart.series === 'read'+ ? 'diskread'+ : chart.series === 'write'+ ? 'diskwrite'+ : 'disk'+ }+ label={chart.label}+ unit={chart.unit}+ range="30m"+ hideSelector+ hideLock+ height={120}+ compact={true}+ />+ </div>+ )}+ </For>+ </div>+ </HistoryChartHoverGroup></div></Show>@@ -211,27 +213,29 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {}><div class={STORAGE_DISK_DETAIL_SECTION_CLASS}>- <div class={STORAGE_DISK_DETAIL_HISTORY_GRID_CLASS}>- <For each={historyCharts()}>- {(chart) => (- <div class={STORAGE_DETAIL_CARD_CLASS}>- <HistoryChart- resourceType="disk"- resourceId={historyResourceId()!}- metric={chart.metric}- label={chart.label}- unit={chart.unit}- height={120}- color={chart.color}- range={chartRange()}- hideSelector={true}- compact={true}- hideLock={true}- />- </div>- )}- </For>- </div>+ <HistoryChartHoverGroup>+ <div class={STORAGE_DISK_DETAIL_HISTORY_GRID_CLASS}>+ <For each={historyCharts()}>+ {(chart) => (+ <div class={STORAGE_DETAIL_CARD_CLASS}>+ <HistoryChart+ resourceType="disk"+ resourceId={historyResourceId()!}+ metric={chart.metric}+ label={chart.label}+ unit={chart.unit}+ height={120}+ color={chart.color}+ range={chartRange()}+ hideSelector={true}+ compact={true}+ hideLock={true}+ />+ </div>+ )}+ </For>+ </div>+ </HistoryChartHoverGroup></div></Show></Show>diff --git a/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx b/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsxindex 247e93e55c..f9654ac366 100644--- a/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx+++ b/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx@@ -1,9 +1,13 @@import { fireEvent, render, screen } from '@solidjs/testing-library';+import type { JSX } from 'solid-js';import { describe, expect, it, vi } from 'vitest';import { DiskDetail } from '@/components/Storage/DiskDetail';import type { Resource } from '@/types/resource';vi.mock('@/components/shared/HistoryChart', () => ({+ HistoryChartHoverGroup: (props: { children: JSX.Element }) => (+ <div data-testid="history-chart-hover-group">{props.children}</div>+ ),HistoryChart: (props: {resourceType: string;resourceId: string;@@ -69,6 +73,7 @@ describe('DiskDetail', () => {expect(Array.from(rangeSelector.options).map((option) => option.value)).not.toContain('14d');expect(Array.from(rangeSelector.options).map((option) => option.value)).not.toContain('90d');expect(screen.getByRole('tab', { name: 'History' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getAllByTestId('history-chart-hover-group')).toHaveLength(2);});it('shows explicit collection status and does not render misleading live I/O', () => {diff --git a/frontend-modern/src/components/shared/HistoryChart.tsx b/frontend-modern/src/components/shared/HistoryChart.tsxindex 2a04365f63..3409300cd9 100644--- a/frontend-modern/src/components/shared/HistoryChart.tsx+++ b/frontend-modern/src/components/shared/HistoryChart.tsx@@ -1,20 +1,27 @@import { Component } from 'solid-js';import type { HistoryChartProps } from './historyChartModel';import { HistoryChartHeader } from './HistoryChartHeader';+import { HistoryChartHoverGroup, useHistoryChartHoverGroup } from './HistoryChartHoverGroup';import { HistoryChartOverlay } from './HistoryChartOverlay';import { HistoryChartTooltip } from './HistoryChartTooltip';import { useHistoryChartState } from './useHistoryChartState';export type { HistoryChartProps } from './historyChartModel';+export { HistoryChartHoverGroup };export const HistoryChart: Component<HistoryChartProps> = (props) => {let canvasRef: HTMLCanvasElement | undefined;let containerRef: HTMLDivElement | undefined;+ const hoverGroup = useHistoryChartHoverGroup();- const chart = useHistoryChartState(props, {- getCanvas: () => canvasRef,- getContainer: () => containerRef,- });+ const chart = useHistoryChartState(+ props,+ {+ getCanvas: () => canvasRef,+ getContainer: () => containerRef,+ },+ hoverGroup,+ );return (<divdiff --git a/frontend-modern/src/components/shared/HistoryChartHoverGroup.tsx b/frontend-modern/src/components/shared/HistoryChartHoverGroup.tsxnew file mode 100644index 0000000000..f41d8cfcc5--- /dev/null+++ b/frontend-modern/src/components/shared/HistoryChartHoverGroup.tsx@@ -0,0 +1,28 @@+import {+ createContext,+ createSignal,+ useContext,+ type Accessor,+ type ParentComponent,+} from 'solid-js';++export interface HistoryChartHoverGroupState {+ hoveredTimestamp: Accessor<number | null>;+ setHoveredTimestamp: (timestamp: number | null) => void;+}++const HistoryChartHoverContext = createContext<HistoryChartHoverGroupState>();++export const HistoryChartHoverGroup: ParentComponent = (props) => {+ const [hoveredTimestamp, setHoveredTimestamp] = createSignal<number | null>(null);++ return (+ <HistoryChartHoverContext.Provider value={{ hoveredTimestamp, setHoveredTimestamp }}>+ {props.children}+ </HistoryChartHoverContext.Provider>+ );+};++export function useHistoryChartHoverGroup() {+ return useContext(HistoryChartHoverContext);+}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 82daa30290..6e7ba95413 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -43,6 +43,7 @@ import patrolObjectivesPanelSource from '@/features/patrol/PatrolObjectivesPanelimport helpIconSource from '@/components/shared/HelpIcon.tsx?raw';import helpIconModelSource from '@/components/shared/helpIconModel.ts?raw';import historyChartHeaderSource from '@/components/shared/HistoryChartHeader.tsx?raw';+import historyChartHoverGroupSource from '@/components/shared/HistoryChartHoverGroup.tsx?raw';import historyChartOverlaySource from '@/components/shared/HistoryChartOverlay.tsx?raw';import historyChartSource from '@/components/shared/HistoryChart.tsx?raw';import historyChartModelSource from '@/components/shared/historyChartModel.ts?raw';@@ -5237,6 +5238,7 @@ describe('shared primitive guardrails', () => {expect(historyChartSource).toContain('HistoryChartHeader');expect(historyChartSource).toContain('HistoryChartOverlay');expect(historyChartSource).toContain('HistoryChartTooltip');+ expect(historyChartSource).toContain('useHistoryChartHoverGroup');expect(historyChartSource).not.toContain('ChartsAPI.getMetricsHistory');expect(historyChartSource).not.toContain('calculateOptimalPoints');expect(historyChartSource).not.toContain('setupCanvasDPR');@@ -5249,6 +5251,10 @@ describe('shared primitive guardrails', () => {expect(historyChartStateSource).toContain('setupCanvasDPR');expect(historyChartStateSource).toContain('export function useHistoryChartState');expect(historyChartStateSource).toContain('HISTORY_CHART_RANGES');+ expect(historyChartStateSource).toContain('hoveredTimestamp');++ expect(historyChartHoverGroupSource).toContain('createContext');+ expect(historyChartHoverGroupSource).toContain('HistoryChartHoverGroup');expect(historyChartModelSource).toContain('formatHistoryChartTooltipValue');expect(historyChartModelSource).toContain('getHistoryChartTooltipLayout');diff --git a/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx b/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsxindex f1ac1fa674..15e2058fb9 100644--- a/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx@@ -1,12 +1,13 @@import { describe, expect, it, vi } from 'vitest';-import { render, screen } from '@solidjs/testing-library';+import { fireEvent, render, screen } from '@solidjs/testing-library';import historyChartHeaderSource from '@/components/shared/HistoryChartHeader.tsx?raw';+import historyChartHoverGroupSource from '@/components/shared/HistoryChartHoverGroup.tsx?raw';import historyChartOverlaySource from '@/components/shared/HistoryChartOverlay.tsx?raw';import historyChartSource from '@/components/shared/HistoryChart.tsx?raw';import historyChartModelSource from '@/components/shared/historyChartModel.ts?raw';import historyChartStateSource from '@/components/shared/useHistoryChartState.ts?raw';import historyChartTooltipSource from '@/components/shared/HistoryChartTooltip.tsx?raw';-import { HistoryChart } from '@/components/shared/HistoryChart';+import { HistoryChart, HistoryChartHoverGroup } from '@/components/shared/HistoryChart';import {getHistoryChartTooltipLayout,HISTORY_CHART_RANGES,@@ -58,6 +59,7 @@ describe('HistoryChart', () => {expect(historyChartSource).toContain('HistoryChartHeader');expect(historyChartSource).toContain('HistoryChartOverlay');expect(historyChartSource).toContain('HistoryChartTooltip');+ expect(historyChartSource).toContain('useHistoryChartHoverGroup');expect(historyChartOverlaySource).toContain("import { LoadingSpinner } from './LoadingSpinner'",);@@ -79,6 +81,7 @@ describe('HistoryChart', () => {expect(historyChartStateSource).toContain('setupCanvasDPR');expect(historyChartStateSource).toContain('export function useHistoryChartState');expect(historyChartStateSource).toContain('HISTORY_CHART_RANGES');+ expect(historyChartStateSource).toContain('hoveredTimestamp');expect(historyChartStateSource).toContain("'mock_synthetic' | null");expect(historyChartStateSource).not.toContain('canStartCommercialTrial');expect(historyChartStateSource).not.toContain('runStartProTrialAction({');@@ -86,6 +89,9 @@ describe('HistoryChart', () => {expect(historyChartStateSource).not.toContain('getTrialAlreadyUsedMessage()');expect(historyChartStateSource).not.toContain('getTrialTryAgainLaterMessage()');+ expect(historyChartHoverGroupSource).toContain('createContext');+ expect(historyChartHoverGroupSource).toContain('HistoryChartHoverGroup');+expect(historyChartModelSource).toContain('formatHistoryChartTooltipValue');expect(historyChartModelSource).toContain('getHistoryChartTooltipLayout');expect(historyChartModelSource).toContain('HISTORY_CHART_RANGES');@@ -128,6 +134,59 @@ describe('HistoryChart', () => {expect(screen.getByText('History')).toBeInTheDocument();});+ it('synchronizes the hovered timestamp across charts in the same group', () => {+ const rectSpy = vi.spyOn(HTMLCanvasElement.prototype, 'getBoundingClientRect').mockReturnValue({+ x: 0,+ y: 0,+ left: 0,+ top: 0,+ right: 400,+ bottom: 120,+ width: 400,+ height: 120,+ toJSON: () => ({}),+ });+ const data = [+ { timestamp: 1_000, value: 10, min: 10, max: 10 },+ { timestamp: 2_000, value: 20, min: 20, max: 20 },+ { timestamp: 3_000, value: 30, min: 30, max: 30 },+ ];++ const { container } = render(() => (+ <HistoryChartHoverGroup>+ <HistoryChart+ resourceType="disk"+ resourceId="disk-1"+ metric="diskread"+ unit="B/s"+ data={data}+ />+ <HistoryChart+ resourceType="disk"+ resourceId="disk-1"+ metric="diskwrite"+ unit="B/s"+ data={data.map((point) => ({+ ...point,+ value: point.value * 2,+ min: point.min * 2,+ max: point.max * 2,+ }))}+ />+ </HistoryChartHoverGroup>+ ));++ const canvases = container.querySelectorAll('canvas');+ fireEvent.mouseMove(canvases[0], { clientX: 220 });++ expect(container.querySelectorAll('[data-history-chart-tooltip="true"]')).toHaveLength(2);++ fireEvent.mouseLeave(canvases[0]);++ expect(container.querySelectorAll('[data-history-chart-tooltip="true"]')).toHaveLength(0);+ rectSpy.mockRestore();+ });+it('exposes the sub-day and Relay history ranges as first-class chart options', () => {expect(HISTORY_CHART_RANGES).toEqual(['1h', '6h', '12h', '24h', '7d', '14d', '30d', '90d']);});diff --git a/frontend-modern/src/components/shared/useHistoryChartState.ts b/frontend-modern/src/components/shared/useHistoryChartState.tsindex d27e6af295..2581d680d8 100644--- a/frontend-modern/src/components/shared/useHistoryChartState.ts+++ b/frontend-modern/src/components/shared/useHistoryChartState.ts@@ -20,13 +20,18 @@ import {type HistoryChartProps,type HistoryChartHoverPoint,} from './historyChartModel';+import type { HistoryChartHoverGroupState } from './HistoryChartHoverGroup';interface HistoryChartRefs {getCanvas: () => HTMLCanvasElement | undefined;getContainer: () => HTMLDivElement | undefined;}-export function useHistoryChartState(props: HistoryChartProps, refs: HistoryChartRefs) {+export function useHistoryChartState(+ props: HistoryChartProps,+ refs: HistoryChartRefs,+ hoverGroup?: HistoryChartHoverGroupState,+) {const [range, setRange] = createSignal<HistoryTimeRange>(props.range || '24h');const [data, setData] = createSignal(props.data ?? []);const [loading, setLoading] = createSignal(false);@@ -37,12 +42,14 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryCharconst [maxPoints, setMaxPoints] = createSignal<number | null>(null);const [refreshTick, setRefreshTick] = createSignal(0);const [hasLoadedOnce, setHasLoadedOnce] = createSignal(false);- const [cursorX, setCursorX] = createSignal<number | null>(null);+ const [localHoveredTimestamp, setLocalHoveredTimestamp] = createSignal<number | null>(null);const [hoveredPoint, setHoveredPoint] = createSignal<HistoryChartHoverPoint | null>(null);const [chartWidth, setChartWidth] = createSignal(300);const chartHeight = createMemo(() => props.height || 200);let chartLeftInset = HISTORY_CHART_MIN_LEFT_INSET;let chartRightInset = 0;+ const hoveredTimestamp = hoverGroup?.hoveredTimestamp ?? localHoveredTimestamp;+ const setHoveredTimestamp = hoverGroup?.setHoveredTimestamp ?? setLocalHoveredTimestamp;const refreshIntervalMs = createMemo(() => getHistoryChartRefreshIntervalMs(range()));@@ -229,6 +236,7 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryChar}if (points.length === 0) {+ setHoveredPoint(null);return;}@@ -273,14 +281,17 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryCharctx.fillText(tick.label, geometry.getX(tick.timestamp), height - 2);}- const cursor = cursorX();+ const hoverTimestamp = hoveredTimestamp();if (- cursor === null ||- cursor < chartLeftInset ||- cursor > width - chartRightInset ||- points.length === 0- )+ hoverTimestamp === null ||+ hoverTimestamp < points[0].timestamp ||+ hoverTimestamp > points[points.length - 1].timestamp+ ) {+ setHoveredPoint(null);return;+ }++ const cursor = geometry.getX(hoverTimestamp);ctx.save();ctx.strokeStyle = isDark ? 'rgba(255, 255, 255, 0.4)' : 'rgba(0, 0, 0, 0.3)';@@ -292,8 +303,6 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryCharctx.stroke();ctx.restore();- const ratio = (cursor - chartLeftInset) / (width - chartLeftInset - chartRightInset);- const hoverTimestamp = points[0].timestamp + ratio * geometry.timeSpan;const closest = findHistoryChartClosestPoint(points, hoverTimestamp);const pointX = geometry.getX(closest.timestamp);const pointY = geometry.getY(closest.value);@@ -312,10 +321,17 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryCharctx.arc(pointX, pointY, 2, 0, Math.PI * 2);ctx.fillStyle = isDark ? 'rgba(255, 255, 255, 0.6)' : 'rgba(255, 255, 255, 0.8)';ctx.fill();++ setHoveredPoint({+ value: closest.value,+ timestamp: closest.timestamp,+ x: pointX,+ y: pointY,+ });};createEffect(() => {- cursorX();+ hoveredTimestamp();drawChart();});@@ -350,41 +366,18 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryCharconst rect = canvas.getBoundingClientRect();const x = event.clientX - rect.left;const width = rect.width;- const geometry = createHistoryChartGeometry({- width,- height: chartHeight(),- startTime: points[0].timestamp,- endTime: points[points.length - 1].timestamp,- minValue: getHistoryChartScale(points, props.unit).minValue,- maxValue: getHistoryChartScale(points, props.unit).maxValue,- leftInset: chartLeftInset,- rightInset: chartRightInset,- });-if (x < chartLeftInset || x > width - chartRightInset) {- setCursorX(null);- setHoveredPoint(null);+ setHoveredTimestamp(null);return;}- setCursorX(x);const ratio = (x - chartLeftInset) / (width - chartLeftInset - chartRightInset);- const hoverTimestamp = points[0].timestamp + ratio * geometry.timeSpan;- const closest = findHistoryChartClosestPoint(points, hoverTimestamp);- const pointX = geometry.getX(closest.timestamp);- const pointY = geometry.getY(closest.value);-- setHoveredPoint({- value: closest.value,- timestamp: closest.timestamp,- x: pointX,- y: pointY,- });+ const timeSpan = Math.max(1, points[points.length - 1].timestamp - points[0].timestamp);+ setHoveredTimestamp(points[0].timestamp + ratio * timeSpan);};const handleMouseLeave = () => {- setHoveredPoint(null);- setCursorX(null);+ setHoveredTimestamp(null);};return {