I have data in json files that I'd like to visualize using d3 and javascript. Sometimes all the data I need is stored in a single file. In those cases I can just read the json and do what I want inside the callback, like so:
function loadAndRunSingleFile(filePath) {
d3.json(filePath).then(function (data) {
doStuffWithTheData(data)
})
}
However, sometimes the data that I want to visualize is split between several json files. Because of the size and structure of the dataset and constraints on my storage, it isn't always possible to have it in a single json. Take that as an absolute constraint.
In this circumstance, how can I do the equivalent of the code above? That is, I want to read the data from the different json files, concatenate them into an array (perhaps with a little processing of the json data before concatenation), and then do stuff with this array and ultimately display it on a web page. [Note: I'm assuming I'd want to concatenate them into an array, but if something else makes sense, please suggest it].
As a concrete example, let's say I am making a sunburst plot (like this). But the data for each ring of a certain radius is in its own json file. I'd like to concatenate all the data together and then make the plot.