我有一個c3圖表,我工作到目前爲止工作。c3圖表背景區域
var chart = c3.generate({
bindto: '#chart',
data: {
x: 'x',
xFormat:'%H:%M',
columns: [
["x", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"],
["line 1" , 50, 60, 70, 80],
["line 2", 80, 85, 90,98],
["line 3", 50, 90, 95,60],
["line 4", 100, 80, 50,60]
],
colors: {
"line 1": '#4575b4',
"line 2": '#d73027',
"line 3": '#FF0000',
"line 4": '#AEAEAE'
},
},
axis: {
x: {
type: 'timeseries',
max: '23:00',
tick: {
values: ["01:00", "02:00", "03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"],
format: '%H:%M',
fit: false
}
},
y: {
max: 100,
min: 40,
padding: {top: 0, bottom:0}
}
},
grid: {
y: {
lines: [
{value: 89},{value: 92}
]
},
x: {
lines: [
{value: "2016-01-08", text: "Want to rorate this text in 180 degrees",
class: "xLineLable", position: "end"}
] } }});
但是,不是網格Y線,我希望他們成爲陰影區域。
例如:
0〜89將紅,
89至92將是橙色和
92至100將是綠色的。
有沒有辦法與C3和D3做到這一點?
問候,
jmcall10
您可以使用漸變作爲背景。 –