uPlot maintainer here. this looks interesting, i'll do a deeper dive soon :)<p>some notes from a very brief look at the 1M demo:<p>- sampling has a risk of eliminating important peaks, uPlot does not do it, so for apples-to-apples perf comparison you have to turn that off. see <a href="https://github.com/leeoniya/uPlot/pull/1025" rel="nofollow">https://github.com/leeoniya/uPlot/pull/1025</a> for more details on the drawbacks of LTTB<p>- when doing nothing / idle, there is significant cpu being used, while canvas-based solutions will use zero cpu when the chart is not actively being updated (with new data or scale limits). i think this can probably be resolved in the WebGPU case with some additional code that pauses the updates.<p>- creating multiple charts on the same page with GL (e.g. dashboard) has historically been limited by the fact that Chrome is capped at 16 active GL contexts that can be acquired simultaneously. Plotly finally worked around this by using <a href="https://github.com/greggman/virtual-webgl" rel="nofollow">https://github.com/greggman/virtual-webgl</a><p>> data: [[0, 1], [1, 3], [2, 2]]<p>this data format, unfortunately, necessitates the allocation of millions of tiny arrays. i would suggest switching to a columnar data layout.<p>uPlot has a 2M datapoint demo here, if interested: <a href="https://leeoniya.github.io/uPlot/bench/uPlot-10M.html" rel="nofollow">https://leeoniya.github.io/uPlot/bench/uPlot-10M.html</a>
Really appreciate you taking the time to look, Leon - uPlot has been a huge inspiration for proving that browser charts don't have to be slow.<p>Both points are fair:<p>1. LTTB peak elimination - you're right, and that PR is a great reference. For the 1M demo specifically, sampling is on by default to show the "it doesn't choke" story. Users can set sampling: 'none' for apples-to-apples comparison. I should probably add a toggle in the demo UI to make that clearer.<p>2. Idle CPU - good catch. Right now the render loop is probably ticking even when static. That's fixable - should be straightforward to only render on data change or interaction. Will look into it.<p>Would love your deeper dive feedback when you get to it. Always more to learn from someone who's thought about this problem as much as you have.
Blind sampling like this makes it <i>useless</i> for real-world statistics of the kind your users care about.<p>And column-oriented data is a <i>must</i>. Look at Rlang's data frames, pandas, polars, numpy, sql, and even Fortran's matrix layout.<p>Also need specialized expicitly targetable support for Float32Array and Float64Array. Both API and ABI are necessary if you want to displace incumbents.<p>There is huge demand for a good web implementation. This is what it takes.<p>Am interested in collaborating.
Original Flot maintainer here.<p>I once had to deal with many million data points for an application. I ended up mip-mapping them client-side.<p>But regarding sampling, if it's a line chart, you can sample adaptively by checking whether the next point makes a meaningfully visible difference measured in pixels compared to its neighbours. When you tune it correctly, you can drop most points without the difference being noticeable.<p>I didn't find any else doing that at the time, and some people seemed to have trouble accepting it as a viable solution, but if you think about it, it doesn't actually make sense to plot say 1 million points in a line chart 1000 pixels wide. On average that would make 1000 points per pixel.
We routinely face this in the audio world when drawing waveforms. You typically have on the order of 10-100k samples per second, durations of 10s-1000s of seconds, and pixel widths of on the order of 1-10k pixels.<p>Bresenham's is one algorithm historically used to downsample the data, but a lot of contemporary audio software doesn't use that. In Ardour (a cross-platform, libre, open source DAW), we actually compute and store min/max-per-N-samples and use that for plotting (and as the basis for further downsampling.
> In Ardour (a cross-platform, libre, open source DAW), we actually compute and store min/max-per-N-samples and use that for plotting (and as the basis for further downsampling.<p>this is, effectively, what uPlot does, too: <a href="https://github.com/leeoniya/uPlot/issues/1119" rel="nofollow">https://github.com/leeoniya/uPlot/issues/1119</a>
This is a good sampling transform to offer. Call it "co-domain awareness" or something.
> Original Flot maintainer here.<p>I discovered flot during my academic research career circa 2008 and it saved my ass more times than I can count. I just wanted to say thank you for that. I wouldn't be where I am today without your help :)
hey!<p>> But regarding sampling, if it's a line chart, you can sample adaptively by checking whether the next point makes a meaningfully visible difference measured in pixels compared to its neighbours.<p>uPlot basically does this (see sibling comment), so hopefully that's some validation for you :)
Is there any techniques using wavelet decomposition to decimate the high frequency component while retaining peaks? I feel like that's a more principled approach than sampling but I haven't seen any literature on it describing the specific techniques (unless the idea is fundamentally unsound which is not obvious to me).
Interesting idea - I haven't explored wavelet-based approaches but the intuition makes sense: decompose into frequency bands, keep the low-frequency trend, and selectively preserve high-frequency peaks that exceed some threshold.<p>My concern would be computational cost for real-time/streaming use cases. LTTB is O(n) and pretty cache-friendly. Wavelet transforms are more expensive, though maybe a GPU compute shader could make it viable.<p>The other question is whether it's "visually correct" for charting specifically. LTTB optimizes for preserving the visual shape of the line at a given resolution. Wavelet decomposition optimizes for signal reconstruction - not quite the same goal.<p>That said, I'd be curious to experiment. Do you have any papers or implementations in mind? Would make for an interesting alternative sampling mode.
Doesn't FFT depend at least on a "representative" sample of the entire dataset?<p>Sounds like what makes sql joins NP-hard.
I don't. I just remember watching a presentation on it and it always struck me that wavelets are an incredibly powerful and underutilized technique for data reduction while preserving quality in a quantifiable and mathematically justifiable way.<p>I don't have any papers in mind, but I do think that the critique around visual shape vs signal reconstruction may not be accurate given that wavelets are starting to see a lot of adoption in the visual space (at least JPEG2000 is the leading edge in that field). Might also be interesting to use DCT as well. I think these will perform better than LTTB (of course the compute cost is higher but there's also HW acceleration for some of these or will be over time).
This really depends on your problem domain.
> creating multiple charts on the same page with GL (e.g. dashboard) has historically been limited by the fact that Chrome is capped at 16 active GL contexts that can be acquired simultaneously. Plotly finally worked around this by using <a href="https://github.com/greggman/virtual-webgl" rel="nofollow">https://github.com/greggman/virtual-webgl</a><p>Sometimes I like to ponder on the immense amount of engineering effort expended on working around browser limitations.
One small thing I noticed: when you zoom in or out (or change the time span), the y-axis stays the same instead of adapting to the visible data.
Not much to add, but as a very happy uPlot user here - just wanted to say thank you for such an amazing library!!
What I did in a few projects to plot aggregated (resampled) data without loosing peaks was to plot it over an area chart representing the min-max values before aggregating (resampling). It worked pretty well.
I wouldn't spend too much of your time deep diving - it's an AI slop project.
[dead]
If you have tons of datapoints, one cool trick is to do intensity modulation of the graph instead of simple "binary" display. Basically for each pixel you'd count how many datapoints it covers and map that value to color/brightness of that pixel. That way you can visually make out much more detail about the data.<p>In electronics world this is what "digital phosphor" etc does in oscilloscopes, which started out as just emulating analog scopes. Some examples are visible here <a href="https://www.hit.bme.hu/~papay/edu/DSOdisp/gradient.htm" rel="nofollow">https://www.hit.bme.hu/~papay/edu/DSOdisp/gradient.htm</a>
Great suggestion - density mapping is a really effective technique for overplotted data. Instead of drawing 1M points where most overlap, you're essentially rendering a heatmap of point concentration. WebGPU compute shaders would be perfect for this - bin the points into a grid, count per cell, then render intensity. Could even do it in a single pass. I've been thinking about this for scatter plots especially, where you might have clusters that just look like solid blobs at full zoom-out. A density mode would reveal the structure. Added to the ideas list - thanks for the suggestion!
Good idea.<p>Add Lab-comor space for this though, like the color theme solarized-light.<p>Also add options to side-step red-green blindness and blue-yellow blindndess.
That digital phosphor effect is fascinating! As someone who works frequently with DSP and occasionally with analogue signals, it's incredible to see how you can pull out the carrier/modulation just by looking at (effectively) a moving average. It's also interesting to see just how much they have to do behind the scenes to emulate a fairly simple physical effect.
agreed, heatmaps with logarithmic cell intensity are the way to go for massive datasets in things like 10,000-series line charts and scatter plots. you can generally drill downward from these, as needed.
Look at Stephen Few's website and books.<p><a href="http://perceptualedge.com/examples.php" rel="nofollow">http://perceptualedge.com/examples.php</a><p>There is also ggplot, ggplot2 and the Grammar of Graphics by Leland Wilkinson. Sadly, Algebra is so incompatible with Geometry that I found the book beautiful but useless for my problem domains after buying and reading and pondering it.
Update: Pushed some improvements to the candlestick streaming demo based on feedback from this thread.<p>You can now render up to 5 million candles. Just tested it - Achieved 104 FPS with 5M candles streaming at 20 ticks/second.<p>Demo: <a href="https://chartgpu.github.io/ChartGPU/examples/candlestick-streaming/" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/candlestick-str...</a><p>Also fixed from earlier suggestions and feedback as noted before:<p>- Data zoom slider bug has been fixed (no longer snapping to the left or right)
- Idle CPU usage bug (added user controls along with more clarity to 1M point benchmark)<p>13 hours on the front page, 140+ comments and we're incorporating feedback as it comes in.<p>This is why HN is the best place to launch. Thanks everyone :)
Right on time.<p>We’ve been working on a browser-based Link Graph (osint) analysis tool for months now (<a href="https://webvetted.com/workbench" rel="nofollow">https://webvetted.com/workbench</a>). The graph charting tools on the market are pretty basic for the kind of charting we are looking to do (think 1000s of connected/disconnected nodes/edges. Being able to handle 1M points is a dream.<p>This will come in very handy.
That's a cool project! Just checked out the workbench. I should be upfront though: ChartGPU is currently focused on traditional 2D charts (line, bar, scatter, candlestick, etc.), not graph/network visualization with nodes and edges. That said, the WebGPU rendering patterns would translate well to force-directed graphs. The scatter renderer already handles thousands of instanced points - extending that to edges wouldn't be a huge leap architecturally.<p>Is graph visualization something you'd want as part of ChartGPU, or would a separate "GraphGPU" type library make more sense? Curious how you're thinking about it.
Really fantastic work! Can't wait to play around with your library. I did a lot of work on this at a past job long ago and the state of JS tooling was so inadequate at the time we ended up building an in-house Scala visualization library to pre-render charts...<p>More directly relevant, I haven't looked at the D3 internals for a decade, but I wonder if it might be tractable to use your library as a GPU rendering engine. I guess the big question for the future of your project is whether you want to focus on the performance side of certain primitives or expand the library to encompass all the various types of charts/customization that users might want. Probably that would just be a different project entirely/a nightmare, but if feasible even for a subset of D3 you would get infinitely customizable charts "for free." <a href="https://github.com/d3/d3-shape" rel="nofollow">https://github.com/d3/d3-shape</a> might be a place to look.<p>In my past life, the most tedious aspect of building such a tool was how different graph standards and expectations are across different communities (data science, finance, economics, natural sciences, etc). Don't get me started about finance's love for double y-axis charts... You're probably familiar with it, but <a href="https://www.amazon.com/Grammar-Graphics-Statistics-Computing/dp/0387245448" rel="nofollow">https://www.amazon.com/Grammar-Graphics-Statistics-Computing...</a> is fantastic if you continue on your own path chart-wise and you're looking for inspiration.
Thanks - and great question about direction. My current thinking: Focus on performance-first primitives for the core library. The goal is "make fast charts easy" not "make every chart possible." There are already great libraries for infinite customization (D3, Observable Plot) - but they struggle at scale.<p>That said, the ECharts-style declarative API is intentionally designed to be "batteries included" for common cases. So it's a balance: the primitives are fast, but you get sensible defaults for the 80% use case without configuring everything. Double y-axis is a great example - that's on the roadmap because it's so common in finance and IoT dashboards. Same with annotations, reference lines, etc. Haven't read the Grammar of Graphics book but it's been on my list - I'll bump it up. And d3-shape is a great reference for the path generation patterns. Thanks for the pointers!<p>Question: What chart types or customization would be most valuable for your use cases?
Most of my use cases these days are for hobby projects, which I would bucket into the "data science"/"data journalism" category. I think this is the easiest audience to develop for, since people usually don't have any strict disciplinary norms apart from clean and sensible design. I mention double y-axes because in my own past library I stupidly assumed no sensible person would want such a chart -- only to have to rearchitect my rendering engine once I learned it was one of the most popular charts in finance.<p>That is, you're definitely developing the tool in a direction that I and I think most Hacker News readers will appreciate and it sounds like you're already thinking about some of the most common "extravagances" (annotations, reference lines, double y-axis etc). As OP mentioned, I think there's a big need for more performant client-side graph visualization libraries, but that's really a different project. Last I looked, you're still essentially stuck with graphviz prerendering for large enough graphs...
Ha - the double y-axis story is exactly why I want to get it right. Better to build it in properly than bolt it on later.<p>"Data science/data journalism" is a great way to frame the target audience. Clean defaults, sensible design, fast enough that the tool disappears and you just see the data.<p>And yeah, graphviz keeps coming up in this thread - clearly a gap in the ecosystem. Might be a future project, but want to nail the 2D charting story first and foremost.<p>Thanks for the thoughtful feedback - this is exactly the kind of input that shapes the roadmap.
You may enjoy Graphistry (eg, pygraphistry, GraphistryJS), where our users regularly do 1M+ graph elements interactively, such as for event & entity data. Webgl frontend, GPU server backend for layouts too intense for frontend. We have been working on stability over the last year with large-scale rollout users (esp cyber, IT, social, finance, and supply chain), and now working on the next 10X+ of visual scaling. Python version: <a href="https://github.com/graphistry/pygraphistry" rel="nofollow">https://github.com/graphistry/pygraphistry</a> . It includes many of the various tricks mentioned here, like GPU hitmapping, and we helped build various popular libs like apache arrow for making this work end-to-end :)<p>Most recently adding to the family is our open source GFQL graph language & engine layer (cypher on GPUs, including various dataframe & binary format support for fast & easy large data loading), and under the louie.ai umbrella, piloting genAI extensions
Can you please comment about this trust listing? Are we talking the same thing?<a href="https://gridinsoft.com/online-virus-scanner/url/webvetted-com" rel="nofollow">https://gridinsoft.com/online-virus-scanner/url/webvetted-co...</a>
Does Cosmos.gl do what you need? <a href="https://cosmos.gl/?path=/docs/welcome-to-cosmos-gl--docs" rel="nofollow">https://cosmos.gl/?path=/docs/welcome-to-cosmos-gl--docs</a>
Is this an open source Palantir?
Agreed. This is highly, highly useful. Going to integrate this today.
my 2 cents: I'm one of these people that could possibly use your tool. However, the website doesnt give me much info. I'd urge you to add some more pages that showcase the product and what it can do with more detail. Would help capture more people imo.
Update: Patched idle CPU usage while nothing is being rendered.<p>One thing to note: I added a toggle to "Benchmark mode" in the 1M benchmark example - this preserves the benchmark capability while demonstrating efficient idle behavior.<p>Another thing to note: Do not be alarmed when you see the FPS counter display 0 (lol), that is by design :) Frames are rendered efficiently. If there's nothing to render (no dirty frames) nothing is rendered. The chart will still render at full speed when needed, it just doesn't waste cycles rendering the same static image 60 times per second.<p>Blown away by all of you amazing people and your support today :)
If this doesn't work for you on a reasonably recent version of Firefox, you can enable experimental (but in my experience quite stable) WebGPU support in `about:config` by setting `dom.webgpu.enabled` to true.
TimeLine maintainer here. Their demo for live-streamed data [0] in a line plot is surprisingly bad given how slick the rest of it seems. For comparison, this [1] is a comparatively smooth demo of the same goal, but running entirely on the main thread and using the classic "2d" canvas rendering mode.<p>[0]: <a href="https://chartgpu.github.io/ChartGPU/examples/live-streaming/index.html" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/live-streaming/...</a><p>[1]: <a href="https://crisislab-timeline.pages.dev/examples/live-with-plugins/" rel="nofollow">https://crisislab-timeline.pages.dev/examples/live-with-plug...</a>
Bug report: there is something wrong with the slider below the chart in the million-points example:<p><a href="https://chartgpu.github.io/ChartGPU/examples/million-points/index.html" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/million-points/...</a><p>While dragging, the slider does not stay under the cursor, but instead moves by unexpected distances.
Congrats, but 1M is nothing spectacular for apps in finance.<p>Here’s a demo of wip rendering engine we’re working on that boosted our previous capabilities of 10M data points to 100M data points.<p><a href="https://x.com/TapeSurfApp/status/2009654004893339903?s=20" rel="nofollow">https://x.com/TapeSurfApp/status/2009654004893339903?s=20</a>
plot.ly has been able to do WebGL scatter plots with > 10 million points for years. There's a lot of libraries that can do this I think?<p><a href="https://plotly.com/python/performance/" rel="nofollow">https://plotly.com/python/performance/</a>
@huntergemmer - assuming you are the author, curious about your experience using .claude and .cursor, I see sub agents defined under these folders, what percent of your time spent would you say is raw coding vs prompting working on this project? And perhaps any other insights you may have on using these tools to build a library - see your first commit was only 5 days ago.
Nice work!<p>D3fc maintainer here. A few years back we added WebGL support to D3fc (a component library for people building their own charts with D3), allowing it to render 1m+ datapoints:<p><a href="https://blog.scottlogic.com/2020/05/01/rendering-one-million-points-with-d3.html" rel="nofollow">https://blog.scottlogic.com/2020/05/01/rendering-one-million...</a>
Does this support <i>stacked</i> area charts? Like <a href="https://recharts.github.io/en-US/examples/StackedAreaChart/" rel="nofollow">https://recharts.github.io/en-US/examples/StackedAreaChart/</a> ?<p>That's what I'm using now but I gave it too much data and it takes like a minute to render so I'm quite interested in this.
> I kept hitting the same wall: charting libraries that claim to be "fast" but choke past 100K data points<p>Haha, Highcharts is a running joke around my office because of this. Every few years the business will bring in consultants to build some interface for us, and every time we will have to explain to them that highcharts, even with it's turbo mode enabled chokes on our data streams almost immediately.
Quick update: Just shipped a fix for the data zoom slider bug that several of you reported (thanks d--b, azangru, and others).<p>The slider should now track the cursor correctly on macOS. If you tried the million-points demo earlier and the zoom felt off, give it another shot.<p>This is why I love launching on HN - real feedback from people actually trying the demos. Keep it coming! :)
I've always been a bit skeptical of JS charting libs that want to bring the entire data to the client and do the rendering there, vs at least having the <i>option</i> to render image tiles on the server and then stream back tooltips and other interactive elements interactively.<p>However, this is pretty great; there really aren't that many use cases that require more than a million points. You might finally unseat dygraphs as the gold standard in this space.
The API and ABI for this are tricky to get right.
> I've always been a bit skeptical of JS charting libs that want to bring the entire data to the client and do the rendering there<p>The computer on my desk only costs me the electric power to run it, and there's 0 network latency between it and the monitor on which I'm viewing charts. If I am visualizing some data and I want to rapidly iterate on the visualization or interact with it, there's no more ideal place for the data to reside than right there. DDR5 and GPUs will be cheap again, some day.
> render image tiles on the server and then stream back tooltips and other interactive elements interactively.<p>I guess the real draw here is smooth scrolling and zooming, which is hard to do with server-rendered tiles. There's also the case of fully local use, where server rendering doesn't make much sense.
> I've always been a bit skeptical of JS charting libs that want to bring the entire data to the client and do the rendering there, vs at least having the option to render image tiles on the server and then stream back tooltips and other interactive elements interactively.<p>I agree, unfortunately no library I've found supports this. I currently SSR plots to SVG using observable plot and JSDom [0]. This means there is no javascript bundle, but also no interactivity, and observable doesn't have a method to generate a small JS sidecar to add interactivity. I suppose you could progressive enhance, but plot is dozens of kilobytes that I'd frankly rather not send.<p>[0] <a href="https://github.com/boehs/site/blob/master/conf/templating/markdown/widgets/eval.js" rel="nofollow">https://github.com/boehs/site/blob/master/conf/templating/ma...</a>
I’ve had a lot of success rendering svg charts via Airbnb’s visx on top of React Server Components, then sprinkling in interactivity with client components. Worth looking into if you want that balance.<p>It’s more low level than a full charting library, but most of it can run natively on the server with zero config.<p>I’ve always found performance to be kind of a drag with server side dom implementations.
There's no question that it's a huge step up in complexity to wire together such tightly-linked front and backend components, but it is done for things like GIS, where you want data overlays.<p>I think it's just a different mindset; GIS libs like Leaflet kind of assume they're the centerpiece of the app and can dictate a bunch of structure around how things are going to work, whereas charting libs benefit a lot more from "just add me to your webpack bundle and call one function with an array and a div ID, I promise not to cause a bunch of integration pain!"<p>Last time I tried to use it for dashboarding, I found Kibana did extremely aggressive down-sampling to the point that it was averaging out the actual extremes in the data that I needed to see.
Is there a best practice how to stream and plot large signal data (e.g. > 1M data points of multiple sine waves) from a Python backend (e.g. numpy + FastAPI) to frontend?
My current solution is: fetch ADC data, convert the bytes to base64 and embed it to JSON that will be send to the frontend. Frontend reverses this process and plot it to eCharts.
What's the best way to get all those points from a backend into the frontend webgpu compute shader?<p>There doesn't seem to be a communication mechanism that has minimal memcopy or no serialization/deserialization, the security boundary makes this difficult.<p>I have a backend array of 10M i16 points, I want to get this into the frontend (with scale & offset data provided via side channel to the compute shader).<p>As it stands, I currently process on the backend and send the frontend a bitmap or simplified SVG. I'm curious to know about the opposite approach.
Not sure, but I solved a similar problem many years ago, and ended up concluding it was silly to send all the data to the client when the client didn't have the visual resolution to show it anyway. So I sampled it adaptively client-side by precomputing and storing multiple zoom-levels. That way the client-side chart app would get the points and you could zoom in, but you'd only ever retrieve about 1000-2000 points at the time.
That was also my research group's approach.
Yeah I agree, I'd like to get an idea of the order-of-magnitude of difference between the two approaches by trying it out but realistically I don't think there's an easy way to get a i16 raw array into the browser runtime with minimal overhead (WebRTC maybe?)
I'm not so good at English but points are:
- Websocket to send raw point data batch by batch
- Strip the float value to integer if possible or multiple it before sending if it won't exceed Number.Max_Integer or something alike
- The front-end should build wrapper around the received raw data for indexing so that no need to modify the data
- There should be drawing/chart libraries handling the rendering quite well with proper data format with batched data
Apache arrow is great here, basically the reason we wrote the initial js tier is for easier shuttling from cloud GPUs & cloud analytics pipelines to webgl in the browser
I did something similar for syncing 10m particles in a sim for a multiplayer test. The gist is that at a certain scale it is cheaper to send a frame buffer but the scale needs to be massive.<p>For this, compression/quantize numbers and then pass that directly to the gpu after it comes off the network. Have a compute shader on the gpu decompress before writing to a frame buffer. This is what high performance lidar streaming renderers do as lidar data is packed efficiently for transport.
I just rewrote all the graphs on phrasing [1] to webgl. Mostly because I wanted custom graphs that didn’t look like graphs, but also because I wanted to be able to animate several tens of thousands of metrics at a time.<p>After the initial setup and learning curve, it was actually very easy. All in all, way <i>less</i> complicated than all the performance hacks I had to do to get 0.01% of the data to render half as smooth using d3.<p>Although this looks next level. I make sure all the computation happens in a single o(n) loop but the main loop still takes place on the cpu. Very well done<p>To anyone on the fence, GPU charting seemed crazy to me beforehand (classic overengineering) but it ends up being much simpler (and much much <i>much</i> smoother) than traditional charts!<p>[1] <a href="https://phrasing.app" rel="nofollow">https://phrasing.app</a>
Nice to see WebGPU experiments in data visualization field. But the description is certainly misleading.<p>All the optimizations mentioned except LTTB downsampling in compute shaders can be done in WebGL.<p>Web charts with > 1 M points and 60 FPS zooming/panning have been available since 2019. For example, here's a line chart with 100M points (100x more): <a href="https://lightningchart.com/lightningchart-js-demos/100M/" rel="nofollow">https://lightningchart.com/lightningchart-js-demos/100M/</a><p>But still, love to see it. WebGPU will surely go forward slowly as these things naturally do, but practical experimentation is essential.
Very cool. Shame there's not a webgl fallback though. It will be a couple of years until webgpu adoption is good enough.<p><a href="https://caniuse.com/webgpu" rel="nofollow">https://caniuse.com/webgpu</a>
WebGL punts to WebGPU for decent compute shaders.
And even if WebGPU is enabled, the implementation might still be broken or inefficient in various ways. For example, Firefox uses some ridiculous polling-based approach [1] to check for completion, which disqualifies the implementation for many performance-critical applications.<p>[1] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1870699" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=1870699</a><p>And there is the issue of getting the browser to use the correct GPU in the first place, but that is a different can of worms.
+1<p>Please support a fallback, ideally a 2D one too. WebGPU and WebGL are a privacy nightmare and the former is also highly experimental. I don't mind sub-60 FPS rendering, but I'd hate having to enable either of them just to see charts if websites were to adopt this library.<p>The web is already bad requiring JavaScript to merely render text and images. Let's not make it any worse.
You can also see extension support for webgpu via <a href="https://web3dsurvey.com/webgpu" rel="nofollow">https://web3dsurvey.com/webgpu</a>
It’s available everywhere if you are on newest OS and newest browser.<p>Biggest issue is MacOS users with newer Safari on older MacOS.
All charts in the demo failed for me.<p>Error message: "WebGPU Error: Failed to request WebGPU adapter. No compatible adapter found. This may occur if no GPU is available or WebGPU is disabled.".
The project (even if it's made with the help of LLMs) is nice, but the author writing all of his HN comments with LLMs is not.
Wow, this is great. I practically gave up on rendering large data in EasyAnalytica because plotting millions of points becomes a bad experience, especially in dashboards with multiple charts. My current solution is to downsample to give an “overview” and use zoom to allow viewing “detailed” data, but that code is fragile.<p>One more issue is that some browser and OS combinations do not support WebGPU, so we will still have to rely on existing libraries in addition to this, but it feels promising.
Fun benchmark :) I'm getting 165 fps (screen refresh rate), 4.5-5.0 in GPU time and 1.0 - 1.2 in CPU time on a 9970x + RTX Pro 6000. Definitely the smoothest graph viewer I've used in a browser with that amount of data, nicely done!<p>Would be great if you had a button there one can press, and it does a 10-15 second benchmark then print a min/max report, maybe could even include loading/unloading the data in there too, so we get some ranges that are easier to share, and can compare easier between machines :)
Fantasic Hunter, congrats!<p>I've been looking for a followup to uPlot - Lee who made uPlot is a genius and that tool is so powerful, however I need OffscreenCanvas running charts 100% in worker threads. Can ChartGPU support this?<p>I started Opus 4.5 rewrite of uPlot to decouple it from DOM reliance, but your project is another level of genius.<p>I hope there is consideration for running your library 100% in a worker thread ( the data munging pre-chart is very heavy in our case )<p>Again, congrats!
Thanks! Leon's uPlot is fantastic - definitely an inspiration.<p>Worker thread support via OffscreenCanvas is a great idea and WebGPU does support it. I haven't tested ChartGPU in a worker context yet, but the architecture should be compatible - we don't rely on DOM for rendering, only for the HTML overlay elements (tooltips, axis labels, legend).<p>The main work would be:
1. Passing the OffscreenCanvas to the worker
2. Moving the tooltip/label rendering to message-passing or a separate DOM layer<p>For your use case with heavy data munging, you could also run just the data processing in a worker and pass the processed arrays to ChartGPU on the main thread - that might be a quicker win.<p>Would you open an issue on GitHub? I'd love to understand your specific workload better. This feels like a v0.2 feature worth prioritizing.
You have a good point about doing zero copy transferables which would probably work.<p>There is certainly something beautiful about your charging GPU code being part of a file that runs completely isolated in another thread along with our websocket Data fire hose<p>Architecturally that could be something interesting where you expose a typed API wrapping postmessage where consumers wanting to bind the main thread to a worker thread could provide the offscreen canvas as well as a stream of normalized, touch and pointer events, keyboard and wheel. Then in your worker listeners could handle these incoming events and treat them as if they were direct from the event listeners on the main thread; effectively, your library is thread agnostic.<p>I'd be happy to discuss this on GitHub. I'll try to get to that today. See you there.
I am on the same boat. Current user and a fan of uPlot starting to hit performance limits. Thank you for this library, I will start testing it soon.<p>On the topic of support for worker threads, in my current project I have multiple data sources, each handled by its own worker. Copying data between worker and main thread - even processed - can be an expensive operation. Avoiding it can further help with performance.
Cool to see that this project started 5 days ago!
Unfortunately, I can not make it work on my system (Ubuntu, chrome, WebGPU enabled as described in the documentation).
On the other hand, It works on my Android phone...<p>Funny enough, I am doing something very similar: a C++ portable (Windows, Linux MacOS) charting library, that also compile to WASM and runs in the browser...<p>I am still at day 2, so see you in 3 days, I guess!
Very cool, I like the variety of demos! On the candle sticks streaming demo (<a href="https://chartgpu.github.io/ChartGPU/examples/candlestick-streaming/index.html" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/candlestick-str...</a>), the 1s/5m/15m etc buttons don't seem to do anything
Can it scroll while populating? I was trying to heart rate chart using libs which is captured at 60fps from camera (finger on camera with flash light). Raw drawing with canvas was faster than any libs.<p>Drawing and scrolling live data was problem for a lib (dont remember which one) because it was drawing the whole thing on every frame.
Live streaming data is one of the examples: <a href="https://chartgpu.github.io/ChartGPU/examples/live-streaming/index.html" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/live-streaming/...</a><p>Although dragging the slider at the bottom is currently kind of broken as mentioned in another comment, seems like they are working on it though.
Nice. Add some extras like being able to draw lines (for the candlesticks) and bands. Could just be an add on. The ability not only to plot things, but point them out is a must for me.<p>I’ve written several of these in the past. Was going to write one in pure WebGPU for a project I’m working on but you beat me to it and now I feel compelled to try yours before going down yet another charting rabbit hole.
Some of these don't feel 60fps, like the streaming one. I don't really know how to verify that though. Or maybe i'm just so used to 144fps.
When did WebGPU become good enough at compute shaders? When I tried and failed at digging through the spec about a year ago it was very touch and go.<p>Maybe am just bad at reading specifications or finding the right web browser.
Safari on latest Sequoia doesn't support this. Given that many people will not upgrade to the latest version, it is a shame Safari is behind these things.
Very Nice. There is an issue with panning on the million point demo -- it currently does not redraw until the dragging velocity is below some threshold, but it should seem like the points are just panned into frame. It is probably enough to just get rid of the dragging velocity threshold, but sometimes helps to cache an entire frame around the visible range
The rendering is very cool, but what i really want is this as a renderer i can plug into Vega.<p>Vega/VGlite have amazing charting expressivity in their spec language, most other charting libs don't come close. It would be very cool to be able to take advantage of that.
this is so well done, thanks for sharing it. i've been trying to communicate with people how we are living in the golden age of dev where things that previously couldn't have been created, now can be. this is an amazing example of that.
What purposes have you found for rendering so many datapoints? It seems like at a certain point, say above a few thousand, it becomes difficult to discriminate/less useful to render more in many cases
What do you think about porting it to React Native using <a href="https://github.com/wcandillon/react-native-webgpu" rel="nofollow">https://github.com/wcandillon/react-native-webgpu</a>?<p>How do you think is it possible? Because on RN most of the Graph Libs on CPU or Skia (which is good but still utilise CPU for Path rendering)
Very cool project. Edward Tufte presented decades ago that great visualizations maximizes data-ink ratio. This is what he ment ;)
Curious:
How does TradingView et.al. solves this problem? They should have the same limitations?
(actually, Im a user of the site, though I never started digging down how they made id)
Amazing. I can't express how thankful I am for you building this.
Nicely done. Will you be able to render 3D donuts? And even animations, say pick a slice & see it tear apart from the donut.
Thanks! Currently focused on 2D charts. That's where the "big data" performance problem is most painful.<p>3D is coming (it's the same rendering pipeline), but I'd want to get the 2D story solid first before expanding scope.<p>The slice animation is doable though - we already have animation infrastructure for transitions. An "explode slice on click" effect would be a fun addition to the pie/donut charts.<p>What's your use case? Dashboard visuals or something else?
No Firefox support? It has had WebGPU support since version 141.<p>Even when I turn on dom.webgpu.enabled, I still get "WebGPU is disabled by blocklist" even though your domain is not in the blocklist, and even if I turn on gfx.webgpu.ignore-blocklist.
Works for me with 146.0.1 (Linux) and having dom.webgpu.enabled set to true.
Which platform? I think FF has only shipped WebGPU on Windows so far.
FF has partial support for WebGPU<p><a href="https://caniuse.com/webgpu" rel="nofollow">https://caniuse.com/webgpu</a>
Working fine on latest FF for me, ~ v.146
Zoom doesn't seem to work on Firefox mobile. Just zooms the whole page in.
Will it be possible to plot large graphs/ networks with thousands of nodes?
I'd love to know if this is compatible as embedded in a Jupyter Notebook.
I like how you used actual financial data for the candlestick example :)
Have you tried rendering 30 different instances at the same time?
Doesn't work on my Android phone because no GPU (but I have webgl is that not enough?)
<a href="https://caniuse.com/webgpu" rel="nofollow">https://caniuse.com/webgpu</a> latest Android Chrome should have WebGPU support. You might need to update.
You have a GPU, and you have WebGL but what's missing is WebGPU support, the latest way of doing GPU-stuff in browsers.
Here is the breakdown of WebGPU support across various devices: <a href="https://web3dsurvey.com/webgpu" rel="nofollow">https://web3dsurvey.com/webgpu</a>
You have as much GPU as you have Web.
Doesn't work for me? Latest chrome, RTX 4080, what am I missing?
The number of points actually being rendered doesn't seem to warrant the webgpu implementation. It's similar to the number of points that cubism.js could throw on the screen 15 years ago.
This looks great. Quick feedback, scrollbars don't work well on my mac mini M1.
The bar seems to move twice as fast as the mouse.
Thanks for the bug report! That's the data zoom slider - sounds like a momentum/inertia scrolling issue on macOS.<p>Which demo were you on? (million-points, live-streaming, or sampling?) I'll test on M1 today and get a fix out.<p>Really appreciate you taking the time to try it :)
Same issue on Windows - doesn't seem to be OS-related, but a general problem.
The sliders and the zoom are basically unusable.
On windows 10, too.
Firefox 147.0.1 (You may want to update your "supported" chart! Firefox has WebGPU now)
I also noticed it. On million-points. MacBook Pro M2 on Firefox Nightly 148.0a1 (2026-01-09) (aarch64)
I see the same on Windows 11, both FF and Chrome.
Impressive! Most impressive.
"The core insight" ...
Wa, this is smooth, man. This is so cool. This is really sexy and cool, the examples page (<a href="https://chartgpu.github.io/ChartGPU/examples/index.html" rel="nofollow">https://chartgpu.github.io/ChartGPU/examples/index.html</a>) has many good.<p>I hope you have a way to monetize/productize this, because this has three.js potential. I love this. Keep goin! And make it safe (a way to fund, don't overextend via OSS). Good luck, bud.<p>Also, you are a master of naming. ChartGPU is a great name, lol!
Thanks! The name was honestly just "what does this do" + "how does it do it" haha.<p>Interesting you mention three.js - there's definitely overlap in the WebGPU graphics space. My focus is specifically on 2D data visualization (time series, financial charts, dashboards), but I could see the rendering patterns being useful elsewhere.<p>On sustainability - still figuring that out. For now it's a passion project, but I've thought about a "pro" tier for enterprise features (real-time collaboration, premium chart types) while keeping the core MIT forever. Open to ideas if you have thoughts.<p>Appreciate the kind words! :)
Have you thought about leaning into some of the fintech space? They'd happily pay for the sorts of features they need to stream financial data (which is usually bazillions of data points) and graph it efficiently.<p>Off the top of my head, look into Order Book Heatmaps, 3D Volatility Surfaces, Footprint Charts/Volatility deltas. Integrating drawing tools like Fibonacci Retracements, Gann Fans etc. It would make it very attractive to people willing to pay.
I don't really care about this, like at all. But I just wanted to say, that's an amazing name. Well done.
This is great, but I don't see it being useful for most use cases.<p>Most high-level charting libraries already support downsampling. Rendering data that is not visible is a waste of CPU cycles anyway. This type of optimization is very common in 3D game engines.<p>Also, modern CPUs can handle rendering of even complex 2D graphs quite well. The insanely complex frontend stacks and libraries, a gazillion ads and trackers, etc., are a much larger overhead than rendering some interactive charts in a canvas.<p>I can see GPU rendering being useful for applications where real-time updates are critical, and you're showing dozens of them on screen at once, in e.g. live trading. But then again, such applications won't rely on browsers and web tech anyway.
There is no problem with using ai but i strongly suspect that anyone can ask claud to make a gpu version of uplot and get a result of similar quality level here. AI emjois included.<p>The code in the repo is pretty awful with zero abstraction of duplicated render pipeline building and ai slop comments all over the place like “last resort do this”. Do not use this for production code. Instead, prompt the ai yourself and use your own slop.<p>The performance here is also terrible given it is gpu based. A gpu based renderer done correctly should be able to hit 50-100m blocks/lines etc at 60fps zoom/panning.<p>It is a testament to how good ai is though and the power of the dunning kruger effect
[dead]
[dead]
[dead]
[dead]
[flagged]
Soon there will be only 3 factors that we will care about: API (easy to use and integrate), behavior (does it do what I want it to do?) and testability (do I have sufficient guaranty that the code doesn't have errors).<p>The fact that the code was generated by a human or a machine is less and less important.
.c? what a yikes. I took a quick look at the code and this application doesn't even have any machine code in it, it's just words like "while", "for", "if", "else" and other English words - someone back in 1970s, I'm sure.
Why don't you judge the results, if the slop is so easy to detect, instead of using the mere indication of a particular tool to mean it's slop? Lazy.
Healthy skepticism is certainly laudable, but too many llmuddites seem rather aggressive while whistling past their own graveyards.
Because it is not reasonable to expend high effort to verify something that took no effort to create. That is not a workable long term solution. Instead you have to rely on low effort signals to signify if something is WORTH expending energy on.
Agree, but, ah, can you illuminate. <totally-offtopic data-but="i am intesnely curious"> Quite amazing 6000 points in under 3 months. Yuge. OK a few almost 1K posts, but they drop off. You must have some mega-point comments. Can you, eh, "point me" to a comment of yours that has a super amount of upvotes?<p>Sorry if this is weird, it's just I've never personally experienced a comment with anything more than 100 - 200 points. And that was RARE. I totally get if you don't want to...but like, what were your "kilopoint" comments, or thereabouts? </offtopic>
Yeah, thanks for giving me a reality-check on my HN addiction, really need to put back my original /etc/hosts file it seems :|<p>So, apparently these are my five most upvoted comments (based on going through the first 100 pages of my own comments...):<p>- 238 - <a href="https://news.ycombinator.com/item?id=46574664">https://news.ycombinator.com/item?id=46574664</a> - Story: Don't fall into the anti-AI hype<p>- 127 - <a href="https://news.ycombinator.com/item?id=46114263">https://news.ycombinator.com/item?id=46114263</a> - Story: Mozilla's latest quagmire<p>- 92 - <a href="https://news.ycombinator.com/item?id=45900337">https://news.ycombinator.com/item?id=45900337</a> - Story: Yt-dlp: External JavaScript runtime now required f...<p>- 78 - <a href="https://news.ycombinator.com/item?id=46056395">https://news.ycombinator.com/item?id=46056395</a> - Story: I don't care how well your "AI" works<p>- 73 - <a href="https://news.ycombinator.com/item?id=46635212">https://news.ycombinator.com/item?id=46635212</a> - Story: The Palantir app helping ICE raids in Minneapolis<p>I think if you too retire, have nothing specific to do for some months, and have too much free time to discuss with strangers on the internet about a wide range of topics you ideally have strong opinions about, you too can get more HN karma than you know what to do with :)
WebGPU is a security nightmare.<p>The idea that GPU vendors are going to care about memory access violations over raw performance is absurd.