Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to control Clusters arrangement, from left to right or top down? #44

Open
ki11roy opened this issue Feb 27, 2020 · 6 comments
Labels
help wanted Extra attention is needed kind/feature New feature or request question Further information is requested

Comments

@ki11roy
Copy link
Contributor

ki11roy commented Feb 27, 2020

Is it possible to control Clusters arrangement, from left to right or top-down for example? How?

@mingrammer
Copy link
Owner

mingrammer commented Feb 27, 2020

Cluster class also has direction options, but it does not work. So I left a comment on why that does not work.

__init__.py

199: # FIXME:
200:     #  Cluster direction does not work now. Graphviz couldn't render
201:     #  correctly for a subgraph that has a different rank direction.

As the comment says, it is not supported (or impossible?) now because the Graphviz issue.

@mingrammer mingrammer added kind/feature New feature or request help wanted Extra attention is needed question Further information is requested labels Feb 27, 2020
@dotenorio
Copy link

i'll try to fix this

@dotenorio
Copy link

failed
sorry

@TheAshwanik
Copy link

HI @mingrammer , awesome work with the tool.. Loving it totally.
The Direction on the Clusters would have been very useful. Any idea any way this could be solved?

@FFengIll
Copy link

FFengIll commented Aug 13, 2020

As we know, Graphviz can not set a new direction (layout) in sub-rank items.
Is it possible to create a sub-graph (only the Cluster) first and then put it (as image file) back to the global graph (the original Diagram)?

If we change Cluster, and render cluster to a temp svg,
then we can use Custom with the temp one.

I made a demo and output like bellow:
image

With this solution, we can use different layout on cluster; link cluster as node.
But this solution comes with a serious drawback - edge CAN NOT link any node included in the cluster (of course).

So we must do a choice

  • link node in cluster or
  • link only the whole cluster for each cluster define.

Furthermore, more temp files generated,
and the direction is a side-effect, not the major motivation

# Diagrams code demo
# Mention: I forked a version, so the code can not work in others.

with Diagram("Demo", show=False, direction="LR", filename="test", outformat='png'):

    parser = Compute('Parser & Analysis')

    with Cluster('object1',direction='LR') as cls1:
        objects = [
            Android(''),
            InternetOfThings('')
        ]

    with Cluster('object2',direction='TB') as cls2:
        objects2 = [
            Android(''),
            InternetOfThings('')
        ]

    parser - cls1
    parser >> cls1
    cls1 - cls2
    cls1 >> cls2 >> cls1

    # sorry, we can not
    # parser >> objects2

@HariSekhon
Copy link

This is a critical feature, without this some diagrams come out badly laid out, eg:

https://github.com/HariSekhon/Diagrams-as-Code/blob/master/opentsdb_kubernetes_hbase.py

When this should clearly be stacked on top of each other rather than this awkward side-by-side layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kind/feature New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants