Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 76dd7a03a5
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (56 sloc) 2.295 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js"></script>
<link type="text/css" rel="stylesheet" href="prettify.css">
<script type="text/javascript" src="prettify.js"></script>
<link type="text/css" rel="stylesheet" href="style.css">
<title></title>
</head>
<body onload="prettyPrint()">
<div style="height:300px; width:750px; margin-left:auto; margin-right:auto; margin-top:1em" id="chart">
</div>
<pre style="font-size:0.7em" class="prettyprint">
d3.select("#chart")
.append("svg")
.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("cx", function(d){return time_scale(new Date(d.time))})
.attr("cy", function(d){return value_scale(d.yes_rsvp_count);})
.attr("r", 6)
</pre>
</div>
<script>
d3.json(
'http://localhost:8000/data/meetup_history.json',
function(data){
time_scale = d3.time.scale()
.domain([
new Date(d3.min(data, function(d){return d.time})),
new Date(d3.max(data, function(d){return d.time}))
])
.range([20,730])
value_scale = d3.scale.linear()
.domain([0, d3.max(data, function(d){return d.yes_rsvp_count})])
.range([290, 10])
d3.select("#chart")
.append("svg")
.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("class","brill")
.attr("cx", function(d){return time_scale(new Date(d.time))})
.attr("cy", function(d){return value_scale(d.yes_rsvp_count);})
.attr("r", 6)
.style("fill","red")
.style("fill-opacity", 0.8)
.style("stroke", "black")
}
)
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.