简体   繁体   English

图表颜色更改Google Charts API

[英]chart color change Google Charts API

I'm using Google Charts API and I don't find in documentation how to change chart color foreground from black in white 我正在使用Google Charts API,但我在文档中找不到如何从黑白中更改图表颜色前景色 在此处输入图片说明

this is the code: 这是代码:

      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);
  }

any solution ? 有什么办法吗?

from the configuration options , use the following... 配置选项中 ,使用以下...

x-axis labels... x轴标签...

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

y-axis labels... y轴标签...

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

legend labels... 图例标签...

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM