Highcharts Stock Demo

author(s): Torstein Hønsi

HTML

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

<script src="https://github.highcharts.com/highstock.js"></script>
<script type="text/javascript" src="https://www.highcharts.com/samples/data/three-series-1000-points.js"></script>

JavaScript

$(function () {
    $('#container').highcharts('StockChart', {

        rangeSelector: {
            selected: 4
        },

        plotOptions: {
            series: {
                dataGrouping: {
                    forced: true,
                    units: [
                        ['week', [1]]
                    ]
                }
            }
        },

        series: [{
            name: 'ADBE',
            data: ADBE,
            dataGrouping: {
                type: 'column'
            },
            tooltip: {
                valueDecimals: 2
            }
        }, {
            name: 'Data point count (confidence)',
            data: ADBE,
            dataGrouping: {
                approximation: function (arr) {
                    console.log(
                        'dataGroupInfo:',
                        this.dataGroupInfo,
                        'Raw data:',
                        this.options.data.slice(this.dataGroupInfo.start, this.dataGroupInfo.start + this.dataGroupInfo.length)
                    );
                    return this.dataGroupInfo.length;
                },
                forced: true
            },
            type: 'column'
        }]
    });
});