我正在尝试使用 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/