Skip to content

Instantly share code, notes, and snippets.

@bangpound
Created February 16, 2010 21:38
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 bangpound/305958 to your computer and use it in GitHub Desktop.
Save bangpound/305958 to your computer and use it in GitHub Desktop.
<style type="text/css">
/* <![CDATA[ */
.road {
height: 28px;
background-color: #ccc;
border-color: black;
border-width: 2px;
border-top-style: solid;
border-bottom-style: solid;
position: absolute;
width: 100%;
}
.road hr {
border-color: yellow;
border-style: dashed;
margin: 0;
margin-top: 12px;
position: absolute;
width: 100%;
}
#graph,#graph-legend {
position: relative;
}
#graph img,#graph-legend img {
height: auto;
width: 65px;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 4px;
z-index: 1;
position: relative;
}
#graph-legend {
border: 1px solid black;
padding: 8px;
}
#graph-legend .road {
width: 75px;
}
#graph-legend dt,dd {
height: 35px;
}
#graph-legend dt {
float: left;
width: 75px;
}
#graph-legend img {
}
#graph-legend dd {
margin: 0 0 0 80px !important;
padding: 0 !important;
}
/* ]]> */
</style>
<script type="text/javascript">
/* <![CDATA[ */
BusGraph = function (json) {
var bus, road, busses;
bus = parseInt(json.feed.entry[0].content.$t, 10);
road = parseInt(json.feed.entry[1].content.$t, 10);
$(document).ready(function() {
var $graph, rows, wholerows, remainder;
$graph = $('#graph');
wholerows = Math.floor(road / 5);
remainder = road % 5;
for (rows = 0; rows < wholerows; rows++) {
$('<div class="road"><hr /></div>').appendTo('#graph').css('top', rows * 35);
}
if (remainder) {
$('<div class="road"><hr /></div>').appendTo('#graph').css('top', rows * 35).css('width', remainder * 75 + "px");
}
for (busses = 1; busses <= bus; busses++) {
$('<img/>').attr('src', 'http://homepage.mac.com/bangpound/icirr-bus/bus.png').addClass('bus').appendTo('#graph');
}
$('#bus-count').text(bus);
});
};
/* ]]> */
</script>
<script src="http://spreadsheets.google.com/feeds/cells/t817jNpBzsf3jaW1ho6CE3Q/od6/public/basic?alt=json-in-script&amp;min-row=2&amp;min-col=1&amp;max-row=2&amp;max-col=2&amp;callback=BusGraph" type="text/javascript"></script>
<p>Our goal is to send <strong>200 buses</strong>, that's <strong>10,000 riders</strong>, to Washington DC on March 21st. We have <strong><em id="bus-count"></em></strong> buses. <a href="http://spreadsheets.google.com/viewform?hl=en&formkey=dE03M2xYS1hVVnB5czBTNXlRQ2RDWEE6MA">Help us reach our goal of 200</a>!</p>
<div id="graph">
</div>
<dl id="graph-legend">
<dt><div class="road"><hr /></div></dt>
<dd>funds raised</dd>
<dt><img src="http://homepage.mac.com/bangpound/icirr-bus/bus.png" alt="Bus" /></dt>
<dd>number of buses organized</dd>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment