(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\n1913,1948\n1914,1827\n1915,1883\n1916,2218\n1917,2201\n1918,2241\n1919,2236\n1920,2094\n1921,1944\n1922,2032\n1923,2420\n1924,2406\n1925,2534\n1926,2724\n1927,2532\n1928,2596\n1929,2789\n1930,2439\n1931,2074\n1932,1720\n1933,1608\n1934,1837\n1935,2052\n1936,2324\n1937,2438\n1938,2205\n1939,2409\n1940,2806\n1941,3426\n1942,3892\n1943,4222\n1944,4169\n1945,3781\n1946,3294\n1947,3418\n1948,3762\n1949,3598\n1950,4070\n1951,4205\n1952,4128\n1953,4197\n1954,4173\n1955,4685\n1956,4571\n1957,4502\n1958,4272\n1959,4781\n1960,4774\n1961,4823\n1962,5191\n1963,5444\n1964,5722\n1965,6126\n1966,6261\n1967,6181\n1968,6335\n1969,6230\n1970,5930\n1971,6240\n1972,6560\n1973,6933\n1974,6614\n1975,6630\n1976,7082\n1977,7436\n1978,7763\n1979,7624\n1980,7249\n1981,7703\n1982,7532\n1983,7982\n1984,8884\n1985,8988\n1986,8704\n1987,8986\n1988,9417\n1989,9564\n1990,9447\n1991,9347\n1992,9443\n1993,9581\n1994,10195\n1995,10735\n1996,11113\n1997,11470\n1998,11360\n1999,11334\n2000,11167\n2001,10904\n2002,11319\n2003,11802\n2004,12381\n2005,13116\n2006,13661\n2007,13052\n2008,12429\n2009,12657\n2010,13851\n2011,14305\n2012,14881\n2013,14434\n2014,15137\n2015,14951" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://cloud.highcharts.com/show/ywynopy'; var encodedUrl = encodeURIComponent(shareUrl); Highcharts.setOptions({ "lang": { "thousandsSep": "," } }); var template = { chart: { renderTo: 'highcharts-ywynopy' }, 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": "2015 Dollars" }, "labels": { "format": "${value:,.0f}" } }, "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": "Per Capita 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); } }());