(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 } ], "columnTypes": [ "float", "float" ], "csv": "Year,Capital Income (Trillions)\n1913,0.19\n1914,0.18\n1915,0.19\n1916,0.23\n1917,0.23\n1918,0.23\n1919,0.23\n1920,0.22\n1921,0.21\n1922,0.22\n1923,0.27\n1924,0.27\n1925,0.29\n1926,0.32\n1927,0.3\n1928,0.31\n1929,0.34\n1930,0.3\n1931,0.26\n1932,0.21\n1933,0.2\n1934,0.23\n1935,0.26\n1936,0.3\n1937,0.31\n1938,0.29\n1939,0.32\n1940,0.37\n1941,0.46\n1942,0.52\n1943,0.58\n1944,0.58\n1945,0.53\n1946,0.47\n1947,0.49\n1948,0.55\n1949,0.54\n1950,0.62\n1951,0.65\n1952,0.65\n1953,0.67\n1954,0.68\n1955,0.77\n1956,0.77\n1957,0.77\n1958,0.74\n1959,0.85\n1960,0.86\n1961,0.89\n1962,0.97\n1963,1.03\n1964,1.1\n1965,1.19\n1966,1.23\n1967,1.23\n1968,1.27\n1969,1.26\n1970,1.22\n1971,1.3\n1972,1.38\n1973,1.47\n1974,1.41\n1975,1.43\n1976,1.54\n1977,1.64\n1978,1.73\n1979,1.72\n1980,1.65\n1981,1.77\n1982,1.75\n1983,1.87\n1984,2.1\n1985,2.14\n1986,2.09\n1987,2.18\n1988,2.31\n1989,2.37\n1990,2.36\n1991,2.37\n1992,2.43\n1993,2.49\n1994,2.69\n1995,2.86\n1996,3\n1997,3.13\n1998,3.14\n1999,3.17\n2000,3.15\n2001,3.11\n2002,3.26\n2003,3.43\n2004,3.63\n2005,3.88\n2006,4.08\n2007,3.94\n2008,3.79\n2009,3.89\n2010,4.29\n2011,4.47\n2012,4.68\n2013,4.57\n2014,4.83\n2015,4.81" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'http://54.244.161.160/show/abigequ'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-abigequ' }, 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": "Trillions of 2015 Dollars" }, "labels": { "format": "${value}" } }, "exporting": { "enabled": false }, "xAxis": { "gridLineWidth": 1 }, "credits": { "position": { "x": 20, "y": -1, "align": "left" }, "href": "http://gabriel-zucman.eu/usdina/", "text": "Source: Piketty, Saez, Zucman (2016)" }, "accessibility": { "enabled": false }, "legend": { "enabled": false }, "series": [ { "marker": { "enabled": false }, "tooltip": { "valuePrefix": "$" }, "index": 0 } ], "title": { "text": "Total US Capital Income (1913-2015)" }, "chart": { "description": null, "type": "line" }, "colors": [ "#B31021", "#434348", "#90ed7d", "#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); } }());