Tell us what’s happening:
I can’t get my graph to render, and I can’t figure out why. It stopped rendering when I transitioned from having the data saved as a variable, to when I accessed that data from the JSON object
Since you are using d3v6, d3.json() actually returns a promise. Using a .then() works (this is what I used) and and according to my notes when I did this, callbacks worked in d3v4. I haven’t tried the async/await route, but see this on SO.
ok, that makes a little more sense but this is my first time using promises. I thought I set it up right,
let jsonPromise = d3.json('https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json');
jsonPromise.then((data)=>{
var gDP = data.data.map(function(i){
return i[1];
// rest of function continues after this
The data is being imported successfully, but I can’t get the graph to show up and I’m not sure where I went wrong .