sveinn-steinarsson / flot-downsample Goto Github PK
View Code? Open in Web Editor NEWDownsample plugin for Flot charts.
Downsample plugin for Flot charts.
A small suggestion: the calculation of the triangular area could be changed to a calculation of a rectangular area and thus get rid of the *.5 ( or division by 2), since the size of the area is only used to compare...
Hello! I just wanted to let you know that I've written an implementation in R, in case it is of interest. I don't know JavaScript, so this was mostly based on the description in your thesis, but it appears to be working correctly.
I don't suppose you have a test data set for validating alternate implementations?
The resulting path seems to jump a little bit around when changing threshold, probably because different points get picked each time.
Here is a slightly different take on the same, using Visvalingam’s algorithm. Here there is less volatility, as the points are in specific order based on information content. Not sure if it's correctly implemented or even whether it's better or worse:
http://bl.ocks.org/ZJONSSON/raw/5581551/
code: https://gist.github.com/ZJONSSON/5581551#file-simplify-js
https://gist.github.com/adrianseeley/264417d295ccd006e7fd
test on sin(x / 2) 100 points, normalized, downsampled to 10 points
I think it will be better to have Downsample disabled by default (threshold set to 0 in initial options), to not affect all plots (especially pie charts), which might be created without any knowledge about this plugin.
IMHO it's better if developer intentionally turns on this functionality on specified charts.
Thanks for the great plugin! I'm receiving a strange error only on iPhone 6 devices, the same exact code works perfectly on earlier iPhone devices: TypeError: undefined is not an object (evaluating 'data[ range_offs ][ 1 ]')
on line 82. I can provide more detailed information if needed. The logic is a bit confusing, but it doesn't seem like your code is using anything 'special' that would change between iPhone versions. Maybe their implementation of floor changed?
Hello,
I wanted to use this algorithm in a C++ project, but couldn't find an existing source. I uploaded it here, if you're interested in adding it to your list:
https://github.com/parkertomatoes/lttb-cpp/
Thanks
Many plotting libraries support having a null with a timestamp to break a trend. (Leaving a gap, preventing interpolation)
Imagine you have time series data and its divided in three buckets:
values dates
1 2021-11...
2 2021-11...
5 2021-11...
2 2021-11...
null 2021-11...
5 2021-11...
6 2021-11...
2 2021-11...
7 2021-11...
I can think of two ways on how to handle this but I'm not sure what would be ideal:
Any thoughts?
In some situations (in IE) flot-downsample will show errors at this line.
avg_x += data[ avg_range_start ][ 0 ] * 1;
The error is: Unable to get property '0' of undefined or null reference.
I have tested on Firefox and Chrome, but errors appear only on IE.
Any thoughts?
Nice plugin, but has one disadvantage. According to Flot documentation, null value passed as one of points means that surrounding points should not be connected. Downsample seems to do not support it (error in javascript).
Hi,
I translated your LTTB algorithm for Dart (So that people can use it in flutter as well).
https://github.com/bnap00/dart-lttb
It is available on pub.dev as well. Thanks for your work!
Hi,
I created a (modified) LTTB port for Python (C-Extension core) due to performance.
https://github.com/dgoeries/lttbc
It is available on PyPI as well (lttbc). Thanks for your work!
Hey,
I've converted this plugin to work with Chart.js: https://github.com/AlbinoDrought/chartjs-plugin-downsample
Was looking for something like this but couldn't find one, so I ended up cobbling some stuff together.
It's available on npm as chartjs-plugin-downsample
Thanks for the great implementation!
Hi, this looks interesting. How you already got any metrics to show Flot's performance is enhanced using this plugin? It's pretty fast already.
Or are there other reasons for using it? E.g. better aesthetics or other?
I'd look into it more but am travelling with work, plus you might have this information already.
Thanks, Adrian
Hello, I've written a port of the algorithm in python : https://github.com/devoxi/lttb-py
Let me know if you need that I change something in my readme about your work.
Not a major bug but figured I should at least document incase anyone else encounters. If the data array is not already ordered flot by itself still plots the line chart correctly. The plugin however does some crazy things with my data if the order of the data does not match the x axis order.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.