javascript - Uncaught TypeError : d3. queue is not a function D3.js

标签 javascript d3.js chord-diagram

我正在尝试使用 D3.js 创建一个和弦图来显示不同客户和 vendor 之间的关系,但是
运行页面时我不断收到以下错误,这是我的代码:

Uncaught TypeError: d3.queue is not a function at chord.html:47


      d3.queue()
        .defer(d3.json, 'NewData/Client_Supplier-matrix.json')
        .defer(d3.csv, 'NewData/Client_Supplier.csv')
        .await(function(err, matrix, mmap) { 
          if (err) console.log(err);
          _.each(mmap, function (d, i) { d.id=i; d.data=d.color })
          drawChords(matrix, mmap);
        });

最佳答案

您似乎正在尝试使用 D3 v5 来运行为 D3 v4 设计的代码。根据D3 5.0 release notes :

D3 5.0 also deprecates and removes the d3-queue module. Use Promise.all to run a batch of asynchronous tasks in parallel, or a helper library such as p-queue to control concurrency.



this question有关如何转换 d3.queue 的示例至Promise.all .

关于javascript - Uncaught TypeError : d3. queue is not a function D3.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58890734/

相关文章:

r - 使用circlize设置弦图的扇区宽度

JavaScript 日期 : How do I compare the current date/time against a recurring event?

javascript - 访问从 AJAX 创建的 DOM 中的信息

javascript - 使用 D3 网格问题和控制台错误的分组条形图

javascript - 如何更改象形图的图标?

javascript - 如何在D3 Treemap中显示 child 的名字

python - 运行 Holoview 和弦图示例时出错

javascript - 断言(req.assert)如何在nodejs中工作

javascript - 实时更新 Javascript 变量

javascript - D3和弦图,带确切位置