Skip to content

Instantly share code, notes, and snippets.

@levvsha
Created December 10, 2017 13:16
Show Gist options
  • Select an option

  • Save levvsha/8d4070d382ca30a597f4b43242dfd792 to your computer and use it in GitHub Desktop.

Select an option

Save levvsha/8d4070d382ca30a597f4b43242dfd792 to your computer and use it in GitHub Desktop.
const filteredData = data.filter(dataItem => enabledRegionsIds.indexOf(dataItem.regionId) >= 0);
const voronoiPaths = voronoiGroup.selectAll('path')
.data(voronoi.polygons(filteredData));
voronoiPaths.exit().remove();
voronoiPaths
.enter()
.append('path')
.merge(voronoiPaths)
.attr('d', d => (d ? `M${ d.join('L') }Z` : null))
.on('mouseover', voronoiMouseover)
.on('mouseout', voronoiMouseout)
.on('click', voronoiClick);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment