Reputation: 79
Following is the set of data:
var data = [{
machine1: [
{x:"20/12/2014", y:2}, {x:"21/12/2014", y:10}
]},{
machine2: [
{x:"20/12/2014", y:23}, {x:"21/12/2014", y:46}
]
}];
Need to implement dc.js for the above data Each machine will have individual line on a chart. Thanks for the help
Upvotes: 0
Views: 250
Reputation: 20120
Crossfilter works best with a flat array of observations. It looks like your data might best be represented by observations (rows) of {machine, x, y}
It's hard to tell with the example you've given, because it is very deeply nested but many of the levels are unused, exactly what the format is. I'd advise you to either flatten it out when you're producing it, or if you have no control over that, loop over it and produce an array of just the deepest {x,y} objects, but annotate them with the machine id from the level above that.
Upvotes: 1