Skip to content Skip to sidebar Skip to footer

Trying To Add An Xhr To Queue.js To Show Progress

I am trying to add a progress meter to my files by following this code: Progress Events I have an XHR with progress working fine like so: d3.csv('data/WLAN2.csv') .on('progress

Solution 1:

Queue.js expects to be given a function that accepts a callback argument. In your code, you're passing an evaluated function, so it won't work. The following code should.

queue()
.defer(function(f) {
  d3.csv("data/WLAN2.csv")
    .on("progress", function() {
       var i = d3.interpolate(progress, d3.event.loaded / d3.event.total);
       d3.transition().tween("progress", function() {
         return function(t) {
           progress = i(t);
           foreground.attr("d", arc.endAngle(twoPi * progress));
           text.text(formatPercent(progress));
         };
     });
  })
  .get(function(error, data) {
    meter.transition().delay(250).attr("transform", "scale(0)");
    f(error, data);
  })
})
.await(transformData);

Post a Comment for "Trying To Add An Xhr To Queue.js To Show Progress"