javascript - d3.parseDate Error cannot read property 'forEach' of undefined -


i hope y'all can me. stuck trying make bar chart time series using d3 , json file. json file structured so:

{             "projectcode": "prj2.1",             "numberofschools": 1188,             "newschools": 0,             "date": 2011-12         },  

the y axis supposed show numberofschools whilst x axis supposed show years passed. used combination of time scale , ordinal scale x axis , parsed date so:

data.foreach(function(d) {                     d.date = parsedate(d.date.tostring());                     d.numberofschools = +d.numberofschools;                 }); 

i'm guessing json file not being parsed , have tried solutions here , here no luck. i'm using d3.v3. , below jsfiddle

http://jsfiddle.net/siyafrica/esye3/

i've seen above fiddle, , understood, can give exact location file is. url of json file might wrong that's why problem raising. read below definition

d3.json(url[, callback])

creates request json file @ specified url mime type "application/json". if callback specified, request issued method, , callback invoked asynchronously when file loaded or request fails; callback invoked 2 arguments: error, if any, , parsed json. parsed json undefined if error occurs. if no callback specified, returned request can issued using xhr.get or similar, , handled using xhr.on.

above github--> https://github.com/mbostock/d3/wiki/requests#d3_json


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -