JSFiddle - React, Tailwind, and code Playground

by maritavindedal

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<div id="container"></div>

JavaScript

const chart = Highcharts.chart('container', {
    accessibility: {
        enabled: true
    },
    chart: {
        type: 'column'
    },
    title: {
        text: 'Major trophies for some English teams',
        align: 'left'
    },
    xAxis: {
        categories: ['Arsenal', 'Chelsea', 'Liverpool', 'Manchester United']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Count trophies'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: (
                    Highcharts.defaultOptions.title.style &&
                    Highcharts.defaultOptions.title.style.color
                ) || 'gray',
                textOutline: 'none'
            }
        }
    },
    legend: {
        align: 'left',
        x: 70,
        verticalAlign: 'top',
        y: 70,
        floating: true,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        headerFormat: '<b>{point.x}</b><br/>',
        pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true
            }
        }
    },
    series: [{
        name: 'BPL',
        data: [3, 5, 1, null]
    }, {
        name: 'FA Cup',
        data: [null, 8, 8, 12]
    }, {
        name: 'CL',
        data: [2, 2, null, 3]
    }]
});

const CustomComponent = function (chart) {
    this.initBase(chart);
};

CustomComponent.prototype = new Highcharts.AccessibilityComponent();

Highcharts.extend(CustomComponent.prototype, {
    getKeyboardNavigation: function () {
        const keys = this.keyCodes;
        const chart = this.chart;
        let currentSeriesIndex = 0;
        let currentPointIndex = 0;

        const findNextValidPoint =...