James Eanes - VI4 - Identity as Spatial Region
This example is similar to the Identity as Color Hue example, but instead of changing the circle's color by identity, it changes the circle's radius.
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>VI4 - Identity as Spatial Region</title>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
</head>
<body>
<script type="text/javascript">
var w = 500;
var h = 50;
var dataset = [["Oregon",15], ["Alabama",10], ["Baylor",25],
["Marshall",5], ["Auburn",20]];
var svg = d3.select("body")
.append("svg")
.attr("width",w)
.attr("height",h);
var circles = svg.selectAll("circle")
.data(dataset)
.enter()
.append("circle");
circles.attr("cx", function(d, i) {
return (i * 50) + 25;
})
.attr("cy", h/2)
.attr("r", function(d) {
return d[1];
});
</script>
</body>
</html>