Skip to main content
100%

voronoi.find() and resizing charts

✓ Published0🌍 Public
Aalexmacy
Last edited Sep 12, 2017
Created on Sep 2, 2017

This example demonstrates multiple interactive SVG charts that can be added, repositioned, and resized by dragging their edges, corners, or bodies. Each chart renders a Voronoi diagram of 200 randomly generated points, and mouse movement highlights the cell containing the cursor using `voronoi.find()`. A "Snap" button tiles all charts to fit the screen. The code uses d3.v4’s `d3.voronoi`, `d3.drag`, and `d3.transition` to handle the geometry, user interactions, and smooth resizing animations.

AI-generated description

The buttons at the top let you add more charts and snap them to the screen tiled to all be visible. The charts are also interactive in that they can be resized and moved. They are also responsive to mouseover events, using voronoi.find() to highlight the cell in each chart for the mouse's relative location.

Also see Philippe Rivière's block Voronoi.find(x,y) .

mit Licensed

Similar vizzes