d3 / d3-hierarchy

2D layout algorithms for visualizing hierarchical data.
https://d3js.org/d3-hierarchy
ISC License
1.13k stars 315 forks source link

Layouts should have orientations. #63

Open mbostock opened 7 years ago

mbostock commented 7 years ago

Currently, you have to do some tedious dancing to change the orientation of d3.cluster, d3.tree or d3.partition, for example swapping x ↔︎ y and width ↔︎ height. It’d be nice if these layouts supported orientations, so that it was trivial to replace the default top-to-bottom tree with a bottom-to-top tree or a left-to-right, etc.

mbostock commented 7 years ago

Also, radial orientations.

ixxie commented 6 years ago

We are trying to flip our d3.cluster at the moment; until this feature is implemented it may be nice to have an example of this sort of thing document, perhaps here (where google landed me)?

Misiu commented 5 years ago

@ixxie something like this?

curran commented 4 years ago

The dancing is not really that tedious IMO. Orientation feels like it does not need to be core functionality.

I wonder if it might be possible to introduce generic transforms that could be applied as a separate step, after computing the original layouts. That way the pain point would be adressed, while introducing less new API surface area.