如何为googlechart中的所有数据显示切片,即使是小值?

时间:2016-11-04 12:57:47

标签: javascript charts google-visualization

我正在使用googlechart创建一个饼图。但问题是,切片应该清晰可见。我尝试使用sliceVisibilityThreshold: 0,但是具有较小值的切片不可见。

代码:

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

function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('string', 'Pizza');
  data.addColumn('number', 'Populartiy');
  data.addRows([
    ['Pepperoni', 1062],
    ['Hawaiian', 5229],
    ['Mushroom', 0],
    ['Sausage', 0],
    ['Anchovies', 14] // Below limit.
  ]);

  var options = {
    title: 'Popularity of Types of Pizza',
    sliceVisibilityThreshold: 0,
    pieStartAngle: 0,
    is3D:true
  };

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

请找到plunker here

0 个答案:

没有答案