2017-02-04 45 views
0
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); 
} 

這是谷歌圖碼在這裏,我想給特定的顏色,如我怎麼可以給顏色以谷歌圖表

沒有在紅色

也許在黃

是在綠色,我該怎麼做..?

回答

2

製作方案是這樣的:

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