Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daemth/a0de6110b4f82f2e11026af49f426108 to your computer and use it in GitHub Desktop.
Save daemth/a0de6110b4f82f2e11026af49f426108 to your computer and use it in GitHub Desktop.
Highcharts donut chart with centered title

Highcharts donut chart with centered title

Highcharts donut chart with a centered title.

A Pen by thomas on CodePen.

License.

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]
]
}]
});
});
<script src="https://code.highcharts.com/highcharts.js"></script>
@kullarkert
Copy link

Just a notice, that this doesn't work with smaller charts https://codepen.io/anon/pen/vrvydd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment