(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 } ], "columnTypes": [ "string", "float" ], "csv": "Kategori,Millioner kroner brukt\nAdministrasjon,15.3\nAktivitetshuset K1,46.8\nTrygge bo- og oppvekstmiljøer,33.9\nEngasjement og aktivitet,25.9\nGratis kjernetid på AKS,19.5" }; 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/alyxyxo'; var encodedUrl = encodeURIComponent(shareUrl); Highcharts.setOptions({ "lang": { "decimalPoint": "," } }); var template = { chart: { renderTo: 'highcharts-alyxyxo' }, 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": { "format": "{y} ", "style": { "fontSize": "12px" }, "enabled": true } }, "pie": { "cursor": true, "innerSize": "60%", "dataLabels": { "backgroundColor": "#ffffff", "distance": -25, "color": "#000000", "style": { "fontWeight": "600", "textOutline": "0px contrast" }, "enabled": false }, "borderWidth": 2, "allowPointSelect": true, "states": { "hover": { "enabled": false } }, "showInLegend": true } }, "yAxis": { "title": { "text": null } }, "exporting": { "enabled": false }, "xAxis": { "labels": { "format": "{value} " } }, "credits": { "style": { "fontSize": "11px" }, "href": null, "text": "Kilde: Områdeløft Tøyen", "position": { "align": "center" } }, "legend": { "itemStyle": { "color": "#26292a", "fontWeight": "600" } }, "series": [ { "index": 0 } ], "subtitle": { "style": { "fontSize": "14px" }, "text": "Slik er 141 millioner kommunale og statlige kroner er brukt fram til august i 2017" }, "tooltip": { "borderColor": "#c8c8c8", "backgroundColor": "#ffffff", "borderRadius": 0, "shadow": false }, "title": { "style": { "color": "#26292a" }, "text": "Områdeløft Tøyen" }, "chart": { "spacingBottom": 30, "style": { "fontFamily": "\u0027LFT Etica\u0027, \u0027Helvetica Neue\u0027, Arial, sans-serif", "fontWeight": "500" }, "type": "pie", "height": "" }, "colors": [ "#00b9f2", " #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); } }());