(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 }, { "x": 0 }, { "x": 0 }, { "x": 0 }, { "x": 0 } ], "columnTypes": [ "float", "float", "float", "float", "float", "float" ], "csv": ",Spain,Italy,Poland,Romania,United Kingdom\n2000,16.6,17.7,19.1,9,5.8\n2001,12.8,15.5,20.5,8,4.7\n2002,13.9,15.7,22.3,8.9,5.8\n2003,13.8,14.9,21.2,9.2,5.1\n2004,12.9,12.8,22.6,10.3,5.1\n2005,11,13.1,20.2,8.7,5\n2006,10.1,11.6,15.3,9.4,5.5\n2007,9,10.4,10.6,7.6,4.9\n2008,13.3,11.1,8.2,6.7,5.7\n2009,21.7,13.3,9.8,8.4,8.3\n2010,24.7,14.8,12,9.6,8.2\n2011,26.3,14.4,12,9.6,8.9\n2012,31.5,18.1,13.1,10.3,8.7\n2013,33.3,22.2,13.6,10.6,8.1\n2014,30.3,23.6,11.8,10.5,6.9\n2015,28.5,22.4,10.1,10.2,6" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://app.everviz.com/show/yhiwyvy'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-yhiwyvy' }, 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": "Rates (in %)" } }, "credits": { "text": "Source: Eurostat", "href": null }, "series": [ { "index": 0 }, { "index": 1 }, { "index": 2 }, { "index": 3 }, { "index": 4 } ], "subtitle": { "text": "Chart provided by www.migrationobservatory.ox.ac.uk" }, "title": { "text": "Unemployment rate among 15-29 year olds" } }; 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 = '//app.everviz.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); } }());