JSFiddle - React, Tailwind, and code Playground

by Olaf Berge

HTML

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script src="https://rawgithub.com/laff/technical-indicators/master/technical-indicators.src.js"></script>
<div id="container" style="min-width: 500x; height: 400px; margin: 0 auto"></div>

JavaScript

$(function() {
    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
        $('#container').highcharts('StockChart', {
    
            title : {
                text : 'Exponential moving average (EMA) of AAPL stock price'
            },
    
            subtitle: {
                text: 'From May 15, 2006 to May 10, 2013.'
            },
    
            xAxis: {
                type: 'datetime'
            },
    
            yAxis: {
                title : {
                    text : 'Price'
                }
            },
            tooltip: {
                crosshairs: true,
                shared: true
            },

			rangeSelector : {
				selected : 1
			},
            
            legend: {
                enabled: true,
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
                borderWidth: 0
            },
    
            plotOptions: {
                series: {
                    marker: {
                        enabled: false,
                    }
                }
            },
    
            series : [{
                name: 'AAPL Stock Price',
                type : 'line',
                id: 'primary',
                data : data
            }, {
                name: '15-day EMA',
                linkedTo: 'primary',
                showInLegend: true,
                type: 'trendline',
                algorithm: 'EMA',
                periods: 15
            }, {
                name: '40-day EMA',
                linkedTo: 'primary',
                showInLegend: true,
                type: 'trendline',
                algorithm: 'EMA',
                periods: 40
            }]
        });
    });
});