Skip to content

graph 使用 force 布局,设置series-graph.force.layoutAnimation:false后,如果更新数据,会导致布局错乱 #12211

@diklios5768

Description

@diklios5768

Version

4.6.0

Steps to reproduce

使用如下设置:

tooltip: {
        show: true,
        showContent: true,
        trigger: 'item',
        triggerOn: 'mousemove',
        alwaysShowContent: false,
        showDelay: 100,
        hideDelay: 2000,
        enterable: false,
        position: 'right',
        confine: false,
        transitionDuration: 0.2,
    },
    legend: {
        show: true,
        type: "scroll",
        animation: true
    },
    series: [{
        type: 'graph',
        name: '',
        layout: 'circular',
        // animation: false,
        legendHoverLink: true,
        hoverAnimation: true,
        coordinateSystem: null,
        xAxisIndex: 0,
        yAxisIndex: 0,
        force: {
            repulsion: 10,
            gravity: 0.1,
            edgeLength: 500,
            layoutAnimation: false
        },
        roam: true,
        nodeScaleRatio: 0.6,
        draggable: true,
        focusNodeAdjacency: true,
        symbol: 'circle',
        edgeSymbol: ['none', 'arrow'],
        edgeSymbolSize: 5,
        itemStyle: {
            color: '#6D9AA2',
            borderType: 'solid',
            borderColor: '#fff',
            borderWidth: 1,
            opacity: 1,
            shadowBlur: 10,
            shadowColor: 'rgba(0, 0, 0, 0.3)',
            emphasis: {
                color: "#334553"
            }
        },
        lineStyle: {
            normal: {
                width: '1',
                type: 'solid',
                curveness: 0.3,
                opacity: 0.2
            },
            emphasis: {
                width: 10
            }
        },
        label: {
            normal: {
                show: true,
                position: 'inside',
                textStyle: {
                    color: 'rgba(164,100,34,0.6)',
                    fontStyle: 'normal',
                    fontWeight: 'bolder',
                    fontFamily: 'sans-serif',
                    fontSize: 15,
                }
            },
            emphasis: {}
        },
        edgeLabel: {
            normal: {
                show: false
            },
        },
        data:[{}],
        links:[{}]

data和 links 比较长,难以上传代码,故给一张图片
force bug
当使用鼠标缩放后,就恢复正常了。

What is expected?

希望能够有好的解决办法,这个问题已经存在很久了,之前有一个人提出了问题但是没上传代码问题被自动关闭了。其他社区也看到有人提出问题,但是没有找到解决办法。

What is actually happening?

实际上就是重新绘制图的时候好像截了动画过程中的一帧,但是如果打开动画,慢慢看他加载完毕,最后结果就是正常的。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions