AnyChart
API Reference
Still have questions?
Contact support
Top

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

Adds series to the chart.

Params:

NameTypeDescription
var_argsanychart.data.View | anychart.data.Set | ArrayChart series data.

Returns:

Array.<anychart.core.timeline.series.Base> - Array of created series.

axis

Getter for the chart axis.

Returns:

anychart.core.axes.Timeline - Axis settings.
Setter for the chart axis.

Params:

NameTypeDescription
valueObjectTimeline axis settings.

Returns:

anychart.charts.Timeline - Self instance for method chaining

data

Getter for the chart data.

Returns:

anychart.data.View - Data view.
Setter for the chart data.
Learn more about mapping at anychart.data.Mapping.

Params:

NameTypeDescription
dataanychart.data.View | anychart.data.Mapping | anychart.data.Set | anychart.data.DataSettings | ArrayData for the chart.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

defaultSeriesType

Getter for the default series type.

Returns:

anychart.enums.TimelineSeriesType | string - Default series type.
Setter for the series type.

Params:

NameTypeDescription
typeanychart.enums.TimelineSeriesType | stringDefault series type.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

fit

Fits chart horizontally by resetting zoom and vertical translation.

Returns:

anychart.charts.Timeline - Self instance for method chaining

getSeries

Getter for the series by its id.

Params:

NameTypeDefaultDescription
idnumber | string
index
Id of the series.

Returns:

anychart.core.timeline.series.Base - An instance of the created series.

getSeriesAt

Getter for the series by its index.

Params:

NameTypeDescription
indexnumberIndex of the series.

Returns:

anychart.core.timeline.series.Base - An instance of the class for method chaining.

getSeriesCount

Returns series count.

Returns:

number - Number of series.

getType

Returns chart type.

Returns:

string - Chart type.

interactivity

Get chart interactivity settings.
Set chart interactivity settings.

Params:

NameTypeDescription
valueObjectInteractivity settings.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

lineMarker

Getter for the line marker.

Params:

NameTypeDefaultDescription
indexnumber
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.
Setter for the line marker.

Params:

NameTypeDescription
valueObject | boolean | nullLine marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.
Setter for the line marker by index.

Params:

NameTypeDescription
indexnumberLine marker index.
valueObject | boolean | nullLine marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(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
}
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

moment

Adds Moment series.

Params:

NameTypeDescription
dataanychart.data.View | anychart.data.Set | Array | stringData for the series.
csvSettingsanychart.enums.TextParsingMode | string | anychart.data.TextParsingSettingsIf CSV string is passed, you can pass CSV parser settings here as a hash map.

Returns:

anychart.core.timeline.series.Moment - Created series.

range

Adds Range series.

Params:

NameTypeDescription
dataanychart.data.View | anychart.data.Set | Array | stringData for the series.
csvSettingsanychart.enums.TextParsingMode | string | anychart.data.TextParsingSettingsIf CSV string is passed, you can pass CSV parser settings here as a hash map.

Returns:

anychart.core.timeline.series.Range - Created series.

rangeMarker

Getter for the range marker.

Params:

NameTypeDescription
indexnumberRange marker index.

Returns:

anychart.core.axisMarkers.Range - Range marker instance by index.
Setter for the range marker.

Params:

NameTypeDescription
valueObject | boolean | nullRange marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.
Setter for the range marker by index.

Params:

NameTypeDescription
indexnumberRange marker index.
valueObject | boolean | nullRange marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

removeAllSeries

Removes all series from chart.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

removeSeries

Removes one of series from chart by its id.

Params:

NameTypeDescription
idnumber | stringSeries id.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

removeSeriesAt

Removes one of series from chart by its index.

Params:

NameTypeDescription
indexnumberSeries index.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

scale

Getter for the chart scale.

Returns:

anychart.scales.GanttDateTime - Default chart scale value.
Setter for the chart scale.

Params:

NameTypeDescription
valueObjectScale configuration.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

scroll

Getter of the scroll value.

Returns:

number - Scroll value.
Setter of the scroll value.

Params:

NameTypeDescription
valuenumberScroll value.

Returns:

anychart.charts.Timeline - Self instance for method chaining

scroller

Getter for the scroller.

Returns:

anychart.core.ui.ChartScroller - Scroller settings.
Setter for the scroller.

Params:

NameTypeDescription
valueObject | boolean | nullChart scroller settings.

Returns:

anychart.charts.Timeline - Self instance for method chaining

textMarker

Getter for the text marker.

Params:

NameTypeDescription
indexnumberText marker index.

Returns:

anychart.core.axisMarkers.Text - Text marker instance by index.
Setter for the text marker.

Params:

NameTypeDescription
valueObject | boolean | nullText marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.
Setter for text marker by index.

Params:

NameTypeDescription
indexnumberText marker index.
valueObject | boolean | nullText marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

todayMarker

Getter for the today marker.

Returns:

anychart.core.axisMarkers.Line - Line marker instance by index.
Setter for the today marker.

Params:

NameTypeDescription
valueObject | boolean | nullLine marker settings to set.

Returns:

anychart.charts.Timeline - Self instance for method chaining.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

zoomTo

Zooms into given dates.

Params:

NameTypeDescription
startDatestring | number | DateStart date.
endDatestring | number | DateEnd date.

Returns:

anychart.charts.Timeline - Self instance for method chaining.