timelineify.js
Transform event data to timeline data.
Usage
npm install timelineify
Node
var timelineify = ;
Browser
This will make window.timelineify
available.
API
timelineify( events [, resolution ] )
Convert the events
hash to timeline data, based on resolution
. The default
resolution
is "days"
.
The possible resolutions are the object properties supported by moment.js.
What are Events
The events hash is an object where each key represents the unique ID of an event. An event
is an object with two properties: start
and end
. These can either be valid moment
objects,
or strings that can be parsed as moments.
What is timeline data
Timeline data can only occur at discrete points, which is determined
by the resolution
of the timeline. The section between these points
is called a "Space." The smallest unit of measurement on a timeline is a Space.
Each event creates two timeline points: one at the start of the event, and one at the end.
The timeline point created by the start of the event is always at the start of a Space, while the end of an event is always the end of a Space.
A Note on Order
At times when two events have the same start and end date, they will appear one after the other within the resultant data set. However, the order in which they appear is not determined by the order in which they appeared in the original data set. Keep that in mind!