question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

datazoom event not detected from roam mousewheel or toolbox

See original GitHub issue

Version

4.3.0

Reproduction link

https://www.echartsjs.com/examples/en/editor.html?c=graph

Steps to reproduce

  1. Edit example code to be this (adding datazoom event listener at very bottom):
myChart.showLoading();
$.get(ROOT_PATH   'data/asset/data/les-miserables.gexf', function (xml) {
    myChart.hideLoading();

    var graph = echarts.dataTool.gexf.parse(xml);
    var categories = [];
    for (var i = 0; i < 9; i  ) {
        categories[i] = {
            name: '类目'   i
        };
    }
    graph.nodes.forEach(function (node) {
        node.itemStyle = null;
        node.value = node.symbolSize;
        node.symbolSize /= 1.5;
        node.label = {
            normal: {
                show: node.symbolSize > 30
            }
        };
        node.category = node.attributes.modularity_class;
    });
    option = {
        title: {
            text: 'Les Miserables',
            subtext: 'Default layout',
            top: 'bottom',
            left: 'right'
        },
        tooltip: {},
        legend: [{
            // selectedMode: 'single',
            data: categories.map(function (a) {
                return a.name;
            })
        }],
        animationDuration: 1500,
        animationEasingUpdate: 'quinticInOut',
        series : [
            {
                name: 'Les Miserables',
                type: 'graph',
                layout: 'none',
                data: graph.nodes,
                links: graph.links,
                categories: categories,
                roam: true,
                focusNodeAdjacency: true,
                itemStyle: {
                    normal: {
                        borderColor: '#fff',
                        borderWidth: 1,
                        shadowBlur: 10,
                        shadowColor: 'rgba(0, 0, 0, 0.3)'
                    }
                },
                label: {
                    position: 'right',
                    formatter: '{b}'
                },
                lineStyle: {
                    color: 'source',
                    curveness: 0.3
                },
                emphasis: {
                    lineStyle: {
                        width: 10
                    }
                }
            }
        ]
    };

    myChart.setOption(option);
    
   // Add this to sample 
    myChart.on('datazoom', function(e) {
        console.log('zoom');
    });
   // End add this
}, 'xml');
  1. Zoom with mouse action (or add toolbox zoom controls and zoom that way).

  2. No zoom event is detected.

What is expected?

A zoom event is detected.

What is actually happening?

Nothing.


Options from my own similar project:

setup.options = {
  title: {
    top: 'bottom',
    left: 'right'
  },
  animation: false,
  tooltip: {
    trigger: 'item',
    position: 'right',
    confine: true,
    backgroundColor: 'transparent',
    padding: [40, 0, 0, 0],
    enterable: false,
    formatter: function(item) {
      return 'Click for more';
    }
  },
  series : [
    {
      name: '###',
      type: 'graph',
      layout: 'force',
      force: {
        repulsion: 95,
        gravity: 0.015,
        edgeLength: 40,
        layoutAnimation: false
      },
      roam: true,
      draggable: true,
      data: setup.nodes,
      links: setup.links,
      focusNodeAdjacency: true,
      itemStyle: {
        normal: {
          borderColor: '#fff',
          borderWidth: 1,
          shadowBlur: 10,
          shadowColor: 'rgba(0, 0, 0, 0.3)'
        }
      },
      lineStyle: {
        color: 'source',
        curveness: 0.3
      },
      emphasis: {
        lineStyle: {
          width: 10
        }
      }
    }
  ]
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
yufeng04commented, Oct 1, 2019

Sorry, I made a mistake to take option.dataZoom into consideration just now. According to the code, maybe you can use:

myChart.on('graphRoam', function(e) {
        console.log('zoom');
});

Hope it helps you!

1reaction
lougroshekcommented, Oct 2, 2019

@yufeng04 graphRoam works! Thank you! I can’t get zoom start and end, but I am able to detect the event and see whether it’s zoom in or out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

datazoom event not detected from roam mousewheel or toolbox
Edit example code to be this (adding datazoom event listener at very bottom):. myChart.showLoading(); $.get(ROOT_PATH 'data/asset/data/les- ...
Read more >
echarts 4.3.0 datazoom event not detected - Stack Overflow
I'm not able to detect the datazoom event when for a chart with series type graph, with roam enabled. This is for eCharts...
Read more >
Data zoom with mouse wheel does not work. - Nevron Software
I checked the "Wheel Zoom" check box in the "Data Zoom Tool" of the sample provided by your company and tried to operate...
Read more >
org.apache.echarts.commits - 2019 October - 1251 messages
[GitHub] [incubator-echarts] amygroshek edited a comment on issue #11361: datazoom event not detected from roam mousewheel or toolbox - GitBox.
Read more >
Changelog - Apache ECharts
[Fix] Fix sometimes when using "toolbox dataZoom" it can not return to the original state. Fix #11055. [Fix] Fix the texture pattern rendering...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found