我可以为谷歌图表的传说添加自定义HTML吗?我想为每个部分添加额外的信息和图标,而不仅仅是文本。
我添加了这个jsFiddle示例
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Source', 'Amount given'],
['organic', 50],
['direct', 30],
['referral', 15],
['paid', 5]
]);
var options = {
pieHole: 0.6,
legend: 'labeled',
pieSliceTextStyle: {
color: '#fff',
},
pieSliceText: 'percentage',
slices: {0: {color: '#27ae60'},
1:{color:'#2980b9'},
2:{color:'#57C0E8'},
3: {color: 'bdc3c7'}}
};
var chart = new google.visualization.PieChart(document.getElementById('donut_single'));
chart.draw(data, options);
}