(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)' } }, tooltip: { crosshairs: true, valueSuffix: '%' }, plotOptions: { series: { cursor: 'pointer', /* events: { click: function(event) { alert(this.name + " clicked\n" + "Alt: " + event.altKey + "\n" + "Control: " + event.ctrlKey + "\n" + "Shift: " + event.shiftKey + "\n"); } } */ marker: { symbol: 'circle', enabled: false } } }, yAxis: {min: 0, max: 60}, xAxis:{ plotLines:[{ label: { text: 'Election Day', zIndex: 99999, align: 'left' }, color: '#ddd', width: 1, value: Date.UTC(2016,10,8), dashStyle: 'shortdashdot' }], plotBands:[{ label: { text: 'RNC', align: 'center' }, from: Date.UTC(2016,6,18), to: Date.UTC(2016,6,21), color: '#edc4c8' }] } })); /* // Sample of extending options: Highcharts.extend(options, Highcharts.merge(options, { chart: { backgroundColor: "#bada55" }, plotOptions: { series: { cursor: "pointer", events: { click: function(event) { alert(this.name + " clicked\n" + "Alt: " + event.altKey + "\n" + "Control: " + event.ctrlKey + "\n" + "Shift: " + event.shiftKey + "\n"); } } } } })); */ } 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 = { "googleSpreadsheetWorksheet": "1", "endColumn": 2, "seriesMapping": [ { "x": 0 }, { "x": 0 }, { "x": 0 } ], "googleSpreadsheetKey": "1WjZFRNRVa2-EUMzBKDUUJi4fTIZ1xDsA-4URdAF_Wrw", "startRow": 0, "startColumn": 0, "endRow": null }; dataOptions.sort = true dataOptions.complete = completeHandler; Highcharts.data(dataOptions, chartOptions); } catch (error) { console.log(error); completeHandler(undefined); } } var shareUrl = 'http://cloud.highcharts.com/show/ugufile'; var encodedUrl = encodeURIComponent(shareUrl); var template = { chart: { renderTo: 'highcharts-ugufile' }, 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": { "marker": { "enabled": false } } }, "yAxis": { "title": { "text": "Response Share (Percentage)" } }, "xAxis": { "crosshair": { "dashStyle": "ShortDashDotDot", "width": 1 }, "type": "datetime", "labels": { "rotation": -45, "format": "{value:%m/%d/%Y}" } }, "credits": { "href": "https://www.peoplespunditdaily.com/", "text": "People\u0027s Pundit Daily" }, "legend": { "borderColor": "#f6f5f2", "backgroundColor": "#f6f5f2", "borderRadius": 3, "borderWidth": 1 }, "series": [ { "index": 0 }, { "index": 1 } ], "subtitle": { "style": { "fontSize": "20px", "color": "#333333" }, "text": "PPD Tracking Poll: Trump Favorable/Unfavorable Ratings" }, "tooltip": { "shared": true, "headerFormat": "\u003cspan style\u003d\"font-size:1.2em;\"\u003e{point.key} AM EST\u003c/span\u003e\u003cbr/\u003e\u003cbr/\u003e", "borderRadius": 2, "useHTML": true, "borderWidth": 2, "pointFormat": "\u003cspan style\u003d\"color:{point.color}\"\u003e{series.name}\u003c/span\u003e: \u003cb\u003e{point.y}\u003c/b\u003e\u003cbr/\u003e\u003c/br\u003e", "followPointer": true }, "title": { "style": { "fontSize": "32px", "color": "#000000" }, "text": "Donald J. Trump Favorable Rating" }, "chart": { "plotBackgroundImage": "https://www.peoplespunditdaily.com/wp-content/uploads/2016/12/President-Donald-J-Trump-Polls-Waving.jpg", "width": 865, "style": { "fontFamily": "\"Futura, sans-serif" }, "type": "line", "height": 500 }, "colors": [ "#5186b4", "#c43d49", "#c39bd3", "#f7a35c", "#8085e9", "#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); } }());