 <p>I think the easiest way is to map the id to the name directly where you use it, as follows:</p> <pre><code>svg.selectAll("text") [...] .text( function(d) { return namesMap[d.name]; }); </code></pre> <p>assuming that <code>namesMap</code> converts <code>node_id</code> to <code>node_name</code>.</p> <p>Now you just have to create aforementioned <code>namesMap</code>, e.g. like this:</p> <pre><code>d3.csv("nodes.csv", function(names) { var namesMap = {}; names.forEach(function(d) { namesMap[d.node_id] = d.node_name; }); // code using namesMap goes here }); </code></pre> <p>A slighly modified code (with the csv data loading from <code>&lt;pre&gt;</code> nodes in HTML) is available in <a href="http://jsfiddle.net/v2UHg/1/" rel="nofollow">this fiddle</a>.</p>