(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 }, { "x": 0 } ], "columnTypes": [ "float", "float", "float", "float", "float", "float", "float" ], "csv": "Continent,Central Africa,Eastern Africa,Northern Africa,Southern Africa,Western Africa,World\n1960,40.6,41.7,45.5,46.1,36.8,52.5\n1961,41,42.2,46.2,46.5,37.2,53\n1962,41.4,42.6,46.9,46.9,37.5,53.5\n1963,41.8,43,47.6,47.3,37.9,54.1\n1964,42.2,43.4,48.4,47.7,38.3,54.9\n1965,42.7,43.8,49.1,48,38.6,55.7\n1966,43.1,44.2,49.8,48.4,39,56.7\n1967,43.6,44.6,50.5,48.8,39.4,57.5\n1968,44.1,44.9,51.1,49.2,39.9,58.2\n1969,44.6,45.3,51.8,49.6,40.3,58.9\n1970,45.1,45.7,52.5,50,40.8,59.5\n1971,45.6,46,53.1,50.4,41.3,60\n1972,46.1,46.4,53.8,50.9,41.9,60.4\n1973,46.6,46.7,54.4,51.4,42.4,60.7\n1974,47.1,47.1,55,51.8,43,61.1\n1975,47.5,47.4,55.7,52.3,43.5,61.4\n1976,48,47.8,56.3,52.8,44.1,61.8\n1977,48.4,48.2,57,53.2,44.7,62.1\n1978,48.8,48.5,57.8,53.7,45.3,62.4\n1979,49.2,48.8,58.5,54.1,45.9,62.7\n1980,49.6,49.2,59.2,54.5,46.4,62.9\n1981,50,49.5,60,54.9,46.9,63.2\n1982,50.3,49.8,60.7,55.2,47.5,63.5\n1983,50.6,50.1,61.4,55.5,47.9,63.8\n1984,50.9,50.3,62,55.8,48.4,64\n1985,51.1,50.4,62.6,56,48.8,64.3\n1986,51.3,50.5,63.1,56.2,49.2,64.6\n1987,51.5,50.4,63.6,56.4,49.5,64.8\n1988,51.6,50.3,64,56.5,49.8,65\n1989,51.7,50,64.5,56.5,50,65.3\n1990,51.8,49.8,65.2,56.4,50.3,65.5\n1991,51.8,49.6,65.5,56.2,50.4,65.7\n1992,51.8,49.6,65.8,55.8,50.6,65.9\n1993,51.7,49.7,66,55.2,50.7,66\n1994,51.7,50,66.3,54.5,50.8,66.2\n1995,51.6,50.5,66.6,53.6,50.8,66.4\n1996,51.6,51.1,66.8,52.6,50.9,66.7\n1997,51.5,51.7,67.1,51.6,51,66.9\n1998,51.5,52.2,67.4,50.5,51.1,67.2\n1999,51.5,52.8,67.7,49.5,51.3,67.4\n2000,51.6,53.3,68,48.7,51.5,67.7\n2001,51.8,53.8,68.3,48.1,51.7,68\n2002,52,54.3,68.6,47.9,52.1,68.3\n2003,52.3,54.9,68.8,48,52.6,68.5\n2004,52.7,55.5,69.2,48.5,53.1,68.8\n2005,53.1,56.2,69.5,49.2,53.7,69.1\n2006,53.6,56.9,69.8,50.1,54.3,69.4\n2007,54.1,57.7,70.2,51.2,54.9,69.7\n2008,54.7,58.4,70.4,52.3,55.5,69.9\n2009,55.2,59.2,70.7,53.4,56.1,70.2\n2010,55.8,59.9,71,54.4,56.7,70.5\n2011,56.3,60.5,71.1,55.3,57.2,70.7\n2012,56.8,61.2,71.2,56,57.6,71\n2013,57.3,61.8,71.3,56.7,58,71.2" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://app.everviz.com/show/ixiwaq'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-ixiwaq' }, 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: World Bank" }, "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 }, { "color": "#194e83", "marker": { "enabled": false }, "index": 5 } ], "subtitle": { "style": { "fontSize": "16px" }, "text": "Years expected to live" }, "title": { "style": { "fontSize": "20px" }, "text": "Life expectancy: Africa compared to the world" }, "chart": { "style": { "fontFamily": "Georgia" } } }; 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); } }());