JSFiddle - React, Tailwind, and code Playground

by pepperdigital

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: 500px; min-width: 500px"></div>

JavaScript

$(function() {
    $.getJSON('https://demo-live-data.highcharts.com/aapl-ohlcv.json', function(data) {

        // split the data set into ohlc and volume
        var ohlc = [],
            volume = [],
            otherData = [],
            dataLength = data.length;
            
    for (i; i < dataLength; i += 1) {
        ohlc.push([
            data[i][0], // the date
            data[i][1], // open

        ]);

        volume.push([
            data[i][0], // the date
            data[i][5] // the volume
        ]);
    }

        // set the allowed units for data grouping
        var groupingUnits = [[
            'week',                         // unit name
            [1]                             // allowed multiples
        ], [
            'month',
            [1, 2, 3, 4, 6]
        ]];

        // create the chart
        chart = new Highcharts.chart({
            chart: {
                renderTo: 'container',
                alignTicks: true
            },

            rangeSelector: {
                selected: 1
            },

            title: {
                text: 'AAPL Historical'
            },

            yAxis: [{
                title: {
                    text: 'OHLC'
                },
                lineWidth: 2,
                height: 200
            }, {
                title: {
                    text: 'Other data panel'
                },
                opposite: true,
                lineWidth: 2,
                height: 200
            }, {
                title: {
                    text: 'Difference'
                },
                top: 300,
                height: 100,
                offset: 0,
                lineWidth: 2
            }],
            
            navigator: {
                enabled: true
            },
            
            series: [{
                type: 'line',
                name: 'AAPL',
                data: ohlc,
                yAxis: 1,
                dataGrouping: {
           ...