(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
function parseData(completeHandler, chartOptions) {
try {
var dataOptions = {
"seriesMapping": [],
"columnTypes": [
"string",
"float"
],
"csv": ",Unemployment rate\nMar-May 2007,5.4\nApr-Jun 2007,5.4\nMay-Jul 2007,5.3\nJun-Aug 2007,5.3\nJul-Sep 2007,5.3\nAug-Oct 2007,5.2\nSep-Nov 2007,5.2\nOct-Dec 2007,5.2\nNov-Jan 2008,5.2\nDec-Feb 2008,5.2\nJan-Mar 2008,5.2\nFeb-Apr 2008,5.3\nMar-May 2008,5.2\nApr-Jun 2008,5.4\nMay-Jul 2008,5.5\nJun-Aug 2008,5.7\nJul-Sep 2008,5.9\nAug-Oct 2008,6\nSep-Nov 2008,6.2\nOct-Dec 2008,6.4\nNov-Jan 2009,6.5\nDec-Feb 2009,6.7\nJan-Mar 2009,7.1\nFeb-Apr 2009,7.3\nMar-May 2009,7.6\nApr-Jun 2009,7.8\nMay-Jul 2009,7.9\nJun-Aug 2009,7.9\nJul-Sep 2009,7.8\nAug-Oct 2009,7.9\nSep-Nov 2009,7.8\nOct-Dec 2009,7.8\nNov-Jan 2010,7.7\nDec-Feb 2010,7.9\nJan-Mar 2010,8\nFeb-Apr 2010,8\nMar-May 2010,7.9\nApr-Jun 2010,7.9\nMay-Jul 2010,7.8\nJun-Aug 2010,7.8\nJul-Sep 2010,7.8\nAug-Oct 2010,7.9\nSep-Nov 2010,7.9\nOct-Dec 2010,7.9\nNov-Jan 2011,7.9\nDec-Feb 2011,7.8\nJan-Mar 2011,7.8\nFeb-Apr 2011,7.7\nMar-May 2011,7.8\nApr-Jun 2011,7.9\nMay-Jul 2011,8\nJun-Aug 2011,8.2\nJul-Sep 2011,8.3\nAug-Oct 2011,8.4\nSep-Nov 2011,8.5\nOct-Dec 2011,8.4\nNov-Jan 2012,8.3\nDec-Feb 2012,8.3\nJan-Mar 2012,8.2\nFeb-Apr 2012,8.2\nMar-May 2012,8.1\nApr-Jun 2012,8\nMay-Jul 2012,8\nJun-Aug 2012,7.9\nJul-Sep 2012,7.9\nAug-Oct 2012,7.9\nSep-Nov 2012,7.8\nOct-Dec 2012,7.8\nNov-Jan 2013,7.8\nDec-Feb 2013,8\nJan-Mar 2013,7.8\nFeb-Apr 2013,7.8\nMar-May 2013,7.8\nApr-Jun 2013,7.7\nMay-Jul 2013,7.7\nJun-Aug 2013,7.7\nJul-Sep 2013,7.6\nAug-Oct 2013,7.4\nSep-Nov 2013,7.2\nOct-Dec 2013,7.2\nNov-Jan 2014,7.2\nDec-Feb 2014,6.9\nJan-Mar 2014,6.8\nFeb-Apr 2014,6.6\nMar-May 2014,6.4\nApr-Jun 2014,6.3\nMay-Jul 2014,6.1\nJun-Aug 2014,6\nJul-Sep 2014,6\nAug-Oct 2014,6\nSep-Nov 2014,5.9\nOct-Dec 2014,5.7\nNov-Jan 2015,5.7\nDec-Feb 2015,5.6\nJan-Mar 2015,5.5\nFeb-Apr 2015,5.5\nMar-May 2015,5.6\nApr-Jun 2015,5.6\nMay-Jul 2015,5.5\nJun-Aug 2015,5.4\nJul-Sep 2015,5.3\nAug-Oct 2015,5.2\nSep-Nov 2015,5.1\nOct-Dec 2015,5.1\nNov-Jan 2016,5.1\nDec-Feb 2016,5.1\nJan-Mar 2016,5.1\nFeb-Apr 2016,5\nMar-May 2016,4.9\nApr-Jun 2016,4.9\nMay-Jul 2016,4.9\nJun-Aug 2016,5\nJul-Sep 2016,4.8\nAug-Oct 2016,4.8\nSep-Nov 2016,4.8\nOct-Dec 2016,4.8\nNov-Jan 2017,4.7\nDec-Feb 2017,4.7\nJan-Mar 2017,4.6\nFeb-Apr 2017,4.6\nMar-May 2017,4.5"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'https://app.everviz.com/show/uvucuha';
var encodedUrl = encodeURIComponent(shareUrl);
var template = {
chart: {
renderTo: 'highcharts-uvucuha'
},
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": "%"
}
},
"series": [
{
"index": 0
}
],
"subtitle": {
"text": "Source: ONS"
},
"title": {
"text": "Wage growth was expected to start rising when unemployment fell this low"
}
};
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);
}
}());