semantic zooming of the force directed graph in d3

前端 未结 2 1882
予麋鹿
予麋鹿 2020-11-27 03:14

Many cases have been shown for force directed graph geometric zooming by SVG Geometric Zooming.

In geometric zooming, I only need to add a transform attribute in zoo

2条回答
  •  萌比男神i
    2020-11-27 03:28

    You have to both transform the node and redraw the paths.

    The idea of "semantic zooming" is that you change the scale of your layout but not the size of individual elements.

    If you have set up the zoom behaviour as in the linked example, it automatically updates the x and y scales for you. You then re-set the position of the nodes based on these scales, and you can also re-set the position and shape of the links.

    If your links are straight lines, re-set the x1,y1,x2 and y2 positions using the updated x and y scales. If your links are paths created with d3.svg.diagonal and the x and y scales, re-set the "d" attribute with the same function.

    If you need more specific instructions, you'll have to post your code.

提交回复
热议问题