BarChart: Fix Sticky Tooltip (#45017) (#45019)

This commit is contained in:
Grot (@grafanabot)
2022-02-07 23:46:04 +01:00
committed by GitHub
parent c4da73ce4d
commit 836168eb13
2 changed files with 6 additions and 1 deletions
@@ -252,7 +252,7 @@ export const BarChartPanel: React.FunctionComponent<Props> = ({ data, options, w
width={width}
height={height}
>
{(config, alignedFrame) => {
{(config) => {
if (oldConfig.current !== config) {
oldConfig.current = setupConfig({
config,
@@ -33,6 +33,11 @@ export const setupConfig = ({
}: SetupConfigParams): UPlotConfigBuilder => {
config.addHook('init', (u) => {
u.root.parentElement?.addEventListener('click', onUPlotClick);
u.over.addEventListener('mouseleave', () => {
if (!isToolTipOpen.current) {
setCoords(null);
}
});
});
let rect: DOMRect;