Skip to main content
Public

Share visualization

Loading preview…

52. D3 Bar Chart Scales

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

52. D3 Bar Chart Scales

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

This example demonstrates a flexible, scalable bar chart built with D3.js (v4.5.0), using ordinal and linear scales to map a static dataset of 20 values to SVG rectangles. The chart uses `d3.scaleBand` for the x-axis positioning with padding and `d3.scaleLinear` for y-axis height, rendering bars and white value labels. The bars’ fill colors are dynamically computed from their values, creating a gradient from dark to light blue. The visualization appears static with no animation or interactions.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed