anvaka / anvaka/VivaGraphJS

how to make hyperlink <a href > from node

Open
#261 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.9k
Forks
418
PR merge metrics
No merged PRs in 30d

Description

Good day. Trying to make in SVG something hyperlink like this:

in VivaGraphJS code i try:

graphics.node(function(node) {
var ui = Viva.Graph.svg("g"),

svgText = Viva.Graph.svg("text").attr("y", "-4px").text(node.id),

img = Viva.Graph.svg("image")
.attr("width", nodeSize)
.attr("height", nodeSize)
.link("https://secure.gravatar.com/avatar/" + node.data),

a = Viva.Graph.svg("a").attr("href", "https://vitalii-u.com/");
// .text('some text')
ui.append(svgText);
ui.append(a);
ui.append(img);
return ui;
})

and in browser i see:


function text(textContent) {
if (textContent !== undefined) {
svgElement.textContent = textContent;
return svgElement;
}
return svgElement.textContent;
}

I don't understand, what need to wrap image or text or thomething be giperlink ?
Thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the graphics.node callback shown in the issue and inspect how Viva.Graph.svg("a") handles appended elements and the displayed text function. Reproduce the generated SVG in a browser, then verify that the intended image or text is wrapped as a hyperlink and no function source appears in the output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.