Giter Site home page Giter Site logo

erikgartner / dtree Goto Github PK

View Code? Open in Web Editor NEW
505.0 19.0 135.0 515 KB

A library for visualizing data trees with multiple parents, such as family trees. Built on top of D3.

Home Page: https://treehouse.gartner.io/ErikGartner/58e58be650453b6d49d7

License: MIT License

JavaScript 92.56% HTML 7.44%
dtree visualizing-data-trees family-tree d3 genealogy

dtree's People

Contributors

erikgartner avatar mrmartinimo avatar piyushparkash avatar richchurcher avatar trulex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dtree's Issues

Write custom layout engine

The current implemented by D3 is somewhat lacking in terms of customisation.

Requirements:

  • Handle variable node size.
  • Good placement of married nodes.

"onClick" handler

Supporting either a string or preferably a function.

Useful for popups, callback etc.

allow for children without spouses

Hi Erik, cool library!

There is a significant amount of divorce in my family. I'm looking for a way to represent divorce, or ex-spouses, or children with only one parent.

Let me know how we could build this, and I'm happy to help.

Kunal

How do I insert images into the tree?

Would the tree be able to support images? img tag or background image? The one i've tried inserting display image but now in the nodes and it doesnt zoom in and out.

How do I add custom node styles?

I need to know who already passed away. So I add rip: true in node of my JSON format.
Then add a class rip to node via custom _nodeRenderer function.

.rip p{
    color: #757474;
    background: url('../img/rip.svg') no-repeat;
    background-size: 9px;
    padding-left: 9px;
}

screenshot from 2017-01-19 12 42 27

Yeah, at least it works for me, but still looks ugly πŸ˜† (my bad in styling)
Is this the right way?
Or could it be the next feature?

Two Grandparents to 1 couple

Is it possible to have two grand parents connected to a couple? 1 grandparents to a father and 1 grandparents to a mother? Father and mother would then be married and have a child?

Add support for marriages for spouses

var treeData =[  
   {  
      "name":"Abc Xyz",
      "class":"man",
      "id":"121",
      "marriages":[  
         {  
            "spouse":{  
               "name":"Jane",
               "class":"woman",
               "id":"122",
               "marriages":[  
                  {  
                     "spouse":{  
                        "name":"Jill",
                        "class":"man",
                        "id":"2304"
                     },
                     "children":[  
                        {  
                           "name":"Abc Xyz",
                           "class":"man",
                           "id":"142"
                        }
                     ]
                  }
               ]
            },
            "children":[  
               {  
                  "name":"Abc Xyz",
                  "class":"man",
                  "id":"131"
               },
               {  
                  "name":"Abc Xyz",
                  "class":"man",
                  "id":"132",
                  "marriages":[  
                     {  
                        "spouse":{  
                           "name":"Abc Xyz",
                           "class":"woman",
                           "id":"141"
                        },
                        "children":[  
                           {  
                              "name":"Abc Xyz",
                              "class":"man",
                              "id":"142"
                           }
                        ]
                     }
                  ]
               },
               {  
                  "name":"Abc Xyz",
                  "class":"man",
                  "id":"133"
               }
            ]
         }
      ]
   }
];

When used above json object dTree is not showing marriages of Jane

Upgrade to d3 v4.

Currently dTree supports only d3 v3 but upgrading may add some nice benefits.

Improved sorting callback

Better than a simple comparator callback would be a full-fledged sorting callback that receives the entire array and should return it sorted according to preference.

Automatic node sizing

Nodes height and perhaps width should be calculated.

Preferable this mechanism should be overwritable by the user.

NodeClick is having the name parameter undefined

nodeClick callback is getting the name parameter undefined, probably happened because of d3 version change, just need to change d.name to d.data.name when calling the callback. Will send a pr when free, also leaving a comment on the code if someone else is working on it.

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.