我正在使用 C3.js 构建折线图。在此图中,我必须根据颜色数组更改圆圈颜色。
c3的代码如下:
var chart = c3.generate({
bindto:'#timeline',
colors:['red', 'blue','green','yellow','green','red'],
data: {
x: 'x',
columns: [
['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'],
['data1', 10, 15, 12, 5, 9, 11],
['data2', 15, 12, 10, 8, 4, 12],
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
},
label: {
text: 'Dates',
position: 'outer-middle'
}
},
y: {
show:true,
label: {
text: 'Count',
position: 'outer-middle'
}
}
}
});
对于每个数据点,我想用colors
数组中的相应颜色填充它。我必须使用 CSS,但我不知道如何在这个generate
函数中做到这一点。