Skip to main content
Public

Share visualization

Loading preview…

Making a barchart

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 barchart

0
NNick Dyson
Last edited Nov 30, 2019
Created on Nov 30, 2019

This example demonstrates a responsive SVG barchart that fills the browser window using CSS. It initially renders two green diagonal lines forming an X, which visually confirm the chart’s dimensions. The code uses D3.js v5 to select the chart container, append an SVG element, and dynamically set its width and height based on the container’s client dimensions. A redraw function is triggered on window resize, using D3’s selection merge methods to update the lines’ coordinates. The chart has no data source, focusing instead on sizing and rendering mechanics.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed