(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,517372,57455\n1982,569179,206069\n1983,601516,278127\n1984,1753183,594828\n1985,1395935,624011\n1986,981564,692779\n1987,1639095,983415\n1988,3485108,2217243\n1989,3041525,1590718\n1990,2952468,1705067\n1991,2541974,1281694\n1992,3309292,2420556\n1993,3841827,1846483\n1994,4436926,1438186\n1995,4889889,1763532\n1996,5931362,2449578\n1997,6433932,3259534\n1998,6319550,4189692\n1999,6991188,5762295\n2000,7263948,7386516\n2001,7396661,5405511\n2002,8299235,3980824\n2003,9235030,4112428\n2004,11107921,5222594\n2005,13060239,6190030\n2006,14085765,6560006\n2007,13959350,7141830\n2008,13652591,6886892\n2009,14844068,4800465\n2010,18590449,4825855\n2011,16444863,4519320\n2012,18440400,6137808\n2013,16191588,5228334\n2014,17247942,5786052" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://cloud.highcharts.com/show/ydycype'; var encodedUrl = encodeURIComponent(shareUrl); Highcharts.setOptions({ "lang": { "thousandsSep": "," } }); var template = { chart: { renderTo: 'highcharts-ydycype' }, 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.01% 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); } }());