Skip to main content
Public

Share visualization

Loading preview…

51. D3 Bar Chart

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

51. D3 Bar Chart

1
Aamakanju@nyit.edu
Last edited Feb 26, 2026
Created on Feb 23, 2026

This is a simple D3.js bar chart that visualizes a numeric dataset of 20 values, displaying each value as a rectangle scaled in height and colored in varying shades of blue. The chart uses an SVG element sized 500 by 100 pixels, with rectangles positioned horizontally and vertically scaled by a factor of four. Each bar is labeled with its corresponding number, rendered in white text. The example demonstrates basic D3 v4.5.0 APIs including `d3.select`, `svg.selectAll`, `.data()`, `.enter()`, and `.attr()`, with a static dataset defined as an array of integers.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed