neo4jd3 icon indicating copy to clipboard operation
neo4jd3 copied to clipboard

how can i set the node's name?

Open jackyrong opened this issue 7 years ago • 4 comments

hi,how can i set the node's name?,now it is still use icon or title?thank you

jackyrong avatar Jul 18 '17 15:07 jackyrong

you can add '.text(function (d)){return d.name}' in the function appendTextToNode and delete both '.attr('class'...)' and '.html(...)'in the neo4jd3.js

laaron2008 avatar Jan 04 '18 06:01 laaron2008

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

mboussaa avatar Sep 25 '18 14:09 mboussaa

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.

image

therealhieu avatar Dec 12 '20 15:12 therealhieu

Hello @eisman, How to achieve appendTextToNode functionality?

Please do needful help to achieve this functionality.

tejash-7span avatar Oct 27 '22 10:10 tejash-7span