class anychart.charts.Timeline Improve this Doc
Extends: anychart.core.SeparateChart
Timeline chart class.
Methods Overview
Specific settings | |
fit() | Fits chart horizontally by resetting zoom and vertical translation. |
getType() | Returns chart type. |
scroll() | Scroll settings. |
scroller() | Scroller settings. |
zoomTo() | Zooms into given dates. |
Axes and Scales | |
axis() | Axis settings. |
lineMarker() | Getter for the line marker. |
rangeMarker() | Range marker settings. |
scale() | Scale settings. |
textMarker() | Text marker settings. |
todayMarker() | Getter for the today marker. |
Data | |
data() | Data settings. |
Events | |
listen() | Adds an event listener. |
listenOnce() | Adds a single time event listener |
removeAllListeners() | Removes all listeners. |
unlisten() | Removes the listener |
unlistenByKey() | Removes the listener by the key. |
Series | |
moment() | Adds Moment series. |
range() | Adds Range series. |
Specific Series Settings | |
addSeries() | Adds series to the chart. |
defaultSeriesType() | Default series type. |
getSeries() | Returns series by id. |
getSeriesAt() | Returns series by index. |
getSeriesCount() | Returns series count. |
removeAllSeries() | Removes all series from chart. |
removeSeries() | Removes one of series from chart by its id. |
removeSeriesAt() | Removes one of series from chart by its index. |
Miscellaneous | |
interactivity() | Chart interactivity settings. |
Methods Description
addSeries
Params:
Name | Type | Description |
---|---|---|
var_args | anychart.data.View | anychart.data.Set | Array | Chart series data. |
Returns:
Array.<anychart.core.timeline.series.Base> - Array of created series.axis
Returns:
anychart.core.axes.Timeline - Axis settings.Params:
Name | Type | Description |
---|---|---|
value | Object | Timeline axis settings. |
Returns:
anychart.charts.Timeline - Self instance for method chainingdata
Returns:
anychart.data.View - Data view.Learn more about mapping at anychart.data.Mapping.
Params:
Name | Type | Description |
---|---|---|
data | anychart.data.View | anychart.data.Mapping | anychart.data.Set | anychart.data.DataSettings | Array | Data for the chart. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.defaultSeriesType
Returns:
anychart.enums.TimelineSeriesType | string - Default series type.Try it:
Params:
Name | Type | Description |
---|---|---|
type | anychart.enums.TimelineSeriesType | string | Default series type. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.Try it:
fit
Returns:
anychart.charts.Timeline - Self instance for method chainingTry it:
getSeries
Params:
Name | Type | Default | Description |
---|---|---|---|
id | number | string | index | Id of the series. |
Returns:
anychart.core.timeline.series.Base - An instance of the created series.getSeriesAt
Params:
Name | Type | Description |
---|---|---|
index | number | Index of the series. |
Returns:
anychart.core.timeline.series.Base - An instance of the class for method chaining.getSeriesCount
Returns:
number - Number of series.getType
interactivity
Returns:
anychart.core.utils.Interactivity -Params:
Name | Type | Description |
---|---|---|
value | Object | Interactivity settings. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.lineMarker
Params:
Name | Type | Default | Description |
---|---|---|---|
index | number | 0 | Line marker index. If not set - creates a new instance and adds it to the end of array. |
Returns:
anychart.core.axisMarkers.Line - Line marker instance by index.Try it:
- null/boolean - disable or enable line marker.
- object - sets line marker settings.
Params:
Name | Type | Description |
---|---|---|
value | Object | boolean | null | Line marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.- null/boolean - disable or enable line marker by index.
- object - sets line marker settings by index.
Params:
Name | Type | Description |
---|---|---|
index | number | Line marker index. |
value | Object | boolean | null | Line marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.listen
Note: Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function(e:Object) | Callback method.
Function that looks like: function(event){ // event.actualTarget - actual event target // event.currentTarget - current event target // event.iterator - event iterator // event.originalEvent - original event // event.point - event point // event.pointIndex - event point index } | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
listenOnce
If the event handler being added already exists, listenOnce will do nothing.
Note: In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function(e:Object) | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
moment
Params:
Name | Type | Description |
---|---|---|
data | anychart.data.View | anychart.data.Set | Array | string | Data for the series. |
csvSettings | anychart.enums.TextParsingMode | string | anychart.data.TextParsingSettings | If CSV string is passed, you can pass CSV parser settings here as a hash map. |
Returns:
anychart.core.timeline.series.Moment - Created series.Try it:
range
Params:
Name | Type | Description |
---|---|---|
data | anychart.data.View | anychart.data.Set | Array | string | Data for the series. |
csvSettings | anychart.enums.TextParsingMode | string | anychart.data.TextParsingSettings | If CSV string is passed, you can pass CSV parser settings here as a hash map. |
Returns:
anychart.core.timeline.series.Range - Created series.Try it:
rangeMarker
Params:
Name | Type | Description |
---|---|---|
index | number | Range marker index. |
Returns:
anychart.core.axisMarkers.Range - Range marker instance by index.Try it:
- null/boolean - disable or enable range marker.
- object - sets range marker settings.
Params:
Name | Type | Description |
---|---|---|
value | Object | boolean | null | Range marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.- null/boolean - disable or enable range marker by index.
- object - sets range marker settings by index.
Params:
Name | Type | Description |
---|---|---|
index | number | Range marker index. |
value | Object | boolean | null | Range marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.removeAllListeners
Params:
Name | Type | Description |
---|---|---|
type | string | Type of event to remove, default is to remove all types. |
Returns:
number - Number of listeners removed.Try it:
removeAllSeries
Returns:
anychart.charts.Timeline - Self instance for method chaining.removeSeries
Params:
Name | Type | Description |
---|---|---|
id | number | string | Series id. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.removeSeriesAt
Params:
Name | Type | Description |
---|---|---|
index | number | Series index. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.scale
Returns:
anychart.scales.GanttDateTime - Default chart scale value.Try it:
Params:
Name | Type | Description |
---|---|---|
value | Object | Scale configuration. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.Try it:
scroll
Returns:
number - Scroll value.- -1 - scroll up and show part of the chart above axis.
- 0 - center chart at axis level.
- 1 - scroll down and show part of the chart under the axis.
Params:
Name | Type | Description |
---|---|---|
value | number | Scroll value. |
Returns:
anychart.charts.Timeline - Self instance for method chainingscroller
Returns:
anychart.core.ui.ChartScroller - Scroller settings.Params:
Name | Type | Description |
---|---|---|
value | Object | boolean | null | Chart scroller settings. |
Returns:
anychart.charts.Timeline - Self instance for method chainingtextMarker
Params:
Name | Type | Description |
---|---|---|
index | number | Text marker index. |
Returns:
anychart.core.axisMarkers.Text - Text marker instance by index.Try it:
- null/boolean - disable or enable text marker.
- object - sets text marker settings.
Params:
Name | Type | Description |
---|---|---|
value | Object | boolean | null | Text marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.- null/boolean - disable or enable text marker by index.
- object - sets text marker settings by index.
Params:
Name | Type | Description |
---|---|---|
index | number | Text marker index. |
value | Object | boolean | null | Text marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.todayMarker
Returns:
anychart.core.axisMarkers.Line - Line marker instance by index.Try it:
- null/boolean - disable or enable today marker.
- object - sets today marker settings.
Params:
Name | Type | Description |
---|---|---|
value | Object | boolean | null | Line marker settings to set. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.unlisten
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function(e:Object) | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
boolean - Whether any listener was removed.Try it:
unlistenByKey
Params:
Name | Type | Description |
---|---|---|
key | Object | The key returned by listen() or listenOnce(). |
Returns:
boolean - Whether any listener was removed.Try it:
zoomTo
Params:
Name | Type | Description |
---|---|---|
startDate | string | number | Date | Start date. |
endDate | string | number | Date | End date. |
Returns:
anychart.charts.Timeline - Self instance for method chaining.Try it: