Skip to main content
Public

Share visualization

Loading preview…

MasteringD3js_ReuseProD3_Ch2 pt2.2a

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

MasteringD3js_ReuseProD3_Ch2 pt2.2a

1
JJimMaltby
Last edited Nov 16, 2021
Created on Nov 13, 2021

Reusable D3 chart functions build SVG bar charts from an array of four string values, rendering yellow background rectangles with blue bars in separate containers for two chart instances. The code demonstrates the transition from D3 v3 to v5 while implementing the ProD3 reusable chart pattern, using `selection.each`, `selection.enter`, and `selection.call` to structure modular chart components.

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) This version is an attempt to put into the ProD3.js resusable pattern

Comments

Sign in to join the discussion.

MIT Licensed