show progress loader while asynchronously loading and processing csv files

江枫思渺然 提交于 2019-12-11 09:02:10

问题


My question is quite simple, but I'm having a difficult time figuring out how to go about solving it. As shown in the code below, I am loading 3 csv files and then processing them using queue.js. While this is happening, I want some type of progress indicator to be shown to the user.

queue()
  .defer(d3.csv,"data/1.csv")
  .defer(d3.csv,"data/2.csv")
  .defer(d3.csv,"data/3.csv")
  .awaitAll(preprocessing);

I have managed to get a progress bar to show up when the document is ready using JQuery. However, the progress bar pauses for the above code to execute, which defeats the whole point. The problem is not having a progress indicator or loading and processing data using a queue on their own; rather, the problem is in integrating the two. I'm really stuck with where to go from here.

Any help is much appreciated. I don't have to use queue.js, so suggestions for alternate ways to go about loading and processing are welcome if they make the solution easier. Thanks!

来源:https://stackoverflow.com/questions/16408661/show-progress-loader-while-asynchronously-loading-and-processing-csv-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!