(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 } ], "columnTypes": [ "string", "string" ], "csv": ",Construction jobs\nJun 05,2.203\nSep 05,2.24\nDec 05,2.249\nMar 06,2.266\nJun 06,2.271\nSep 06,2.283\nDec 06,2.346\nMar 07,2.322\nJun 07,2.321\nSep 07,2.351\nDec 07,2.33\nMar 08,2.309\nJun 08,2.298\nSep 08,2.377\nDec 08,2.345\nMar 09,2.337\nJun 09,2.257\nSep 09,2.188\nDec 09,2.159\nMar 10,2.065\nJun 10,2.103\nSep 10,2.087\nDec 10,2.057\nMar 11,2.064\nJun 11,2.066\nSep 11,2.091\nDec 11,2.096\nMar 12,2.09\nJun 12,2.066\nSep 12,2.062\nDec 12,2.05\nMar 13,2.05\nJun 13,2.049\nSep 13,2.078\nDec 13,2.116\nMar 14,2.121\nJun 14,2.123\nSep 14,2.135\nDec 14,2.164\nMar 15,2.176\nJun 15,2.169\nSep 15,2.243\nDec 15,2.243\nMar 16,2.282\nJun 16,2.301" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://app.everviz.com/show/ufarubu/0'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-ufarubu' }, 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": "Employment, millions" } }, "credits": { "branded": true, "text": "Highcharts", "href": "//app.everviz.com/", "enabled": true }, "series": [ { "index": 0 } ], "subtitle": { "text": "Source: ONS" }, "title": { "text": "Construction is one of the UK\u0027s big employment industries" } }; 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); } }());