Closed logust79 closed 8 years ago
This seems to be caused when multiple circles intersect at nearly the same point - causing issues with the code that tries to figure out the intersection area. In your case this point occurs with the 'a', 'd', 'e', 'f' circles:
.
The last commit should fix https://github.com/benfred/venn.js/commit/1792850b4d0dd732b31e9fa27f68426ca8053cb5
Excellent work! Thank you very much!
I have this dataset (a bit long, attach at the bottom), where it causes venn.js Cannot read property 'circle' of null error. at
arcArea += circleArea(arc.circle.radius, arc.width);
I printed out the buggy loop data, it looks something like this:innerPoints = [{...parentIndex: [0, 2]...}, {...parentIndex: [1, 2]...}, {...parentIndex: [0, 2]...}, {...parentIndex: [1, 2]...}, {...parentIndex: [1, 3]...}, {...parentIndex: [1, 3]...}
When it decides to nest-loop the first and last element of the list, it can't find matching index andarc
will end up withnull
, causing thearcArea += circleArea(arc.circle.radius, arc.width);
to fail. A quick fix is to add a conditional to avoid updatingarcArea
whenarc
is null, although I have no clue if this breaks the mathematics. Can you please have a look at this? Many thanks. The dataset