(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 }, { "x": 0 } ], "columnTypes": [ "float", "float", "float" ], "csv": ",Capital,Labor\n1980,0,0\n1981,13300,-997\n1982,-457,885\n1983,12862,5909\n1984,45106,27994\n1985,56557,35209\n1986,50164,43644\n1987,82902,71068\n1988,108504,115390\n1989,126128,102435\n1990,119327,116626\n1991,102520,90754\n1992,122969,123296\n1993,127287,106618\n1994,153344,102964\n1995,174377,119478\n1996,188671,143400\n1997,212919,172221\n1998,221176,210243\n1999,239895,246241\n2000,234929,294602\n2001,217106,266730\n2002,250114,223555\n2003,262793,223654\n2004,309338,246195\n2005,346024,262269\n2006,391203,285083\n2007,352188,286688\n2008,327112,267460\n2009,300626,186840\n2010,349107,193120\n2011,363373,214516\n2012,397181,246607\n2013,372710,237832\n2014,402230,253824" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://cloud.highcharts.com/show/omojemu'; var encodedUrl = encodeURIComponent(shareUrl); Highcharts.setOptions({ "lang": { "thousandsSep": "," } }); var template = { chart: { renderTo: 'highcharts-omojemu' }, 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 = { "plotOptions": { "series": { "stacking": "normal" } }, "yAxis": { "title": { "text": "2014 Dollars" } }, "exporting": { "enabled": false }, "credits": { "href": "http://gabriel-zucman.eu/usdina/", "text": "Source: Piketty, Saez, Zucman (2016)", "position": { "x": 20, "y": -1, "align": "left" } }, "accessibility": { "enabled": false }, "legend": { "layout": "vertical", "verticalAlign": "top", "floating": true, "y": 31 }, "series": [ { "marker": { "symbol": "circle", "enabled": false }, "tooltip": { "valuePrefix": "$", "valueSuffix": null }, "index": 0 }, { "marker": { "symbol": "circle", "enabled": false }, "tooltip": { "valuePrefix": "$", "valueSuffix": null }, "index": 1 } ], "tooltip": { "shared": true }, "title": { "style": { "fontSize": "14px" }, "text": "Average Income Gains of Top 0.5%-0.1% by Income Type (1980-2014)" }, "chart": { "description": null, "type": "area" }, "colors": [ "#B31021", "#000000", "#696969", "#f7a35c", "#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1" ] }; 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 = '//cloud.highcharts.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); } }());