JSFiddle - React, Tailwind, and code Playground

by Tirthadeep Roy

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="http://code.highcharts.com/modules/broken-axis.js"></script>

<button id = "startButton">Start</button>
<button id = "pauseButton">Pause</button>
<button id = "clearButton">Clear</button><hr/>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {
    $(document).ready(function () {
        Highcharts.setOptions({
            global: {
                useUTC: false
            }
        });       
        $('#container').highcharts({
            chart: {
                type: 'spline',
                animation: Highcharts.svg, // don't animate in old IE
                marginRight: 10, 
                zoomType: 'x',
                panning: true,
                panKey: 'shift'
            },
            title: {
                text: 'Testing Axis.breaks'
            },
            xAxis: {
                type: 'datetime',
            },
            yAxis: {
                title: {
                    text: 'Value'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                formatter: function () {
                    return '<b>' + this.series.name + '</b><br/>' +
                        Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
                        Highcharts.numberFormat(this.y, 2);
                }
            },
            legend: {
                enabled: false
            },
            exporting: {
                enabled: false
            },
            series: [{
                name: 'Random data',
                data: []
            }]
        });
        var chart = $('#container').highcharts();
        var chartUpdateFunc;
        var lastPointBeforeStop;
        var x,y;
         $('#startButton').click(function() {
             var series = chart.series[0];
             chartUpdateFunc = setInterval(function () {
                 x = (new Date()).getTime(); // current time
                 y = Math.random();               
                 series.addPoint([x, y], false, false);
                 console.log("lastPointBeforeStop",lastPointBeforeStop);
                ...