(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
var onCustomCodeError;
function customCode(options, product) {
try {
Highcharts.extend(options, Highcharts.merge(options, {
xAxis: {
labels: {
style: {
fontWeight: '600',
fontSize: '12px',
color: '#26292a',
},
}
},
title: {
style: {
color: '#26292a',
fontWeight: '600',
fontSize: '18px',
}
}
}));
} catch(error) {
console.error(error)
if (onCustomCodeError && onCustomCodeError(error) === false){
// stop execution
return;
}
}
var chart = new Highcharts['Chart'](options);
}
function parseData(completeHandler, chartOptions) {
try {
var dataOptions = {
"seriesMapping": [
{
"x": 0
},
{
"x": 0
},
{
"x": 0
}
],
"columnTypes": [
"string",
"string",
"string"
],
"csv": "Delbydel,2010,2015\nNedre Tøyen,60.4,63.7\nGrønland,51.6,52.2\nEnerhaugen,45.5,49.2\nSnitt for Oslo,16,17.5\nHolmen,6.6,2.4\nMunkerud,4,2.9\nDisen,3.9,3.1"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'https://54.244.161.160/show/agyresi';
var encodedUrl = encodeURIComponent(shareUrl);
Highcharts.setOptions({
"lang": {
"decimalPoint": ","
}
});
var template = {
chart: {
renderTo: 'highcharts-agyresi'
},
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": {
"style": {
"fontSize": "14px",
"color": "#26292a"
}
}
},
"column": {
"groupPadding": 0.1,
"colors": ""
}
},
"yAxis": {
"endOnTick": false,
"title": {
"style": {
"fontSize": "12px",
"color": "#26292a"
},
"text": null
},
"labels": {
"format": " {value}"
}
},
"xAxis": {
"gridLineColor": "#c8c8c8",
"minorTickInterval": "",
"tickLength": 0,
"lineColor": "#c8c8c8",
"tickPositions": "",
"tickPosition": "inside",
"title": {
"style": {
"fontSize": "16px",
"color": "#26292a"
},
"text": null
},
"labels": {
"x": -10
}
},
"exporting": {
"enabled": false
},
"credits": {
"style": {
"fontSize": "11px"
},
"href": null,
"text": "Kilde: SSB",
"position": {
"align": "center"
}
},
"legend": {
"itemStyle": {
"color": "#26292a",
"fontWeight": "600",
"fontSize": "12 px"
}
},
"series": [
{
"color": "#4dcef6",
"index": 1
},
{
"index": 1
}
],
"subtitle": {
"style": {
"color": "#26292a",
"fontSize": "14px"
},
"text": "Andelen barn som bor i husholdninger med vedvarende lavinntekt over 3 år (EU standard)"
},
"tooltip": {
"borderColor": "#c8c8c8",
"backgroundColor": "#ffffff",
"borderRadius": 0,
"shadow": false
},
"title": {
"style": {
"fontSize": "16px",
"color": "#26292a",
"fontWeight": "normal"
},
"text": "Barn i lavinntektsfamilier"
},
"chart": {
"spacingBottom": 30,
"spacingLeft": 0,
"style": {
"fontFamily": "\u0027LFT Etica\u0027, \u0027Helvetica Neue\u0027, Arial, sans-serif"
},
"type": "column",
"inverted": true,
"spacingRight": 0,
"height": "540"
},
"colors": [
"#bebfbf",
" #80d4d5",
" #67528b",
" #f383bb",
" #c9c1d5 "
]
};
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);
customCode(options, 'Chart');
}, 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);
}
}());