Skip to main content
Public

Share visualization

Loading preview…

Histogram with Bins Using D3

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

Histogram with Bins Using D3

0
OOlha
Last edited Apr 16, 2022
Created on Mar 8, 2022
Forked from Histogram with D3

This example shows the distribution of docked bikes across California stations in 2013, with a control to adjust the histogram’s bin count from 2 to 40 in steps of 3. The chart uses D3’s `d3.bin` (with `value`, `domain`, and `thresholds` based on `x.ticks(numBins)`) to compute bins from a CSV loaded via `d3.csv`, then renders bars as SVG `rect` elements on a linear scale. Animated transitions via D3’s `transition` API update the y-axis and bar heights when the bin number changes, while the x-axis remains fixed to the full data domain.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed