Utility to make working with d3 scales less painful
A simple utility to make working with d3 scales easier.
npm install d3-Mapping
Designed to be used node style:
Mapping = require"d3-mapping"
Initialize a new mapping with a scale and an acessor function
x = xScale xAccessor
x has convenience methods for a number of common tasks.
x.place(d)returns the value a data element is mapped to.
x.placewill dodge d3's reassignment of the this operator, so you are free to use within
d3.extent(data, x.accessor). Currently doesn't support ordinal scales.
x.create_axis()creates an axis for the scale, and return it, so it can be used in a method chain.
Check out the example.