diff --git a/packages/d3tooltip/src/index.ts b/packages/d3tooltip/src/index.ts index bdba4d7b..b346be4f 100644 --- a/packages/d3tooltip/src/index.ts +++ b/packages/d3tooltip/src/index.ts @@ -85,8 +85,8 @@ export function tooltip< ) => ''; let styles = {}; - let el: Selection; - const anchor: Selection = + let el: Selection; + const anchor: Selection = root || d3.select('body'); const rootNode = anchor.node()!; @@ -107,7 +107,7 @@ export function tooltip< top: `${y}px`, ...styles, }) - .html(() => text(node)) as Selection; + .html(() => text(node)); }); selection.on('mousemove.tip', (node) => {