You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,20 +16,27 @@ There is a very minimal interactive demo app available if you want to play aroun
16
16
npm install downsample
17
17
```
18
18
19
+
## Acknowledgement
20
+
21
+
The implementation is based on Sveinn Steinarsson's 2013 paper _Downsampling Time Series for
22
+
Visual Representation_ that can be found [here](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf).
23
+
19
24
## Usage
20
25
21
-
Two downsampling methods are currently supported, description of both can be found [here](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf):
26
+
Three downsampling methods are currently supported, description of all three can be found [here](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf):
22
27
23
28
- Largest triangle three buckets (LTTB)
24
29
- Largest triangle one bucket (LTOB)
30
+
- Largest triangle dynamic (LTD)
25
31
26
32
Downsampling a series of data points using either of these looks like this:
27
33
28
34
```typescript
29
35
// ES6
30
-
import { LTOB, LTTB } from"downsample";
36
+
import { LTD, LTOB, LTTB } from"downsample";
31
37
32
38
// Or old school
39
+
var LTD =require("downsample").LTD;
33
40
var LTOB =require("downsample").LTOB;
34
41
var LTTB =require("downsample").LTTB;
35
42
@@ -92,3 +99,14 @@ otherwise the results will be unpredictable.
92
99
`desiredLength: number` is the length of the downsampled array.
93
100
94
101
This function will throw an error if the `desiredLength` is negative.
Implementation of `Largest triangle dynamic` downsampling method. Especially good for unevenly sampled data, for evenly spaced data `LTTB` should produce better results.
106
+
107
+
`data: DataPoint[]` is the input array. This array should be sorted by the independent variable
108
+
otherwise the results will be unpredictable.
109
+
110
+
`desiredLength: number` is the length of the downsampled array.
111
+
112
+
This function will throw an error if the `desiredLength` is negative.
0 commit comments