antvis/G6

Combo收缩时changeData重新加载相同一份数据后Combo内部节点和线条错位 #4751

youbins posted onGitHub

问题描述

Combo收缩时changeData重新加载相同一份数据后Combo内部节点和线条错位(注:拓扑不管Combo还是Node都是指定(x,y)坐标的) 1、首次初始化并加载数据 1

// 首次加载时装载数据部分代码
let dtreeData = _topo.dtreeData,
    g6GrapData = _topo.g6GraphData;
_topo.performance['renderStart'] = new Date().getTime();
_topo.initDtree(dtreeData);
_topo.processParallelEdges(g6GrapData.edges);
_topo.g6Graph.read(g6GrapData);
_topo.performance['initEnd'] = _topo.performance['renderEnd'] = new Date().getTime();
_topo.exFunction(callback);
_topo.printPerformance();

2、Combo收缩时使用changeData重新加载相同的一份数据(异常) 2

# 使用changeData重新装载数据部分代码
let dtreeData = _topo.dtreeData,
    g6GrapData = _topo.g6GraphData;
_topo.performance['renderStart'] = new Date().getTime();
_topo.reloadDtree(dtreeData);
_topo.processParallelEdges(g6GrapData.edges);
__topo.g6Graph.changeData(g6GrapData, false);_
_topo.performance['refreshEnd'] = _topo.performance['renderEnd'] = new Date().getTime();
_topo.refreshNeAlarmInfo(_topo.prevAlarmInfo);
_topo.exFunction(callback);
_topo.printPerformance();

如果刷新前,Combo是收缩状态,此时使用changeData重新装载数据,再展开Combo则发现其内节点和边位置发生错位。 3、Combo展开时使用changeData重新加载相同的一份数据(恢复正常) 3 如果刷新前,Combo是展开状态,此时使用changeData重新装载数据,再展开Combo则发现其内节点和边位置恢复正常。

重现链接

Combo

重现步骤

1、Combo和Node指定x,y坐标,假设第一步使用数据A初始化拓扑。 2、Combo收缩状态时使用changeData重新装载一次数据A(异常)。 3、Combo展开状态时使用changeData重新装载一次数据A(恢复正常)。

预期行为

正常情况下,相同一份数据,不管Combo在使用changeData前是处于展开亦或收缩状态,其内节点和线条位置应保持一致才对。

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


我之前遇到过类似的问题,最后的解决方法是在combo展开/收缩后用graph.render()取代graph.changeData()重新渲染,并调用graph.layout()重新布局

graph.on('afterrender', _event => {
    graph.layout();
});
posted by ravengao over 1 year ago

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 10 months ago

Fund this Issue

$0.00
Funded

Pull requests