score:1

Accepted answer

In your case,

['x', xData] 

is equal to

['x', ['2017-07-28', '2017-07-29']]

not

['x', '2017-07-28', '2017-07-29']

What you can do is create the array before :

var xData = ['2017-07-28', '2017-07-29'];
var yData = [30, 200];

xData.unshift('x');
yData.unshift('data1');

var chart = c3.generate({
     bindto: '#chart',
     data: {
         x: 'x',
         xFormat: '%Y-%m-%d',
         columns: [
             xData,
             yData
        ]
    },
    axis: {
        x: {
             type: 'timeseries',
             tick: {
                 format: '%Y-%m-%d'
             }
        }
    }
});

Related Query