【问题标题】:Is there a way to align the first node at the top instead of at the middle?有没有办法将第一个节点对齐在顶部而不是中间?
【发布时间】:2019-02-07 18:11:54
【问题描述】:

我正在使用 BalkanGraph 插件,我正在尝试将 orgchart 的第一个父节点对齐到 svg 的顶部而不是它的中心。

我尝试设置一个负的“margin-top”并增加整个 svg 的高度,但随后点击随之而来,并且效果不佳。

我唯一的 CSS 是这样的:

#tree {
    width: 100%;
    height: 630px;
    border: 1px solid lightgray;
    background-color: #fff;
}

我在 Orgchart 中使用的是这些:

var chart = new OrgChart(document.getElementById("tree"), {
    mouseScroolBehaviour: BALKANGraph.action.zoom,
    nodeMouseClickBehaviour: BALKANGraph.action.none,
    scaleInitial: BALKANGraph.match.boundary,

    collapse: {
        level: 2,
        allChildren: true
    },
});

【问题讨论】:

    标签: orgchart


    【解决方案1】:

    align 选项设置为 BALKANGraph.ORIENTATION

       var chart = new OrgChart(document.getElementById("tree"), {
                align: BALKANGraph.ORIENTATION,
                ...
       });
    

    【讨论】:

    • 刚刚试过,久等了。没有用,它仍然是中心化的。我没有设置任何方向,所以默认是顶部,对吧?也尝试设置它,但它没有改变:/。还有其他想法吗?
    • 从设置中移除 scaleInitial: BALKANGraph.match.boundary
    猜你喜欢
    • 2021-09-08
    • 2021-07-23
    • 1970-01-01
    • 2015-10-25
    • 1970-01-01
    • 2018-08-02
    • 2022-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多