Quantcast
Channel: User i alarmed alien - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Answer by i alarmed alien for D3JS wrap text plugin overwritten after updating the data

$
0
0

I've just come across the same issue elsewhere. It is because the text wrap function cannot act on a transition, it requires a selection. To fix your code, just move the text addition and wrap calls to prior to the transition:

node  .selectAll("text.nodeText")  .text(function(d) {    return d.name;  })  .call(wrap, 130);var nodeUpdate = node  .transition()  .duration(duration)  .attr("transform", function(d) {    return "translate("+ d.y +","+ d.x +")";  });nodeUpdate  .selectAll("text.nodeText")  .style("fill-opacity", 1)

Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>