Built with blockbuilder.org
xxxxxxxxxx
<meta charset="utf-8">
<style>
</style>
<body>
<script src="//d3js.org/d3.v4.0.0-alpha.45.min.js"></script>
<script>
var width = 512;
var height = 600;
var svg = d3.select('body').append('svg')
.attr({width: width, height: height});
var data = d3.csv('201508_weather_data.csv', function(err, data) {
if (err) { throw err; }
// convert string properties to numbers.
data.forEach(function(d) {
for(prop in d) {
if (prop !== 'species') {
d[prop] = Number(d[prop]);
}
}
});
var domain = d3.extent(data, function(d) {
return d.dockcount;
});
var scale = d3.scale.linear()
.domain(domain)
.range([20, width - 20]);
svg.selectAll('circle').data(data)
.enter().append('circle')
.attr({
r: 3,
cx: function(d) {
return scale(d.dockcount);
},
cy: function(d, i) { return 3 * i + 30; },
}).style({
fill: function(d) { return color(d.species); },
});
});
</script>
</body>
</html>
https://d3js.org/d3.v4.0.0-alpha.45.min.js