我正在尝试更改饼图的颜色,例如 数据A->橙色 数据B->红色
解决此问题的任何建议 解决这个问题的任何建议 谢谢你的帮助
google.charts.load('current', { packages: ['corechart'] });
google.charts.setOnLoadCallback(draw_Charts);
function draw_Charts() {
var options = {
backgroundColor: 'transparent',
width: '100%',
height: 400,
title: 'Project Status',
titleTextStyle: {
fontSize: 20,
},
legend: { position: 'left', textStyle: { fontSize: '40%' } },
colors: ['#3E7CB1', '#054A91']
};
$.ajax({
type: "POST",
url: "progress_project.asmx/GetPiChartEx",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var data = google.visualization.arrayToDataTable(r.d);
var chart = new google.visualization.PieChart($("#Extend_Pie")[0]);
chart.draw(data, options);
updateChart();
},
failure: function (r) {
alert(r.status + " - " + r.statusText);
},
error: function (r) {
alert(r.status + " - " + r.statusText);
}
});
}