Incubator-echarts: 希望可以监听到graph图形缩放事件

Created on 11 Nov 2016  ·  8Comments  ·  Source: apache/incubator-echarts

问题简述 (One-line summary)

无法监听到graph图形缩放事件

版本及环境 (Version & Environment)

ECharts 版本 (ECharts 3.2.2):
浏览器类型和版本 (Chrome 版本 54.0.2840.87 m (64-bit)):
操作系统类型和版本 (windows8.1 专业版):

重现步骤 (Steps to reproduce)

1.滚动鼠标滚轮进行缩放

期望结果 (Expected behaviour)

能够监听到缩放事件及缩放比例

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {
    title: {
        text: 'Graph 简单示例'
    },
    animationDurationUpdate: 1500,
    animationEasingUpdate: 'quinticInOut',
    series : [
        {
            type: 'graph',
            layout: 'none',
            symbol:'rect',
            symbolSize: 50,
            roam: true,
            label: {
                normal: {
                    show: true
                }
            },
            edgeSymbol: [],
            edgeLabel: {
                normal: {
                    textStyle: {
                        fontSize: 20
                    }
                }
            },
            data: [{
                name: '节点1',
                x: 300,
                y: 300
            }, {
                name: '节点2',
                x: 800,
                y: 300
            }, {
                name: '节点3',
                x: 550,
                y: 100
            }, {
                name: '节点4',
                x: 550,
                y: 500
            }],
            // links: [],
            links: [{
                source: 0,
                target: 1,
                symbolSize: [5, 20],
                label: {
                    normal: {
                        show: true
                    }
                },
                lineStyle: {
                    normal: {
                        curveness: 0.2
                    }
                }
            }, {
                source: '节点2',
                target: '节点1',
                label: {
                    normal: {
                        show: true
                    }
                },
                lineStyle: {
                    normal: { curveness: 0.2 }
                }
            }, {
                source: '节点1',
                target: '节点3'
            }, {
                source: '节点2',
                target: '节点3'
            }, {
                source: '节点2',
                target: '节点4'
            }, {
                source: '节点1',
                target: '节点4'
            }],
            lineStyle: {
                normal: {
                    opacity: 0.9,
                    width: 2,
                    curveness: 0
                }
            }
        }
    ]
};

其他信息 (Other comments)

All 8 comments

已找到!

@zuifengwuchou 请问是什么方法啊

@coolwxb
myChart.on('graphRoam', function (params) {
var zoom = myChart._coordSysMgr._coordinateSystems[0]._zoom;
var option = myChart.getOption();
});

@zuifengwuchou 谢谢,我去试试

@zuifengwuchou 对了 我的series type 是map类型
series: [ { type: 'map', mapType: 'china', roam: true, } ]
这种你知道要怎么监听么?我试了graphRoamroam貌似都不好用

geoRoam

@zuifengwuchou 谢谢,这回真的好使了,不过请问下这些个参数实在文档哪里能找到,我看官网3.0的文档没发现这些个参数呀

@coolwxb
在源码中找到的

Was this page helpful?
0 / 5 - 0 ratings