Ignore hidden xAxis

This commit is contained in:
Petar Petrov 2025-07-06 11:36:50 +03:00
parent a18b9bc342
commit 11f6438ace

View File

@ -371,7 +371,9 @@ export class HaChartBase extends LitElement {
lastTipY = e.y; lastTipY = e.y;
this.chart?.setOption({ this.chart?.setOption({
xAxis: ensureArray(this.chart?.getOption().xAxis as any).map( xAxis: ensureArray(this.chart?.getOption().xAxis as any).map(
(axis: XAXisOption) => ({ (axis: XAXisOption) =>
axis.show
? {
...axis, ...axis,
axisPointer: { axisPointer: {
...axis.axisPointer, ...axis.axisPointer,
@ -381,7 +383,8 @@ export class HaChartBase extends LitElement {
show: true, show: true,
}, },
}, },
}) }
: axis
), ),
}); });
}); });
@ -395,7 +398,9 @@ export class HaChartBase extends LitElement {
} }
this.chart?.setOption({ this.chart?.setOption({
xAxis: ensureArray(this.chart?.getOption().xAxis as any).map( xAxis: ensureArray(this.chart?.getOption().xAxis as any).map(
(axis: XAXisOption) => ({ (axis: XAXisOption) =>
axis.show
? {
...axis, ...axis,
axisPointer: { axisPointer: {
...axis.axisPointer, ...axis.axisPointer,
@ -405,7 +410,8 @@ export class HaChartBase extends LitElement {
}, },
status: "hide", status: "hide",
}, },
}) }
: axis
), ),
}); });
this.chart?.dispatchAction({ this.chart?.dispatchAction({