Hide tooltip after clicking on a chart to display more info (cosmetic change) (#18103)

This commit is contained in:
K3A 2023-10-05 11:28:07 +02:00 committed by GitHub
parent e1a71fbfaa
commit c106a0ac85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -180,7 +180,9 @@ export class StateHistoryChartLine extends LitElement {
return; return;
} }
const points = e.chart.getElementsAtEventForMode( const chart = e.chart;
const points = chart.getElementsAtEventForMode(
e, e,
"nearest", "nearest",
{ intersect: true }, { intersect: true },
@ -192,6 +194,7 @@ export class StateHistoryChartLine extends LitElement {
fireEvent(this, "hass-more-info", { fireEvent(this, "hass-more-info", {
entityId: this._entityIds[firstPoint.datasetIndex], entityId: this._entityIds[firstPoint.datasetIndex],
}); });
chart.canvas.dispatchEvent(new Event("mouseout")); // to hide tooltip
} }
}, },
}; };

View File

@ -238,6 +238,7 @@ export class StateHistoryChartTimeline extends LitElement {
// @ts-ignore // @ts-ignore
entityId: this._chartData?.datasets[index]?.label, entityId: this._chartData?.datasets[index]?.label,
}); });
chart.canvas.dispatchEvent(new Event("mouseout")); // to hide tooltip
}, },
}; };
} }

View File

@ -164,6 +164,7 @@ export class HuiEnergyDevicesGraphCard
// @ts-ignore // @ts-ignore
entityId: this._chartData?.datasets[0]?.data[index]?.y, entityId: this._chartData?.datasets[0]?.data[index]?.y,
}); });
chart.canvas.dispatchEvent(new Event("mouseout")); // to hide tooltip
}, },
}) })
); );