I'm learning d3.js and I'm having a problem pushing a simple data from a csv file. The error at the console is: "ReferenceError: Can't find variable: data"
Apparently, the compiler can't identify the method .data() from d3. The one we call to iterate the svg elements:
const circles = svg.selectAll("circles").data(data);
Before this statement, I called the data like this and it is showing normally on the console.
d3.csv("data/HousePricesAroundtheWorld.csv").then((data) => {
data.forEach((d) => {
d.number = Number(d["annual percent change"]);
});
console.log(data);
});