chart two

author(s): Torstein Hønsi

by Brooke Henderson

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; max-width: 600px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'area',
        inverted: true
    },
    title: {
        text: 'Comparison of contribution frequency from the U.S. from 2012 to 2014'
    },
    subtitle: {
    text: 'Source: The USAID Foreign Assistance Database (FADB). For more information please visit: https://explorer.usaid.gov',
        style: {
            position: 'absolute',
            right: '0px',
            bottom: '10px'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'top',
        x: -150,
        y: 100,
        floating: true,
        borderWidth: 1,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    },
    xAxis: {
        categories: [
            'Church and Faith Based',
      'Enterprises',
      'Goverment',
      'Multilateral',
      'Networks',
      'NGO',
      'Public and Private Partnerships',
      'Universities and Research Institutes',
        ]
    },
    yAxis: {
        title: {
            text: 'Frequency of contributions'
        },
        labels: {
            formatter: function () {
                return this.value;
            }
        },
        min: 0
    },
    plotOptions: {
        area: {
            fillOpacity: 0.5
        }
    },
    series: [{
        name: '2012',
        data: [1082,21162,18010,4097,81,13562,41,1626]
    }, {
        name: '2013',
        data: [699,19713,17991,3015,139,12557,60,1529]
        },{
        name: '2014',
        data: [770,19034,16223,3086,155,13823,66,1741]       
        
    }]
});