bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
928 stars 330 forks source link

Is it possible to get a Label per "Depth Level?" When that level has something in it ? #325

Open Morphexe opened 1 year ago

Morphexe commented 1 year ago

I am in need of adding a Depth Level label to the left of children that reports the depth level (or a custom information).

Either that or a way to be able to get how many levels are open, and the Y coordinate on the screen somewhat.

Thanks.

bumbeishvili commented 1 year ago

Hi, there are two properties attached to d variable in the nodeContent func which might be useful

  1. depth
  2. _height
chart.nodeContent(d=> `depth:${d.depth}, hierarchy height: ${d.height}`)

That d is a d3 hierarchy object, so you can use any property or method attached to it

Full list here - https://d3js.org/d3-hierarchy/hierarchy#hierarchy