I need help in converting a flat data to be used to used for the nvd3 Stacked Area Chart from the website mentioned - Stacked Area Chart - NVD3.JS.
Sample Data :
levels 01-Oct-13 02-Oct-13 03-Oct-13 level1 11 13 13 level2 11 20 20 level3 17 11 11 level4 10 20 20 level5 15 18 18 level6 12 15 15 level7 17 17 17
Required Format :
[ { "key": "level1" "values" : [[1138683600000, 11], [ 1141102800000 , 13], [[ 1141102800000 , 13]] }, { "key": "level2" "values" : [[1138683600000, 11], [ 1141102800000 , 20], [[ 1141102800000 , 20]] }, { "key": "level3" "values" : [[1138683600000, 17], [ 1141102800000 , 11], [[ 1141102800000 , 11]] }, { "key": "level4" "values" : [[1138683600000, 10], [ 1141102800000 , 20], [[ 1141102800000 , 20]] }, "key": "level5" "values" : [[1138683600000, 11], [ 1141102800000 , 13], [[ 1141102800000 , 13]] }, { "key": "level6" "values" : [[1138683600000, 11], [ 1141102800000 , 13], [[ 1141102800000 , 13]] }, "key": "level7" "values" : [[1138683600000, 11], [ 1141102800000 , 13], [[ 1141102800000 , 13]] } ]
Tried using d3.nest() function but i couldn't get the in the format requried.
Would like to take some suggestions on converting the data.
Thanks in advance.