I'm trying to pass JSON data (from an AJAX call) into a function that uses D3 charts to iterate through the data. I am NOT passing the URL to a Json file, I am passing the DATA from a Json that is returned from an AJAX call. Every time I do this, however, the 'data' in the callback is undefined and won't let me iterate through it. How do I manage this? I just want to iterate through the JSON data and draw things according to it.
Here's the example code:
drawLine(jsonData)
function drawLine(chartData) {
d3.json(chartData, function(data) {
data.forEach(function(d) {
d.date = parseDateD3(d.date);
d.close = +d.close;
});
// DO STUFF PAST HERE TO DATA
});
}