Skip to main content
Public

Share visualization

Loading preview…

D3_CookBook(v5)_Ch3 pt2

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

D3_CookBook(v5)_Ch3 pt2

0
JJimMaltby
Last edited Jul 1, 2021
Created on Jul 1, 2021

This example demonstrates a streaming bar chart that updates every 1.5 seconds by shifting the first data point and pushing a new random value onto the end of an array. It shows the classic D3 data-join pattern using `.enter()`, `.update`, and `.exit()` to manage div elements with the class `h-bar`. The code uses `d3.select` and `data()` binding to set each bar’s width and display its numeric value in a span. The visualization relies on `setInterval` to trigger re-renders, with the bars growing and shrinking as the dataset evolves.

AI-generated description

D3 Cook Book getting used to JS in d3 CH2 Problem in converting from v3 to v5 and looks like book has poor practice of d3.js (https://stackoverflow.com/questions/45181773/d3-js-raw-selection-get-error-uncaught-typeerror-cannot-read-property-0-of-u)

Comments

Sign in to join the discussion.

MIT Licensed