neo4jd3
neo4jd3 copied to clipboard
how can i set the node's name?
hi,how can i set the node's name?,now it is still use icon or title?thank you
you can add '.text(function (d)){return d.name}' in the function appendTextToNode and delete both '.attr('class'...)' and '.html(...)'in the neo4jd3.js
It does not work when I changed as you suggested @laaron2008
function appendTextToNode(node) {
return node.append('text')
.text(function (d){return d.name})
.attr('fill', '#ffffff')
.attr('font-size', function(d) {
return icon(d) ? (options.nodeRadius + 'px') : '10px';
})
.attr('pointer-events', 'none')
.attr('text-anchor', 'middle')
.attr('y', function(d) {
return icon(d) ? (parseInt(Math.round(options.nodeRadius * 0.32)) + 'px') : '4px';
});
}
Do you have any idea why? @jackyrong @laaron2008 Thank youuuuu
It does not work when I changed as you suggested @laaron2008
function appendTextToNode(node) { return node.append('text') .text(function (d){return d.name}) .attr('fill', '#ffffff') .attr('font-size', function(d) { return icon(d) ? (options.nodeRadius + 'px') : '10px'; }) .attr('pointer-events', 'none') .attr('text-anchor', 'middle') .attr('y', function(d) { return icon(d) ? (parseInt(Math.round(options.nodeRadius * 0.32)) + 'px') : '4px'; }); }
Do you have any idea why? @jackyrong @laaron2008 Thank youuuuu
Hi, you need to run function appendTextToNode() in appendNodeToGraph(), default setting is only running this function when options.icon argument is not null.
Hello @eisman, How to achieve appendTextToNode functionality?
Please do needful help to achieve this functionality.