0.3.0 • Published 12 years ago
d3-mapping v0.3.0
A simple utility to make working with d3 scales easier.
Installation
npm install d3-Mapping
Usage
Designed to be used node style:
Mapping = require("d3-mapping")Initialize a new mapping with a scale and an acessor function
x = new Mapping(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.attrassignments, etc.x.create_domain(data)will calld3.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.- axis and scale attributes can be set or accessed via
x.axisandx.scalerespectively.
Check out the example.