2016-06-22 3 views

ответ

0

Вот как вы делаете текст для узлов.

node.append("text") 
     .attr("x", -6) 
     .attr("y", function(d) { return d.dy/2; }) 
     .attr("dy", ".35em") 
     .attr("text-anchor", "end") 
     .attr("transform", null) 
     .text(function(d) { return d.name; }) 
     .filter(function(d) { return d.x < width/2; }) 
     .attr("x", 6 + sankey.nodeWidth()) 
     .attr("text-anchor", "start"); 

Для создания текста на праве всегда делать:

node.append("text") 
     .attr("x", -6) 
     .attr("y", function(d) { return d.dy/2; }) 
     .attr("dy", ".35em") 
     .attr("text-anchor", "end") 
     .attr("transform", null) 
     .text(function(d) { return d.name; }) 
    //.filter(function(d) { return d.x < width/2; }) //COMMENT THIS LINE 
     .attr("x", 6 + sankey.nodeWidth()) 
     .attr("text-anchor", "start"); 

Закомментируйте линия, показанная выше, так что она не фильтрует узлов> половина ширины SVG.

Рабочий код here

+1

Спасибо тонну :) – d33a