0

Is it possible to add html elements such as <tspan> inside the caption of a node in Alchemy.js?

My alchemy config has the following:

nodeCaption: "title",

and if I have json like:

{
  "nodes": [
    {
      "id": "1",
      "title": "Some <tspan>text</tspan>",
      ...
    },
    ...
  ]
}

The caption on the graph will render as Some <tspan>text</tspan>...

FYI: I am happy to take suggestions that require making manual changes to the alchemy.js file. I've already had to make some of my own changes for other things.

benjovanic
  • 537
  • 1
  • 5
  • 18

1 Answers1

0

Within the DrawNode function in alchemy.js replace

.text(function(d) { ...

with

.html(function(d) { ...

Now <tspan> will render in a node caption.

benjovanic
  • 537
  • 1
  • 5
  • 18