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 v3.1.10 ‘click’ 事件 #3440

Closed
Sammi4fun opened this issue Jun 16, 2016 · 11 comments
Closed

ECharts v3.1.10 ‘click’ 事件 #3440

Sammi4fun opened this issue Jun 16, 2016 · 11 comments

Comments

@Sammi4fun
Copy link

问题简述 (One-line summary)

点击图中灰色区域时,没有触发 ‘click’ 事件。
不知道点击该区域时是否会触发 ‘click’事件?

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.1.10
  • 浏览器类型和版本 (Browser version):chrome 50.0.2661.102
  • 操作系统类型和版本 (OS Version):OS X EI Capitan 10.11.5

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

期望能触发 ‘click’ 事件

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

ECharts配置项 (ECharts option)

option = {

}

其他信息 (Other comments)

2016-06-16 3 33 11

@pissang
Copy link
Contributor

pissang commented Jun 16, 2016

点击非图表图形元素不会触发事件

@Sammi4fun
Copy link
Author

请问有什么办法可以触发 ‘click’ 事件呢?

@pissang
Copy link
Contributor

pissang commented Jun 16, 2016

myChart.getZr().on('click') 可以监听到整个画布的 click 事件

@Sammi4fun
Copy link
Author

Sammi4fun commented Jun 16, 2016

我想点击灰色区域的时候,可以获取到 yAxis 的信息,就好像 tooltip 里面的“45-50岁”,不知道有什么办法?

@pissang
Copy link
Contributor

pissang commented Jun 16, 2016

有 showtip 事件

@pissang pissang closed this as completed Jun 18, 2016
@zombieJ
Copy link

zombieJ commented Sep 5, 2016

@pissang ,在点击点的时候getZrclick事件和chart的click事件同时会触发。我尝试在chart的click中调用stopPropagation告知没有这个方法。

目前用一个boolean存储chart click,用setTimeout重置来阻止getZr同时触发click事件。我觉得这里可以enhance一下,加个stop方法。

@pissang
Copy link
Contributor

pissang commented Sep 5, 2016

@zombieJ 嗯可以考虑

@hustcc
Copy link
Contributor

hustcc commented Dec 12, 2016

为什么都没没有理解issue楼主的意思呢?@pissang @zombieJ

@hustcc
Copy link
Contributor

hustcc commented Dec 12, 2016

目前 echarts 的 events 中有 click 事件,楼主在一个 bar 图表中设置监听 click 事件之后,希望:

  1. 点击图表中灰色区域也能响应 click 事件;
  2. 可以获得点击点在 y 轴或者 x 轴的数据;

以上两点是 的关系。

echarts 的 click 事件可以获得 x,y数据,但是没有监控灰色区域,zr 的 click 可以监听灰色区域,但是不能或取点击点的数据。


我遇到同样的问题,搜索了 echarts 的 issue,几乎全部翻了一遍,很多类似的问题,但是官方都没有解答清楚,回复都是 使用 zr 监控 click。例如:#3853

@leixu2txtek
Copy link

目前也遇到相同的问题,图表中数据差距太大导致小数据的图表显示很小,几乎不可能点击到。。。

@ZhuGYao
Copy link

ZhuGYao commented Mar 19, 2018

这东西真的好气,关键时候了发现timeline的前进后退键无法被click事件捕获到。。

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

6 participants