d3.js not reading JSON (d3.js + dc.js + crossfilter)
Here is the solution:
You can replace this part of the code:
var data; d3.json("./pata.json", function(data) { console.log(data[1]); var ndx = crossfilter(data);
with:
d3.json("./pata.json", function(data) { console.log(data.Patatine); data = data.Patatine var ndx = crossfilter(data);
The error
Error: <path> attribute d: Expected number, "Mundefined,6V0Hun…".
comes from the way you read the json file.
In fact, just above your error, in the console, you probably see this:
undefined
which comes from console.log(data[1]);
in:
var data; d3.json("./pata.json", function(data) { console.log(data[1]);
The data of interest in your json (the list) is in fact data.Patatine
. And thus to print data[1]
you should in fact use data.Patatine[1]