webit / downsampling
Downsampling algorithms
Installs: 26 765
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^7.5.20
This package is auto-updated.
Last update: 2024-11-24 15:35:33 UTC
README
A simple interface for Downsampling algorithms
Installation
via Composer
Add the webit/downsampling into composer.json
{ "require": { "php": ">=7.1", "webit/downsampling": "^2.0.0" } }
Usage
use Webit\DownSampling\DownSampler\LargestTriangleThreeBucketsDownSampler; $data = array(); for ($i=0; $i < 500; $i++) { $data[] = [$i, mt_rand(0, 200)]; } $sampler = new LargestTriangleThreeBucketsDownSampler(); $sampled = $sampler->sampleDown($data, 100); echo count($sampled); // displays 100
Algorithms provided
- Largest-Triangle-Three-Buckets or LTTB (PHP port of flot-downsample, see: https://github.com/sveinn-steinarsson/flot-downsample)