我正在尝试添加不同的颜色条,但是当我colors
在选项中使用时,似乎所有条都采用了第一个选项红色。有什么帮助吗?我在用datatable
请在下面找到代码:
graphData = data;
var arr = Object.keys(graphData).map(function (k) { return graphData[k] });
var tdata = new google.visualization.DataTable();
tdata.addColumn('string', 'Testing');
tdata.addColumn('number', 'Amount');
var col1 = Object.keys(graphData[0])[0];
col1 = col1.replace("_", " ");
var col2 = Object.keys(graphData[0])[1];
col2 = col2.replace("_", " ");
var col3 = Object.keys(graphData[0])[2];
col3 = col3.replace("_", " ");
if (col3 == "TM Automation") {
col3 = col3.replace("Auto", "T")
}
tdata.addRow([col1, arr[0].Manual])
tdata.addRow([col2, arr[0].OCB_Auto]);
tdata.addRow([col3, arr[0].Amount]);
options = {
fontSize: 12,
height: 430,
width: 380,
chartArea: { left: "25%", top: "20%", right: "5%", bottom: "10%" },
title: 'Project',
pieSliceText: 'value',
colors: ['red', 'green', 'blue'],
'is3D': true
};
var chart = new google.visualization.ColumnChart(document.getElementById('drilldown_div'));
chart.draw(tdata, options);
return false;