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:
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.
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:
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