Semi-circle pie chart
author(s):
Øystein Moseng
by oysteinmoseng
October 12, 2021
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>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/themes/high-contrast-light.js"></script>
<h1>Semi-circle pie chart</h1>
<h2>Chart</h2>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Semi-circle pie chart with labels overlaying slices. These are often seen in dashboards.
</p>
</figure>
<h2>CSV data</h2>
<pre id="csv"></pre>
CSS
body {
font-family: Verdana, sans-serif;
padding-left: 10px;
}
h2 {
font-size: 1.3rem;
margin-left: 10px;
margin-bottom: 0;
margin-top: 1.5rem;
}
pre {
margin-left: 1rem;
border: 1px solid #cde;
max-width: 600px;
padding: 10px;
background-color: #f9f9f9;
border-radius: 10px;
}
#container {
height: 400px;
}
.highcharts-figure, .highcharts-data-table table {
min-width: 320px;
max-width: 600px;
margin: 1em;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
input[type="number"] {
min-width: 50px;
}
JavaScript
var colors = Highcharts.getOptions().colors;
var chart = Highcharts.chart('container', {
chart: {
type: 'pie'
},
title: {
text: 'Browser<br>shares<br>2018',
align: 'center',
verticalAlign: 'middle',
y: 90
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
distance: -50,
style: {
fontWeight: 'bold',
color: 'white'
}
},
startAngle: -90,
endAngle: 90,
center: ['50%', '85%'],
size: '130%',
innerSize: '50%'
}
},
series: [{
name: 'Market share',
colorByPoint: true,
data: [{
name: 'Chrome',
y: 61.41
}, {
name: 'Internet Explorer',
y: 11.84
}, {
name: 'Firefox',
y: 10.85
}, {
name: 'Edge',
y: 4.67
}, {
name: 'Safari',
y: 4.18,
color: colors[8]
}, {
name: 'Other',
y: 7.05,
color: colors[4]
}]
}]
});
var csv = chart.getCSV();
document.getElementById('csv').innerHTML = csv;