Highcharts donut chart with a centered title.
Created
September 21, 2016 19:01
-
-
Save daemth/a0de6110b4f82f2e11026af49f426108 to your computer and use it in GitHub Desktop.
Highcharts donut chart with centered title
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function() { | |
var chart1 = new Highcharts.Chart({ | |
chart: { | |
type: 'pie', | |
renderTo: 'container' | |
}, | |
title: { | |
verticalAlign: 'middle', | |
floating: true, | |
text: 'CENTERED<br>TEXT' | |
}, | |
plotOptions: { | |
pie: { | |
innerSize: '90%' | |
} | |
}, | |
series: [{ | |
data: [ | |
['Firefox', 44.2], | |
['IE7', 26.6], | |
['IE6', 20], | |
['Chrome', 3.1], | |
['Other', 5.4] | |
] | |
}] | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.highcharts.com/highcharts.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a notice, that this doesn't work with smaller charts https://codepen.io/anon/pen/vrvydd