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 className
string className
title html
Element | string Content of the element
click
function a function called when the button is clicked
-
collapse(b)
-
Collapse the line
Parameters:
Name Type Description b
boolean -
getDate(position, stick)
-
Get the date of the center
Parameters:
Name Type Description position
string position to get 'start', 'end' or 'middle', default middle
stick
string 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 zoom
Number 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 d
Date stick
string 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 feature
Date | String | ol.feature a date or a feature with a date
options
Object Properties
Name Type Description anim
boolean animate scroll
position
string start, end or middle, default middle
-
setFeatures(features, zoom)
-
Set the features to display in the timeline
Parameters:
Name Type Description features
Array.<ol.Features> | ol.source.Vector An array of features or a vector source
zoom
number zoom to draw the line default 1
-
setInterval(length)
-
Set an interval
Parameters:
Name Type Description length
number | 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