//3.画线
var _sPos = {
x:(node1.getBBox().x+node1.getBBox().x2)/2,
y:(node1.getBBox().y+node1.getBBox().y2)/2
};
var _ePos = {
x:(node2.getBBox().x+node2.getBBox().x2)/2,
y:(node2.getBBox().y+node2.getBBox().y2)/2
};
//直线 M (x y)+
var path = ['M', _sPos.x, _sPos.y, _ePos.x, _ePos.y];
var lineAttr = {
"stroke":"#2E3DF2",//字符串笔触颜色
"stroke-width":2,//数字笔触宽度(像素,默认为1)
"stroke-dasharray":[""],//笔触分割样式 ["", "-", ".", "-.", "-..", ". ", "- ", "--", "- .", "--.", "--.."]
}
var line1 = graph.path(path.join(',')).attr(lineAttr).toBack();
//曲线-- C (x1 y1 x2 y2 x y)+
var sAPoint = {
x: _sPos.x + (_ePos.x - _sPos.x) * 0.2 + 0.12 * (_ePos.y - _sPos.y),
y: _sPos.y + (_ePos.y - _sPos.y) * 0.2 - 0.12 * (_ePos.x - _sPos.x)
};
var eAPoint = {
x: _ePos.x - (_ePos.x - _sPos.x) * 0.2 + 0.12 * (_ePos.y - _sPos.y),
y: _ePos.y - (_ePos.y - _sPos.y) * 0.2 - 0.12 * (_ePos.x - _sPos.x)
};
var path = ['M', _sPos.x, _sPos.y, 'C', sAPoint.x, sAPoint.y, eAPoint.x, eAPoint.y, _ePos.x, _ePos.y];
var line2 = graph.path(path.join(',')).attr(lineAttr).toBack();