Ronak Bhandari
Ronak Bhandari

Reputation: 332

Uncaught error: cannot construct a line segment with two equal endpoints

I am trying to integrate d3 force layout http://nylen.tv/d3-process-map/graph.php which is at https://github.com/nylen/d3-process-map The live version is at http://rumi.io.knowledge.tree.8d4ef892b35606a87ba5cc39a1f99f68df97.s3-website-ap-southeast-1.amazonaws.com

On searching the node, i am sending a request to the server to get the data and successfully drawing the chart. But when i search for the second time on the next screen (white background), i am getting the data and on drawing, i am getting an error in the console --> Uncaught error: cannot construct a line segment with two equal endpoints. enter image description here

The problem is, this error produces randomly. I am really not able to get the pattern of the error-producing and what does it mean.

One of my theory is that the error occurs when the internet connection drops. But not sure whether the theory is correct or not.

Any insight will be helpful.

Upvotes: 1

Views: 111

Answers (1)

Fariz Azmi
Fariz Azmi

Reputation: 723

I've experienced this as well. But, in my case there caused by duplicating name in json data.

Here the example how the problem with the data look like:
(original data source)

[
    {
        "name"    : "Fauchelevent", // Duplicated
        "type"    : "group0",
        "depends" : [
            "Valjean",
            "Javert"
        ]
    }, {
        "name"    : "Myriel",
        "type"    : "group1",
        "depends" : []
    }, {
        "name"    : "Fauchelevent", // Duplicated
        "type"    : "group1",
        "depends" : [
            "Myriel"
        ]
    }
]

The plugins will use object.name as a node key in graph data. So it's impossible to have same name.

So try to check your json data if there possibly have duplicate name.

Upvotes: 1

Related Questions