(function () { var script = document.getElementById('highcharts-script'); function addChart() { function parseData(completeHandler, chartOptions) { try { var dataOptions = { "seriesMapping": [ { "x": 0 }, { "x": 0 }, { "x": 0 } ], "columnTypes": [ "string", "float", "float", "float" ], "csv": "Local authority,Mid-2014,Mid-2024,Projected change over 10 years\nBarrow-in-Furness,67600,64700,-2900\nCopeland,69800,68100,-1700\nRichmondshire,52700,51900,-800\nBlackpool,140500,138900,-1600\nHyndburn,80200,79400,-800\nBlackburn with Darwen,146700,145700,-1100\nAllerdale,96500,96300,-200\nRedcar and Cleveland,135000,135000,-100\nSouth Lakeland,103300,103200,-100\nBurnley,87300,87400,200" }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'https://app.everviz.com/show/yramed'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-yramed' }, 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": "Number of people" } }, "exporting": { "enabled": false }, "series": [ { "color": "#ea1c1c", "index": 0, "type": "column" }, { "color": "#224bdf", "index": 1 }, { "color": "#252629", "index": 2 } ], "subtitle": { "text": "Source: ONS" }, "title": { "text": "Local authorities in England with the lowest projected percentage population change between mid-2014 and mid-2024" }, "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 = '//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); } }());