(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
function parseData(completeHandler, chartOptions) {
try {
var dataOptions = {
"seriesMapping": [
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
}
],
"columnTypes": [
"float",
"float",
"float",
"float",
"float",
"float"
],
"csv": "Continent,Africa,Asia,Europe,Latin America and the Caribbean,Northern America\n2015,1186178,4393296,738442,634387,357838\n2016,1216130,4436224,738849,641029,360529\n2017,1246505,4478315,739208,647565,363224\n2018,1277292,4519452,739495,653991,365918\n2019,1308492,4559518,739676,660304,368602\n2020,1340103,4598426,739725,666502,371269\n2021,1372113,4636105,739638,672581,373918\n2022,1404512,4672534,739424,678534,376550\n2023,1437315,4707739,739088,684357,379159\n2024,1470542,4741781,738640,690042,381736\n2025,1504213,4774708,738090,695584,384274\n2026,1538328,4806518,737439,700980,386771\n2027,1572883,4837199,736691,706226,389224\n2028,1607889,4866784,735851,711323,391630\n2029,1643359,4895316,734928,716269,393983\n2030,1679301,4922830,733929,721067,396278\n2031,1715713,4949340,732860,725712,398514\n2032,1752587,4974853,731725,730205,400691\n2033,1789919,4999378,730536,734543,402812\n2034,1827701,5022921,729304,738724,404882\n2035,1865922,5045488,728037,742747,406905\n2036,1904572,5067085,726741,746611,408883\n2037,1943637,5087717,725420,750316,410817\n2038,1983089,5107387,724079,753862,412707\n2039,2022896,5126098,722723,757251,414556\n2040,2063030,5143850,721355,760484,416364\n2041,2103470,5160648,719980,763561,418135\n2042,2144198,5176486,718596,766481,419870\n2043,2185190,5191345,717201,769246,421576\n2044,2226417,5205201,715789,771854,423261\n2045,2267856,5218033,714355,774305,424930\n2046,2309484,5229837,712899,776600,426589\n2047,2351284,5240617,711421,778740,428236\n2048,2393237,5250375,709915,780727,429874\n2049,2435326,5259117,708374,782562,431500\n2050,2477536,5266848,706793,784247,433114\n2051,2519848,5273583,705171,785785,434716\n2052,2562245,5279326,703509,787174,436311\n2053,2604708,5284069,701809,788415,437901\n2054,2647223,5287799,700070,789507,439493\n2055,2689773,5290517,698296,790450,441089\n2056,2732342,5292235,696489,791244,442692\n2057,2774913,5292989,694653,791892,444300\n2058,2817473,5292830,692792,792393,445913\n2059,2860007,5291824,690915,792748,447529\n2060,2902500,5290030,689029,792959,449146\n2061,2944937,5287477,687137,793028,450764\n2062,2987302,5284197,685247,792955,452381\n2063,3029583,5280251,683369,792744,453996\n2064,3071767,5275709,681517,792397,455603\n2065,3113841,5270626,679703,791917,457200\n2066,3155790,5265044,677932,791307,458784\n2067,3197597,5258982,676209,790570,460355\n2068,3239243,5252447,674538,789709,461909\n2069,3280706,5245437,672925,788728,463444\n2070,3321968,5237953,671372,787631,464959\n2071,3363012,5230016,669884,786422,466450\n2072,3403820,5221650,668462,785104,467918\n2073,3444372,5212866,667106,783681,469361\n2074,3484648,5203675,665816,782161,470777\n2075,3524628,5194087,664591,780546,472164\n2076,3564294,5184122,663431,778842,473523\n2077,3603632,5173802,662334,777052,474853\n2078,3642623,5163138,661298,775179,476155\n2079,3681249,5152143,660321,773228,477430\n2080,3719492,5140834,659399,771201,478681\n2081,3757336,5129225,658530,769102,479908\n2082,3794768,5117346,657710,766936,481111\n2083,3831781,5105244,656932,764708,482293\n2084,3868370,5092972,656190,762424,483455\n2085,3904528,5080577,655475,760090,484602\n2086,3940245,5068080,654785,757709,485732\n2087,3975507,5055495,654115,755286,486848\n2088,4010296,5042851,653461,752822,487950\n2089,4044591,5030175,652815,750320,489038\n2090,4078374,5017487,652175,747781,490113\n2091,4111635,5004798,651535,745210,491175\n2092,4144365,4992105,650894,742611,492225\n2093,4176561,4979400,650250,739986,493263\n2094,4208220,4966668,649602,737341,494288\n2095,4239338,4953893,648950,734679,495300\n2096,4269910,4941056,648291,732003,496298\n2097,4299931,4928135,647625,729318,497283\n2098,4329391,4915111,646952,726625,498252\n2099,4358282,4901958,646270,723926,499206\n2100,4386591,4888653,645577,721224,500143"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'https://app.everviz.com/show/igoreq';
var encodedUrl = encodeURIComponent(shareUrl);
var template = {
chart: {
renderTo: 'highcharts-igoreq'
},
navigation: {
menuItemStyle: {
fontFamily: Highcharts.SVGRenderer.prototype.getStyle().fontFamily,
padding: '2px 10px'
}
},
exporting: {
buttons: {
contextButton: {
menuItems: [{
text: '' +
'Share on Facebook'
}, {
text: '' +
'Share on Google+'
}, {
text: '' +
'Share on Twitter'
}, {
text: '' +
'Share on LinkedIn'
}, {
separator: true
}]
.concat(Highcharts.getOptions().exporting.buttons.contextButton.menuItems)
.concat([{
separator: true
}, {
text: '' + 'Edit chart'
}, {
text: '' + 'Create chart'
}])
}
}
}
};
var chartOptions = {
"yAxis": {
"title": {
"text": null
}
},
"exporting": {
"enabled": false
},
"credits": {
"href": null,
"text": "Source: UN"
},
"legend": {
"itemStyle": {
"fontSize": "13px"
}
},
"series": [
{
"color": "#9e0b0f",
"marker": {
"enabled": false
},
"index": 0
},
{
"color": "#000000",
"marker": {
"enabled": false
},
"index": 1
},
{
"color": "#e0671e",
"marker": {
"enabled": false
},
"index": 2
},
{
"color": "#00afad",
"marker": {
"enabled": false
},
"index": 3
},
{
"color": "#b0a8a6",
"marker": {
"enabled": false
},
"index": 4
}
],
"subtitle": {
"style": {
"fontSize": "16px"
},
"text": "People (000s)"
},
"title": {
"style": {
"fontSize": "20px"
},
"text": "Continent populations: The rise of Africa"
},
"chart": {
"style": {
"fontFamily": "Georgia"
},
"type": "spline"
}
};
parseData(function (dataOptions) {
// Merge series configs
if (chartOptions.series && dataOptions) {
Highcharts.each(chartOptions.series, function (series, i) {
chartOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]);
});
}
var options = Highcharts.merge(dataOptions, chartOptions, template);
var chart = new Highcharts['Chart'](options);
}, chartOptions);
}
// Load the Highcharts script if undefined, and add the chart
if (typeof Highcharts !== 'undefined') {
addChart();
} else if (script) {
script.deferredCharts.push(addChart);
} else {
script = document.createElement('script');
script.id = 'highcharts-script';
script.src = '//app.everviz.com/resources/js/highstock-cloud-5.0.7.js';
script.type = 'text/javascript';
script.deferredCharts = [addChart];
script.onload = function () {
// Prevent double firing of event in IE9/IE10
if (!script.chartsAdded) {
script.chartsAdded = true;
while(script.deferredCharts.length) {
script.deferredCharts.shift()();
}
}
};
script.onreadystatechange = function() {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
script.onload();
}
};
document.getElementsByTagName('head')[0].appendChild(script);
}
}());