venn.js
venn.js copied to clipboard
Set complement and intersection subset areas
I am a big fan of your project, thanks for the good work. I would like to select and interact with any individual subset areas in the same way as is possible with intersection areas. Does this library already support this? If not is there any plan to implement this in the near future?
I would like to be able to select areas such as A ∖ (B ∪ C), B ∖ (A ∪ C) etc in the example below:
Kind Regards, Vern
Its not supported right now, and its kinda tricky to do in general. The areas might not be contiguous like here with the blue 'A' circle:
Interacting with the intersection areas is only possible because I spent some time calculating the area - which required breaking the intersection area down into something that can be translated to a svg path pretty easily. Its not quite as straightforward because of cases like above for what you're asking.
It might be possible to do this with svg clipping instead (like in here: https://gist.github.com/mbostock/1067636) though I haven't looked at it that much
I need this ability as well. I reckon the way to do it is to cheat, just find the correct coloured pixels. I'm going to attempt this this evening. Also, I'm going to only do the simple case where the area is contiguous by forcing the circles to be all positioned concentrically about a common mid-point if you know what I mean!
First of all, thanks for a really great library-- I'm a big fan!
This issue relates to the labeling of intersection areas as well:
The labels are a bit misleading in that without a hover to indicate the selected intersection, one might assume a number represents a different intersection. In this case, there are 411 in the intersection of all 4 sets, but 437 is displayed.
A good default behavior would be to display the most intersected set's size, as other values can be recapitulated by adding adjacent intersections. The current label system makes it impossible to compute all intersection sizes (e.g. A∩B∩C∩D).
Here's my attempt to make all the venn area parts selectable: https://codepen.io/avnerz/pen/dJPWee
@avnersch Ooh. Very nice. Well done.
@avnersch Great! Could you please tell me how to assign the size to each venn area part?
Hi @benfred, I saw that there is a PR may resolve this problem. Can you take a look ? https://github.com/benfred/venn.js/pull/105
Thanks