Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Recompute text sizes on redraw

  • Loading branch information...
commit 8660f01daf0773311abe2d53f1954be2231f979d 1 parent c07d88c
@hadley authored
Showing with 5 additions and 4 deletions.
  1. +3 −2 inst/d3/profr.coffee
  2. +2 −2 inst/d3/profr.js
View
5 inst/d3/profr.coffee
@@ -117,10 +117,11 @@ redraw = ->
# text.exit().remove()
# text.transition()
- text
+ svg.selectAll("g").data(data, id).selectAll("text")
.each((d) -> this.__width = this.getBBox().width)
- .style("opacity", (d) ->
+ .style("opacity", (d, i) ->
w = this.__width
+ # if i == 1 then console.log(w + " / " + width(d))
if w != 0 and w + 8 < width(d) then 1 else 0
)
View
4 inst/d3/profr.js
@@ -129,9 +129,9 @@
text = g.append("text").text(function(d) {
return d.f;
}).attr("y", "18px").attr("x", "5px");
- return text.each(function(d) {
+ return svg.selectAll("g").data(data, id).selectAll("text").each(function(d) {
return this.__width = this.getBBox().width;
- }).style("opacity", function(d) {
+ }).style("opacity", function(d, i) {
var w;
w = this.__width;
if (w !== 0 && w + 8 < width(d)) {
Please sign in to comment.
Something went wrong with that request. Please try again.