如何将事件处理程序附加到 Google 图表?
我熟悉如何通过 API 附加选择处理程序:
google.visualization.events.addListener(table, 'select', selectHandler);
但是,只有当用户选择图表上的元素(例如单击条形图)时,这才有效。如果用户单击图表中的任何空白,侦听器不会触发。我想添加一个功能,如果用户单击图表上的空白区域,则会打开一个新页面。这可以做到吗?我尝试在包含的 div 上添加 jQuery 事件处理程序,但该事件从未触发。我认为图表可以防止事件传播。
I'm familiar with how to attach a select handler via the API:
google.visualization.events.addListener(table, 'select', selectHandler);
However, this only work if a user selects an element on the chart, for example click on a bar. The listener doesn't fire if a user clicks on any whitespace in the chart. I want to add a feature where if the user clicks white space on the chart, it opens a new page. Can this be done? I've tried adding a jQuery event handler on the containing div, but the event never fires. I assume the chart prevents event propagation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论