All Projects → justincy → D3 Pedigree Examples

justincy / D3 Pedigree Examples

Licence: mit
Examples of how to create family pedigrees with D3

Labels

Projects that are alternatives of or similar to D3 Pedigree Examples

Ng2 Finance
Finance dashboard using Yahoo's public APIs.
Stars: ✭ 149 (-21.16%)
Mutual labels:  d3
React D3 Speedometer
✨ ⚛️ React Speedometer component using d3.js 🌈 🎨
Stars: ✭ 162 (-14.29%)
Mutual labels:  d3
Semiotic
A data visualization framework combining React & D3
Stars: ✭ 2,207 (+1067.72%)
Mutual labels:  d3
Electricitymap Contrib
A real-time visualisation of the CO2 emissions of electricity consumption
Stars: ✭ 2,138 (+1031.22%)
Mutual labels:  d3
Ngx Dynamic Dashboard Framework
This is a JSON driven angular x based dashboard framework that is inspired by JIRA's dashboard implementation and https://github.com/raulgomis/angular-dashboard-framework
Stars: ✭ 160 (-15.34%)
Mutual labels:  d3
Calendar Heatmap
A d3 heatmap for representing time series data similar to github's contribution chart
Stars: ✭ 1,985 (+950.26%)
Mutual labels:  d3
Introd3
Introduction talk to D3
Stars: ✭ 148 (-21.69%)
Mutual labels:  d3
V Chart Plugin
Easily bind a chart to the data stored in your Vue.js components.
Stars: ✭ 188 (-0.53%)
Mutual labels:  d3
React Native Svg Charts
📈 One library to rule all charts for React Native 📊
Stars: ✭ 2,056 (+987.83%)
Mutual labels:  d3
China Geojson
最新中国地图json文件,可用d3开发中国地图
Stars: ✭ 181 (-4.23%)
Mutual labels:  d3
D3 Es6
D3 力导向图 增删改动态更新数据 点击生成节点 拖拽生成连线...
Stars: ✭ 155 (-17.99%)
Mutual labels:  d3
Victory Native
victory components for react native
Stars: ✭ 2,013 (+965.08%)
Mutual labels:  d3
Calendar Heatmap
📊 Calendar heatmap graph
Stars: ✭ 170 (-10.05%)
Mutual labels:  d3
Skillset
✨ Intuitive job-candidate skill visualization, taking advantage of D3.js and JSONResume.
Stars: ✭ 152 (-19.58%)
Mutual labels:  d3
Visx
🐯 visx | visualization components
Stars: ✭ 14,544 (+7595.24%)
Mutual labels:  d3
Vue Tree Chart
flexible tree chart using Canvas and Svg, powered by D3.js
Stars: ✭ 149 (-21.16%)
Mutual labels:  d3
D3tutorial
📊📈 A D3 v6 tutorial - interactive bar chart and multiple coordinated views (MCV)
Stars: ✭ 163 (-13.76%)
Mutual labels:  d3
Clustergrammer
An interactive heatmap visualization built using D3.js
Stars: ✭ 188 (-0.53%)
Mutual labels:  d3
Plotly.js
Open-source JavaScript charting library behind Plotly and Dash
Stars: ✭ 14,268 (+7449.21%)
Mutual labels:  d3
Sunburstr
R htmlwidget for interactive sunburst plots
Stars: ✭ 177 (-6.35%)
Mutual labels:  d3

d3-pedigree-examples

Examples of how to create traditionally styled family pedigrees with D3 v3.

When I started learning how to draw pedigrees with D3, I had difficulty mixing and matching techniques from different examples and separating the basics from the fancy stylistic additions. Hopefully by showing the basics and how to incrementally add advanced features, you won't have to become an expert in D3 just to draw a pedigree.

My requirements were:

  • A tree with square boxes and straight connecting lines. Most D3 tree examples used circles for nodes and curved connecting lines.
  • There needed to be a fixed distance between generations. By default, D3 trees fill up all the available space given to them.
  • The tree needed to be expandable and collapsible.
  • Need a way to display both ancestors and descendants.
  • Pan and zoom.

Examples

Notes

  • Pan and zoom via the mouse are enabled in all examples.

  • In the code you'll often see the variable d as the only parameter of an anonymous function. d is a D3 convention that stands for data.

  • D3 tree layouts are configured for top -> bottom displays. We want a left -> right display so the x and y coordinates are flipped for nodes and links only. This is made even more complicated by svg using screen coordinates instead of cartesian coordinates.

    Say D3 calculates that a root node will be displayed at (10,10) with a child below it at (10,20). We switch the x and y which leaves the root at (10,10) but moves the child to (20,10) which is now to the right. This gives us the traditional left to right ancestral pedigree view.

    To display descendants we swap the x and y then negate the x value which puts child nodes at the left.

  • You have to draw two different trees in order to display both ancestors and descendants which dramatically increases the complexity. I strongly suggest an OOP approach if you need to do that. As you can see in the source code, it gets pretty hairy otherwise.

  • Displaying formatted text in SVG can be a pain because you have little control. There is no built-in way to do text wrapping and you also can't easily style one word or phrase in a sentence. To get around these limitations you could use a foreignObject to display HTML and have all the formatting tools of CSS. However, foreignObject is not supported by any version of IE (11 is the latest at the time of writing). If you need to support any version of IE then you need to stick with pure SVG. Since we're using D3 we can use the handy D3plus library to help with text wrapping. See the Text Wrap example.

  • D3 does not handle pedigree collapse well. D3 trees are designed to only ever branch out; there is no built-in mechanism for allowing the tree to collapse. Here are some options for handling this ourself:

    1. Duplicate common ancestor nodes instead of collapsing the pedigree. This is only feasible if you don't use a dynamic tree. When D3 processes updates to a dynamic tree, it relies on all nodes having a unique ID. So to make this work with a dynamic tree you would need to generate unique IDs for each duplicated person in the pedigree.

    2. Allow the pedigree to collapse by only displaying a common ancestor once. We will let D3 draw the first connection then draw all other connections manually. This is not trivial, especially if you want to have a dynamic tree. There is an example of this. It doesn't appear to be a solution that scales well.

    3. Try using dagre, a library desgigned for rendering DAGs. There is an add-on available for integration with d3 called dagre-d3. I have no experience with this but it seems like a viable solution.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].