0
votes

I'm trying to create a stacked area chart using nvd3. Currently I'm creating the json data to be graphed and testing it against nvd3 live code section on nvd3 website, at the moment I've got this:

[
    {
        "values": [[1382812284000, 0], [1382818677000, 1], [1382818677000, 2], [1382819934000, 3], [1382820167000, 4], [1382822993000, 5], [1382823894000, 6], [1382825059000, 7], [1382827775000, 8]], 
        "key": "first"
    },
    {
        "values": [[1382812284000, 0], [1382819096000, 1], [1382822399000, 2], [1382825092000, 3], [1382826256000, 4], [1382826291000, 5], [1382827074000, 6], [1382827332000, 7], [1382827374000, 8], [1382827662000, 9], [1382829230000, 10], [1382829230000, 11], [1382829230000, 12]],
        "key": "second"
    },
    {
        "values": [[1382812284000, 0], [1382826522000, 1], [1382826522000, 2], [1382826522000, 3], [1382826522000, 4], [1382826522000, 5], [1382826522000, 6], [1382826522000, 7], [1382826522000, 8], [1382829299000, 9], [1382830207000, 10], [1382830207000, 11], [1382830207000, 12], [1382830207000, 13], [1382830207000, 14], [1382830207000, 15], [1382830207000, 16]],
        "key": "third"
    }
]

I can't get the chart to be displayed though the legend is showing all three labels. Anyway removing (any) two of the series and leaving just one the remaining one gets displayed, so I suppose the problem is not in the data itself but probably something in json structure.

Anyone could help?

1
Could you put your code in a fiddle, so its easy to identify the problem. - shabeer90
that's what I'm doing, there's a live code section on nvd3 website - primordialooze
can you have different y keys? - SuperUberDuper

1 Answers

3
votes

I solved the problem: it seems the series must have the same number of elements!