Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

echarts 4.0 树缩放 后收拢根节点会玩失踪 #9256

Closed
020cui opened this issue Oct 19, 2018 · 8 comments
Closed

echarts 4.0 树缩放 后收拢根节点会玩失踪 #9256

020cui opened this issue Oct 19, 2018 · 8 comments

Comments

@020cui
Copy link

020cui commented Oct 19, 2018

One-line summary [问题简述]

前置条件:
1,当树的配置 启用了内部缩放,与拖动
2,视图中拖动过树,(或做过缩放动作)

对根节点进行收缩处理,根节点会向树根反方向飘移一个较大的距离,
根节点在边缘的话,就会看不见树,(树跨界了)且没办法找到树,

临时解决办法:只能重置或刷新页面

Version & Environment [版本及环境]

  • ECharts version [4.0]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

ECharts option [ECharts配置项]

myChart.showLoading();
$.get('data/asset/data/flare.json', function (data) {
myChart.hideLoading();

myChart.setOption(option = {
    tooltip: {
        trigger: 'item',
        triggerOn: 'mousemove'
    },
    series:[
        {
            type: 'tree',

            data: [data],

            left: '2%',
            right: '2%',
            top: '8%',
            bottom: '20%',

            symbol: 'emptyCircle',

            orient: 'vertical',

            expandAndCollapse: true,
            roam: true,
            label: {
                normal: {
                    position: 'top',
                    rotate: -90,
                    verticalAlign: 'middle',
                    align: 'right',
                    fontSize: 9
                }
            },

            leaves: {
                label: {
                    normal: {
                        position: 'bottom',
                        rotate: -90,
                        verticalAlign: 'middle',
                        align: 'left'
                    }
                }
            },

            animationDurationUpdate: 750
        }
    ]
});

});

option = {

}

Other comments [其他信息]

http://www.echartsjs.com/gallery/editor.html?c=tree-vertical

image

@deqingli deqingli self-assigned this Oct 19, 2018
@side9527
Copy link

我之前也遇到这个问题,后来的解决方法是,点击节点的时候根据chartChild._chartsViews[0]._data._graphicEls.length 来判断点击的节点是否为根节点(length < 3即为根节点),如果是根节点就使用chartChild.setOption(chartChild.getOption())重新产开,也算是不让他收起根节点吧,别的方法找了很多没找到,就先暂时用的这个

@mm007008009
Copy link

mm007008009 commented Nov 8, 2018

补充一下:
1.开启roam属性后,才会有这个问题,拖动后点击根节点必现,如果不拖动,点击根节点概现。
2.横竖树图都有这个问题,是往展开方向的反方向,进行位移。

@lurenj
Copy link

lurenj commented Jan 17, 2019

问一下,现在这个问题解决了吗?

@deqingli
Copy link
Member

deqingli commented Sep 3, 2019

#10291

@yuxiaoxia
Copy link

怎么解决?关系图也有这样的问题

@wangmeijian
Copy link

配置setOption的第二个参数设置为true即可,意思是重新绘制

@doubleSweet99
Copy link

请问有人解决这个问题了吗?

@cengcengceng
Copy link

getOption后设置center为null,setOption即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants