user2618824
user2618824

Reputation: 33

Rendered nodes overlap in visjs network graph

I render a graph using visjs. The shape of the nodes are of type dot. Each node is given a custom size using the size attribute.

When the graph is rendered some of the nodes overlap. So the graph looks like in the following picture:

actual graph

I expected a graph like the this picture is showing:

expected graph

What am I doing wrong?

Upvotes: 3

Views: 1206

Answers (2)

YakovL
YakovL

Reputation: 8316

To be more specific compared to the TERMIN's answer, in the physics configuration example you can see (at least for the barnesHut solver) that increasing avoidOverlap prevents overlapping even when springConstant is equal to zero and

var options = {
  "physics": {
    "barnesHut": {
      "avoidOverlap": 0.2
    }
  }
}

is probably enough (but you may increase the value according to your needs).

Upvotes: 0

TERMIN
TERMIN

Reputation: 862

Try to use the physics configuration.

see this example of visjs.

GOOD LUCK.

Upvotes: 1

Related Questions