Jitjs:在Spacetree图中设置最小和最大缩放限制

时间:2018-11-01 08:52:20

标签: javascript jquery d3.js

我正在开发一个应用程序,该应用程序需要为具有某些约束的空间树图设置缩放限制。我参考了文档,但没有找到任何相关数据。请有人指导我解决这个问题。

以下是我尝试的代码,

  var st = new $jit.ST({

    injectInto: 'infovis',
    duration: 800,
    transition: $jit.Trans.Quart.easeInOut,
    levelDistance: 50,
    Navigation: {
      enable:true,
      panning:true
    },
    Node: {
        height: 20,
        width: 60,
        type: 'rectangle',
        color: '#aaa',
        overridable: true
    },
 Navigation: {
                    enable: true,
                    zooming:20
                    },

    Edge: {
        type: 'bezier',
        overridable: true
    },

});
//load json data
st.loadJSON(json);
st.compute();
st.geom.translate(new $jit.Complex(-200, 0), "current");
st.onClick(st.root);

var top = $jit.id('r-top'), 
    left = $jit.id('r-left'), 
    bottom = $jit.id('r-bottom'), 
    right = $jit.id('r-right'),
    normal = $jit.id('s-normal');


function changeHandler() {
    if(this.checked) {
        top.disabled = bottom.disabled = right.disabled = left.disabled = true;
        st.switchPosition(this.value, "animate", {
            onComplete: function(){
                top.disabled = bottom.disabled = right.disabled = left.disabled = false;
            }
        });
    }
};

top.onchange = left.onchange = bottom.onchange = right.onchange = changeHandler;

}

谢谢。

0 个答案:

没有答案