xxxxxxxxxx
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.dot {
stroke: #000;
}
</style>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src='/1wheel/1b6758978dc2d52d3a37/example/d3-jetpack.js'></script>
<script src='/1wheel/1b6758978dc2d52d3a37/example/d3-starterkit.js'></script>
<script>
d3.tsv("data.tsv", function(error, data) {
var c = d3.conventions({
margin: {top: 20, right: 20, bottom: 30, left: 40},
width: 900,
height: 450,
})
c.x.domain(d3.extent(data, ƒ('sepalWidth'))).nice();
c.y.domain(d3.extent(data, ƒ('sepalLength'))).nice();
c.drawAxis()
c.svg.select('.x.axis')
.append("text.label")
.attr("x", c.width)
.attr("y", -6)
.style("text-anchor", "end")
.text("Sepal Width (cm)");
c.svg.select('.y.axis')
.append("text.label")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Sepal Length (cm)")
c.svg.dataAppend(data, "circle.dot")
.attr("r", 3.5)
.attr("cx", ƒ('sepalWidth', c.x))
.attr("cy", ƒ('sepalLength', c.y))
.style("fill", ƒ('species', c.color))
var legend = c.svg.dataAppend(c.color.domain(), "g.legend")
.attr("class", "legend")
.translate(function(d, i){ return [0, i*20] })
legend.append("rect")
.attr("x", c.width - 18)
.attr("width", 18)
.attr("height", 18)
.style("fill", c.color);
legend.append("text")
.attr("x", c.width - 24)
.attr("y", 9)
.attr("dy", ".35em")
.style("text-anchor", "end")
.text(ƒ())
})
</script>
Updated missing url http://bl.ocks.org/1wheel/raw/1b6758978dc2d52d3a37/d3-jetpack.js to /1wheel/1b6758978dc2d52d3a37/example/d3-jetpack.js
Updated missing url http://bl.ocks.org/1wheel/raw/1b6758978dc2d52d3a37/d3-starterkit.js to /1wheel/1b6758978dc2d52d3a37/example/d3-starterkit.js
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://bl.ocks.org/1wheel/raw/1b6758978dc2d52d3a37/d3-jetpack.js
https://bl.ocks.org/1wheel/raw/1b6758978dc2d52d3a37/d3-starterkit.js