edgebundleR icon indicating copy to clipboard operation
edgebundleR copied to clipboard

If vertex name contains strings with more than one word

Open Ddey07 opened this issue 6 years ago • 8 comments

The javascript doesn't work when the vertex name contains more than one word. Can you please let me know what might be the issue here?

Thanks.

Ddey07 avatar Mar 24 '18 02:03 Ddey07

Hi @galaktoboureko thanks for reporting the issue. I'm not sure what the problem is and I don't currently have time to investigate. A quick and dirty solution would be to replace spaces with underscores. I'll try to investigate further, but can't give a timeline at this stage. Happy to take pull requests though if you identify the offending code!

garthtarr avatar Mar 27 '18 23:03 garthtarr

Hi, @garthtarr , another thing. The nodes of the graph is now ordered alphabetically, can I choose my own order for the nodes in the circle? Please let me know how I can do that.

Ddey07 avatar Apr 03 '18 02:04 Ddey07

Try the development version to see if it no longer orders alphabetically, see issue #6

garthtarr avatar Apr 03 '18 02:04 garthtarr

Can you please give me a link to the development version? Shall I have to download the zip from here and upload it in R? Thanks for the quick reply.

Ddey07 avatar Apr 03 '18 02:04 Ddey07

# install.packages("devtools")
devtools::install_github("garthtarr/edgebundleR")

garthtarr avatar Apr 03 '18 08:04 garthtarr

@garthtarr Just checking if there's any update on displaying node names with spaces?

Ddey07 avatar Sep 24 '18 02:09 Ddey07

@galaktoboureko sorry, no, haven't looked into this yet. Happy to take pull requests if you identify the issue.

garthtarr avatar Sep 25 '18 10:09 garthtarr

I realize this is very late but I had the same problem and modified the JS code from:

 nodes_g.append("text")
      .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
      .attr("dy", ".31em")
      .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
      .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
      .style("fill", function(d){
        if(d.color) return d.color;
      })
      .text(function(d) { return d.key; })
      .on("mouseover", mouseover)
      .on("mouseout", mouseout)
      .on("click", click)
      .append("svg:title")
      .text(function(d) { return d.name; });

to

    nodes_g.append("text")
      .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
      .attr("dy", ".31em")
      .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
      .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
      .style("fill", function(d){
        if(d.color) return d.color;
      })
      //.text(function(d) { return d.key; })
      .on("mouseover", mouseover)
      .on("mouseout", mouseout)
      .on("click", click)
      .text(function(d) { return d.key.split("_").join(" "); })
      .append("svg:title")
      .text(function(d) { return d.name; });

Admittedly this is a bit of a hack as it simply removes the underscores and replaces them with spaces for the plot. You can see this in the image below where the hover text shows how the actual value has an underscore but the text in the plot has the space. This 'fix' does not actually allow the user to upload data with the spaces in the names and have the arcs work. However, it may be enough to get you by.

example

JonP-16 avatar Mar 03 '23 20:03 JonP-16