Highcharts Demo

author(s): Torstein Hønsi

by pepperdigital

HTML

<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/highcharts-more.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>

<div id="container"></div>

CSS

#container {
    min-width: 310px;
    max-width: 800px;
    height: 400px;
    margin: 0 auto;
}

JavaScript

(async () => {

    // Load the dataset
    const data = await fetch(
        'https://cdn.jsdelivr.net/gh/highcharts/[email protected]/samples/data/range.json'
    ).then(response => response.json());

    Highcharts.stockChart('container', {

        chart: {
            type: 'arearange'
        },

        rangeSelector: {
            allButtonsEnabled: false
        },

        title: {
            text: 'Temperature variation by day'
        },

        subtitle: {
            text: 'Demo of all buttons enabled. Even though "YTD" and "1y" ' +
                'don\'t apply since we\'re<br>only showing values within one ' +
                'year, they are enabled to allow dynamic interaction'
        },

        tooltip: {
            valueSuffix: '°C'
        },

        series: [{
            name: 'Temperatures',
            data: data
        }]

    });

})();