BarChart: Fix Sticky Tooltip (#45017)

This commit is contained in:
Nathan Marrs authored and GitHub committed 2022-02-07 23:26:27 +01:00
1 parent 01d961c824
commit ed7b9905c2
2 files changed
+6 -1

No files matched your search

@@ -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;