1
我正在使用谷歌饼图,我想要显示百分比值,但它不是那样显示。任何人,建议我一个想法来显示四舍五入的百分比值。我的代码看起来像我想谷歌饼图显示pieSliceText被舍入整数
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Members', 'Total Members'],
['Members', 23],
['Total Members', 41 - 23]
]);
var options = {
width: 150,
height: 150,
chartArea: {
width: 150,
height: 150,
left: 10},
legend: {position: 'none'},
tooltip: {trigger: 'none'},
colors: ['#FEC240', '#FFFFFF'],
pieSliceText: 'percentage',
pieSliceTextStyle: {
bold: true,
fontSize: 16,
color: 'black'
},
enableInteractivity: false,
pieSliceBorderColor: "#DFE0E1"
};
var chart = new
google.visualization.PieChart(document.getElementById('checkpie'));
chart.draw(data, options);
<div id="checkpie" ></div>