Googel图表-无法在PieChart中显示较小的值

时间:2019-12-15 10:54:49

标签: charts google-api google-visualization

我无法使PieChart显示较小的值(在此示例中为3.05)。我尝试将sliceVisibilityThreshold设置为0,但没有帮助。

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

  function drawChart() {

    var data = google.visualization.arrayToDataTable([
      ['City', 'Connections to Top Ecosystems'],
      ['Property 1',     {v: 26.66, f: '26.66%'}],
      ['Property 2',     {v: 16.47, f: '16.47%'}],
      ['Property 3',     {v: 25.47, f: '25.47%'}],
      ['Property 4',     {v: 12.22, f: '12.22%'}],
      ['Property 5',     {v: 3.05, f: '3.05%'} ],
      ['Property 6',   {v: 16.13, f: '16.13%'}  ]
    ]);

    var options = {
      pieHole: 0.5,
      height: '510',
      pieSliceText: 'value',
      sliceVisibilityThreshold: 0,
      legend: 'right',
    };

    var chart = new google.visualization.PieChart(document.getElementById('piechart'));

    chart.draw(data, options);
  }

Jsfiddle:https://jsfiddle.net/hqpebow7/

0 个答案:

没有答案