Mouse hover event on nodes

33 views
Skip to first unread message

Hikmet Emre Kaya

unread,
Jun 30, 2022, 5:21:52 AM6/30/22
to cytoscape-app-dev
Hello,

I know this was asked quite some time ago, but I was wondering if there is a way to show additional info on nodes when the mouse cursor hovers over them. Has there been any updates on this? Thanks!

Mike Kucera

unread,
Jun 30, 2022, 9:21:02 AM6/30/22
to cytoscape-app-dev
You can use the Node Tooltip Visual Property to show a piece of text when the mouse cursor hovers over a node.



On Thu, Jun 30, 2022 at 5:21 AM Hikmet Emre Kaya <hikmete...@gmail.com> wrote:
Hello,

I know this was asked quite some time ago, but I was wondering if there is a way to show additional info on nodes when the mouse cursor hovers over them. Has there been any updates on this? Thanks!

--
You received this message because you are subscribed to the Google Groups "cytoscape-app-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-app-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cytoscape-app-dev/d4153660-3e15-4a50-a043-860421bfd623n%40googlegroups.com.

Hikmet Emre Kaya

unread,
Jul 1, 2022, 5:26:14 AM7/1/22
to cytoscape-app-dev
Hello Mike,

Thank you for the response. I tried the following method, but have not achieved success:

                    CyNode node = ..
                    CyEventHelper eventHelper = CyActivator.cyEventHelper;
                    eventHelper.flushPayloadEvents();
                    View<CyNode> nodeView = networtkView.getNodeView(node);
                    nodeView.setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, "some string");
networkView.updateView


I also added the following dependency to my pom.xml

<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>

not sure what I am missing.

Mike Kucera

unread,
Jul 4, 2022, 10:07:10 AM7/4/22
to cytoscape-app-dev
You are probably running into a common issue... generally Apps should not use nodeView.setVisualProperty(), because when anything in the current style changes the style gets re-applied and that overwrites all visual properties that were set using setVisualProperty().

You have two options...
1) Use nodeView.setLockedValue() instead. This is for setting bypasses on individual nodes.
2) Create a mapping in the current style. This is the preferred way if the text you want to show comes from a table column. Create a PassthroughMapping to the column that contains the tooltips and add it to the current style.

Mike.


Reply all
Reply to author
Forward
0 new messages