d3.js v5 - Promise.all replaced d3.queue

前端 未结 3 856
南旧
南旧 2020-11-30 11:15

I\'ve been using d3.js v4 for sometime now and I\'ve learned that Mike Bostock has replaced the d3.queue in the v5 release with the Promise native JavaScript object. I would

3条回答
  •  温柔的废话
    2020-11-30 12:09

    You can also add a formatting function for your data as such if you want to clean up your data to your preference. .then() will have your data in a nice array which you can use later.

    const myData = d3.csv("data.csv", formatterFunction)
    .then(data => /* do whatever*/ )
    
    function formatterFunction(row){
      // do formatting
      return // formatted data
       }

提交回复
热议问题