Skip to content

Instantly share code, notes, and snippets.

@ghing ghing/index.html
Last active Aug 29, 2015

Embed
What would you like to do?
Playing with rainfall data
<!doctype html>
<html>
<head></head>
<body>
<div id="chart"></div>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var ENDPOINT_ROOT = 'http://chicagorains.com/api/hourlyPrecip/';
function getURL(date, location) {
var dateStr = ('0' + (date.getMonth() + 1)).slice(-2) + '-'
+ ('0' + date.getDate()).slice(-2) + '-'
+ date.getFullYear();
return ENDPOINT_ROOT + '?startDate=' + dateStr + '&endDate=' + dateStr + '&location=' + location;
}
function getRainfall(date) {
}
function lineChart() {
}
var today = new Date();
console.debug(getURL(today));
//d3.json(url, function(error, data) {
//});
d3.select('#chart')
.data(data)
.call(lineChart);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.