openownership / visualisation-tool

A visualisation library for beneficial ownership structures
https://www.openownership.org/en/publications/beneficial-ownership-visualisation-system/bods-data-visualiser/
Apache License 2.0
20 stars 5 forks source link

Support for vertical diagrams #34

Open timgdavies opened 4 years ago

timgdavies commented 4 years ago

The visual language rules allow for horizontal and vertical diagrams.

Is it possible to implement a simple switch to choose between these layout options?

stevenday commented 4 years ago

I took a quick look at this today, there's a simple switch in terms of the underlying options we give to dagre-d3, but doing so breaks the offset paths we use to draw ownership & control separately. Specifically the offset doesn't work any more, so we just get a single line instead of two visible.

Technically, it seems like there's some divide-by-zero issue, either in code which turns our SVG path into a bezier curve, or in the code that then offsets the curve.

The solution to this seems non-trivial, I think it's basically because dagre-d3 doesn't draw continuous curves, they have little straight bits coming out of the nodes. I'm not sure why this isn't a problem on horizontal layouts though.