(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 }, { "x": 0 } ], "columnTypes": [ "float", "string", "string" ], "csv": "Economic structure and performance,Deuda Bruta,Deuda Neta\n2000,40,26.4\n2001,48.2,31.5\n2002,83.6,61.2\n2003,107.3,68.3\n2004,101.6,66.5\n2005,85,51.4\n2006,74.4,46.7\n2007,74,41.2\n2008,58.2,27.2\n2009,72.4,35.3\n2010,59.3,30.5\n2011,56.3,27.9\n2012,60.8,27.2\n2013,57.6,23.1\n2014,58.5,21.9\n2015,58.9,23.5\n2016,63.4,47.5" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://cloud.highcharts.com/show/eraqohe'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-eraqohe' }, 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": { "dataLabels": { "format": "{y} %" } } }, "yAxis": { "title": { "text": null }, "labels": { "format": "{value} %" } }, "credits": { "branded": true, "text": "Highcharts", "href": "//cloud.highcharts.com/", "enabled": true }, "series": [ { "index": 0 }, { "index": 1 } ], "title": { "text": "Deuda/PIB" }, "chart": { "type": "line" } }; 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); } }());