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 click not working

See original GitHub issue

Version

5.2.1

Reproduction link

https://jsfiddle.net/tmtron/9y0xtqs7/11/

Steps to reproduce

click on the dataZoom

What is expected?

click event should be invoked

What is actually happening?

click event is not invoked


The example from the documentation: echartsInstance. on is also not working:

chart.on('click', 'dataZoom', function () {...});
  • Other click events work: e.g. on the series, axis-labels (when triggerEvent is set to true)
  • but for dataZoom, triggerEvent does not exist
  • Maybe someone knows a temporary workaround?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
pissangcommented, Jan 4, 2022

Sorry for not merging the PR from @susiwen8 . Didn’t notice it’s a mistake from the doc.

We need to think through these questions carefully before we providing such an event.

  1. Which part of the dataZoom can trigger the event. The whole component or only the slider. If it’s only the slider, what about other parts of the dataZoom.
  2. What event parameters we need to provide. And how developers can use them in their scenarios.
  3. How should we handle the conflicts of loading action from click event handler and the default dataZoom action.
  4. Is there a better way to do async loading on demand. For example, render a loading button around the slider, this button will trigger click event with necessary event parameters.
0reactions
tmtroncommented, Dec 17, 2021

We are trying to keep all exposed API are simple and consistent.

In the case of a click event for the data-zoom slider, there is anyway only very little info that you can send along:

  • the click point
  • optionally the selected range.
    this is maybe not required, when you can also ask the chart-instance fot he currently selected range and maybe find out if the click-point is in the selected zoom range, or outside

API that only solve one very specific case needs to be added very carefully.

A click event is something very generic and for sure not tied to a single use-case.

There are many more things that this can be used for:
e.g. we have a config mode, where the users can configure/move/resize the charts. in this mode, a click on the zoom slider could bring up a config dialog, where they can configure the slider: e.g.

  • slider properties: color, handleSize, …
  • a check-box if they want to show the slider at all

Another use-case that you have mentioned is the click-moves-the-zoom-window feature.
This could easily be implemented by users of the library via this click event.
Even better; we could implement our own strategy: e.g. maybe we want that clicking should not move the zoom window, but expand or shrink the window to the click-point

Well, I don’t know a better way to do this. However I am very open to suggestions.

From my side. Your first and second solution sounds more solid on the user experience. But that’s only my humble opinion. I’m just not convinced that adding click event on dataZoom can provide a good enough solution to solve cases like this.

Well, I also thought that at first. But in the meanwhile I have changed my mind and think that our users are right.
When you use the zoom slider handles to select a suitable range, then you don’t want to move the mouse away, to a button or menu - you want to immediately invoke the load-action by a simple click.

Read more comments on GitHub >

github_iconTop Results From Across the Web

echarts dataZoom event does not return timestamp but only ...
I came across the same problem the following simple code works perfectly for me: myChart.on('dataZoom', function() { var option = myChart.
Read more >
Need Help DataZoom option not working · Issue #7049 - GitHub
One-line summary [问题简述] I can not figure out how to get data zoom to work with my chart, the chart and data show...
Read more >
See How It Works - Datazoom
Datazoom users can easily create new datapipes, using an intuitive drag-and-drop interface, and configure them in just a few clicks.
Read more >
Event and Action - Concepts - Handbook - Apache ECharts
There are two kinds of event in ECharts, one happened when the user clicks the mouse or hover the elements in charts, the...
Read more >
Datazoom | New Relic Instant Observability
The Datazoom quickstart will help you gain insights into your viewers streaming video experience. ... Click the install button. Install the quickstart to ......
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