Can\'t seem to properly fetch the data from JSON. My chart is not even able to be displayed. Any ideas on how i can fix this?
d3.json
does not accept an accessor (or row) function. It has to be just:
d3.json(url[, callback])
In your code:
d3.json("bboList.json", function(d) {
d.timeStr = parseTime(d.timeStr);
d.bid = +d.bid;
return d;
}, function(error, data) {
if (error) throw error;
//...
});
Everything between the URL and function(error, data)
is the row function.
Solution: remove it, and coerce the values to numbers and dates using a forEach
:
d3.json("bboList.json", function(error, data) {
if (error) throw error;
data.forEach(d => {
d.timeStr = parseTime(d.timeStr);
d.bid = +d.bid;
});
/...
});