Create label on diagram-js


#1

Hello,

I am using diagram-js to implement a custom workflow modeler.

At the moment I want to be able to put a label inside a shape, I dug into the code, but I was not able to pull it off with sucess.

How can I achieve such feature? What do I need to use?

Is there any documentation, besides what is inside the code?

PS: I used the example that was on the github page to start my custom modeler.


#2

If I understand correctly you want to render labels into custom elements. Have you had a look at the BpmnRenderer. This is where the rendering of labels happens.


#3

But how can I achieve that in diagram-js? (Not with bpmn-js)


#4

You’d have to build it similar to how it is build in bpmn-js. This involves a couple of things like specifying rules which elements can have labels, creating the actual label shapes layouting and rendering the text. It’s not trivial but you can see all the aspects of it in bpmn-js.