Highcharts Demo

author(s): Torstein Hønsi

by sgearhart2

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'pie'
    },
    title: {
        text: 'Browser market shares in January, 2018'
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
    subtitle: {
    	align: 'center',
      verticalAlign: 'middle',
      style: {
      	textAnchor: 'middle'
      },
      text : 'Total<br>12,165<br>MWh'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            center: ['50%', '50%'],
            dataLabels: {
                enabled: true,
                format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                style: {
                    color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                }
            }
        }
    },
    series: [{
        name: 'Brands',
        colorByPoint: true,
        innerSize: '55%',
        data: [{
            name: 'Chrome',
            y: 61.41,
            sliced: false,
            selected: false
        }, {
            name: 'Internet Explorer',
            y: 11.84
        }, {
            name: 'Firefox',
            y: 10.85
        }, {
            name: 'Edge',
            y: 4.67
        }, {
            name: 'Safari',
            y: 4.18
        }, {
            name: 'Sogou Explorer',
            y: 1.64
        }, {
            name: 'Opera',
            y: 1.6
        }, {
            name: 'QQ',
            y: 1.2
        }, {
            name: 'Other',
            y: 2.61
        }]
    }]
},
function (chart) { 
		//console.log(chart.subtitle);
   /* var renderer = chart.renderer;
renderer.createElement('tspan').add(renderer.defs).attr({
            id: 'tLabel',
            x: '50%'
          },'Total').add(chart.subtitle);
renderer.createElement('tspan').add(renderer.defs).attr({
            id: 'tValue',
       ...