Add custom attribute to SVG edge point using jQuery

I am working on creating interactive graphs. So far, I started with the dot graph from which I generate SVG.

I would like to add custom classes to the edge so that it is easier for me to dynamically add some information using a script.

So far, I have only found a way to add a user id. Is there a way to add a custom class as well?

In fact, since I'm going to use jQuery to select attributes, this would be enough to add a custom attribute to the edge element.

+6
source share
3 answers

The point guide recommends using a comment field for user data. Alternatively, you can use the URL field.

+2
source

You can simply specify a class attribute. For instance.

digraph ab { a -> b [class="foo"] } 
0
source

Yes, class = "" is the correct answer. The comment field is invalid.

In the following example, you can see how to define a class for an edge (foo), for a node (bar), or even a subgraph (sub-foobar). And it’s even better. Each entity type is also a class, so you can, for example, hide all clusters or all edges.

 digraph simple { c [class="bar"] a -> b [class="foo"] c -> b subgraph cluster_0 { class="sub-foobar"; d e } } 

graphviz svg output

graphicsviz rendering

0
source

Source: https://habr.com/ru/post/897738/


All Articles