基础配置
$(go.Shape, // the "from" arrowhead
{
fromArrow: "", //剪头形状 standard右箭头 backward左箭头
stroke: null,
fill: "#B5B5B5",
},
new go.Binding("fill", "color"),
new go.Binding("fromArrow", "fromArrow"),
),
$(go.Shape, // the arrowhead
{
toArrow: "", //standard
stroke: null,
fill: "#B5B5B5",
},
new go.Binding("fill", "color"), //设置箭头颜色
new go.Binding("toArrow", "toArrow") //设置箭头形状
),
设置 左箭头
myDiagram.selection.each(function(node) {
if (node instanceof go.Link) {
let data = node.data
let newShape = 4;
myDiagram.model.setDataProperty(data, "toShortLength", newShape);
myDiagram.model.setDataProperty(data, "fromArrow", "backward");
}
})
设置 右箭头
myDiagram.selection.each(function(node) {
if (node instanceof go.Link) {
let data = node.data
let newShape = 4;
myDiagram.model.setDataProperty(data, "toShortLength", newShape);
myDiagram.model.setDataProperty(data, "toArrow", "standard");
}
})
设置双向箭头
myDiagram.selection.each(function(node) {
if (node instanceof go.Link) {
let data = node.data
let newShape = 4;
myDiagram.model.setDataProperty(data, "toShortLength", newShape);
myDiagram.model.setDataProperty(data, "fromArrow", "backward");
myDiagram.model.setDataProperty(data, "toArrow", "standard");
}
})