My notes
Edit of mbostock's DRY Bar Chart
A variation of the example bar chart using a slightly more D.R.Y. style. The visual encoding is represented by two functions and their composition:
- The value accessor returns the value (or property) to encode for a given data object.
- The scale maps this value to a visual display encoding, such as a pixel position.
- The map function represents the composition value ○ scale, mapping from data to display.
Inspired by Andrew Winterman’s post, Tooling for the Lazy Programmer: DRYing up D3.
https://d3js.org/d3.v3.min.js