Labels in Nodes and Ports
b12-144 opened this issue · 1 comments
b12-144 commented
Hi, this project is really cool.
Is it possible to add a label to the node and next to the in/out ports, similar to what react diagrams do?
Thanks!
DanielNetzer commented
Hi @brunovacare, you can see in the code the DefaultNodeComponent and the way it's implemented here:
https://github.com/DanielNetzer/ngx-diagrams/tree/3bcfe40bb04b846096e9b088a1c0219d0793aa62/projects/ngx-diagrams/src/lib/defaults/components/default-node
in a similar manner you can create a custom node with anything you'd like.
to create a Label you can just do:
import { ..., DefaultLabelModel } from 'ngx-diagrams';
...
const someLinkModel = new DefaultLinkModel();
const capsLabel = new DefaultLabelModel('LABEL!');
someLinkModel.setLabel(capsLabel);