Socket
Book a DemoInstallSign in
Socket

d3-chronological

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-chronological

d3 components using proper timezone information

0.2.0
latest
Source
npmnpm
Version published
Weekly downloads
6
Maintainers
2
Weekly downloads
 
Created
Source

d3-chronological

d3 components using proper timezone information. Currently only scale has been implemented.

Scale

Replace d3.time.scale with d3.chrono.scale.

var x = d3.chrono.scale('Pacific/Auckland')
  .domain([
    moment('2015-01-01'),
    moment('2015-01-02')
  ])
  .nice(moment().tz('Pacific/Auckland').startOf('w').every(1, 'w'))
  .range([0, width]);

Create the scale with a timezone identifier from momentjs timezone or leave blank to use UTC. This timezone is used to create default ticks that align to the correct start of day, etc.

Pass a chronological time schedule to the nice function to round to the nearest schedule. The above example rounds to the nearest week.

Values are kept as milliseconds past epoch internally and converted to timezone moments on output from domain() and ticks(). Calculating your own tick values and tick format is suggested - using chronological makes this easy.

FAQs

Package last updated on 06 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.