Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooltip bug fixed #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

tooltip bug fixed #40

wants to merge 1 commit into from

Conversation

esabt
Copy link

@esabt esabt commented Sep 9, 2020

Hello mattflor,

i'm working for Ebner Stolz and we are currently developing a tool using R and Shiny. Part of our code relies on your great chorddiag-library.

Unfortunately, there is a bug with the tooltips. Your library uses the d3-tip library. This library generates a new div for each tooltip. The problem is, that these tooltip-divs are added to the body of the DOM as a direct child, not to the svg-container.
Whenever a user clicks a chord, the chorddiag-javascript sends a request to the Shiny-Server and eventually the Shiny-Server initiates an update of the Chord Diagram, therefore updating or re-creating the elements contained in the svg-container. But because the tooltip-divs aren't descendents of the svg container, new ToolTip-divs are created on every update. This results in dangling ToolTips whenever the user clicks on a chord:
dangling tooltips

To solve this problem, I implemented the creation of tooltips and the behaivor of showing, hiding and positioning these tooltips when the user hovers the mouse over the svg-elements (actually my code generates just a single tool tip-div and reuses it). The code is embedded directly in the file inst/htmlwidgets/lib/chorddiag/chorddiag.js. The code doesn't rely on the d3-tip anymore, so this library can be removed from the repository. The dependency in the inst/htmlwidgets/chorddiag.yaml is already commented out. After all, I added about 60 lines of code but removed the 340 lines of the d3-tip-library. My code runs faster, is much more intuitive than the d3-tip and should be easier to maintain.

My changes don't affect the usage of the library in any way. Users already relying on your library won't have to change a single line of code.

If you have any questions, please don't hesitate contacting me. You can contact me via e-mail: tobias.abend@ebnerstolz.de.

Best regards
Tobias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant