小编nbe*_*ing的帖子

使用谷歌图表在圆环饼图中心显示总数?

我是angularjs和谷歌排行榜的新手我现在想做一个饼图我想要跟随:

1- display total components inside the centre of the pie charts.
2- display pieSliceText outer side of the pie slice
Run Code Online (Sandbox Code Playgroud)

你可以看到这就是我想要的:在此输入图像描述

怎样才能完成我的示例代码:

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['corechart']}]}">                    </script>
<div id="piechart" style="width: 900px; height: 500px;"></div>
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

google.setOnLoadCallback(drawChart);
function drawChart() {

    var data = google.visualization.arrayToDataTable([
        ['Task', 'Hours per Day'],
        ['Work',     11],
        ['Eat',      2],
        ['Commute',  2],
        ['Watch TV', 2],
        ['Sleep',    7]
    ]);

    var options = {     
        height: 360,
        width: 360,
        pieHole: 0.5,
        showLables: 'true',
        pieSliceText: 'value',
        pieSliceTextStyle: {
            color: 'white',
            fontSize:18
        },
        legend: { …
Run Code Online (Sandbox Code Playgroud)

google-visualization

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

google-visualization ×1