garthtarr / edgebundleR

Circle plot with bundled edges
http://garthtarr.github.io/edgebundleR/
66 stars 12 forks source link

If vertex name contains strings with more than one word #15

Open Ddey07 opened 6 years ago

Ddey07 commented 6 years ago

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.

garthtarr commented 6 years ago

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!

Ddey07 commented 6 years ago

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.

garthtarr commented 6 years ago

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

Ddey07 commented 6 years ago

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.

garthtarr commented 6 years ago
# install.packages("devtools")
devtools::install_github("garthtarr/edgebundleR")
Ddey07 commented 5 years ago

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

garthtarr commented 5 years ago

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

JonP-16 commented 1 year ago

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