如何使Google折线图圈子有边框?

时间:2018-10-14 21:00:39

标签: charts google-visualization linegraph

我想知道是否有可能使圆圈(一旦将其悬停在Google折线图上时出现)是否具有彩色边框?

1 个答案:

答案 0 :(得分:1)

您可以使用样式列角色来更改点的样式。

point {stroke-width: 2; stroke-color: red;}

请参阅以下工作片段,
悬停一点以查看样式...

google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = new google.visualization.DataTable();
  data.addColumn('number', 'x');
  data.addColumn('number', 'y');
  data.addColumn({role: 'style', type: 'string'});
  data.addRows([
    [0, 1, 'point {stroke-width: 2; stroke-color: red;}'],
    [1, 2, 'point {stroke-width: 2; stroke-color: red;}'],
    [2, 3, 'point {stroke-width: 2; stroke-color: red;}'],
    [3, 4, 'point {stroke-width: 2; stroke-color: red;}'],
    [4, 5, 'point {stroke-width: 2; stroke-color: red;}'],
  ]);

  var options = {
    legend: 'none'
  };

  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>