Skip to content

Instantly share code, notes, and snippets.

@apjmason
Last active November 20, 2015 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apjmason/435b4daacd7635f50800 to your computer and use it in GitHub Desktop.
Save apjmason/435b4daacd7635f50800 to your computer and use it in GitHub Desktop.
CommunismPatriotism Responsive
/*add CSS rules to style wrapper and chart divs - AM*/
.chart_wrap {
position: relative;
padding-bottom: 57.9%;
height: 0;
overflow:hidden;
}
#chart_div {
position: absolute;
top: 0;
left: 0;
width:100%;
height:100%;
}
google.load('visualization', '1', {packages: ['corechart', 'line']});
google.setOnLoadCallback(drawLogScales);
// add call to the draw function on window resize events - AM
$(window).on("throttledresize", function (event) {
drawLogScales();
});
function drawLogScales() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year'); // Implicit domain label col.
data.addColumn('number', 'Communism'); // Implicit series 1 data col.
data.addColumn({type:'string', role:'annotation'});
data.addColumn({type:'string', role:'annotationText', p: {html:true}});
data.addColumn('number', 'Patriotism'); // Implicit series 2 data col.
data.addColumn({type:'string', role:'annotation'});
data.addColumn({type:'string', role:'annotationText', p: {html:true}});
data.addRows([
['1916', 0, null, null, 36, null, null],
['1917', 0, null, null, 25, null, null],
['1918', 0, null, null, 17, null, null],
['1919', 0, null, null, 9, null, null],
['1920', 0, null, null, 6, null, null],
['1921', 0, null, null, 0, null, null],
['1922', 1, 'A', "Russia's experiment in communism seems to have failed, but in the Men's Dorm it has always been practiced,<br/>where every man's clothes, books, and tobacco are the property of his neighbor.", 4, null, null],
['1923', 1, null, null, 2, null, null],
['1924', 4, null, null, 7, null, null],
['1925', 0, null, null, 7, null, null],
['1926', 5, null, null, 6, null, null],
['1927', 0, null, null, 6, null, null],
['1928', 1, null, null, 6, null, null],
['1929', 0, null, null, 0, null, null],
['1930', 6, null, null, 5, null, null],
['1931', 4, null, null, 1, null, null],
['1932', 1, null, null, 4, null, null],
['1933', 0, null, null, 3, null, null],
['1934', 6, null, null, 5, null, null],
['1935', 10, null, null, 0, null, null],
['1936', 8, null, null, 3, null, null],
['1937', 0, null, null, 4, null, null],
['1938', 2, null, null, 6, 'A', "The bombing of the American gunboat 'Panay' was notable 'because of the lack of indignation and patriotism'<br/>aroused. The emotions will not be played upon in the war this summer."],
['1939', 2, null, null, 7, null, null],
['1940', 5, null, null, 2, null, null],
['1941', 4, null, null, 28, 'B', "Our letter column this week carries a letter advocating a world patriotism over a national patriotism.<br/>Some may interpret it as an urgent cry for America to enter the present war. We do not intend to interpret<br/>the letter for our readers (we are sure they would rather do that for themselves) but it brings to light an<br/>important element in future world order that has direct bearing on college and university students the<br/>nation over. Whether America becomes actively engaged in the destruction aspects of warfare or not, there is little<br/>reason to believe that she will not be called upon, will not feel obligated to assist in the reconstruction<br/>of cultures that have been partially destroyed already. It is to youth that the world will look for its rebirth.<br/>The old have built, they will not build again. But the young men and women of America should do more than<br/>rebuild a shattered world. They must preserve that they build. This preservation can only be brought about if<br/>democracy is the foundation stone upon which all building is done."],
['1942', 2, null, null, 9, null, null],
['1943', 1, null, null, 13, null, null],
['1944', 0, null, null, 2, null, null],
['1945', 3, null, null, 2, null, null],
['1946', 3, null, null, 1, null, null],
['1947', 34, 'B', "Secondly, inasmuch as 15, or, half of the stories were bylined somewhat as follows: 'Communists Create Chinese Crisis,'<br/>'Communism in Colleges,'etc., it seemed as if Communists were responsible for everything evil in the world.<br/>The page after page damnation of Commies, Reds, etc., was quite effective. I was now prepared to give my best sneer to<br/>anyone I suspected, even people with red hair. I even sneered when my nurse brought me a red pill.", 0, null, null],
['1948', 26, null, null, 2, null, null],
['1949', 17, null, null, 0, null, null],
['1950', 16, null, null, 0, null, null],
['1951', 30, null, null, 0, null, null],
['1952', 31, null, null, 1, null, null],
['1953', 4, null, null, 0, null, null],
['1954', 12, null, null, 1, null, null],
['1955', 8, null, null, 0, null, null],
['1956', 8, null, null, 0, null, null],
['1957', 12, null, null, 0, null, null],
['1958', 19, null, null, 0, null, null],
['1959', 11, 'C', "We Americans pride ourselves on having passed the great Red scare phase and when we see a play like the current<br/>Player's production of 'The Crucible,'' we view with mutual horror the domestic witch hunting. And yet if we<br/>have abandoned the domestic variety, the United States is emphatically the most significant international<br/>witch hunter. Such a statement is not to underestimate the communist threat but to criticize the particular<br/>methods presently being employed by this country in dealing with world communism.", 1, null, null],
['1960', 12, null, null, 0, null, null],
['1961', 48, 'D', "ACCORDING TO the Marxists, the course of history dictates the inevitability of communism. Whether they are aware of it<br/>or not, capitalist states must seek to destroy the socialist state if they are not to be destroyed by it. <br/>So policies of containment, conciliatory statements by globe-trotting US diplomats, and the present unilateral moratorium<br/>on nuclear tests are, in the eyes of the Communists, acts of propaganda, hypocrisy, or plain stupidity.... Unless we<br/>are fully prepared to accept all the consequences of a permanent shift in the balance of power to our enemies, we<br/>must assert our superior power. If we want peace, we must be ready for war." , 3, null, null],
['1962', 31, null, null, 3, null, null],
['1963', 39, null, null, 4, null, null],
['1964', 5, null, null, 1, null, null],
['1965', 6, null, null, 3, null, null],
['1966', 18, null, null, 2, 'C', "The vast majority of those who refused a pair of GI boots and an M-1 rifle were formulating<br/>a new definition of patriotism. Service to one's country was taking new forms, such as<br/>VISTA, the Peace Corps, and countless variations of social work."],
]);
var options = {
hAxis: {
title: 'Year',
logScale: false
},
vAxis: {
title: 'Popularity',
logScale: false
},
tooltip: {isHtml: true},
colors: ['#a52714', '#097138']
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<!DOCTYPE html>
<html>
<head>
<!-- add jQuery and throttledresize libraries, and link to stylesheet - AM -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://rawgithub.com/louisremi/jquery-smartresize/master/jquery.throttledresize.js"></script>
<link rel="stylesheet" href="chart.css" />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="CommunismPatriotism.js"></script>
</head>
<body>
<!-- add wrapper div and remove hard coding of width and height - AM -->
<div class="chart_wrap">
<div id="chart_div"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment