Highcharts Demo

author(s): Torstein Hønsi

by ewolden

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>


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

JavaScript

//Setting thousands seperator first:
Highcharts.setOptions({lang: {thousandsSep: ','}})


$.getJSON('https://www.highcharts.com/samples/data/aapl-ohlc.json', function (data) {
	for(let i = 0; i < data.length; i++){
  	data[i][1] = data[i][1] * 1000
    data[i][2] = data[i][2] * 1000
    data[i][3] = data[i][3] * 1000
    data[i][4] = data[i][4] * 1000
  }

    // create the chart
    Highcharts.stockChart('container', {

				
        rangeSelector: {
            selected: 2
        },

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

        series: [{
            type: 'ohlc',
            name: 'AAPL Stock Price',
            data: data,
            dataGrouping: {
                units: [[
                    'week', // unit name
                    [1] // allowed multiples
                ], [
                    'month',
                    [1, 2, 3, 4, 6]
                ]]
            }
        }]
    });
});