JSFiddle - React, Tailwind, and code Playground

by Torstein Hønsi

HTML

<script src="http://github.highcharts.com/fa07d08fa93a/highcharts.js"></script>
<script src="http://github.highcharts.com/fa07d08fa93a/highcharts-more.js"></script>
<script src="http://github.highcharts.com/fa07d08fa93a/modules/solid-gauge.js"></script>

<div style="width: 600px; height: 400px; margin: 0 auto">
    <div id="container" style="width: 600px; height: 500px; float: left"></div>
</div>

JavaScript

$(function() {

    var chart = Highcharts.chart('container', {

        chart: {
            type: 'solidgauge'
        },

        title: null,

        pane: {
            center: ['50%', '50%'],
            size: '90%',
            startAngle: -140,
            endAngle: 140,
            background: {
                backgroundColor: '#EEE',
                innerRadius: '80%',
                outerRadius: '100%',
                shape: 'arc'
            }
        },

        tooltip: {
            enabled: false
        },

        xAxis: {
            labels: {
                enabled: true
            }
        },

        // the value axis
        yAxis: {

            min: -4,
            max: 4,
            title: {
                text: 'Loss'
            },
            lineWidth: 1,
            tickAmount: 2,
            zIndex: 4,
            title: {
                y: 50
            },
            labels: {
                y: 20,
                distance: 0.5
            },
            stops: [
                [0.4999, '#55BF3B'], // green
                [0.5, '#DF5353'] // red
            ],
            plotBands: [{
                color: '#55BF3B', // Color value
                from: -4, // Start of the plot band
                to: 0,
                outerRadius: "78%"
            }, {
                color: '#DF5353', // Color value
                from: 0, // Start of the plot band
                to: 4,
                outerRadius: "78%"
            }]
        },

        plotOptions: {
            solidgauge: {
                dataLabels: {
                    y: 5,
                    borderWidth: 0,
                    useHTML: true
                },
                innerRadius: "80%"
            }
        },

        credits: {
            enabled: false
        },

        series: [{
            name: 'Svinn',
            data: [-0.5],
            threshold: 0,
            dataLabels: {
                format: '<div...