Skip to main content
100%

MasteringD3-Resusable-ProD3js-2.2.4

✓ Published1🌍 Public
JJimMaltby
Last edited Nov 26, 2021
Created on Nov 26, 2021

This example demonstrates a reusable bar-code chart built with D3 v5, following the ProD3.js pattern for modular, maintainable visualizations. It renders a time-based dataset as vertical black lines over a white background, with each line’s x-position determined by a date value via `d3.scaleTime`. The chart initializes with a back bar drawn as a white rectangle, then appends and transitions line elements using SVG and `transition().duration(300)`. The code includes update functions for data and fill color, reflecting the reusable chart architecture derived from Mike Bostock’s and Rob Moore’s patterns.

AI-generated description

Simple Bar Chart example:

A vanilla HTML implementation of Rob Moores updateable pattern Towards Updatable https://www.toptal.com/d3-js/towards-reusable-d3-js-charts.

It is derived from Mike Bostock's Towards Reusable Charts (https://bost.ocks.org/mike/chart/) as the source of the foundational principles.

Will evolve to use the ProD3 pattern (Pro D3.js Use D3.js to Create Maintainable, Modular, and Testable Charts by Marcos Iglesias https://www.apress.com/gp/book/9781484252024) as the basis for further charts.

MIT Licensed

Similar vizzes