I have data in a .csv file that I am trying to display using D3. My script inside the head tag has a function:
function show(data) {
console.log(data[0]);
d3.select("body")
.selectAll("p")
.data(data)
.enter()
.append("p")
.text(function(d) { return d.price} )
}
In the body of the page inside a script tag I have:
d3.csv('simple5.csv', show)
The file simple5.csv is:
name, price
a, 5
b, 10
c, 15
d, 20
e, 25
f, 30
g, 35
While the console.log function shows me the data, I am unable to see the data in the HTML page. I have tried using the d3.csv.parse and the d3.cd.parseRows functions, but then I get an error: "text.charCodeAt is not a function".