2017-06-02 82 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