JSFiddle - React, Tailwind, and code Playground

by hfrntt

HTML

<script type="text/javascript" src="http://www.highcharts.com/js/testing-stock-exporting.js"></script>

<div id="container" style="height: 500px; min-width: 500px"></div>

JavaScript

$(function() {

    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
        // Create the chart
        window.chart = new Highcharts.StockChart({
            chart: {
                renderTo: 'container'
            },

            rangeSelector: {
                selected: 1
            },

            title: {
                text: 'AAPL Stock Price'
            },

            xAxis: {
                minPadding: 0,
                // Ticks in binary positions
                tickPositioner: function(min, max) {

                    var pos, tickPositions = [],
                        tickStart = 333;

                    for (pos = tickStart; pos <= 555; pos += 111) {
                        tickPositions.push(pos);
                    }
                    return tickPositions;

                },
                // Only show labels where there is room for them
                labels: {
                    formatter: function() {
                        if (this.value > 8 || this.value == 2) {
                            return this.value;
                        }
                    }
                }

            },

            series: [{
                name: 'AAPL',
                data: data,
                tooltip: {
                    yDecimals: 2
                }}]
        });
    });

});