From 65ca8d318ed8944e61f99123bb8bbfeee44e9742 Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Fri, 6 Dec 2024 17:03:55 +0200 Subject: [PATCH] zoom out on double click --- src/components/chart/ha-chart-base.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index a9425bcedcbf..2367590d8369 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -260,6 +260,7 @@ export class HaChartBase extends LitElement { "padding-inline-start": `${this._paddingYAxisInternal}px`, "padding-inline-end": 0, })} + @click=${this._handleChartClick} > ${this._tooltip @@ -409,6 +410,13 @@ export class HaChartBase extends LitElement { ]; } + private _handleChartClick(ev: MouseEvent) { + if (ev.detail === 2) { + // reset zoom with double click + this.chart?.resetZoom(); + } + } + private _legendClick(ev) { if (!this.chart) { return;