1.4.0 • Published 7 years ago

averaged-timeseries v1.4.0

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

This is a tiny in memory non persistent database library. It is made for aggregating timeseries data and storing it as averages/sums. Example usage:

See index.spec.js for more examples.

API

index

In memory timeseries database with averaged/summed values to reduce performance footprint

Parameters

  • options object? Options object, can be left as blank to use defaults, see index.spec.js for details
    • options.maxEntries number? how many entries to store in the timeseries, defaults to 3600
    • options.entriesPerSecond number? how many times a second to move the timeseries, default 1, can be less than 1 for slower updates
    • options.mergeMode string? how to merge multiple entries in one tick, default is "average"
    • options.data object? starting data for timeSeries, defaults to {}
  • log function? Logging function, can be left as undefined for no logging

Returns object timeSeries

Meta

  • author: Daniel Vestøl
  • license: MIT

add

Adds timeseries data to a collection

Parameters

Examples

let series = new timeSeries();
series.add({
  key: "apples",
  value: 3,
});

get

Retrieves timeseries data

Parameters

  • datapoints number the number of datapoints to retrieve, has to be less than size of collection
  • key string name of collection to retrieve

Returns array of objects like {key: "string", value: number}

clear

Clears all data

Examples

new timeSeries().clear()
1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago