Giter Site home page Giter Site logo

Collapsable nodes about dtree HOT 4 OPEN

erikgartner avatar erikgartner commented on June 12, 2024
Collapsable nodes

from dtree.

Comments (4)

Yogeshbluepi avatar Yogeshbluepi commented on June 12, 2024

On click collapse wokring in dtree.js ???

from dtree.

ErikGartner avatar ErikGartner commented on June 12, 2024

This feature is not implemented yet. Feel free to make a pull request to add it 👍

from dtree.

Yogeshbluepi avatar Yogeshbluepi commented on June 12, 2024

Can u suggest me how to implement this..?

from dtree.

ErikGartner avatar ErikGartner commented on June 12, 2024

Sure! :-)

You want look into how to collapse tree nodes in D3 v4. Basically you create a listener on clicking that removes or hides all the children nodes when a node is clicked, then you re-render the tree.

Here is an example:
https://bl.ocks.org/d3noob/43a860bc0024792f8803bba8ca0d5ecd

Make sure that your listener on clicking doesn't interfere with the dTree click callback.

We also want to add an option flag called "collapseOnClick" that controls the behavior. I think that the default behavior should be that the flag is set to false. Something like this:

{
  target: '#graph',
  debug: false,
  width: 600,
  collapseOnClick: false
  // the rest of the options are excluded..
}

/Erik

from dtree.

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.