Code Monkey home page Code Monkey logo

Comments (4)

adevicq avatar adevicq commented on September 22, 2024

Hi
I don't know if this is the same need, but mine is: provide a method to center the chart on a specific node.
I did something on my side but it would be useful to have it as a standard function. For example, I give the possibility to a user to search for a person and I center the chart on the found node.

from tree-chart.

tylerdelange avatar tylerdelange commented on September 22, 2024

@adevicq Can I ask how you accomplished centering the node to the screenspace?

from tree-chart.

adevicq avatar adevicq commented on September 22, 2024

Hi,
If you inspect the DOM, you will find two elements under a DIV which class is "tree-container"
image
These two elements (SVG and DIV) have a style which defines the position of the diagram:
style="transform: scale(1) translate(1024px, -15px); transform-origin: center center;"
You have to play with the "translate" parameter to move the view up/down and right/left.
Store the initial values of the two values in the translate property and move the view according to the desired coordinates.

Hope this helps.

from tree-chart.

awaisamir123 avatar awaisamir123 commented on September 22, 2024

@adevicq How can we calculate this transformation? Suppose a node has properties such as width, height, top, and left. How can we manipulate these properties to determine the transformation translation values for X and Y?

from tree-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.