Comments (4)
Hi, thank you for reporting the issue.
That was a restriction in drawio module in release 0.1.2 but latest code on master brunch includes capability to add labels to links/edges for drawio diagrams - docs - added it as result of working on #1. If you want to test, feel free to install from master:
python3 -m pip install git+https://github.com/dmulyalin/N2G
Yet to release N2G 0.2.0, as planning to add new features and refactor the code a bit. But 0.2.0 will include capability to add src/trgt labels to edges for drawio.
from n2g.
Thanks for the reply. I am using the latest from master branch. These two links do not have labels (nor need them), but one is A->B and the other is B->A. They are getting collapsed into a single link (which is semantically incorrect for what I need).
I did a clean venv with the pip install
approach and the same result.
from n2g.
Ok, I see.
Each link need to have unique ID attribute assigned, the most natural way is to use link labels and source/target nodes ID to derive link id. If several links with no labels added between same nodes, links will end up with same ID value calculated, by default second link will be skipped as a duplicate.
Added support for optional link_id
attribute to add_link
method starting with commit 78c7395. link_id
must be unique across all links on this particular diagram.
from N2G import drawio_diagram as create_drawio_diagram
data = {
"nodes": [
{"id": "node-1"},
{"id": "node-2"}
],
"links": [
{
"source": "node-1",
"target": "node-2",
"link_id": 1,
'style': 'endArrow=classic;endFill=0;sourcePortConstraint=east;targetPortConstraint=west;edgeStyle=orthogonalEdgeStyle;'
},
{
"source": "node-2",
"target": "node-1",
"link_id": 2,
'style': 'endArrow=classic;endFill=0;sourcePortConstraint=east;targetPortConstraint=west;edgeStyle=orthogonalEdgeStyle;'
}
]
}
drawio_drawing = create_drawio_diagram()
drawio_drawing.from_dict(data)
drawio_drawing.dump_file("diagram.drawio", ".")
from n2g.
Great - that works. Can work with that. Thanks.
BTW you need to add ttp
and openpyxl
to your package dependencies in the instructions
from n2g.
Related Issues (20)
- Can't Read New Diagrams.net XML HOT 2
- Typing error documentation HOT 1
- Redundant link are over lapping on each other HOT 1
- Method for 'clustering' nodes as posistional argument HOT 4
- Excellent Software! - one question regarding src_label and trgt_label HOT 3
- Unable to update node HOT 2
- Use drawio library element as node style HOT 1
- Any support for Nokia routers? HOT 1
- layout not working HOT 1
- Center text horizontally if only has "bottom_label", no "top-label" HOT 1
- sample graph : src_label does not show in topology HOT 2
- suggestion : ability to specify font name and size for yEd output
- Add carriage return to node "label" in drawio_diagram class HOT 1
- [RFE] Add ability to assign layers when using drawio diagram HOT 2
- Tests not passing HOT 2
- Help for rt layout HOT 1
- Building diagrams for FPrime and Feature requiests HOT 1
- TypeError: add_link() got an unexpected keyword argument 'src_label' HOT 1
- 【feature】Can save it to PNG or JEPG ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n2g.