Skip to main content
100%

TDD Bar Chart

✓ Published0🌍 Public
GGolodhros
Last edited Nov 29, 2015
Created on Feb 21, 2015

This bar chart displays the frequency of letters in the English language using a TSV dataset. The example demonstrates a test-driven approach to building a reusable, responsive D3.js chart, built upon Mike Bostock's original block and the Data Manager API for loading and parsing data. The chart uses `d3.scale.ordinal` for the x-axis, `d3.scale.linear` for the y-axis, and `d3.svg.axis` for display, with bars rendered as SVG rectangles. The code includes a Jasmine test suite that validates chart rendering, structure, and configurable properties like width, height, and margins.

AI-generated description

This chart takes as a base the simple bar chart by Mike Bostock and refactors that example using the reusable API, making it responsive and configurable.

It also uses the Data Manager API from the Developing a D3.js Edge Book.

It includes tests and was conceived on a TDD basis for the talk Better D3 Charts with the Reusable API.

From the original Block:

This simple bar chart is constructed from a TSV file storing the frequency of letters in the English language. The chart employs conventional margins and a number of D3 features:

Similar vizzes