我们正在编写一个使用mxgraph生成图形的程序。
新手问题请回答
当使用insertEdge时,我们想要指示特定的颜色,否则它将采用默认样式颜色,
我们需要添加到insertEdge的最后一个参数的样式字符串是什么?敬请指教。
发布于 2021-01-18 19:52:00
您需要在边缘的样式中指定strokeColor元素,如下例所示,它覆盖了默认的边缘笔触颜色以使用‘黑色’(以及其他样式元素)
const v1 = graph.insertVertex(parent, null, 'Pump', 20, 20, 60, 60,vertexStyle);
const v2 = graph.insertVertex(parent, null, 'Tank', 200, 150, 60, 60,vertexStyle);
const e1 = graph.insertEdge(parent, null, '', v1, v2,
// edge style
'strokeWidth=3;endArrow=block;endSize=2;endFill=1;strokeColor=black;rounded=1;'
);它取自mxGraph动画示例
https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/examples/animation.html#L40
https://stackoverflow.com/questions/65773115
复制相似问题