标签到JointJS中的流程

时间:2018-01-23 10:08:10

标签: javascript jquery bpmn jointjs rappid

我正在使用jointJs和Rappid。我知道如何绘制bpmn图,就像我附上的照片一样。我正在绘制元素,但是我遇到了一些行(流)的问题。有没有办法添加流标签或名称?正如我在我的图像上添加了红色。

我在他们的文档中看到了这一点,但我看不到任何关于标签的内容

var flow = new joint.shapes.bpmn.Flow({
source: { id: task.id },
target: { id: annotation.id },
flowType: 'association'

});

enter image description here

谢谢,

1 个答案:

答案 0 :(得分:1)

您可能希望查看dia.Link.prototype.labels,因为BPMN流只是链接扩展(joint.shapes.bpmn.Flow = joint.dia.Link.extend({)。

您的流程示例:

flow.label(0, // the label's index (you can have multiple labels per link/flow)
  {
    position: .5, // place it halfway on the link (0-1)
    attrs: {
        text: { fill: 'red', text: 'Label' }
    }
  }
);