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>
<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">The following chart demonstrates a chart that animates quickly and is hidden from a screen reader.
        If you pause the data, the Accessibility module is enabled and you are able to explore the data.</p>
</figure>
<button id="toggle">Start animating</button>

JavaScript

Highcharts.chart('container', {
    title: {
        text: 'Dynamic data'
    },
    subtitle: {
        text: 'Click button to animate or explore chart'
    },
    accessibility: {
        enabled: false
    },
    tooltip: {
        dateTimeLabelFormats: {
            day: '%H:%M',
            hour: '%H:%M'
        }
    },
    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            day: '%H:%M',
            hour: '%H:%M'
        }
    },
    plotOptions: {
        series: {
            pointStart: 0,
            pointInterval: 1000 * 60 * 60
        }
    },
    series: [{
        name: 'Random data',
        data: [1, 3, 4, 6, 7, 5, 3, 4, 8, 9, 7, 6, 4, 3]
    }]
});