网格边距的Google图表颜色

时间:2018-11-29 15:52:47

标签: javascript charts google-visualization

gridlinecolor

Google Chart Api中的哪个选项可以更改线条的颜色?

1 个答案:

答案 0 :(得分:1)

使用选项-> baselineColor

在一个或两个上-> hAxisvAxis

var options = {
  hAxis: {
    baselineColor: 'magenta',
  },
  vAxis: {
    baselineColor: 'magenta',
  }
};

请参阅以下工作片段...

google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = google.visualization.arrayToDataTable([
    ['x', 'y'],
    [0, 1],
    [1, 2],
    [2, 3],
  ]);

  var options = {
    hAxis: {
      baselineColor: 'magenta',
    },
    vAxis: {
      baselineColor: 'magenta',
    }
  };

  var chart = new google.visualization.LineChart(
    document.getElementById('chart_div')
  );
  chart.draw(data, options);
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>