line chart trend

author(s): Mustapha Mekhatria

by mustapha mekhatria

HTML

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

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

CSS

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

JavaScript

Highcharts.chart('container', {

  title: {
    text: 'World population and extreme poverty (1820-2015)'
  },

  subtitle: {
    text: 'Source:ourworldindata.org'
  },
  xAxis: {
    categories: [1820, 1850, 1870, 1890, 1910, 1929, 1950, 1960, 1970, 1981, 1984, 1987, 1990, 1993, 1996, 1999, 2002, 2005, 2008, 2010, 2011, 2012, 2015],
  },

  yAxis: {
    title: {
      text: 'Number of Employees'
    },
    labels: {
      format: '{value} million',

    },
  },
  tooltip: {
    shared: true,
    valueSuffix: ' million'
  },

  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },

  series: [{
      name: 'Number of people living in extreme poverty',
      color: '#ff1744',
      data: [1021.75, 1167.98, 1253.75, 1334.53, 1442, 1552.14, 1811.88, 1945.72, 2218.39, 1986.38, 1946.29, 1860.49, 1959.8, 1937.82, 1731.82, 1759.11, 1651.62, 1363.91, 1261.44, 1127.47, 990.3, 903.51, 705.55],
    },{
      name: 'Number of people not in extreme poverty',
      color: '#00e676',
      data: [60.61, 94.7, 145.52, 222.68, 308, 492.84, 708.12, 1080.28, 1472.78, 2532.22, 2819.36, 3173.31, 3349.87, 3632.23, 4083.57, 4290.1, 4630.68, 5155.73, 5502.3, 5802.26, 6023.13, 6193.99, 6643.92],
    }
  ]

});