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

The graph jumps when panned in some situations after rendering a second graph without using a transition #75

Closed
magjac opened this issue Jun 28, 2018 · 0 comments

Comments

@magjac
Copy link
Owner

magjac commented Jun 28, 2018

One case is when the second graph height changes. Another when the first graph has been panned or zoomed.

https://jsfiddle.net/fc4os5m0/8/

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v5.js"></script>
<script src="https://unpkg.com/viz.js@1.8.1/viz.js" type="application/javascript"></script>
<script src="https://unpkg.com/d3-graphviz@2.4.0/build/d3-graphviz.js"></script>
<div id="graph"></div>
<script>

d3.select("#graph").graphviz()
    .width(800)
    .height(400)
    .scale(0.5)
    .fit(true)
    .renderDot('digraph  {label="Click me"; a -> b}')
    .on("end", function() {
        d3.select(document).on("click", function() {
            var event = d3.event;
            event.preventDefault();
            event.stopPropagation();
            console.log('document click');
            render2();
        });
    })
    ;
        
function render2() {
    d3.select("#graph").graphviz()
        .renderDot('digraph  {label="Pan me"; c; d}')
    ;
}

</script>

A workaround is to use a transition.

@magjac magjac changed the title The graph jumps vertically when panned after rendering a second graph with a different height without using a transition The graph jumps when panned in some situations after rendering a second graph without using a transition Jun 28, 2018
magjac pushed a commit that referenced this issue Jul 2, 2018
@magjac magjac closed this as completed in #77 Jul 2, 2018
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

No branches or pull requests

1 participant