leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.75k stars 383 forks source link

WebGL #282

Closed sirinath closed 4 years ago

sirinath commented 4 years ago

Though not by default is it possible to be able to use WebGL when needed for large datasets.

leeoniya commented 4 years ago

what do you consider "large"?

are you having performance issues without WebGL?

sirinath commented 4 years ago

I am still not using uPlot but evaluating to use it. I am very impressed by the performance characteristics compared with the other libraries. Though following implies that the limitation of uPlot since it does not use WebGL or WASM which only effects startup time:

However, if you're looking for true real-time 60fps performance with massive datasets, uPlot can only get you so far. WebGL should still be the tool of choice for applications like realtime signal or waveform visualizations

I am looking to be able to plot real-time high-frequency data. Total data size may be about 200+ Gb per day through only a subset will be plotted spanning multiple days.

leeoniya commented 4 years ago

is pumping a raw 200gb worth of HFT data to a web browser a thing that people do? this seems like it would not be a great idea in any scenario, WebGL or otherwise.

i'm rather curious how a human operator of a financial dashboard can even react to a raw stream like this if it's not somehow pre-aggregated first to something like 100ms buckets - human reaction time is ~200ms on a good day.

to answer your question directly, webgl would be a completely different architecture, and not something that can just be swapped-in. there are some libs which do provide a Canvas2D-like api facade over webgl (two.js, pixi.js), but i imagine these solutions would not extract the max webgl performance possible compared to purpose-built vertex and fragment shaders.

i would recommend looking elsewhere if you need to render a consistent update stream (presumably over a websocket?) at more than 10hz and have more than a few thousand points displayed at once in such a setup.

sirinath commented 4 years ago

You would not get all of 200gb for analysis only a subset. Also, data will be aggregated to bars.

Out of available charting libraries what would be the best? Would Plotly or ECharts be a good fit? Also, how does mapd-charting and mapd3 stack up?

leeoniya commented 4 years ago

You would not get all of 200gb for analysis only a subset. Also, data will be aggregated to bars.

ultimately what matters is how many shapes or vertices you're rendering to the screen and how often you're updating that data. if you're rendering a few hundred aggregated bars to the chart and updating them every 100ms or 200ms, then uPlot will easily handle this, as will some of the other fast charting libs in the uPlot bench.

Out of available charting libraries what would be the best?

this is an impossible question for me to answer with the info you've provided. uPlot will most likely be smallest and fastest, but it also has very sparse documentation and requires a decent level of JavaScript and webdev proficiency to really take full advantage of.

Would Plotly or ECharts be a good fit?

both libraries are part of the uPlot bench, so i'll let the numbers speak for themselves.

https://github.com/leeoniya/uPlot#performance

Also, how does mapd-charting and mapd3 stack up?

both libraries are d3-based, which uses SVG for rendering. SVG is considerably slower for paths or shapes with more than a a couple hundred vertices (compared to Canvas2D or WebGL).