使用 .toString() 时 c3 解析失败
c3 failed to parse when using .toString()
提到了一个类似的问题,但是,它并没有解决我的问题。在 var dates = ["2015-03-07", "2015-03-09"]
上使用 .toString()
方法时,一个简单的 c3
脚本无法加载数据
data: {
x: 'x',
xFormat: '%Y-%m-%d', // 'xFormat' can be used as custom format of 'x'
columns: [
['x', dates.toString()],
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 340, 200, 500, 250, 350]
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
}
}
我是不是漏掉了什么?报错如下
Failed to parse x '2015-03-07,2015-03-09' to Date object
.toString
将数组变成一个字符串,在列 属性 中使用它来代替
['x'].concat(dates),
var dates = ["2015-03-07", "2015-03-09"]
.toString()
方法时,一个简单的 c3
脚本无法加载数据
data: {
x: 'x',
xFormat: '%Y-%m-%d', // 'xFormat' can be used as custom format of 'x'
columns: [
['x', dates.toString()],
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 340, 200, 500, 250, 350]
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
}
}
我是不是漏掉了什么?报错如下
Failed to parse x '2015-03-07,2015-03-09' to Date object
.toString
将数组变成一个字符串,在列 属性 中使用它来代替
['x'].concat(dates),