echarts icon indicating copy to clipboard operation
echarts copied to clipboard

关系图节点设置 x,y 后显示不正确

Open maoyr opened this issue 8 years ago • 2 comments

One-line summary [问题简述]

关系图节点设置 x,y 后显示不正确。

比如 data: [{ name: '节点1', x: 10, y: 10 }, { name: '节点2', x: 20, y: 20 }] 和 data: [{ name: '节点1', x: 100, y: 100 }, { name: '节点2', x: 200, y: 200 }] 展示出来居然是一样的。 x,y 难道不是对应 canvas 画布的吗? 如果不是的话,怎样可以把 x,y 转换成相对于画布位置的值?

Version & Environment [版本及环境]

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

Expected behaviour [期望结果]

希望 x,y 是对应 canvas 画布的位置,或者怎样转换为画布相对位置。

ECharts option [ECharts配置项]

option = {
    series : [
        {
            type: 'graph',
            layout: 'none',
            symbolSize: 50,
            roam: true,
            label: {
                normal: {
                    show: true
                }
            },
            edgeSymbol: ['circle', 'arrow'],
            edgeSymbolSize: [4, 10],
            edgeLabel: {
                normal: {
                    textStyle: {
                        fontSize: 20
                    }
                }
            },
            data: [{
                name: '节点1',
                x: 10,
                y: 10
            }, {
                name: '节点2',
                x: 20,
                y: 20
            }],
            links: [ {
                source: '节点1',
                target: '节点2'
            }]
        }
    ]
};

Other comments [其他信息]

maoyr avatar Feb 07 '18 08:02 maoyr

这个问题为什么关了?

ArrayZheng avatar Mar 22 '18 03:03 ArrayZheng

需要自己做坐标转换,基本能实现相对位置,参考 convertToPixel/convertFromPixel

maoyr avatar Mar 22 '18 04:03 maoyr