JSFiddle - React, Tailwind, and code Playground
by gorillawit
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/solid-gauge.src.js"></script>
<div class="bg">
<div id="container-speed"></div>
</div>
CSS
.bg{
width: 40rem;
height: 20rem;
margin: 0 auto;
background: pink;
}
#container-speed{
width: 100%;
height: 80%;
}
JavaScript
$(function () {
var gaugeOptions = {
chart: {
type: 'solidgauge'
},
title: null,
pane: {
center: ['50%', '90%'], //placement inside parent container (left/top)
size: '180%', //size of parent div
startAngle: -90, // -90 = left horizontal start
endAngle: 90, //90 = right horizontal end
background: {
backgroundColor: '#000', //bg mask bg color
innerRadius: '60%', //bg mask inner radius
outerRadius: '100%', //bg mask outer radius
shape: 'arc'
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
stops: [
[0.1, '#55BF3B'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
],
lineWidth: 0, //outer border
minorTickInterval: null,
tickPixelInterval: 400,
tickWidth: 0,
title: {
y: 30
},
labels: {
y: 16
}
},
plotOptions: {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
}
};
// The speed gauge
$('#container-speed').highcharts(Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: 200,
title: {
text: 'Rawley Rulez!!'
}
},
// turns off highcharts.com watermark
credits: {
enabled: false
},
series: [{
name: 'Speed',
data: [80],
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:25px;color:' +
((Highcharts.theme &&...