2017-06-02 75 views
1

我使用谷歌API的圖表,我沒有在文檔中如何從黑白色 enter image description here圖表顏色改變谷歌圖表API

此更改圖表顏色前景發現是代碼:

 google.charts.load('current', {'packages':['corechart']}); 
    google.charts.setOnLoadCallback(drawChart); 

    function drawChart() { 
    var data = google.visualization.arrayToDataTable([ 
     ['Year', 'Expenses'], 
     ['2004',  400], 
     ['2005',  460], 
     ['2006',  1120], 
     ['2007',  540] 
    ]); 

    var options = { 
     curveType: 'function', 
     backgroundColor: { fill:'transparent' }, 
    }; 

    var chart = new google.visualization.LineChart(document.getElementById('curve_chart')); 

    chart.draw(data, options); 
    } 

任何解決方案?

回答

0

configuration options,使用下列...

x軸標籤...

hAxis: { 
    textStyle: { 
    color: '#ffffff' 
    } 
} 

y軸標籤...

vAxis: { 
    textStyle: { 
    color: '#ffffff' 
    } 
} 

圖例標籤.. 。

legend: { 
    textStyle: { 
    color: '#ffffff' 
    } 
} 
+0

是的,這是工作,謝謝 – Gradin98