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

Edge attributes support #48

Merged
merged 7 commits into from
Mar 9, 2020
Merged

Edge attributes support #48

merged 7 commits into from
Mar 9, 2020

Conversation

ki11roy
Copy link
Contributor

@ki11roy ki11roy commented Mar 1, 2020

First, I would like to say thank you for such a handy tool, because I personally hate to draw diagrams by hand.
This PR adds support for Edges, colors and labels in particular and some other features like circular references and so on. Also, I have slightly changed tests to use folders instead of files in some cases. Just comment tear down to keep the folders with images.

Examples of usage could be seen in the tests, for example:

                node1 = Node("node1")
                node2 = Node("node2")
                nodes = [Node("node3"), Node("node4")]
                
                # line                
                nodes - Edge(color='red') - node1

                # one directional
                nodes >> Edge(color='red', label='6.1') >> node1
                nodes << Edge(color='green', label='6.2') << node1
                
                # both directional
                node1 << Edge(color='blue', label='1.3') >> node2

                # loop
                node >> Edge(color='blue', label='3.3') << node

@ki11roy
Copy link
Contributor Author

ki11roy commented Mar 1, 2020

As an improvement Edge could be replaced with dict in some cases, just to add some consistency with the original syntax ( node1 >> {'color': 'red'} >> node2 ), but it won't work with the group of nodes, regretfully ( nodes >> {'color': 'red'} >> node ).

@ki11roy ki11roy changed the title Edges support Edge attributes support Mar 1, 2020
@mingrammer mingrammer linked an issue Mar 2, 2020 that may be closed by this pull request
@mingrammer mingrammer added the kind/feature New feature or request label Mar 2, 2020
@pchaganti
Copy link

pchaganti commented Mar 2, 2020

@ki11roy Is it possible to assign an icon to a node?

thx!

@ki11roy
Copy link
Contributor Author

ki11roy commented Mar 3, 2020

@pchaganti take a look at examples with Custom Nodes, this feature is about edges only.

@mingrammer
Copy link
Owner

Awesome.

Great works! I'll test it with some diagrams for checking backward compatibility.

And could you please add a practical example diagram in the examples page?

@ki11roy
Copy link
Contributor Author

ki11roy commented Mar 3, 2020

Added some examples and additional parameter "style" (i.e. dotted, dashed, bold, solid).

@pchaganti pchaganti mentioned this pull request Mar 4, 2020
diagrams/__init__.py Outdated Show resolved Hide resolved
diagrams/__init__.py Show resolved Hide resolved
diagrams/__init__.py Outdated Show resolved Hide resolved
diagrams/__init__.py Show resolved Hide resolved
docs/getting-started/examples.md Outdated Show resolved Hide resolved
diagrams/__init__.py Outdated Show resolved Hide resolved
docs/guides/edge.md Outdated Show resolved Hide resolved
Copy link
Owner

@mingrammer mingrammer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thank you for adding a great feature. I really appreciate it :)

@mingrammer mingrammer merged commit ca1e7ec into mingrammer:master Mar 9, 2020
@mingrammer mingrammer self-assigned this Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Per node/edge attributes
4 participants