Highcharts test tool

by Torstein Hønsi

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container"></div>

CSS

#container {
    min-width: 300px;
    max-width: 800px;
    height: 300px;
    margin: 1em auto;
}

JavaScript

const data = [1, 3, 4, -2, -4, 2, 4, -1];


Highcharts.chart('container', {
    chart: {
        type: 'pie'
    },
    plotOptions: {
        pie: {
            ignoreHiddenPoint: false,
            dataLabels: {
                enabled: false
            }
        }
    },
    series: [{
        data: data.map(value => ({
            y: Math.abs(value),
            visible: value > 0
        })),
        size: '100%',
        innerSize: '80%'
    }, {
        data: data.map(value => ({
            y: Math.abs(value),
            visible: value < 0
        })),
        size: '80%',
        innerSize: '80%'
    }]
});