data
var data = [32, 57, 112],
dataEnter = data.concat(293),
dataExit = data.slice(0, 2),
w = 360,
h = 180,
x = d3.scale.ordinal().domain([57, 32, 112]).rangePoints([0, w], 1),
y = d3.scale.ordinal().domain(data).rangePoints([0, h], 2);
overview
-->
<ol>
<li>enter - incoming actors, entering the stage.</li>
<li>update - persistent actors, staying on stage.</li>
<li>exit - outgoing actors, exiting the stage.</li>
</ol>
<!--
script
(function() {
var svg = d3.select("#chart-13").append("svg")
.attr("width", w)
.attr("height", h);
select
var gd = svg.selectAll(".data")
.data([32, 57, 293])
.enter().append("g")
.attr("class", "data")
.attr("transform", function(d, i) { return "translate(" + 20 * (i + 1) + ",20)"; });
filter(s)
var ed = gd.filter(function(d, i) { return i == 2; }),
ud = gd.filter(function(d, i) { return i != 2; });
ed.append("circle")
.attr("class", "little")
.attr("r", 1e-6);
gd.append("rect")
.attr("x", -10)
.attr("y", -10)
.attr("width", 20)
.attr("height", 20);
gd.append("text")
.attr("dy", ".35em")
.attr("text-anchor", "middle")
.text(String);
select
var ge = svg.selectAll(".element")
.data(data)
.enter().append("g")
.attr("class", "element")
.attr("transform", function(d) { return "translate(" + d + ",90)"; });
append
ge.append("circle")
.attr("class", "little")
.attr("r", Math.sqrt);
ge.append("text")
.attr("dy", ".35em")
.attr("text-anchor", "middle")
.text(String);
ed.select("rect")
.style("fill", "lightgreen")
.style("stroke", "green");
circle
var xe = ge.filter(function(d, i) { return i == 2; });
xe.select("circle")
.style("fill", "lightcoral")
.style("stroke", "red");
button
d3.select("#chart-13 button").on("click", function() {
gd
.attr("transform", function(d, i) { return "translate(" + 20 * (i + 1) + ",20)"; })
.transition()
.duration(750)
.attr("transform", function(d) { return "translate(" + d + ",90)"; });
transition
gd.select("rect")
.style("opacity", 1)
.transition()
.duration(750)
.style("opacity", 1e-6);
ed.select("circle")
.attr("r", 1e-6)
.transition()
.duration(750)
.attr("r", Math.sqrt);
xe.select("circle")
.attr("r", Math.sqrt)
.transition()
.duration(750)
.attr("r", 1e-6);
xe.select("text")
.style("opacity", 1)
.transition()
.duration(750)
.style("opacity", 1e-6);
});
})();