0.3.0 • Published 11 years ago

d3-mapping v0.3.0

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

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.place will dodge d3's reassignment of the this operator, so you are free to use within .attr assignments, etc.
  • x.create_domain(data) will call 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.
  • axis and scale attributes can be set or accessed via x.axis and x.scale respectively.

Check out the example.

0.3.0

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago