This is in answer to the Stack Overflow question Show info when hovering over voronoi polygons (in D3.js). In this example the title attribute has been used for the ‘tooltip’ but there are better alternatives around. This example uses an accessor function to specify the x
and y
for the Voronoi polygons and created an object locCities
to store the descriptive variables, although the conversion of co-ordinates using the projection function could have been done in the accessor function and the orginal data used i.e. the cities
variable. Also, note that an old version of d3 has been used due to some change in the Albers Usa projection.