Skip to main content
100%

D3: Drawing divs with data

✓ Published1🌍 Public
MMarisa Tania
Last edited Sep 26, 2022
Created on Sep 26, 2022
Forked from HTML Starter

This example shows 25 randomly generated data values rendered as a series of inline-block bars. The code uses D3.js v7’s `d3.select` and the data join pattern with `.data()`, `.enter()`, and `.append()` to create `div` elements styled with a CSS class. Each bar’s height is computed dynamically by multiplying the integer data value (0–29) by 5 pixels, overriding the default 75-pixel CSS height. The data is generated client-side with a JavaScript loop and `Math.random()`.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes