Skip to main content
Public

Share visualization

Loading preview…

10. D3 Drawing Divs Height

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

10. D3 Drawing Divs Height

1
Aamakanju@nyit.edu
Last edited Feb 13, 2026
Created on Feb 9, 2026

Five vertical divs display a bar chart, each bar's height corresponding to a value in a small JavaScript array. The visualization demonstrates how D3 version 4.5.0 maps data to visual properties using a simple pipeline. The code uses `d3.select` to target the body, `selectAll` and `data` to bind the dataset, then `enter` and `append` to create divs with class 'bar'. A style function dynamically sets the `height` attribute in pixels, overriding the initial CSS. This example illustrates D3's core selectors and data-binding methods.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed