Highcharts Demo

author(s): Torstein Hønsi

by Alagar Kamuthurai

HTML

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

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

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'area'
    },
    title: {
        text: 'Test data'
    },
    xAxis: {
        allowDecimals: false,
        tickInterval: 1,
        labels: {
            formatter: function () {
                return this.value; // clean, unformatted number for year
            }
        }
    },
    yAxis: {
        title: {
            text: 'Nuclear weapon states'
        },
        labels: {
            formatter: function () {
                return this.value / 1000 + 'k';
            }
        }
    },
    tooltip: {
        pointFormat: '{series.name} produced <b>{point.y:,.0f}</b><br/>warheads in {point.x}'
    },
    plotOptions: {
        area: {
            marker: {
                enabled: false,
                symbol: 'circle',
                radius: 2,
                states: {
                    hover: {
                        enabled: true
                    }
                }
            }
        }
    }, plotOptions: {
        series: {
             pointStart: 7 // by default
        }
    },
    series: [{
        name: 'USA',
        data: [
            {x:0,y:20000}, {x:1,y:19000}, {x:2,y:19000}, {x:3,y:18000},{x:4,y:17000}, {x:5,y:16000}, {x:6,y:15000}, {x:7,y:14000}]
    }, {
        name: 'USSR/Russia',
        data: [
             {x:8,y:13000}, {x:9,y:12000}, {x:10,y:11000}, {x:11,y:10000}]
    }]
});