Skip to main content
Public

Share visualization

Loading preview…

Making a Bar Chart D3 Tutorial

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

Making a Bar Chart D3 Tutorial

0
Aal0210.stevie@gmail.com
Last edited Nov 12, 2024
Created on Nov 12, 2024

This example demonstrates an SVG-based bar chart that dynamically responds to browser resizing. The visualization fills the entire viewport using CSS positioning, while a redraw function extracts the current width and height from the chart container and updates the SVG element’s dimensions accordingly. Two diagonal green lines are drawn to visually confirm the resizing behavior. The implementation uses D3 v5, with d3.select and SVG line elements, and listens for window resize events to trigger redrawing.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed