(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 }, { "x": 0 }, { "x": 0 } ], "columnTypes": [ "string", "float", "float", "float", "float", "float" ], "csv": "Straffbare forhold med mistenkt/siktet under 18 år,2012,2013,2014,2015,2016\nGrønland,765,774,619,571,776\nStovner,449,511,421,506,541\nManglerud,390,326,509,328,391\nMajorstua,364,394,308,213,346\nSentrum,301,260,240,199,223\nBærum,286,233,287,259,191\nAsker,179,106,114,87,89" }; 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/agapolu'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-agapolu' }, 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": "12px", "color": "#26292a", "fontWeight": "600" } } } }, "yAxis": { "title": { "style": { "color": "#26292a" }, "text": null }, "labels": { "format": " {value}", "x": -10 } }, "xAxis": { "tickColor": "#f2f2f2", "lineColor": "#c8c8c8", "tickPosition": "inside", "title": { "style": { "fontSize": "16px", "color": "#26292a" }, "text": null } }, "exporting": { "enabled": false }, "credits": { "style": { "fontSize": "11px" }, "href": null, "text": "Kilde: Oslo politidistrikt", "position": { "align": "center" } }, "legend": { "itemStyle": { "color": "#26292a", "fontWeight": "normal" } }, "series": [ { "index": 0 }, { "index": 1 }, { "index": 2 }, { "index": 3 }, { "index": 4 } ], "subtitle": { "style": { "color": "#26292a" }, "text": null }, "tooltip": { "borderColor": "#c8c8c8", "backgroundColor": "#ffffff", "borderRadius": 0, "shadow": false }, "title": { "style": { "fontSize": "16px", "color": "#26292a" }, "text": "Straffbare forhold med mistenkt/siktet under 18 år" }, "chart": { "spacingBottom": 30, "spacingLeft": 0, "style": { "fontFamily": "\u0027LFT Etica\u0027, \u0027Helvetica Neue\u0027, Arial, sans-serif", "fontWeight": "500" }, "type": "column", "spacingRight": 0 }, "colors": [ "#00b9f2", " #a8a9aa", " #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); } }());