christophergandrud / d3Network

Tools for creating D3 JavaScript network graphs from R.
http://christophergandrud.github.io/d3Network/
171 stars 56 forks source link

ensure node labels are not obstructed by other nodes #20

Open maxcw opened 10 years ago

maxcw commented 10 years ago

I have a dense network, and when my mouse hovers over nodes, the label is sometimes obstructed by other nodes. I would love it if the text was 'on top of' all nodes.

I tried my hand at this myself in the code below. The weird thing is that the stand-alone version of the code works fine when opened as an html file. But when I give it to shiny using cat() and htmlOutput(), the next labels appear at the bottom of the screen.

christophergandrud commented 10 years ago

Can you send the code as a gist. It hasn't been rendered very well in the issue.

maxcw commented 10 years ago

Hi Christopher,

The code is located at:

https://gist.github.com/maxcw/7fb0b8dbaa10efb79d41

I've never used a gist before, so let me know if that doesn't work. Just to reiterate, this is a sample of what I plug into shiny:

In server.R I have:

output$networkPlot <- {

    conn=file('d3network_mod.html',open='r')
    cat(readLines(conn),sep='\n')
    close(conn)

}

and in the ui.R I have:

htmlOutput('networkPlot')

The free-standing version of the html file looks fine in when opened directly by browsers. But when d3network_mod.html is plugged into Shiny, the node labels show up at the bottom left corner!

Thank You For Your Help,

Max

Max Watson, PhD L-3 Data Tactics 7901 Jones Branch Dr., Suite 700 McLean, VA 22102 Cell: (760) 274-4693 Office: (571) 482-7109 www.Data-Tactics.comhttp://www.data-tactics.com/


From: Christopher Gandrud [notifications@github.com] Sent: Tuesday, July 22, 2014 2:23 AM To: christophergandrud/d3Network Cc: Max Watson Subject: Re: [d3Network] ensure node labels are not obstructed by other nodes (#20)

Can you send the code as a gisthttps://gist.github.com/. It hasn't been rendered very well in the issue.

— Reply to this email directly or view it on GitHubhttps://github.com/christophergandrud/d3Network/issues/20#issuecomment-49702495.

christophergandrud commented 10 years ago

The gist looks good. Thanks!

I'll try to carve out a bit of time to look at this within the week.

On Tue, Jul 22, 2014 at 3:08 PM, maxcw notifications@github.com wrote:

Hi Christopher,

The code is located at:

https://gist.github.com/maxcw/7fb0b8dbaa10efb79d41

I've never used a gist before, so let me know if that doesn't work. Just to reiterate, this is a sample of what I plug into shiny:

In server.R I have:

output$networkPlot <- {

conn=file('d3network_mod.html',open='r') cat(readLines(conn),sep='\n') close(conn) }

and in the ui.R I have:

htmlOutput('networkPlot')

The free-standing version of the html file looks fine in when opened directly by browsers. But when d3network_mod.html is plugged into Shiny, the node labels show up at the bottom left corner!

Thank You For Your Help,

Max

Max Watson, PhD L-3 Data Tactics 7901 Jones Branch Dr., Suite 700 McLean, VA 22102 Cell: (760) 274-4693 Office: (571) 482-7109 www.Data-Tactics.comhttp://www.data-tactics.com/


From: Christopher Gandrud [notifications@github.com] Sent: Tuesday, July 22, 2014 2:23 AM To: christophergandrud/d3Network Cc: Max Watson Subject: Re: [d3Network] ensure node labels are not obstructed by other nodes (#20)

Can you send the code as a gisthttps://gist.github.com/. It hasn't been rendered very well in the issue.

— Reply to this email directly or view it on GitHub< https://github.com/christophergandrud/d3Network/issues/20#issuecomment-49702495>.

— Reply to this email directly or view it on GitHub https://github.com/christophergandrud/d3Network/issues/20#issuecomment-49743484 .

maxcw commented 10 years ago

Thank you for looking at my code!

Max Watson, PhD L-3 Data Tactics 7901 Jones Branch Dr., Suite 700 McLean, VA 22102 Cell: (760) 274-4693 Office: (571) 482-7109 www.Data-Tactics.comhttp://www.data-tactics.com/


From: Christopher Gandrud [notifications@github.com] Sent: Tuesday, July 22, 2014 10:27 AM To: christophergandrud/d3Network Cc: Max Watson Subject: Re: [d3Network] ensure node labels are not obstructed by other nodes (#20)

The gist looks good. Thanks!

I'll try to carve out a bit of time to look at this within the week.

On Tue, Jul 22, 2014 at 3:08 PM, maxcw notifications@github.com wrote:

Hi Christopher,

The code is located at:

https://gist.github.com/maxcw/7fb0b8dbaa10efb79d41

I've never used a gist before, so let me know if that doesn't work. Just to reiterate, this is a sample of what I plug into shiny:

In server.R I have:

output$networkPlot <- {

conn=file('d3network_mod.html',open='r') cat(readLines(conn),sep='\n') close(conn) }

and in the ui.R I have:

htmlOutput('networkPlot')

The free-standing version of the html file looks fine in when opened directly by browsers. But when d3network_mod.html is plugged into Shiny, the node labels show up at the bottom left corner!

Thank You For Your Help,

Max

Max Watson, PhD L-3 Data Tactics 7901 Jones Branch Dr., Suite 700 McLean, VA 22102 Cell: (760) 274-4693 Office: (571) 482-7109 www.Data-Tactics.comhttp://www.data-tactics.com/


From: Christopher Gandrud [notifications@github.com] Sent: Tuesday, July 22, 2014 2:23 AM To: christophergandrud/d3Network Cc: Max Watson Subject: Re: [d3Network] ensure node labels are not obstructed by other nodes (#20)

Can you send the code as a gisthttps://gist.github.com/. It hasn't been rendered very well in the issue.

— Reply to this email directly or view it on GitHub< https://github.com/christophergandrud/d3Network/issues/20#issuecomment-49702495>.

— Reply to this email directly or view it on GitHub https://github.com/christophergandrud/d3Network/issues/20#issuecomment-49743484 .

— Reply to this email directly or view it on GitHubhttps://github.com/christophergandrud/d3Network/issues/20#issuecomment-49746225.