0

我试图用谷歌饼图制作一个图表,但是你切片的笔画宽度太薄了,我试图让它们更厚。

下面的代码是我正在使用的,但不幸的是它不起作用。

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

function drawChart() {
  var data = google.visualization.arrayToDataTable([
  ['Sitio', 'Dinheiro'],
  ['Restaurantes', 8],
  ['Bares', 2], 
  ['Discotecas', 7]
]);

  // Optional; add a title and set the width and height of the chart
    var options = {

        width: '92%',
        height: 550,
        color: 'white',

        backgroundColor: '#232220',

        chartArea: { top: '3%', width: '70%', height: '80%' },
        slice: {
            backgroundColor: {strokeWidth:2}
        },
        legend: { position: 'bottom', textStyle: { color: 'white', fontSize: 16 } },
        
        pieSliceBorderColor : "tranparent"
        };

  // Display the chart inside the <div> element with id="piechart"
  var chart = new google.visualization.PieChart(document.getElementById('piechart'));
  chart.draw(data, options);
}
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="piechart" style="height: 370px; width: 92%;"></div> 

已经搜索过了,但它总是关于颜色而不是切片宽度的宽度,所以我无法更改它

4

1 回答 1

1

查看谷歌饼图的配置选项,没有设置切片的描边宽度的选项。

但是,您可以使用 css 设置笔触宽度:

    <style type="text/css">
        path {
          stroke-width: 2;
        }
    </style>
于 2018-04-30T16:06:42.517 回答