meteoJS/timeline . Timeline
Source: Timeline.
Class represents a timeline.
On this timeline, you could define different set of times. This is useful for
the usecase 1: You have different data types for different times (like radar
and satellite pictures). Then, the timeline provides a list of all available
times. Each time in each set of times could be enabled or disabled. This
yields to the usecase 2: In a viewer of model charts, you probably want to
show all the times with charts. (Global models normally have a time interval
of 3 hours between charts) But for different parameters, you only provide
charts at a greater interval. E.g. you calculate 24h-precipiation sums only
for 00 UTC. So you can set the times of the 3-hour-interval and only set
the 00 UTC timestamps as enabled. To visualise the timeline use some
child class of the
module:meteoJS/timeline/visualisation.Visualisation
class. To animate
through time steps use the module:meteoJS/timeline/animation.Animation
class.
import Timeline from 'meteojs/Timeline';
Methods
new Timeline([options])
Parameter
Name | Type | Optional | Description |
---|---|---|---|
options |
|
Yes |
Options. |
Methods
add(amount, timeKey) → module:meteoJS/timeline.Timeline
Changes the selected time width adding an amount of "time". If the "new" timestamp is not available, the selected time is not changed.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
amount |
number |
|
"Time"-Amount. |
timeKey |
('years', 'y', 'months', 'M', 'days', 'd', 'hours', 'h', 'minutes', 'm', 'seconds', 's', 'milliseconds', or 'ms') |
|
Period, nomenclature analogue to momentjs. |
- Returns
-
module:meteoJS/timeline.Timeline
- Returns this.
deleteSetID(id) → module:meteoJS/timeline.Timeline
Deletes a set of times.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID of the set of times. |
- Fires
- module:meteoJS/timeline#change:times
- module:meteoJS/timeline#change:enabledTimes
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
first() → module:meteoJS/timeline.Timeline
Set selected time to the first time, which is enabled.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
getAllEnabledTimes() → Array of Date
Returns a list of times. These times are enabled throug every set of times.
- Returns
-
Array of Date
Enabled times, sorted upwardly.
getEnabledTimes() → Array of Date
Returns a list of all enabled timestamps of this timeline.
- Returns
-
Array of Date
All enabled times, sorted upwardly.
getFirstAllEnabledTime() → Date
Returns first time in this timeline, which is enabled by at all sets.
- Returns
-
Date
First time, which is enabled by all sets.
getFirstEnabledTime() → Date
Returns first time in this timeline, which is enabled by at least one set.
- Returns
-
Date
First enabled time, could be invalid.
getLastAllEnabledTime() → Date
Returns last time in this timeline, which is enabled by at all sets.
- Returns
-
Date
Last time, which is enabled by all sets.
getLastEnabledTime() → Date
Returns last time in this timeline, which is enabled by at least one set.
- Returns
-
Date
Last enabled time, could be invalid.
getNextAllEnabledTime() → Date
Returns next time after the selected time, which is enabled by all sets. If selected time is invalid, the last all enabled time is returned.
- Returns
-
Date
Next time, which is enabled by all sets.
getNextEnabledTime() → Date
Returns next time after the selected time, which is enabled by at least one set. If selected time is invalid, the first enabled time is returned.
- Returns
-
Date
Next enabled time.
getPrevAllEnabledTime() → Date
Returns previous time before the selected time, which is enabled by all sets. If selected time is invalid, the first all enabled time is returned.
- Returns
-
Date
Previous time, which is enabled by all sets.
getPrevEnabledTime() → Date
Returns previous time before the selected time, which is enabled by at least one set. If selected time is invalid, the last enabled time is returned.
- Returns
-
Date
Previous enabled time.
getSelectedTime() → Date
Current selected time.
- Returns
-
Date
Selected time, could be invalid.
getSetIDs() → Array of mixed
Returns IDs of all defined sets.
- Returns
-
Array of mixed
IDs.
getTimes() → Array of Date
Returns a list of all timestamps represented by this timeline. This includes on the one hand all timestamps defined by setTimesBySetID, on the other hand there could exists additional timestamps (e.g. through the maxTimeGap option).
- Returns
-
Array of Date
All defined times, sorted upwardly.
isFirstEnabledTime() → boolean
Is the selected time the first enabled time.
- Returns
-
boolean
isLastEnabledTime() → boolean
Is the selected time the last enabled time.
- Returns
-
boolean
isTimeAllEnabled() → boolean
Returns if the passed time is an enabled time.
- Returns
-
boolean
isTimeEnabled() → boolean
Returns if the passed time is an enabled time.
- Returns
-
boolean
last() → module:meteoJS/timeline.Timeline
Set selected time to the last time, which is enabled.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
next() → module:meteoJS/timeline.Timeline
Changes selected time to the next enabled time.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
nextAllEnabledTime() → module:meteoJS/timeline.Timeline
Changes selected time to the next time, which is enabled by all sets.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
prev() → module:meteoJS/timeline.Timeline
Changes selected time to the previous enabled time.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
prevAllEnabledTime() → module:meteoJS/timeline.Timeline
Changes selected time to the previous time, which is enabled by all sets.
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
setEnabledTimesBySetID(id, times) → module:meteoJS/timeline.Timeline
Defines the enbaled times of a set of times. The passed times must be contained in the times of the set (defined earlier by setTimesBySetID).
Parameters
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID of the set of times. |
times |
Array of Date |
|
Times to set enabled (must be sorted upwardly). |
- Fires
- module:meteoJS/timeline#change:enabledTimes
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
setSelectedTime(time) → module:meteoJS/timeline.Timeline
Sets current selected time. You can select a time returned by getTimes only. If this is not the case, an invalid timestamp will be set.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
time |
Date |
|
Time to select. |
- Fires
- module:meteoJS/timeline#change:time
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
setTimesBySetID(id, times) → module:meteoJS/timeline.Timeline
Defines a set of times. Set is identified by an ID. If the set was already defined, the set of times will be overwritten.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID of the set of times. |
times |
Array of Date |
|
Times (must be sorted upwardly). |
- Fires
- module:meteoJS/timeline#change:times
- module:meteoJS/timeline#change:enabledTimes
- Returns
-
module:meteoJS/timeline.Timeline
Returns this.
sub(amount, timeKey) → module:meteoJS/timeline.Timeline
Changes the selected time width subracting an amount of "time". If the "new" timestamp is not available, the selected time is not changed.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
amount |
number |
|
"Time"-Amount. |
timeKey |
('years', 'y', 'months', 'M', 'days', 'd', 'hours', 'h', 'minutes', 'm', 'seconds', 's', 'milliseconds', or 'ms') |
|
Period, nomenclature analogue to momentjs. |
- Returns
-
module:meteoJS/timeline.Timeline
- Returns this.