Giter Site home page Giter Site logo

lttb's Introduction

lttb - Largest-Triangle-Three-Buckets (Ruby)

This is an implementation of the Largest-Triangle-Three-Buckets (LTTB) downsampling algorithm in Ruby.

The code has been translated from the work of Sveinn Steinarsson in his plugin for Flot charts. More information is available on his page, and you can find the thesis describing the algorithm here.

Installation

Add this line to your application's Gemfile:

gem 'lttb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lttb

Usage

Data passed should be in the format [[x1,y1],[x2,y2]].

  data = [[1, 1], [2, 4], [3, 9], [4, 16], [5, 25]]
  threshold = 3
  Lttb.process(data, threshold)
  # => [1, 1], [3, 9], [5, 25]]

Pass :dates => true to process DateTime objects correctly.

  Lttb.process(data, threshold, dates: true)

Known limitations

Does not support gaps (null values) in the data array. X-values must be in a strictly increasing order.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Jubke/lttb.

License

The gem is available as open source under the terms of the MIT License.

lttb's People

Contributors

jubke avatar

Stargazers

Jônatas Davi Paganini avatar  avatar Daniel Ravina avatar Jacopo Beschi avatar Harris Novick avatar Dante Haskell Elrik avatar Sveinn avatar

Watchers

James Cloos avatar

Forkers

aytanleibowitz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.