(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
var onCustomCodeError;
function customCode(options, product) {
try {
Highcharts.extend(options, Highcharts.merge(options, {
chart: {
style: {
fontFamily: 'Playfair Display SC, serif'
}
},
title: {
style: {
textShadow: '0 0.032em 0 #999, 0px 0.15em 0.11em rgba(0,0,0,0.15), 0px 0.25em 0.021em rgba(0,0,0,0.1), 0px 0.32em 0.32em rgba(0,0,0,0.1)'
}
},
yAxis: {min: 0, max: 60},
xAxis:{
plotLines:[{
label: {
text: '1st Debate',
align: 'left'
},
color: '#ddd',
width: 2,
value: Date.UTC(2016,8,26),
dashStyle: 'shortdashdot'
},{
label: {
text: 'VP Debate',
align: 'left'
},
color: '#ddd',
width: 2,
value: Date.UTC(2016,9,4),
dashStyle: 'shortdashdot'
},{
label: {
text: '2nd Debate',
align: 'left'
},
color: '#ddd',
width: 2,
value: Date.UTC(2016,9,9),
dashStyle: 'shortdashdot'
},{
label: {
text: '3rd Debate',
align: 'left'
},
color: '#ddd',
width: 2,
value: Date.UTC(2016,9,19),
dashStyle: 'shortdashdot'
}],
plotBands:[{
label: {
text: 'RNC',
align: 'center'
},
from: Date.UTC(2016,6,18),
to: Date.UTC(2016,6,21),
color: '#edc4c8'
},{
label: {
text: 'DNC',
align: 'left'
},
from: Date.UTC(2016,6,25),
to: Date.UTC(2016,6,28),
color: '#ccdce9'
},{
label: {
text: 'GNC',
align: 'left'
},
from: Date.UTC(2016,7,4),
to: Date.UTC(2016,7,5),
color: '#17AA5C'
}]
}
}));
} 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
},
{
"x": 0
}
],
"columnTypes": [
"datetime",
"float",
"float",
"float",
"float",
"float",
"float",
"float"
],
"csv": "Date,\u003cimg class\u003d\"chart-candidates-img\" src\u003d\"https://www.peoplespunditdaily.com/wp-content/uploads/2016/09/Trump-PPD-thumb.png\"/\u003e\u003cspan\u003eTrump (R)\u003c/span\u003e,\u003cimg class\u003d\"chart-candidates-img\" src\u003d\"https://www.peoplespunditdaily.com/wp-content/uploads/2016/09/Clinton-PPD-thumb.png\"/\u003e\u003cspan\u003eClinton (D)\u003c/span\u003e,\u003cimg class\u003d\"chart-candidates-img\" src\u003d\"https://www.peoplespunditdaily.com/wp-content/uploads/2016/09/Johnson-PPD-thumb.png\"/\u003e\u003cspan\u003eJohnson (L)\u003c/span\u003e,\u003cimg class\u003d\"chart-candidates-img\" src\u003d\"https://www.peoplespunditdaily.com/wp-content/uploads/2016/09/Stein-PPD-thumb.png\"/\u003e\u003cspan\u003eStein (G)\u003c/span\u003e,\u003cimg class\u003d\"chart-candidates-img\" src\u003d\"https://www.peoplespunditdaily.com/wp-content/uploads/2015/06/Avatar-PPD-thumb.png\"/\u003e\u003cspan\u003eUndecided\u003c/span\u003e,\u003cspan style\u003d\"margin-top:10px;\"\u003e(95%) Confidence Interval\u003c/span\u003e,Series 7\n1468137600000,41.7,43.6,8.4,1.8,4.5,45.3,40\n1468224000000,43.5,43.7,6.9,2.4,3.5,,\n1468310400000,43.6,43.4,6.7,1.9,3.5,,\n1468396800000,43.4,43.2,7.8,3.1,2.5,,\n1468483200000,42.6,41.2,9.2,2.3,4.7,,\n1468569600000,42.6,40.3,8.1,1.8,7.2,,\n1468656000000,42.4,40.1,6.8,2.1,8.6,,\n1468742400000,42.8,39.8,6.8,1.7,8.9,45.6,37.2\n1468828800000,42.9,40.4,7.1,1.8,7.8,,\n1468915200000,42.8,42.2,9.1,3.1,2.8,,\n1469001600000,42.7,42.1,9.3,3.2,2.7,,\n1469088000000,44.1,42.9,7.9,2.6,2.5,,\n1469174400000,44.3,42.1,5.8,1.8,6,,\n1469260800000,45.5,41.9,4.9,2.1,5.6,,\n1469347200000,45.3,41.1,4.9,2.5,6.2,,\n1469433600000,46.8,41.1,4.3,3.1,4.7,,\n1469520000000,47.4,40.2,4.4,4.1,3.9,,\n1469606400000,48.1,40.5,4.1,4.1,3.2,,\n1469692800000,47.8,41.5,4,3.9,2.8,,\n1469779200000,47.6,42.1,3,4.3,3,49.4,40.3\n1469865600000,46.8,42.2,4,4.4,2.6,,\n1469952000000,45.9,43.1,5.1,4.3,2.8,,\n1470038400000,44.8,43.3,5.9,4.2,1.8,,\n1470124800000,43.9,44.1,4.9,4.1,3,,\n1470211200000,43.8,44.3,5,4.3,2.6,,\n1470297600000,43.5,45.1,6.4,3.1,1.9,,\n1470384000000,43.6,45.3,5.9,3.2,2,,\n1470470400000,42.6,46.1,6.1,3.1,2.1,,\n1470556800000,41.4,47.3,6.3,3.3,1.7,,\n1470643200000,41.2,46.9,6.8,4,1.1,,\n1470729600000,41.1,44.9,8.1,3.9,2,,\n1470816000000,40.9,44.5,8.4,3.7,2.5,47.2,38.6\n1470902400000,41.2,43.2,8.6,3.5,3.5,45.9,38.5\n1470988800000,41.1,43.3,9.5,3.9,2.2,45.9,38.6\n1471075200000,40.3,44.9,8.9,4.1,1.8,47.5,37.7\n1471161600000,40.5,43.5,8.7,3.8,3.8,46.3,37.7\n1471248000000,39.9,42.2,9.8,4.1,4,44.9,37.2\n1471334400000,40.2,41.8,9.2,4.3,4.5,44.6,37.4\n1471420800000,40,41.1,9.6,3.7,5.6,43.8,37.3\n1471507200000,41.3,42.5,8.1,3.1,5,45.5,38.4\n1471593600000,41.5,42.1,7.9,3.3,5.2,45.1,38.5\n1471680000000,42.9,42,7.1,3.5,4.5,45.7,39.2\n1471766400000,43.1,41.7,7.2,2.9,5.1,45.9,39\n1471852800000,43.2,42.6,7.9,3.6,2.7,46,39.9\n1471939200000,42,41.1,8.8,4.1,4,44.7,38.4\n1472025600000,42.3,40.8,9.5,3.2,4.2,45,38\n1472112000000,42.1,41.3,10.1,2.9,3.6,45,38.5\n1472198400000,40.8,42.1,10.6,2.6,3.9,44.9,38\n1472284800000,41.5,42.2,11,2.1,3.2,44.9,38.8\n1472371200000,41.9,42.1,10.3,2,3.7,45,39\n1472457600000,42.4,42,9.9,2.2,3.5,45.1,39.4\n1472544000000,43.1,41.7,9.1,2.8,3.3,45.9,39\n1472630400000,42.2,40.2,8.2,3.1,6.3,44.9,37.5\n1472716800000,41.1,40.3,7.5,3.3,7.9,44.3,37.3\n1472803200000,42.3,40.1,7.9,3.4,6.3,45,37.5\n1472889600000,41.9,39.2,8.1,4.1,6.7,44.7,36.5\n1472976000000,42.1,40.1,7.8,3.9,6.1,44.8,37.5\n1473062400000,43.6,41.2,7.2,2.9,5.1,46.5,38.4\n1473148800000,42.3,42.1,6.9,3,5.7,45.3,39.3\n1473235200000,42.2,42.2,7,3.3,5.1,45.1,39.5\n1473321600000,42.4,42.1,7.2,3.1,5.2,45,39.6\n1473408000000,43.3,41.9,7.1,3.1,4.6,46.3,38.9\n1473494400000,44.5,42.2,6.5,2.8,4,47.2,39.6\n1473580800000,44.9,41.9,7.2,2.6,3.4,47.4,39.4\n1473667200000,44.7,41.4,7.8,2.9,3.2,47.2,38.9\n1473753600000,45.1,41,8.1,3.2,2.6,47.7,38.5\n1473840000000,45.4,40.2,8.3,2.8,3.3,47.9,37.7\n1473926400000,45.5,40.4,8.6,3.1,2.4,48,38\n1474012800000,45.1,40.6,9.1,3.1,2.1,47.6,38\n1474099200000,45.3,39.8,9.3,3.2,2.6,47.9,37.3\n1474185600000,45.4,40.1,9.1,3.4,2,48.2,37.4\n1474272000000,44.5,40.2,9.5,3.2,2.6,46.9,37.9\n1474358400000,44.1,40.9,9.6,2.8,2.6,45.2,37.2\n1474444800000,43.4,39.2,9.2,2.4,5.8,45.7,37\n1474531200000,42.9,39.8,9.8,3.3,4.2,45.2,37.6\n1474617600000,43.1,41.1,9.5,2.7,3.6,45.4,38.8\n1474704000000,43.3,40.9,10.1,2.6,3.1,45.6,38.7\n1474790400000,43.2,41.1,9.1,2.2,4.4,45.5,38.8\n1474876800000,43.3,40.9,8.7,2.4,4.7,45.5,38.6\n1474963200000,42.9,40.5,9.6,2.1,5.3,45.1,38.3\n1475049600000,41.1,41.5,9.9,2.7,4.8,43.8,38.8\n1475136000000,41.5,42.6,9.1,2.2,4.6,44.8,39.3\n1475222400000,40.9,43.1,9.3,2.3,4.3,45.4,36.1\n1475308800000,41.5,42.1,8.8,2.1,5.4,44.3,39.2\n1475395200000,42.1,41.9,8.1,2.3,5,44.3,39.7\n1475481600000,43.2,41.5,7.9,2,5.4,45.5,39.3\n1475568000000,42.5,41.1,7.8,2.2,6.4,44.8,38.9\n1475654400000,42.7,40.9,7.6,2.1,6.7,44.9,38.6\n1475740800000,41.1,41.9,7.8,1.9,8.3,44.1,38.9\n1475827200000,40.5,41,8.3,2.6,7.6,43.2,38.4\n1475913600000,38.8,41.4,9.1,3.1,7.6,43.6,36.6\n1476000000000,38.2,41,8.7,3.2,8.9,43.2,36\n1476086400000,39.1,42.1,8.5,3,7.3,44.2,36.9\n1476172800000,39.4,42.5,7.3,2.3,7.5,44.7,37.3\n1476259200000,40.6,41.4,7.4,2.1,8.5,43.6,38.5\n1476345600000,41.5,40.9,7.1,2.4,8.1,43.6,38.7\n1476432000000,43.5,41.7,6.6,2.6,5.6,45.7,39.5\n1476518400000,43.1,41.5,7.1,2.7,5.6,45.3,39.4\n1476604800000,42.4,41.8,7.2,2.8,5.8,44.6,39.8\n1476691200000,42.6,41.4,6.9,2.9,6.7,44.7,39.3\n1476777600000,40.2,41.9,7.8,3.2,6.9,44,38.1\n1476864000000,42.8,41.2,7.2,3.8,5,45.3,39.4\n1476950400000,42.5,41.3,7.6,4.3,4.3,44.6,39.1\n1477036800000,42.6,41.2,7.4,4.4,4.4,44.7,39\n1477123200000,42.7,41.3,7.1,4.2,4.7,45.1,39.5\n1477209600000,41.8,41.2,7.6,3.9,5.5,44.7,39.1\n1477296000000,41.1,41.5,8.1,3.5,5.8,45.3,38.9\n1477382400000,41.2,41.4,8.3,3.3,5.8,43.6,40.1\n1477468800000,41.4,41.8,8.1,3.1,5.6,44.9,39.1\n1477555200000,42.4,42.2,6.8,2.6,5.8,44.8,38.1\n1477641600000,43.5,42.4,6.1,2.4,5.6,45.6,40.2\n1477728000000,43.3,42.1,6.4,2.4,6,45.7,39.2\n1477814400000,43.9,41.9,5.9,2.5,5.8,45.9,38.1\n1477900800000,44.1,41.7,5.8,2.3,6.2,46.4,37.9\n1477987200000,44.7,42.1,4.9,2.1,5.6,47.1,36.9\n1478073600000,44.9,42.5,4.5,2.3,5.8,45.6,39.9\n1478160000000,44.5,43.3,4.1,2.2,5.9,46.6,41.2\n1478246400000,45.1,44.2,3.9,1.9,4.9,46.5,42.1\n1478332800000,45.2,44.1,3.8,2.1,4.8,47.3,42\n1478419200000,45.1,44.5,3.2,2.2,5,47.1,42.5\n1478505600000,45.8,45.2,6.6,2.3,0,47.8,43.1"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'http://cloud.highcharts.com/show/ivufimu';
var encodedUrl = encodeURIComponent(shareUrl);
var template = {
chart: {
renderTo: 'highcharts-ivufimu'
},
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": "Candidate Vote Share (Percentage)"
}
},
"xAxis": {
"title": {
"text": null
},
"type": "datetime",
"labels": {
"rotation": -45,
"format": "{value:%m/%d/%Y}"
}
},
"credits": {
"href": "https://www.peoplespunditdaily.com",
"text": "People\u0027s Pundit Daily"
},
"legend": {
"backgroundColor": "#f6f5f2",
"borderRadius": 3,
"itemStyle": {
"fontWeight": "normal"
}
},
"series": [
{
"color": "#c43d49",
"marker": {
"symbol": "circle",
"enabled": false
},
"tooltip": {
"valueSuffix": "%"
},
"index": 0,
"type": "line"
},
{
"color": "#5186b4",
"marker": {
"symbol": "circle",
"enabled": false
},
"tooltip": {
"valueSuffix": "%"
},
"index": 1,
"type": "line"
},
{
"color": "#e5c601",
"marker": {
"symbol": "circle",
"enabled": false
},
"tooltip": {
"valueSuffix": "%"
},
"index": 2
},
{
"color": "#17aa5c",
"marker": {
"symbol": "circle",
"enabled": false
},
"tooltip": {
"valueSuffix": "%"
},
"index": 3
},
{
"color": "#333333",
"dashStyle": "Dot",
"marker": {
"enabled": false
},
"tooltip": {
"valueSuffix": "%"
},
"index": 4,
"negativeColor": "#ffffff",
"type": "line"
},
{
"tooltip": {
"valuePrefix": "{series.point.high}",
"valueSuffix": null
},
"index": 5,
"type": "errorbar"
}
],
"subtitle": {
"style": {
"fontSize": "16px",
"color": "#333333",
"fontWeight": "normal"
},
"text": "Election 2016: Vote for President of the United States"
},
"tooltip": {
"shared": true,
"headerFormat": "\u003cspan style\u003d\"font-size:1.2em;\"\u003e{point.key} AM EST\u003c/span\u003e\u003cp style\u003d\"font-size:0.8em;\"\u003e(3-Day Rolling Average)\u003c/p\u003e\u003chr/\u003e",
"crosshairs": true,
"borderRadius": 2,
"useHTML": true,
"borderWidth": 2,
"pointFormat": "\u003cb\u003e{series.name}: {point.y}\u003c/b\u003e\u003chr/\u003e",
"xDateFormat": null,
"valueSuffix": "%"
},
"title": {
"style": {
"fontSize": "24px",
"fontWeight": "bold",
"color": "#000000"
},
"text": "U.S. Presidential Election Daily Tracking Poll"
},
"chart": {
"plotBackgroundImage": null,
"style": {
"fontFamily": "Palatino Linotype"
},
"type": "line",
"height": null
},
"colors": [
"#7cb5ec",
"#434348",
"#90ed7d",
"#f7a35c",
"#000000",
"#f15c80",
"#e4d354",
"#2b908f",
"#f45b5b",
"#91e8e1"
]
};
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 = '//cloud.highcharts.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);
}
}());