Highcharts Demo
author(s):
Torstein Hønsi
by HemalathaThanigaivel
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-speed" style="width: 100%;"></div>
CSS
.highcharts-yaxis-grid .highcharts-grid-line {
// display: none;
}
JavaScript
function styleTickLines() {
var paths = $('.highcharts-axis > path').splice(0),
len = paths.length;
// hide first and last
paths[0].setAttribute('opacity', 0);
paths[len - 1].setAttribute('opacity', 0);
// style the rest
for (var i = 1; i < len - 1; i++) {
paths[i].setAttribute('stroke-dasharray', '3,3');
}
}
var gaugeOptions = {
chart: {
type: 'solidgauge',
backgroundColor: null,
events: {
load: styleTickLines,
redraw: styleTickLines
}
},
title: null,
pane: {
center: ['50%', '73%'],
size: '90%',
startAngle: -60,
endAngle: 60,
background: {
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#666',
innerRadius: '50%',
outerRadius: '100%',
shape: 'arc',
borderWidth:0
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
gridLineWidth : 0,
zIndex: 7,
stops: [
// [0.1, 'GoldenRod'], // green
// [0.7, '#55bf3b'], // yellow
// [0.9, 'Tomato'] // red
[0.1, 'lime'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
],
lineWidth: 0,
minorTickInterval: null,
tickPixelInterval: 400,
tickAmount: 2,
title: {
y: -115
},
labels: {
y: 25
},
tickWidth: 1,
tickLength: 90,
tickColor: '#fff',
tickPositions: [0,50],
},
plotOptions: {
solidgauge: {
innerRadius: '50%',
dataLabels: {
y: 0,
borderWidth: 0,
useHTML: true
}
}
}
};
// The speed gauge
var chartSpeed = Highcharts.chart('container-speed',...