3

I developed a donut chart using highchart library. I need to include a label in the inner part of the donut.

Expected Result:

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]
            ]
        }]
    });
});

Fiddle can be found here: http://jsfiddle.net/ak9jK/

user3492795
  • 193
  • 5
  • 19

2 Answers2

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

AND at the end

},

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

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

Related questions:
Highcharts Donut Chart text in center change on hover
Place text in center of pie chart - Highcharts

Community
  • 1
  • 1
Ivan Chau
  • 1,403
  • 1
  • 18
  • 28
0

You can use Renderer which allows to add custom text.

Sebastian Bochan
  • 37,348
  • 3
  • 49
  • 75