(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
var onCustomCodeError;
function customCode(options, product) {
try {
/*
// 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 = {
"seriesMapping": [
{
"x": 0
},
{
"x": 0
},
{
"x": 0
}
],
"columnTypes": [
"string",
"float",
"float",
"float"
],
"csv": ",Allow them a way to become citizens provided they meet certain requirements,Allow them to become permanent legal residents but not citizens,Identify and deport them\nApril 2-7,61,16,20\nApril 9-14,61,16,21\nApril 16-21,61,18,17\nApril 30-May 5,62,19,16\nMay 7-12,64,16,17\nMay 14-19,62,19,16\nMay 21-26,61,18,18\nMay 28-June 1,63,15,17\nJune 4-9,61,16,20\nJune 11-16,62,18,16\nJune 18-23,58,18,22\nJune 25-30,59,18,19\nJuly 1-6,58,18,19\nJuly 9-13,59,15,23\nJuly 16-20,59,18,20\nJuly 23-27,58,17,22\nJuly 30-Aug 3,57,19,22\nAug 6-10,57,19,21\nAug 13-17,57,19,21\nAug 20-24,58,18,20\nAug 27-31,57,19,21\nSept 3-7,57,17,23\nSept 17-21,60,17,19\nSept 18-22,63,16,17\nSept 24-28,56,18,24\nOct 1-5,60,17,20\nOct 8-12,59,19,20\nOct 15-19,59,16,21\nOct 22-26,60,16,21\nOct 29-Nov 2,64,17,17\nNov 5-9,59,16,22\nNov 12-16,61,15,20\nNov 19-23,58,21,19\nNov 25-30,59,19,21\nDec 3-7,65,18,15\nDec 10-14,62,17,18\nDec 17-21,62,19,18\nDec 18-21,62,16,19\nDec 23-28,64,16,18\nDec 30-Jan 4,61,17,20"
};
dataOptions.sort = true
dataOptions.complete = completeHandler;
Highcharts.data(dataOptions, chartOptions);
} catch (error) {
console.log(error);
completeHandler(undefined);
}
}
var shareUrl = 'https://app.everviz.com/show/ebeguq';
var encodedUrl = encodeURIComponent(shareUrl);
var template = {
chart: {
renderTo: 'highcharts-ebeguq'
},
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": "{x}"
}
}
},
"yAxis": {
"minorTickColor": "#d8d8d8",
"tickInterval": 10,
"tickColor": "#d8d8d8",
"lineColor": "#d8d8d8",
"minorGridLineWidth": 0,
"title": {
"style": {
"fontSize": "13px"
},
"text": null
},
"lineWidth": 1,
"tickWidth": 1,
"minorGridLineColor": "#d8d8d8",
"minorTickInterval": "",
"gridLineWidth": 0,
"min": 0,
"minColor": "#d8d8d8",
"maxColor": "#d8d8d8"
},
"xAxis": {
"minorGridLineColor": "#d8d8d8",
"minorTickColor": "#d8d8d8",
"tickColor": "#d8d8d8",
"lineColor": "#d8d8d8",
"title": {
"style": {
"fontSize": "11px",
"color": "#000000"
},
"text": "Source: PRRI, American Values Atlas, 2014."
},
"minorGridLineWidth": 0,
"labels": {
"rotation": null
}
},
"credits": {
"href": "publicreligion.org",
"text": "PRRI"
},
"legend": {
"layout": "vertical",
"verticalAlign": "top",
"itemStyle": {
"color": "#000000"
},
"y": 45
},
"series": [
{
"color": "#00abba",
"marker": {
"symbol": "circle"
},
"index": 0
},
{
"color": "#c0d769",
"marker": {
"symbol": "circle"
},
"index": 1,
"negativeColor": "#000000"
},
{
"color": "#ffca46",
"marker": {
"symbol": "circle"
},
"index": 2
}
],
"subtitle": {
"style": {
"fontWeight": "normal",
"fontSize": "14px",
"color": "#000000"
},
"text": "In dealing with immigrants living in the U.S. illegally, the immigration system should…"
},
"title": {
"style": {
"fontWeight": "bold",
"color": "#000000"
},
"text": "Immigration Reform in 2014"
},
"chart": {
"backgroundColor": "#ffffff",
"plotBackgroundColor": "#ffffff",
"width": null,
"style": {
"fontFamily": "Arial"
},
"type": "line"
},
"colors": [
"#76d155",
"#434348",
"#90ed7d",
"#f7a35c",
"#8085e9",
"#f15c80",
"#e4d354",
"#2b908f",
"#f45b5b",
"#97e4de"
]
};
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);
}
}());