Highcharts Demo
author(s): Torstein Hønsi
by Jawad Ameen
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>
<div id="container"></div>
CSS
#container {
margin: 0 auto;
max-width: 400px;
min-width: 380px;
}
JavaScript
// Uncomment to style it like Apple Watch
/*
if (!Highcharts.theme) {
Highcharts.setOptions({
chart: {
backgroundColor: 'black'
},
colors: ['#F62366', '#9DFF02', '#0CCDD6'],
title: {
style: {
color: 'silver'
}
},
tooltip: {
style: {
color: 'silver'
}
}
});
}
// */
/**
* In the chart render event, add icons on top of the circular shapes
*/
Highcharts.chart('container', {
chart: {
type: 'solidgauge',
height: '110%',
events: {
// render: renderIcons
}
},
title: {
text: 'Activity',
style: {
fontSize: '24px'
}
},
pane: {
startAngle: 0,
endAngle: 360,
background: [{ // Track for Move
outerRadius: '100%',
innerRadius: '76%',
backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[0])
.setOpacity(0.3)
.get(),
borderWidth: 0
}]
},
yAxis: {
min: 0,
max: 100,
lineWidth: 0,
tickPositions: []
},
plotOptions: {
solidgauge: {
dataLabels: {
enabled: true,
format: '<span style="font-size:4em; color: {point.color}; font-weight: bold">{point.y}%</span>',
borderWidth: 0,
useHTML: true,
verticalAlign: 'middle'
},
linecap: 'round',
stickyTracking: false,
rounded: true
}
},
series: [{
name: 'Move',
data: [{
color: Highcharts.getOptions().colors[0],
radius: '100%',
innerRadius: '76%',
y: 80
}]
}]
});