Skip to content

Commit b56e021

Browse files
Merge pull request #210 from microsoft/PSL-BUG-13860-1
fix: tooltip issue fixed on hover
2 parents 8edc947 + ac6504a commit b56e021

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/App/frontend/src/chartComponents/HorizontalBarChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const BarChart: React.FC<BarChartProps> = ({
2929
document?.getElementById(containerID)!.clientWidth || 200;
3030
const svg = d3.select(chartRef.current);
3131
svg.selectAll("*").remove(); // Clear previous render
32-
32+
d3.selectAll("#tooltip-container").remove(); // Ensuring the previous tooltip is removed.
3333
const modifiedData: DataWithFullCategoryText[] = data.map((ob) => {
3434
let truncatedCategory = ob.category;
3535

@@ -95,6 +95,7 @@ const BarChart: React.FC<BarChartProps> = ({
9595
const tooltip = d3
9696
.select("body")
9797
.append("div")
98+
.attr("id", "tooltip-container") // Ensure only one tooltip exists
9899
.style("position", "absolute")
99100
.style("background", "#fff")
100101
.style("padding", "5px 10px")

0 commit comments

Comments
 (0)