(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
function parseData(completeHandler, chartOptions) {
try {
var dataOptions = {
"seriesMapping": [
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
},
{
"x": 0
}
],
"columnTypes": [
"string",
"float",
"float",
"float",
"float",
"float",
"float",
"float"
],
"csv": ",Clinton,Vorsprung Clinton,TCTC Clinton,keine Umfragen,TCTC Trump,Vorsprung Trump,Trump\nWahlmännerstimmen,178,70,141,6,22,35,86"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'https://app.everviz.com/show/ixahev';
var encodedUrl = encodeURIComponent(shareUrl);
var template = {
chart: {
renderTo: 'highcharts-ixahev'
},
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": "16px",
"color": "rgba(0, 0, 0, 0.88)"
},
"enabled": true
},
"stacking": "percent"
}
},
"yAxis": {
"title": {
"text": null
},
"reversed": true,
"labels": {
"format": " "
}
},
"exporting": {
"enabled": false
},
"xAxis": {
"labels": {
"format": " "
}
},
"credits": {
"branded": true,
"text": "Highcharts",
"href": "//app.everviz.com/",
"enabled": true
},
"series": [
{
"color": "#3b5998",
"index": 0
},
{
"color": "rgba(59, 89, 152, 0.68)",
"index": 1
},
{
"color": "rgba(123, 142, 185, 0.5)",
"index": 2
},
{
"color": "#b1a3a3",
"index": 3
},
{
"color": "rgba(224, 76, 92, 0.57)",
"index": 4
},
{
"color": "#e04c5c",
"index": 5
},
{
"color": "#d30015",
"index": 6
}
],
"subtitle": {
"text": "Für den Wahlsieg sind 270 Stimmen erforderlich"
},
"tooltip": {
"enabled": false
},
"title": {
"text": "Clinton vs. Trump: Wahlmännerstimmen"
},
"chart": {
"style": {
"fontFamily": "Arial"
},
"plotBorderColor": "#401010",
"inverted": true,
"type": "column"
}
};
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);
}
}());