score:0

Yes, just need to tell c3 which of those variables is the 'x' value (we know it's x, but just need to tell c3)

A slight tweak to the example at http://c3js.org/samples/data_json.html shows this in practice:

var chart = c3.generate({
    data: {
        json: [
            {name: 'www.site1.com', upload: 200, download: 200, total: 400, x: 2},
            {name: 'www.site2.com', upload: 100, download: 300, total: 400, x: 3},
            {name: 'www.site3.com', upload: 300, download: 200, total: 500, x: 4},
            {name: 'www.site4.com', upload: 400, download: 100, total: 500, x: 5},
        ],
        keys: {
            x: 'x',
            value: ['upload', 'download'],
        }
    },
});

JSFiddle version of above: http://jsfiddle.net/dj27wwef/


Related Query