Mus*_*yed 14 javascript jquery d3.js
我正在尝试使用d3.js.实现Concept Map网络图.图表的样本可以在js-fiddle中找到.
我通过使用此代码检查曲线位置找到了解决方案。
if(af.x>180)
{
af.xOffset = -S;
}else
{
af.xOffset = S;
}
Run Code Online (Sandbox Code Playgroud)
并通过检查推送功能的条件
if (ab.x > 180) {
H.push({
source: ae,
target: ab,
key: aa,
canonicalKey: aa,
x1: ae.x + (ab.type === "theme" ? 0 : U),
y1: ae.y + K / 2,
x2: Math.cos(Y) * X + ab.xOffset,
y2: Math.sin(Y) * X
})
}
else if (ae.x < 180) {
H.push({
source: ae,
target: ab,
key: aa,
canonicalKey: aa,
x1: ae.x + (ab.type === "theme" ? U : 0),
y1: ae.y + K / 2,
x2: Math.cos(Y) * X + ab.xOffset,
y2: Math.sin(Y) * X
})
}
Run Code Online (Sandbox Code Playgroud)
预期输出为