1

我正在尝试在 c3.js 中创建具有多个时间序列轴的线图,但它不起作用

这是我为此目的使用的代码:

var chart = c3.generate({

   data: {
      x: 'x',
      x1: 'x1',
     xFormat: '%Y-%m-%d %H:%m',
     x1Format: '%Y-%m-%d %H:%m',
     selection: {
     multiple: true
    },
    xs:{
     'data1':'x',
     'data2':'x1'
    },
columns: [

//            ['x', '2012-12-31 10:00', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05'],
            ['x', '2012-12-31 10:00', '2012-12-31 11:00', '2012-12-31 12:00', '2012-12-31 13:00'],
            ['x1', '2012-12-31 10:30', '2012-12-31 11:30', '2012-12-31 12:30', '2012-12-31 13:30'],
            ['data1', 30, 200, 100, 400],
            ['data2', 130, 340, 200, 500]
        ]
    },
    axis: {
        x: {
            type: 'timeseries',
            // if true, treat x value as localtime (Default)
            // if false, convert to UTC internally
            localtime: true,
            tick: {
                format: '%Y-%m-%d %:%M %p'
            }
        },
4

0 回答 0