May 2019
Beginner to intermediate
650 pages
14h 50m
English
A time scale, which is created with d3.scaleTime() or d3.scaleUtc() is like a linear scale with a temporal domain. The domain takes an interval of Date objects. The following code places dates on an axis:
const data = [ new Date(2017,10,1), new Date(2017,11,26), new Date(2018,3,15) ];const scale = d3.scaleTime() .domain([new Date(2017,9,1),new Date(2018,9,1)]) .range([0,1000]);
The dates are distributed according to their position in the time domain, as follows:

This other example displays intervals within a day:
const data = [ new Date(2018,9,15,6,30,0), ...
Read now
Unlock full access