[SOLVED]-HOW TO ADD A TOOLTIP TO A PIE CHART?-REACTJS

HOW TO ADD A TOOLTIP TO A PIE CHART?-REACTJS


const tooltippos = (centroid) => {

    const svgbox = d3.select(`svg#<your tag>`).node().getboundingclientrect();
   
    const posx = svgbox.x + (centroid[0] / width) * svgbox.width;
    const posy = svgbox.y + (centroid[1] / height) * svgbox.height;

    return [posx, posy];
}

note that width and height are the ones passed onto the svg

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments