From 11f6438acecfc832cd387dbe92f7103ad649494c Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Sun, 6 Jul 2025 11:36:50 +0300 Subject: [PATCH] Ignore hidden xAxis --- src/components/chart/ha-chart-base.ts | 50 +++++++++++++++------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 7bb4e23242..45a6eecf72 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -371,17 +371,20 @@ export class HaChartBase extends LitElement { lastTipY = e.y; this.chart?.setOption({ xAxis: ensureArray(this.chart?.getOption().xAxis as any).map( - (axis: XAXisOption) => ({ - ...axis, - axisPointer: { - ...axis.axisPointer, - status: "show", - handle: { - ...axis.axisPointer?.handle, - show: true, - }, - }, - }) + (axis: XAXisOption) => + axis.show + ? { + ...axis, + axisPointer: { + ...axis.axisPointer, + status: "show", + handle: { + ...axis.axisPointer?.handle, + show: true, + }, + }, + } + : axis ), }); }); @@ -395,17 +398,20 @@ export class HaChartBase extends LitElement { } this.chart?.setOption({ xAxis: ensureArray(this.chart?.getOption().xAxis as any).map( - (axis: XAXisOption) => ({ - ...axis, - axisPointer: { - ...axis.axisPointer, - handle: { - ...axis.axisPointer?.handle, - show: false, - }, - status: "hide", - }, - }) + (axis: XAXisOption) => + axis.show + ? { + ...axis, + axisPointer: { + ...axis.axisPointer, + handle: { + ...axis.axisPointer?.handle, + show: false, + }, + status: "hide", + }, + } + : axis ), }); this.chart?.dispatchAction({