Skip to content

GuillaumeBeal/LTTB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LTTB (Largest Triangle Three Buckets)

[CI Status](https://travis-ci.org/Guillaume Béal/LTTB) Version License Platform

Largest Triangle Three Buckets

Largest Triangle Three Buckets downsampling algorithm in Swift. Downsample timeseries to display millions of points.

The visualization isn’t meant to give you access to the individual values of tens of thousands of data points on a line, it’s meant to show you how that data looks and is trending over time."(http://blackops.io/blog/2014/05/time-series-graphs-and-downsampling/)

This algorithm shrinks a timeserie and keeps the visual apsect of the serie.

Pre-process your time serie with LTTB in order to display a thousands of points on a Graph.

Works well with Charts API https://github.com/danielgindi/Charts

Example

To run the LTTB downsampler, clone the repo, and run pod install from the LTTB directory first.

Installation

LTTB is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LTTB"

Usage

In case you installed LTTB via CocoaPods you need to import it (add this somewhere at the top of your source code file):

import LTTB
  • Dataset: The array (of tuples) to downsample
  • threshold: The number of element to keep
let lttb = LTTB()
let result = lttb.downSample(dataSet: [(x: Double,y: Double)], threshold: Int)

In any cases the function will return an array of tuples (x: Double,y: Double):

[(x: Double,y: Double)]

Bibliography

License

LTTB is available under the MIT license. See the LICENSE file for more info.

Author

Guillaume Béal

Original version by Sveinn Steinarsson(https://github.com/sveinn-steinarsson/highcharts-downsample)

About

Largest Triangle Three Buckets in Swift 2.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published