Highcharts Demo
author(s):
Torstein Hønsi
by Danielle Parkinson
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 style="width: 600px; height: 400px; margin: 0 auto">
<div id="container-speed" style="width: 300px; height: 200px; float: left"></div>
<div id="container-rpm" style="width: 300px; height: 200px; float: left"></div>
</div>
CSS
.highcharts-yaxis-grid .highcharts-grid-line {
display: none;
}
JavaScript
var gaugeOptions = {
chart: {
type: 'solidgauge',
backgroundColor: '#201f2d',
},
title: null,
pane: {
center: ['50%', '85%'],
size: '140%',
startAngle: -90,
endAngle: 90,
background: {
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
stops: [
[0.1, '#bc204b'], // green
[0.5, '#bc204b'], // yellow
[0.9, '#bc204b'] // red
],
lineWidth: 0,
minorTickInterval: null,
tickAmount: 2,
title: {
y: -70
},
labels: {
y: 16
}
},
plotOptions: {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
}
};
// The RPM gauge
var chartRpm = Highcharts.chart('container-rpm', Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: 5,
title: {
text: ''
}
},
series: [{
name: 'RPM',
data: [5],
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:24px;color:' +
((Highcharts.theme && Highcharts.theme.contrastTextColor) || '#201f2d') + '">{y:.1f}</span><br/>'
},
tooltip: {
valueSuffix: ' '
}
}]
}));