d3-timezone-scale
v0.0.1
Published
d3 scale component using a specified timezone name
Readme
d3-timezone-scale
Heavily copied from Thomas Coats' d3-chronological but updated for D3 V4.
d3-timezone-scale allows creating scales locked into a specified timezone name from momentjs timezone (such as "UTC" or "US/East").
Installing
If you use NPM, npm install d3-timezone-scale. Otherwise, download the latest release.
API Reference
Use just like D3's scaleTime, except you pass a timezone name into the constructor. Intelligent boundary-drawing will follow the natural boundaries in the specified timezone. This is especially useful when a scale spans a daylight savings time change (see example).
Pass a chronological time schedule to the nice function to round to the nearest schedule. example:
myScale = d3.scaleTimezone('US/Eastern')
.domain([moment('2017-03-10T00:00:00Z'), moment('2017-03-14T00:00:00Z')])
.nice(moment().tz('US/Eastern').startOf('d').every(1, 'd'))
.range([0, 500])Dependencies
Contributing
First things first:
npm install
Running the example locally:
npm install -g watchifywatchify examples/index.js -o examples/bundle.js- open
examples/index.htmlin a browser
