admin管理员组文章数量:1333475
I am trying to implement Concept Map Network Graph using d3.js
. The sample of the graph is available here in the js-fiddle.
js-fiddle
The node direction is pointing from the left direction only. All the nodes in a right side having the lines from the back of rectangle. I want to display all the nodes point in left as well as from right side.
Expected Graph:
I am trying to implement Concept Map Network Graph using d3.js
. The sample of the graph is available here in the js-fiddle.
js-fiddle
The node direction is pointing from the left direction only. All the nodes in a right side having the lines from the back of rectangle. I want to display all the nodes point in left as well as from right side.
Expected Graph:
Share Improve this question edited Aug 19, 2015 at 12:52 Musakkhir Sayyed asked Aug 10, 2015 at 12:14 Musakkhir SayyedMusakkhir Sayyed 7,18013 gold badges43 silver badges67 bronze badges 2- It's hard to interpret your desired behavior, but it sounds like the behavior you want is: when you hover over any node "A", recursively highlight all nodes linked from the root nodes associated with "A". In your first example, that means hovering over "1to1media.", for example, would highlight nearly every node on the page, since the root of "1to1media." is "webmetro.", which is linked to nearly every other node. Is that what you're asking for? – Palpatim Commented Aug 12, 2015 at 14:15
- Hi Palpatim, I updated my question. kindly go through it. Let me know if you have any solution for this. – Musakkhir Sayyed Commented Aug 14, 2015 at 5:19
2 Answers
Reset to default 3I found the solution by checking curve position by using this code.
if(af.x>180)
{
af.xOffset = -S;
}else
{
af.xOffset = S;
}
and by checking the condition for push function
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
})
}
Expected Output was
The problem you're having is that the node links join to the top left corner. of that central column.
You need to:
- Find the source of all links going to the right hand side.
- Offset the source x position by the width of the central column.
It's possible I've got the source and target mixed up. The code looks partially minified, so it's quite hard to read.
You can get the width of an element relatively easily (Example).
You can recognise whether a link should be changed by paring the source and target x positions.
Alternatively, you could look at nodes which link to something which is on the right-hand side, that might prove slightly more plex but recognize links which need changing more accurately.
EDIT:
You might also try binding to the centre of the node, instead of the corner.
本文标签: javascriptConcept Map NetworkNode IssueStack Overflow
版权声明:本文标题:javascript - Concept Map Network - Node Issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742351633a2458611.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论