@welldot/utils

downsampleLoggerReadings

Reduces a series for plotting, keeping its extremes.

downsampleLoggerReadings(readings, maxPoints): LoggerReading

Reduces a series for plotting, keeping its extremes.

The first and last readings are kept and the readings between them are split into buckets, each keeping its lowest and highest depth. The result has at most maxPoints readings, in time order. A series already within maxPoints is returned unchanged (same array).

Parameters

readings

LoggerReading

maxPoints

number

Returns

LoggerReading