我使用Google Chart API创建了一个饼图,但无法控制添加哪些数据标签。我希望能够为馅饼的每个切片添加标签。任何人都可以提供有关如何做到这一点的任何见解吗?
下表的代码:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Resource', 'Percentage'],
['Video', 517],
['Download', 13],
['Tool', 13],
['Video and Download', 15],
['Video and Tool', 59],
['Download Video and Tool', 5]
]);
var options = {
title: '',
is3D: 'true',
colors: ['592C81', '799A3D', '863375', '5B5B5B', '004A97', 'B8BABD' ]
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>