d3 and canvas - the bind, the draw and the pick
✓ Published0🌍 Public
AAngelos Chatzimparmpas
Last edited May 23, 2022
Created on May 22, 2022
Forked from d3 and canvas - the bind, the draw and the pick
This example demonstrates a dynamic grid of colored cells on an HTML canvas, where each cell represents a data point. A hidden secondary canvas is used for mouse picking; each cell gets a unique color assigned via `genColor()`, and this color is mapped to the original data in a dictionary (`colourToNode`). When the user hovers over the visible canvas, the tooltip displays the corresponding data value by reading the pixel color from the hidden canvas. The visualization uses d3.v4 for data binding and transitions, and it redraws both canvases continuously.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed