JSFiddle - React, Tailwind, and code Playground

by navindian

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: 600px"></div>

JavaScript

$(function() {
    var seriesOptions = [],
        yAxisOptions = [],
        seriesCounter = 0,
        names = ['MSFT', 'AAPL', 'GOOG'],
        colors = Highcharts.getOptions().colors;
        markersData= [{
               name: 'Messages800',
            data: [[1325412416000, 800], [1354356416000, 800]],
            id: 'Messages800'},
            },
            // the event marker flags
            {
                type : 'flags',
                data : [{
                x: new Date(parseInt("1330415928000")),
                    title : 'H',
                    text : 'Euro Contained by Channel Resistance'
                }],
                onSeries : 'dataseries',
                shape : 'circlepin',
                width : 16
            }]
    $.each(names, function(i, name) {

        $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename='+ name.toLowerCase() +'-c.json&callback=?',    function(data) {

            seriesOptions[i] = {
                name: name,
                data: data
            };

            // As we're loading the data asynchronously, we don't know what order it will arrive. So
            // we keep a counter and create the chart when all the data is loaded.
            seriesCounter++;

            if (seriesCounter == names.length) {
                seriesOptions[names.length] = markersData;
                createChart();
            }
        });
    });



    // create the chart when all data is loaded
    function createChart() {

        chart = new Highcharts.StockChart({
            chart: {
                renderTo: 'container'
            },

          
         
            
           
            
           
            
            series: seriesOptions
        });
    }

});