Highstock Demo

author(s): Sebastian Bochan

by Jon Eyrick

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script src="https://code.highcharts.com/stock/indicators/indicators.js"></script>
<script src="https://code.highcharts.com/stock/indicators/zigzag.js"></script>


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

JavaScript

$.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?', function (data) {

    Highcharts.stockChart('container', {

        rangeSelector: {
            selected: 2
        },

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

        legend: {
            enabled: true
        },

        plotOptions: {
            series: {
                showInLegend: true
            }
        },

        series: [{
            type: 'ohlc',
            id: 'aapl',
            name: 'AAPL Stock Price',
            data: data
        }, {
            type: 'zigzag',
            linkedTo: 'aapl'
        }, {
            type: 'zigzag',
            name: 'Zig Zag (5%)',
            linkedTo: 'aapl',
            params: {
                deviation: 5
            }
        }]
    });
});