如何使用cytoscape.js在图形中的节点上添加鼠标悬停事件的工具提示 [英] How to add tooltip on mouseover event on nodes in graph with cytoscape.js

查看:1644
本文介绍了如何使用cytoscape.js在图形中的节点上添加鼠标悬停事件的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用cytoscape.js创建的图表中的所有节点上显示有关鼠标悬停事件的节点详细信息。我找到了一个插件 qtip ,但这不起作用。
我怎样才能做到这一点?是否有其他方法在节点上显示工具提示?

I want to show node's details on mouseover event on all nodes in graph created with cytoscape.js. I have found a plug-in qtip, but this is not working. How can i achieve this? Is there some other way to show tooltip on nodes?

提前致谢。

推荐答案

您仍然可以使用QTip。因为cy.js每个图元素没有关联的DOM元素,所以你需要(1)创建虚拟HTML DOM元素来定位QTips,或者(2)使用QTip API手动将QTips定位到节点。

You can still use QTip. Because cy.js doesn't have associated DOM elements per graph element, you'll need to either (1) create dummy HTML DOM elements to position the QTips or (2) use the QTip API to manually position the QTips to the nodes.

Cy.js提供事件绑定API,因此您可以在此端绑定到 mouseover 等: http://cytoscape.github.io/cytoscape.js/#core/events

Cy.js provides event binding APIs, so you can just bind to mouseover etc on that end: http://cytoscape.github.io/cytoscape.js/#core/events

这篇关于如何使用cytoscape.js在图形中的节点上添加鼠标悬停事件的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆