new Timeline( [options])
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Control options. Properties
|
Fires:
- event:select
- event:scroll
- event:collapse
Extends
Methods
-
addButton(button)
-
Add a button on the timeline
Parameters:
Name Type Description button* Properties
Name Type Description classNamestring classNametitle htmlElement | string Content of the element
clickfunction a function called when the button is clicked
-
collapse(b)
-
Collapse the line
Parameters:
Name Type Description bboolean -
getDate(position, stick)
-
Get the date of the center
Parameters:
Name Type Description positionstring position to get 'start', 'end' or 'middle', default middle
stickstring sticking option to stick date to: 'mn', 'hour', 'day', 'month', default no stick
Returns:
- Type
- Date
-
getEndDate()
-
Get the end date of the control
Returns:
- Type
- Date
-
getFeatures()
-
Get features
Returns:
- Type
- Array.<ol.Feature>
-
getStartDate()
-
Get the start date of the control
Returns:
- Type
- Date
-
isCollapsed()
-
Is the line collapsed
Returns:
- Type
- boolean
-
refresh(zoom)
-
Refresh the timeline with new data
Parameters:
Name Type Description zoomNumber Zoom factor from 0.25 to 10, default 1
-
roundDate(d, stick)
-
Get round date (sticked to mn, hour day or month)
Parameters:
Name Type Description dDate stickstring sticking option to stick date to: 'mn', 'hour', 'day', 'month', default no stick
Returns:
- Type
- Date
-
setDate(feature, options)
-
Center timeline on a date
Parameters:
Name Type Description featureDate | String | ol.feature a date or a feature with a date
optionsObject Properties
Name Type Description animboolean animate scroll
positionstring start, end or middle, default middle
-
setFeatures(features, zoom)
-
Set the features to display in the timeline
Parameters:
Name Type Description featuresArray.<ol.Features> | ol.source.Vector An array of features or a vector source
zoomnumber zoom to draw the line default 1
-
setInterval(length)
-
Set an interval
Parameters:
Name Type Description lengthnumber | string the interval length in ms or a farmatted text ie. end with y, 1d, h, mn, s (31 days = '31d'), default none
-
setMap(map)
-
Set the map instance the control is associated with and add interaction attached to it to this map.
Parameters:
Name Type Description map_ol_Map_ The map instance.
-
toggle()
-
Collapse the line