-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Venn Diagram Syntax #2583
Comments
It would be useful, for sure. There have been multiple times when I looked to see if the gods had finally conspired to make Venn diagrams in mermaid a thing… that being said is venn more useful than….. |
Yup, I agree. I think a useful strategy here would be to ask anyone who wants it to 👍 the issue. If it's got enough community interest. I'd be happy to look at thinking it through more thoroughly in 2022 (among the million other things I gotta do 😂 ) |
I would love venn diagrams :) I'd be interested in helping when I start having more free time |
Yes! Venn diagrams would be lovely! |
I, too, would like Venn diagrams! |
+1 this would be a killer feature. |
+1 I am also interested! |
+1 for sure! |
+1 Would be amazing. |
+1 I was doing an documentation in Notion and I asked to myself if mermaid could help my with that. Would be awesome to have this feature. |
+1, any walkaround? |
+1, this would be helpful so frequently! |
+1 |
⬆️ Upvote |
yes please! |
+1 👍 |
+1 |
4 similar comments
+1 |
+1 |
👍 |
+1 |
Definitely a +1 from me |
+1 |
2 similar comments
+1 |
+1 |
Any updates on this? |
+1 ! |
+1 |
Please, I recommend using python library |
I'd take either Euler or Venn - but I can see from the discussion, this may be difficult for anything but trivial data sets. Still ... I'm doing some work with a company that has multiple, overlapping cloud services, and thought if I could describe the overlaps via code, then view it in an Euler diagram, it could be useful. |
@jgwinner the library https://pypi.org/project/eule/ provides the service you need. |
venn and euler can be two different directives. using this MIT licensed library, it should be easy to add venn: https://github.com/benfred/venn.js ... can leave it as a lib, or just absorb it, depending on what the mermaid maintainers prefer the expression of sets, labels, intersections and intersection-labels is all very mermaid-like already, just need to parse the syntax and use the lib
syntax:
without sizes specified, the sizes of all sets (circles) are equal by default additional classes added to inner items should make mermaid-syntax styling easy |
Has there been an update on this? It would be an awesome feature to have 🥇 |
@migueltorrescosta It is a challenging one. Do you need a visualization or data analysis in this regard? |
Yes. My goal would be to define a Venn and/or Euler code as a diagram, as I generate a lot of them. The current example that yrig is having a layout of time complexity classes ( P Vs NP Vs NP Hard Vs NP Complete Vs ... ), but I'm building others as needed |
Your example is rather an Euler Diagram, as coleagues has mentioned already. Once you have the key-value structure, also called 'dictionary' with the respective class categories and a list of elements respective to that category, you may use the library |
Check out the input format in this one: it’s also an interesting Euler/Venn hybrid |
Definitely, sorry for the confusion
eule is a python package. Isn't python independent from
Thank you for the link @d-led 🙏 AnyChart requires us to specify and setup the diagram with javascript, instead of using a "pure text" description, as is done with a sequenceDiagram, for example. Am I correct that there is no text only option in |
@migueltorrescosta sorry, as I didn't elaborate much from the phone. What I meant with the anychart link is that the task of providing a Venn/Euler syntax could be simplified by not solving the set operations. I haven't looked at how AnyChart do it, however their input is as follows, from the link above: var data = [
{x: "A", value: 100},
{x: "B", value: 100},
{x: "C", value: 100},
{x: ["A", "B"], value: 20},
{x: ["B", "C"], value: 20},
{x: ["A", "B", "C"], value: 20}
]; you can see that the input is in a shape that already hints at the resulting picture, including the intersection areas. Taking this as a starting point for the syntax could probably lead to faster results (and less code) without having to solve the set operations. |
@jgreywolf I noticed that the following labels have been added on the 6th April 2023
I am happy to be said contributor. The Community Contributing Guidelines are clearly written. It is unclear what the venn/euler diagram specification is. Are there issues that specify it, or should I design it as part of this contribution? If I am to design it, @d-led 's comment and @aboy021's comment provide good starting points to building up the syntax. Regarding the visualisation of Euler DiagramsI suggest we
|
I'd love to see things start moving on this issue. Reading over the full conversation here, I think we're really over complicating what needs to happen to make this a reality. Looking at the While I haven't tested the library myself thoroughly, if it works as I envision the process would them become:
This approach is similar to what I did for generating Architecture diagrams and would completely skip having to implement our own layout engine that involves set theory. As for the actual requirements, I personally think the average user of this diagram type wouldn't need more then 4 or 5 sets, nor would they care about the difference between an Euler or Venn diagram. The library I linked to doesn't even clearly state what type it actually generates and at a quick glance it seems to pick the one best suited to the data provided. Let me know your thoughts on this approach and if you're still interesting in being the contributor. I'm also happy to collaborate with you and divvy up with work if you'd prefer to focus on a particular part of the implementation. |
@NicolasNewman that sounds ideal. I'd appreciate help on getting the syntax right: the given example looks good but I'd need to standardise it. We also need to decide what happens with non-planar graphs: maybe
|
Given the format of the input for venn.js, we first need to decide if the diagram having proportional area relative to the set's size is important. I personally don't think the functionality will be important to our use-case (so we would default to passing The library expects input in the format: const sets = [
{ sets: ['A'], size: 12 },
{ sets: ['B'], size: 12 },
{ sets: ['A', 'B'], size: 2 },
]; so this could be translated as (assuming we're fixing size to 1 and the labels will be handled by ourselves)
I personally don't think using the language of As for non-planar graph's, could you clue me in on how it's relevant to Venn diagrams? It's been quite some time since I took a discrete/graph theory course. |
In the described notation, how do you differentiate the size of the intersection with the size of the union? I assume that Regarding the relevancy of planar graphs, these are essential to know whether it can be plotted at all or not. If we have 6 sets, with all possible combinations occurring, we will never be able to plot it as a Venn diagram. The thinking for this is to
I think the above is correct, and if so then when the associated graph is not planar, we need to decide either to show an error, or to find an adaptation of a Venn diagram that represents the same information |
Personally I don't think the implementation added to Mermaid should concern itself with the size of a set, just that the labels of the intersection between sets can (mostly) fit within the region. I'd be interested to hear from others who've add to this issue's discussion over the years and how they envision a Venn/Euler diagram in Mermaid though as what I'm envisioning could be quite different. From my perspective, I picture something like this: There's a writeup of the algorithm that Regarding determining if a Venn diagram is non-planar, I believe |
There’s one reason one might want to control the sizes of the intersections and circles: labels inside them. Another challenge: fitting text. Newlines in the input could be valuable to make the diagram legible. If one cannot see where the label belongs to, the point of having such a diagram vanishes. |
I was thinking from the angle of computing the sizes behind the scenes to make sure everything fits. You make a good point and I think you're right in that even if that approach is fessable, users should still have the option to specify their own sizes if they don't like the default fit of the labels. |
I think, using an adaptation of libraries provided by @NicolasNewman, excluding the zero-measure intersections to make them more Euler-diagram-like is a great way to go. I designed a library in javascript called |
@brunolnetto as you already designed libraries related to this and I won't be able to take this for a couple weeks, would you be happy to take on this work? |
I think, I am not the right guy for this task, barely had some frontend experience. At other hand, @NicolasNewman seems to have some better starting points than mine. |
Fair. @NicolasNewman , with the caveat that I won't be able to pick this for a couple weeks, I am happy to have this issue assigned to myself |
I thought that the discussion was stale... to find out that a new comment was added 7 hours ago. Thanks for the great work, it is looking very promising. |
Here's my thoughts on what the syntax for the diagram should look like:
A couple notes:
Let me know if there's anything I may have missed. Also, I mentioned previously that supporting putting a Venn diagram inside of a Venn diagram may be something to consider supporting to achieve a diagram like this. I'm still thinking of the best way to accomplish this in the syntax but if anyone has any suggestions feel free to share them! |
+1 lemme know when anything new |
Problem
I'm always frustrated when I have to manually create Venn diagrams of more than 4 intersecting circles. It might sound trivial but arranging complex Venn diagrams in a legible manner is annoying and hard with most of the standard diagraming tools I've used.
Request
This was already brought up many years ago in #200 but Venn diagram in syntax in Mermaid would be great.
Venn Diagrams are basically just a visualization of set theory. So the syntax would just have to implement basic set operations:
Potential Syntax
Something like the following could be a good syntax:
I know everyone is busy. I am just wondering what the general interest is from the community on prioritizing this versus other new diagram formats.
The text was updated successfully, but these errors were encountered: