Google visualization 更改谷歌图表中列的颜色
你如何改变谷歌图表中一栏的颜色。我有这个Google visualization 更改谷歌图表中列的颜色,google-visualization,Google Visualization,你如何改变谷歌图表中一栏的颜色。我有这个drawGraph功能: function drawGraph(){ var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); data.addColumn('number', 'House 1') data.addColumn('number', 'House 2') data.addColumn('number', 'House
drawGraph
功能:
function drawGraph(){
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'House 1')
data.addColumn('number', 'House 2')
data.addColumn('number', 'House 3')
data.addColumn('number', 'House 4')
data.addRows([
[new Date(2016, 01, 20),
180,
150,
186,
176,
],
[new Date(2016, 01, 19),
100,
150,
200,
175,
],
[new Date(2016, 01, 11),
10,
11,
20,
17,
],
[new Date(2016, 01, 07),
55,
51,
123,
100,
],
])
var options = {
title: 'House Points',
hAxis: {
title: 'Date'
},
vAxis: {
title: 'Points'
}
}
var material = new google.charts.Bar(document.getElementById('edhp_housepoints'));
material.draw(data, options);
}
我想把1号楼的颜色设置为4号楼,我该怎么做
我试过几件事,但都不管用 可以在选项哈希中设置每列的颜色,如下所示:
var options = {
title: 'House Points',
hAxis: {
title: 'Date'
},
vAxis: {
title: 'Points'
},
colors: [
"#f0c514",
"#eb7f25",
"#eb4b33",
"#22b05a"
]
}
可以在选项哈希中设置每列的颜色,如下所示:
var options = {
title: 'House Points',
hAxis: {
title: 'Date'
},
vAxis: {
title: 'Points'
},
colors: [
"#f0c514",
"#eb7f25",
"#eb4b33",
"#22b05a"
]
}
您还可以在
系列中指定颜色:{0:{color:'black'}
您还可以在系列中指定颜色:{0:{color:'black'}