Class: Timeline

ol.control. Timeline


new Timeline( [options])

Timeline control

Parameters:
Name Type Argument Description
options Object <optional>

Control options.

Properties
Name Type Description
className String

class of the control

features Array.<ol.Feature>

Features to show in the timeline

source ol.SourceImageOptions.vector

class of the control

interval Number

time interval length in ms or a text with a format d, h, mn, s (31 days = '31d'), default none

maxWidth String

width of the time line in px, default 2000px

minDate String

minimum date

maxDate String

maximum date

minZoom Number

Minimum zoom for the line, default .2

maxZoom Number

Maximum zoom for the line, default 4

zoomButton boolean

Are zoom buttons avaliable, default false

getHTML function

a function that takes a feature and returns the html to display

getFeatureDate function

a function that takes a feature and returns its date, default the date propertie

endFeatureDate function

a function that takes a feature and returns its end date, default no end date

graduation String

day|month to show month or day graduation, default show only years

scrollTimeout String

Time in milliseconds to get a scroll event, default 15ms

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)

Get the date of the center

Parameters:
Name Type Description
position string

start, end or middle, default middle

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


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