Zoomable和Draggable折线图

时间:2015-09-07 07:52:43

标签: javascript jquery d3.js svg

我想绘制一张具有可缩放和可拖动属性的图表。

Chart View 1

放大后有子元素的人应该如下图所示。

Second View after zoom child element is showing

我没有找到任何线索。

1 个答案:

答案 0 :(得分:1)

查看您发布的图表,没有直接的d3 laout以这种螺旋方式排列节点。但是,如果您知道需要放置节点的位置,则可以进行力布局。

是的,您可以拖动节点,链接将相应更新。附上一个小提琴你可以即兴创作并将图像添加到节点。节点的数据应该是这样的:

"nodes": [{
        "x": 30,// as i said you need to provide the x coordinate where to put the node
        "y": 30,
        fixed: true,//so that the force layout don't move it
        name: "Start", //text to be displayed 
        display: "none",// set this as none if you dont want the circle
        tx: 5, //x placement of text on node
        ty: -5 //y placement of text on node
    }, {
        "x": 200,
        "y": 30,
        fixed: true,
        name: "A"
    },

这是我的fiddle

相关问题