gpt4 book ai didi

javascript - 我怎样才能给谷歌图表颜色

转载 作者:太空宇宙 更新时间:2023-11-04 01:59:25 24 4
gpt4 key购买 nike

google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Invites', 'Count'],
['No', parseInt(response['JobInvitationstatus']['no'])],
['Maybe', parseInt(response['JobInvitationstatus']['noresponse'])],
['Yes', parseInt(response['JobInvitationstatus']['yes'])]
]);
var options = {
title: 'Job ID '+response['jobData']['id_job']+' Invitation Status'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}

这是谷歌图表代码,我想给出特定的颜色,比如

没有是红色

也许是黄色

是的,绿色,我该怎么做......?

最佳答案

做出这样的选择:

var options = {
colors: ['red','yellow', 'green'],
title: 'Job ID '+response['jobData']['id_job']+' Invitation Status'
};

关于javascript - 我怎样才能给谷歌图表颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42037233/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com