Skip to content

Commit

Permalink
Allow transient marks to be chained.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Bostock committed Jun 10, 2010
1 parent 06c5078 commit 9ca4534
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/mark/Mark.js
Expand Up @@ -1228,5 +1228,5 @@ pv.Mark.prototype.transition = function(ms) {
};

pv.Mark.prototype.on = function(state) {
return this["$" + state] = new pv.Transient();
return this["$" + state] = new pv.Transient(this);
};
3 changes: 2 additions & 1 deletion src/mark/Transient.js
@@ -1,6 +1,7 @@
pv.Transient = function() {
pv.Transient = function(mark) {
pv.Mark.call(this);
this.fillStyle(null).strokeStyle(null).textStyle(null);
this.on = function(state) { return mark.on(state); };
};

pv.Transient.prototype = pv.extend(pv.Mark);
27 changes: 11 additions & 16 deletions tests/mark/transition-anchor.html
Expand Up @@ -18,26 +18,21 @@
.margin(30);

var rule = vis.add(pv.Rule)
.data(function() i & 1 ? [0.25] : [0.5])
.data(function() i & 1 ? [0.25, 0.75] : [0.5])
.id(function(d) d.toFixed(2))
.bottom(function(d) d * h);

var label = rule.anchor("left").add(pv.Label)
.text(function(d) d.toFixed(2));

rule.enter()
.bottom(0)
.strokeStyle("transparent");

rule.exit()
rule.on("enter")
.bottom(0)
.strokeStyle("transparent");

label.enter()
.textStyle("transparent");

label.exit()
.textStyle("transparent");
.left(0)
.width(0)
.on("exit")
.top(0)
.left(0)
.width(0);

rule.anchor("left").add(pv.Label)
.text(function(d) d.toFixed(2));

vis.render();

Expand Down

0 comments on commit 9ca4534

Please sign in to comment.