甜甜圈内心文字

时间:2014-05-06 09:53:01

标签: javascript jquery highcharts

我使用高图库开发了一个圆环图。我需要在甜甜圈的内部加一个标签。

预期结果:

enter image description here

JS:

$(function () {
    $('#container8').highcharts({
        chart: {
            type: 'pie',
            options3d: {
                enabled: false,
                alpha: 0
            }
        },
        colors: ['#081969', '#0e2569', '#1e3b81', '#284893', '#30509b'],
        title: {
            text: ''
        },tooltip: {
            enabled: false
        },
        plotOptions: {
            pie: {
                innerSize: 140,
                depth: 45
            }
        },
        series: [{
            name: 'Delivered amount',
            data: [
                ['56%', 56],
                ['44%', 44]
            ]
        }]
    });
});

可以在这里找到小提琴:http://jsfiddle.net/ak9jK/

2 个答案:

答案 0 :(得分:1)

title: {
        style: {
            fontSize: '48px',
            fontWeight: 'bold'
        },
        verticalAlign: 'middle'
    },

最后

},

function (chart) {
    chart.setTitle({
        text: chart.series[0].data[0].y + '%'
    });
});

DEMO http://jsfiddle.net/ak9jK/1/

相关问题:
Highcharts Donut Chart text in center change on hover
Place text in center of pie chart - Highcharts

答案 1 :(得分:0)

您可以使用Renderer来添加自定义文字。

相关问题