Skip to content
Advertisement

Use d3 csv inside a Codesandbox

I’m trying to create a basic data visualization using D3. As editor I would like to use Codesandbox.

So I create a data folder and inside it I put my dataset.csv file. Then, this is my code:

import * as d3 from "d3";

const something = d3.csv("./data/dataset.csv").then(function (dataset) {
  console.log(dataset);
});

but the result is:

enter image description here

Why? Is it probably a problem about a server missing? How can I use d3.csv inside a Codesandbox?

Advertisement

Answer

The solution is put the csv file inside a public folder: enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement