(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,69014,4386\n1982,69441,28274\n1983,99793,39040\n1984,262474,115533\n1985,308966,140727\n1986,186875,142682\n1987,322727,214267\n1988,509646,374287\n1989,507176,301763\n1990,488985,323066\n1991,392790,238660\n1992,441777,370935\n1993,454144,299279\n1994,555583,272472\n1995,643121,337040\n1996,733856,429970\n1997,867829,559164\n1998,841516,694269\n1999,895960,856563\n2000,901800,1092286\n2001,892298,881532\n2002,976757,712410\n2003,1030094,700868\n2004,1222320,819960\n2005,1464645,938331\n2006,1624277,1013900\n2007,1448968,1018472\n2008,1366973,938607\n2009,1240154,628432\n2010,1542750,660640\n2011,1585236,717859\n2012,1743421,862348\n2013,1529867,777311\n2014,1675173,863804" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://cloud.highcharts.com/show/yduvato'; var encodedUrl = encodeURIComponent(shareUrl); Highcharts.setOptions({ "lang": { "thousandsSep": "," } }); var template = { chart: { renderTo: 'highcharts-yduvato' }, 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.1%-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); } }());