Skip to content

Commit

Permalink
[TSVB] Show tooltip on external pointer events (#77306) (#79968)
Browse files Browse the repository at this point in the history
* Show external pointer events in TSVB

* Disable tooltip visibility

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
sulemanof and kibanamachine authored Oct 8, 2020
1 parent 9a74a36 commit 9408f41
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,20 @@ export const TimeSeries = ({
annotations,
}) => {
const chartRef = useRef();
const updateCursor = (_, cursor) => {
if (chartRef.current) {
chartRef.current.dispatchExternalPointerEvent(cursor);
}
};

useEffect(() => {
const updateCursor = (_, cursor) => {
if (chartRef.current) {
chartRef.current.dispatchExternalPointerEvent(cursor);
}
};

eventBus.on(ACTIVE_CURSOR, updateCursor);

return () => {
eventBus.off(ACTIVE_CURSOR, undefined, updateCursor);
};
}, []); // eslint-disable-line
}, []);

const tooltipFormatter = decorateFormatter(xAxisFormatter);
const uiSettings = getUISettings();
Expand Down Expand Up @@ -139,6 +140,7 @@ export const TimeSeries = ({
type: tooltipMode === 'show_focused' ? TooltipType.Follow : TooltipType.VerticalCursor,
headerFormatter: tooltipFormatter,
}}
externalPointerEvents={{ tooltip: { visible: false } }}
/>

{annotations.map(({ id, data, icon, color }) => {
Expand Down

0 comments on commit 9408f41

Please sign in to comment.