Search code examples
javascriptsvgd3.jsweb-worker

Use Web Worker and D3.js to asynchronously generate graphs?


I'm currently working a problem that requires my web application to generate a chart that represents approximately 50k to 60k points of data. It loads fairly quickly (~6 seconds), but what I'm wondering if it is possible to use D3.js to generate the graph in a Web Worker and then pass the SVG back to be loaded into the page.


Solution

  • Web Workers have no DOM access, so all you could do on that side would be to build something that could be used for quickly creating the DOM. The worker(s) could e.g process the datasets and do all the heavy computations, then pass the result back as a set of arrays.