RefactorFirst icon indicating copy to clipboard operation
RefactorFirst copied to clipboard

Create SVG Popup Button for Large Graphs

Open jimbethancourt opened this issue 8 months ago • 0 comments
trafficstars

Create a popup button when a graph is large to allow users to view an SVG graph while also avoiding horrible page load times.

This is a start and renders correctly the first time, but does not render correctly the second time and causes the page to freeze:

    function showSVGPopup(popupId, containerName, dot) {
        // Add event listener for Escape key to close the popup
        document.addEventListener('keydown', function (event) {
            if (event.key === 'Escape') {
                hidePopup();
            }
        });

        document.getElementById('overlay').style.display = 'block';
        document.getElementById(popupId).style.display = 'block';

        var container = document.getElementById(containerName);

        d3.select(container)
            .graphviz()
            .width(screen.width)
            .height(screen.height)
            .fit(true)
            .renderDot(classGraph_dot);
    }

jimbethancourt avatar Mar 16 '25 13:03 jimbethancourt