d3-hierarchy icon indicating copy to clipboard operation
d3-hierarchy copied to clipboard

Layouts should have orientations.

Open mbostock opened this issue 7 years ago • 4 comments

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.

  • [ ] d3.partition = d3.partitionDown
  • [ ] d3.partitionUp
  • [ ] d3.partitionDown
  • [ ] d3.partitionLeft
  • [ ] d3.partitionRight
  • [ ] d3.partitionRadial
  • [ ] d3.tree = d3.treeDown
  • [ ] d3.treeUp
  • [ ] d3.treeDown
  • [ ] d3.treeLeft
  • [ ] d3.treeRight
  • [ ] d3.treeRadial
  • [ ] d3.cluster = d3.clusterDown
  • [ ] d3.clusterUp
  • [ ] d3.clusterDown
  • [ ] d3.clusterLeft
  • [ ] d3.clusterRight
  • [ ] d3.clusterRadial

mbostock avatar Oct 27 '16 21:10 mbostock

Also, radial orientations.

mbostock avatar Oct 28 '16 04:10 mbostock

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)?

ixxie avatar Aug 15 '18 15:08 ixxie

@ixxie something like this?

Misiu avatar Sep 19 '18 08:09 Misiu

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.

curran avatar Oct 23 '19 09:10 curran