diff --git a/packages/view/src/components/Statistics/AuthorBarChart/AuthorBarChart.tsx b/packages/view/src/components/Statistics/AuthorBarChart/AuthorBarChart.tsx index e532e096..37428909 100644 --- a/packages/view/src/components/Statistics/AuthorBarChart/AuthorBarChart.tsx +++ b/packages/view/src/components/Statistics/AuthorBarChart/AuthorBarChart.tsx @@ -88,13 +88,11 @@ const AuthorBarChart = () => { .text(`${metric} # / Total ${metric} # (%)`); // Event handler - const handleMouseOver = () => { - tooltip.style("display", "inline-block"); - }; - const handleMouseMove = (e: MouseEvent, d: AuthorDataType) => { + const handleMouseOver = (e: MouseEvent, d: AuthorDataType) => { tooltip + .style("display", "inline-block") .style("left", `${e.pageX - 70}px`) - .style("top", `${e.pageY - 70}px`) + .style("top", `${e.pageY - 90}px`) .html( `

${d.name}

${metric}: @@ -106,6 +104,10 @@ const AuthorBarChart = () => {

` ); }; + + const handleMouseMove = (e: MouseEvent) => { + tooltip.style("left", `${e.pageX - 70}px`).style("top", `${e.pageY - 90}px`); + }; const handleMouseOut = () => { tooltip.style("display", "none"); };