I'm making a basic d3 charge that pulls in data using d3.csv and then forwards it in an anonymous function like this
d3.csv("https://example.com/report.csv", function(error, data) {
console.log(data);
data.forEach(function(d) {
d.zeit = parseDate(d.zeit);
d.total = +d.total;
d.count = d.count;
});
...//code ommitted
});
However, since there's not a lot of data, I thought would embed the csv data using the technique described in this answer, which removes the anonymous function above. The log statement reveals an array of objects exactly the same as above, however when I do it this way, the chart doesn't display and I get an error that seems to arise from an array Uncaught TypeError: Cannot read property 'length' of undefined
var raw = d3.select("#csvdata").text();
var data = d3.csv.parse(raw);
console.log(data)
data.forEach(function(d) {
d.zeit = parseDate(d.zeit);
d.total = +d.total;
d.count = d.count;
});
...
Here is a fiddle for the first method https://jsfiddle.net/mjmitche/5Y6kf/3/ and here is a fiddle for the second one not working fiddle

