Chapter 3: Simulating a Projection Chart (1)

Projection part only - (Dashed line)

by JoeKuan

HTML

<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<body>
<div style="margin: 5px 60px 5px 5px; " id='container'></div>
</body>

JavaScript

$(document).ready(function() {
        var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                spacingBottom: 30,
                backgroundColor: '#EAEAEA'
             
            },
            title: {
                text: 'Population ages 65 and over (% of total) - Japan ',
                margin: 40,
                align: 'right',
                style: {
                   fontFamily: 'palatino'
                }
            },
            credits: { 
               position: {
                  align: 'left',
                  x: 20
               },
               text: 'Data from The World Bank'
            },
            yAxis: {
                title: {
                    text: '(%)',
                    rotation: 0,
                    x: 10,
                    y: 5,
                    align: 'high'
                },
                opposite: true,
                gridLineWidth: 0,
                lineWidth: 1,
            },
            xAxis: {
                allowDecimals: false,
                labels: {
                    // To avoid calling Highcharts.numberFormat
                    formatter: function() {
                        return this.value;
                    }
                },
                lineColor: '#CC2929',
                lineWidth: 4,
                tickWidth: 0,
                offset: 2
            },
            plotOptions: {
                series: {
                  marker: {
                     enabled: true,
                     radius: 0,
                  }
                }
            },
            series: [{
                name: 'project data',
                type: 'spline',
                showInLegend: false, 
                lineColor: '#145252',
                pointStart: 1980,
                dashStyle: 'Dash',

                data: [ [ 2010, 23 ], 
                        [ 2011, 22.8 ], [ 2012, 23.6 ], [ 2013, 24.4 ], [ 2014, 25.3...