Skip to main content
100%

Scatterplot with Voronoi

✓ Published0🌍 Public
TThanaporn-sk
Last edited Jul 31, 2017
Created on Jul 31, 2017

This interactive scatterplot maps life expectancy against GDP per capita for countries, colored by region and sized by total GDP. It uses a Voronoi tessellation to expand the hover target for each point, so tooltips appear when the mouse is near a circle, not just directly over it. Built with D3 v4 and React, the visualization leverages `d3.voronoi.find(x, y, radius)` for efficient neighbor lookup and displays tooltips via Bootstrap popovers. The data comes from the World Bank.

AI-generated description

This is a D3.v4 port by Philippe Rivière of <a href='http://bl.ocks.org/nbremer/'>Nadieh Bremer</a>'s block: <a href='http://bl.ocks.org/nbremer/61cd485e399b6a71d5fb2b1072fbc6c1'>Step 6 - Final - Voronoi (Distance Limited Tooltip) Scatterplot</a>.

In addition, we use d3.voronoi.find(x,y,radius) to locate the point, instead of relying on a SVG overlay of clipped circles.

This gives:

  1. lazy computation of the Voronoi
  2. other objects are allowed capture the mouse before svg.

------ 8X --------

Nadieh:

This 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

forked from <a href='http://bl.ocks.org/Fil/'>Fil</a>'s block: <a href='http://bl.ocks.org/Fil/7d4ac8a6c259e3d4329c54c4f1abed34'>Step 6 - d3.v4 [UNLISTED]</a>

forked from <a href='http://bl.ocks.org/Fil/'>Fil</a>'s block: <a href='http://bl.ocks.org/Fil/f49b5cf943a0210212994aa5860ac4a8'>Nadieh Bremer's Scatterplot with Voronoi - ported to d3.v4, and no SVG overlay</a>

Similar vizzes