Highcharts Stock Demo

author(s): Torstein Hønsi

by HemalathaThanigaivel

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div id="container" style="height: 400px; min-width: 600px"></div>

<button id="button">Export chart</button>

<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="https://www.highcharts.com/samples/data/usdeur.js"></script>

JavaScript

var chart = Highcharts.stockChart('container', {

    rangeSelector: {
        selected: 1,
        inputBoxStyle: {
            right: '80px'
        },
        buttons: [{
    type: 'month',
    count: 1,
    text: '1m'
}, {
    type: 'month',
    count: 3,
    text: '3m'
}, {
    type: 'month',
    count: 6,
    text: '6m'
}, {
    type: 'ytd',
    text: 'YTD'
}, {
    type: 'year',
    count: 1,
    text: '12m'
}, {
    type: 'all',
    text: 'All'
}]
    },

    series: [{
        name: 'USD to EUR',
        data: usdeur
    }],

    exporting: {
        chartOptions: {
            chart: {
                width: 1024,
                height: 768
            }
        }
    }
});

$('#button').click(function () {
    chart.exportChart();
});