score:4

Accepted answer

You basically have two options here: 1. Munge your data into a format that's easier to deal with 2. Try to deal with your current format.

I think (1) is going to make your life easier in most cases:

data = data.map(function(d) {
    // get the date
    var date = d3.keys(d)[0];
    // put it into the inner object
    d[date].date = date;
    // return the inner object
    return d[date];
});

This gives you rows like

{
  "orders": "10",
  "revenue": "1000",
  "date": "2013-08-21"
}

which are much easier to deal with. Might also be a good idea to parse the date as you do this.


Related Query

More Query from same tag