Is there any way to load multiple json files with d3 json and use them all in then callback?
const file1 = 'data1.json';
const file2 = 'data2.json';
const file3 = 'data3.json';
Promise.all([
d3.json(file1),
d3.json(file2),
d3.json(file3)
]).then(([data1, data2, data3]) => {
console.log('Data from file 1:', data1);
console.log('Data from file 2:', data2);
console.log('Data from file 3:', data3);
}).catch(error => {
console.error('Error loading JSON files:', error);
});
1 Like