Home Identifier Source
import {TimeSeries} from '@esnet/pond/src/series.js'
public class | source

TimeSeries

Extends:

Series → TimeSeries

A TimeSeries is a a Series where each event is an association of a timestamp and some associated data.

Data passed into it may have the following format, which corresponds to InfluxDB's wire format:

{ "name": "traffic", "columns": ["time", "value", ...], "points": [ [1400425947000, 52, ...], [1400425948000, 18, ...], [1400425949000, 26, ...], [1400425950000, 93, ...], ... ] }

Alternatively, the TimeSeries may be constructed from a list of Events.

Internaly the above series is represented as two lists, one of times and one of data associated with those times. The position in the list links them together. For each position, therefore, you have a time and an event:

'time' --> Event

The time may be of several forms:

  • a time
  • an index (which represents a timerange)
  • a timerange

The event itself is stored is an Immutable Map. Requesting a particular position in the list will return an Event that will in fact internally reference the Immutable Map within the series, making it efficient to get back items within the TimeSeries.

You can fetch the full item at index n using get(n).

The timerange associated with a TimeSeries is simply the bounds of the events within it (i.e. the min and max times).

Static Method Summary

Static Public Methods
public static

equal(series1: *, series2: *): *

public static

is(series1: *, series2: *): *

Constructor Summary

Public Constructor
public

constructor(arg1: *)

Method Summary

Public Methods
public

at(i: *): *

Access the series data via index.

public

begin(): Date

Gets the earliest time represented in the TimeSeries.

public

bisect(t: *, b: *): *

Finds the index that is just less than the time t supplied.

public

end(): Date

Gets the latest time represented in the TimeSeries.

public

* events()

Generator to allow for..of loops over series.events()

public

index(): *

Access the Index, if this TimeSeries has one

public
public
public

isUTC(): *

Is the data in UTC or Local?

public

From the range of times, or Indexes within the TimeSeries, return

public

slice(begin: *, end: *): *

Perform a slice of events within the TimeSeries, returns a new

public

From the range of times, or Indexes within the TimeSeries, return

public

toJSON(): *

Turn the TimeSeries into regular javascript objects

public

toString(): *

Represent the TimeSeries as a string

Inherited Summary

From class Series
public static

equal(series1: *, series2: *): *

public static

is(series1: *, series2: *): *

public

at(i: *): number

Returns the number of rows in the series.

public

avg(column: *): *

public

Return the list of columns

public

Returns the number of rows in the series.

public

max(column: *): *

public

mean(column: *): *

public

medium(column: *): *

public

meta(key: *): *

Return the meta data associated with the Series.

public

min(column: *): *

public

Returns the same of the series

public

Returns the number of rows in the series.

public

stdev(column: *): *

public

sum(column: *): *

public

Returns a JSON representation, the same format as accepted by the

public

Return a string representation of the Series.

Static Public Methods

public static equal(series1: *, series2: *): * source

Override:

Series#equal

Params:

NameTypeAttributeDescription
series1 *
series2 *

Return:

*

public static is(series1: *, series2: *): * source

Override:

Series#is

Params:

NameTypeAttributeDescription
series1 *
series2 *

Return:

*

Public Constructors

public constructor(arg1: *) source

Override:

Series#constructor

Params:

NameTypeAttributeDescription
arg1 *

Public Methods

public at(i: *): * source

Access the series data via index. The result is an Event.

Override:

Series#at

Params:

NameTypeAttributeDescription
i *

Return:

*

public begin(): Date source

Gets the earliest time represented in the TimeSeries.

Return:

Date

Begin time

public bisect(t: *, b: *): * source

Finds the index that is just less than the time t supplied. In other words every event at the returned index or less has a time before the supplied t, and every sample after the index has a time later than the supplied t.

Optionally supply a begin index to start searching from.

Params:

NameTypeAttributeDescription
t *
b *

Return:

*

public end(): Date source

Gets the latest time represented in the TimeSeries.

Return:

Date

End time

public * events() source

Generator to allow for..of loops over series.events()

public index(): * source

Access the Index, if this TimeSeries has one

Return:

*

public indexAsRange(): * source

Return:

*

public indexAsString(): * source

Return:

*

public isUTC(): * source

Is the data in UTC or Local?

Return:

*

public range(): TimeRange source

From the range of times, or Indexes within the TimeSeries, return the extents of the TimeSeries as a TimeRange.

Return:

TimeRange

The extents of the TimeSeries

public slice(begin: *, end: *): * source

Perform a slice of events within the TimeSeries, returns a new TimeSeries representing a portion of this TimeSeries from begin up to but not including end.

Params:

NameTypeAttributeDescription
begin *
end *

Return:

*

public timerange(): TimeRange source

From the range of times, or Indexes within the TimeSeries, return the extents of the TimeSeries as a TimeRange.

Return:

TimeRange

The extents of the TimeSeries

public toJSON(): * source

Turn the TimeSeries into regular javascript objects

Override:

Series#toJSON

Return:

*

public toString(): * source

Represent the TimeSeries as a string

Override:

Series#toString

Return:

*