JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>

JavaScript

$(function () {
    var UNDEFINED,
        gInfo;
    $('#container').highcharts('StockChart', {
        plotOptions: {
            series: {
                dataGrouping: {
                    approximation: function (arr) {
                        // first time or point precalculated
                        if (!gInfo || gInfo.nextPoint) {
                            // first time return first value (arr[0])
                            var point = gInfo ? gInfo.nextPoint : arr[0];
                            // save current data to the next iteration    
                            gInfo = {
                                prev: arr,
                                nextPoint: null
                            };
                            return point;
                        } else {
                            var prev = gInfo.prev,
                                // concat current group with the previous one
                                data = prev.concat(arr),
                                // get min, max and their positions        
                                min = Math.min.apply(null, data),
                                max = Math.max.apply(null, data),
                                minIdx = data.indexOf(min),
                                maxIdx = data.indexOf(max),
                                // order min and max
                                aprox = minIdx < maxIdx ? [min, max] : [max, min];
                            // save next aproximation and return current
                            console.log(minIdx, maxIdx);
                            gInfo.nextPoint = aprox[1];
                            console.log(aprox[0]);
                            return aprox[0];
                        }
                    }
                }
            }
        },

        series: [{
            data: (function () {
                var tab = [],
                    i = 1e4;
                while (i--) {
                    tab.push(i %...