meteoJS/timeline/visualisation . Visualisation
Source: timeline/
Object to visualise module:meteoJS/timeline.Timeline
.
How to create your own visualisation object:
- Inherit this object
- Inherit method onChangeTime()
- Inherit method onChangeTimes()
- Inherit method emptyNode()
- Inherit method onInitNode()
- To get all times to display use getTimelineTimes()
- Use method timeToText() to convert a Date to String.
- Use method attachEventListener() to attach event listeners on a object. The event listener will be deleted automatically if the output is muted.
- At the end of the constructor call "this.setNode(this.options.node);".
import Visualisation from 'meteojs/timeline/Visualisation';
new Visualisation(options)
Parameter
Name | Type | Optional | Description |
---|---|---|---|
options |
|
|
Options. |
Methods
attachEventListener(obj, listener, func[, thisArg])
Attach an event listener on an object. Object could be a jQuery-object or
an object using module:meteoJS/events
.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
obj |
Object |
|
Object to put the event listener on. |
listener |
mixed |
|
Event listener key. |
func |
function() |
|
Function to be executed when event is triggered. |
thisArg |
Object |
Yes |
This in the function func when event triggered. |
emptyNode()
Called to empty the output node. Mainly if the output is muted. Prerequisite: this.options.node must be defined.
getOutputTimezone() → (string or undefined)
Gets current value of output timezone.
- Returns
-
(string or undefined)
Output timezone.
getTimelineTimes() → Array of Date
Returns the times to display. This could be either all times in the timeline or only the enabled times or the all enabled times. The user of the visualisation object select this by the options.
- Returns
-
Array of Date
Times.
onChangeTime()
Called if the timeline triggers the
module:meteoJS/timeline#change:time
event.
Prerequisite: this.options.node must be defined.
onChangeTimes()
Called if the timeline triggers the module:meteoJS/timeline#change:times
or module:meteoJS/timeline#change:enabledTimes
event.
Prerequisite: this.options.node must be defined.
onInitNode(isListenersDefined)
Called once an output node is set. Prerequisite: this.options.node must be defined.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
isListenersDefined |
boolean |
|
True if the event listeners are already set. |
setNode(node) → module:meteoJS/timeline/visualisation.Visualisation
Sets jQuery-Node for output.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
node |
(external:jQuery or undefined) |
|
Node, undefined to mute the output. |
- Returns
setOutputTimezone(outputTimezone) → module:meteoJS/timeline/visualisation.Visualisation
Sets output timezone, undefined for UTC.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
outputTimezone |
(string or undefined) |
|
Timezone for datetime output. |
- Returns
timeToText(time, format) → string
Converts a Date-object to a string.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
time |
Date |
|
Time. |
format |
string |
|
Format string, passed to the . |
- Returns
-
string
String.