Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to create a Chord Diagram using D3.js to show the relationship between different clients and suppliers, but I keep getting the following error when running the page, and here's my code:

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);
        });
like image 338
Hamad Avatar asked Mar 03 '23 04:03

Hamad


2 Answers

It seems you are attempting to use D3 v5 to run code designed for D3 v4. According to the 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.

See this question for an example of how to convert d3.queue to Promise.all.

like image 124
Luke Woodward Avatar answered Mar 12 '23 14:03

Luke Woodward


try this command npm install d3-queue

like image 43
Руслан Тютин Avatar answered Mar 12 '23 15:03

Руслан Тютин