Select Page
Latest 0.2.0 https://github.com/GuillaumeBeal/LTTB MIT ios 8.0 Foundation Guillaume Béal

# LTTB (Largest Triangle Three Buckets)

[](https://travis-ci.org/Guillaume Béal/LTTB)

## 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

``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)]``

## Author

Guillaume Béal

### Latest podspec

```{
"name": "LTTB",
"version": "0.2.0",
"summary": "Largest Triangle Three Buckets downsampling algorithm in Swift.",
"description": "Largest Triangle Three Buckets downsampling algorithm in Swift.nnOriginal version by Sveinn Steinarsson(https://github.com/sveinn-steinarsson/highcharts-downsample)nnAuthor : Guillaume BealnnThe visualization isnu2019t meant to give you access to the individual values of tens of thousands of data points on a line, itu2019s meant to show you how that data looks and is trending over time."(http://blackops.io/blog/2014/05/time-series-graphs-and-downsampling/)nThis algorithm shrinks a timeserie and keeps the visual apsect of the serie.nnPre-process your time serie with LTTB in order to display a thousands of points on a Graph.nnWorks well with Charts API https://github.com/danielgindi/Charts",
"homepage": "https://github.com/GuillaumeBeal/LTTB",
"type": "MIT",
},
"authors": {
"Guillaume Beu0301al": "[email protected]"
},
"source": {
"git": "https://github.com/GuillaumeBeal/LTTB.git",
"tag": "0.2.0"
},
"platforms": {
"ios": "8.0"
},
"source_files": "LTTB/Classes/**/*",
"frameworks": "Foundation"
}```