GithubHelp home page GithubHelp logo

Comments (6)

bumbeishvili avatar bumbeishvili commented on July 24, 2024

@aafarian can you provide a reproduced sample? also video recording would be helpful

You can fork and extend this sample - https://stackblitz.com/edit/js-q8n1mh?file=index.html

from org-chart.

aafarian avatar aafarian commented on July 24, 2024

i can try to do that sometime soon. until then, there's also another issue because i just wrote the logic in my code manually to "fit to screen". it seems like if i expand the nodes, and then try to fit to screen, the chart sticks to the left/bottom left. you can actually reproduce this in the stackblitz link you sent me. is that intended/known?

EDIT: right now, the issue i'm working through is the chart seems to center properly if i move it and then click on "fit", but once i click on the "expand all" button i put on it, clicking on fit makes it zoom out and go to the bottom left of the screen. other than that, it seems to work as intended with my manually coded "handleFit" function since the .fit is having issues. might be a Firefox issue?

from org-chart.

aafarian avatar aafarian commented on July 24, 2024

here is the behavior, and i'm showing you the logs for the initial chart render, a log at the start of the handleFit function, and one at the end after the fit is done. in this case, even the initial render had lastTransform: Object { k: NaN, x: NaN, y: NaN }, but there are times where the initial render will have lastTransform: Object { x: 0, y: 0, k: 0.5 } (however, the handleFit will still have the NaN issue)

this is using the d3-org-chart .fit({ animate: true }), i stopped trying to implement my own solution because there were too many discrepancies between my transform/zoom state and the transform/zoom state in d3-org-chart.

Screen.Recording.2024-05-16.at.1.12.31.PM.mov

from org-chart.

aafarian avatar aafarian commented on July 24, 2024

here's a video of me not even moving it and just clicking on "fit":

Screen.Recording.2024-05-16.at.1.35.58.PM.mov

from org-chart.

aafarian avatar aafarian commented on July 24, 2024

I found the issue! it seemed to be my .svgHeight(() => 800) line. if i comment that out, it all seems to work perfectly! it seems like manually altering the svg height seemed to break the logic

from org-chart.

bumbeishvili avatar bumbeishvili commented on July 24, 2024

@aafarian .svgHeight(() => 800) this is not correct, it just receives the number, so it should be .svgHeight(800)

from org-chart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.