Scatterplot with Voronoi
This interactive scatterplot displays life expectancy versus GDP per capita for countries, colored by region. The chart uses a Voronoi grid with invisible large circular regions around each point to expand the hover target, making tooltips easier to trigger. When hovering over a circle’s enlarged area, a tooltip appears with the country’s details. Built with D3 v3 and SVG, the visualization also includes a legend and animated transitions.
AI-generated descriptionThis scatterplot is part of the extension of my blog on Using a D3 Voronoi grid to improve a chart's interactive experience. After writing that blog Franck Lebeau came with another version which uses large circles to define the tooltip region. I thought this was a great idea! But I made this variation on his code, because I felt that the extra code used in this example (versus the previous version 4) is more in line with the rest of the code.
The tooltip now reacts when you hover over an invisible large circular region around each circle.
You can find all of the steps here
- Step 1: Tooltip attached to circle element
- Step 2: Tooltip attached to voronoi cell
- Step 3: Tooltip attached to circle
- Step 4: Extra hover effects and interactivity
- Step 5: Update with distance limiting circles - made visible
- Step 6: This is step 6 :)
forked from <a href='http://bl.ocks.org/nbremer/'>nbremer</a>'s block: <a href='http://bl.ocks.org/nbremer/61cd485e399b6a71d5fb2b1072fbc6c1'>Step 6 - Final - Voronoi (Distance Limited Tooltip) Scatterplot</a>