0.0.6 • Published 3 years ago

downsample-lttb-ts v0.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

array-downsample: Downsample array of numbers

This is a downsample of numbers function taken from the "Largest-Triangle-Three-Buckets or LTTB" algorithm designed by Sveinn Steinarsson. Adapted to typescript and dropping the need to use points in a future.

Instructions

Install with

npm i downsample-lttb-ts

or

yarn add downsample-lttb-ts

Usage example

import { downsample } from 'downsample-lttb-ts';

//provide a series as an array of [x,y] pairs
const dummyDataSeries = [[1,2],[2,2],[3,3],[4,3],[5,6],[6,3],[7,3],[8,5],[9,4],[10,4],[11,1],[12,2]];

//pass the series and number of desired datapoints
const downsampledSeries = downsample({series:dummyDataSeries, threshold:3});

console.log(downsampledSeries);	
//outputs [ [ 1, 2 ], [ 5, 6 ], [ 12, 2 ] ]
0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago