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

Edge titles does not work? #268

Open
zkutasi opened this issue Dec 4, 2023 · 6 comments
Open

Edge titles does not work? #268

zkutasi opened this issue Dec 4, 2023 · 6 comments

Comments

@zkutasi
Copy link

zkutasi commented Dec 4, 2023

The documentation states that add_edge(...) has a parameter, title (str) – The title is shown in a pop-up when the mouse moves over the edge.
I have tried to set a string to this, I eventually wanted to be a HTML fragment the same way node title works, but it seems the code behind is only prepared for Node hover-tooltips.

Uncaught TypeError: nodeData[0] is undefined
    showPopup file:///home/ezolkut/localmnt/eea/EEA/cnint/dep.html:176
    drawGraph file:///home/ezolkut/localmnt/eea/EEA/cnint/dep.html:159
    emit https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    value https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    popupTimer https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    setTimeout handler*value https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    value https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    value https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    value https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    xT https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js:26
    drawGraph file:///home/ezolkut/localmnt/eea/EEA/cnint/dep.html:129
    <anonymous> file:///home/ezolkut/localmnt/eea/EEA/cnint/dep.html:207

When I look into the html code, I do not see showPopup(...) has even a way to be called with an edge:

function showPopup(nodeId) {
                          // get the data from the vis.DataSet
                          var nodeData = nodes.get([nodeId]);
                          popup.innerHTML = nodeData[0].title;
...

How is this supposed to work?
Using PyVis 0.3.2.
In the template HTML code I cannot even see anything related to this. The "edges" variable is not even read in a meaningful way.
Is this broken, or a feature that was prematurely documented, but never implemented?

@txu-7777
Copy link

I am having the same problem when my node title contains an href, I thought the problem was fixed based on comments here: #133

But doesn't seem like the case. I deleted the following code from the HTML file for the network:

.vis-tooltip {display:none;}

And then the edge title showed up, but the node titles become duplicated like this:
image

Would also like to know if there is away around this right now. Thank you!

@norweeg
Copy link

norweeg commented Apr 3, 2024

Are your node IDs numeric? Wondering if this is related to #272. It seems a LOT of things are ignored when node IDs are numeric

@txu-7777
Copy link

txu-7777 commented Apr 3, 2024

Hey @norweeg, my node IDs are strings in this case

@norweeg
Copy link

norweeg commented Apr 3, 2024

Hey @norweeg, my node IDs are strings in this case

right, but are the strings numeric in that they contain only numeric characters?? Pyvis silently casts numeric strings to int for no reason causing issues if your node IDs are numeric strings, but does not do the same cast-as-int when adding edges containing numeric node ID strings. I fixed this in #277 which addresses my issue, #276

@txu-7777
Copy link

txu-7777 commented Apr 3, 2024

Oh, I see your point. In my case, the node IDs don't contain any numeric strings, they are BQ table names in the following format project.dataset.table

@lucca-miorelli
Copy link

In addition to this issue:

I'm encountering a similar problem. When I set the node title to HTML that includes an href, the edges' tooltips mysteriously disappear, even though the titles are present in the HTML file.

  • Node IDs are strings with numbers and letters;
  • If node title is a simple string, the edge titles show up as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants