Skip to content
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

classDiagram cardinality not showing #602

Closed
ruizmarc opened this issue Dec 7, 2017 · 2 comments
Closed

classDiagram cardinality not showing #602

ruizmarc opened this issue Dec 7, 2017 · 2 comments
Labels
Type: New Shape Request for new shape

Comments

@ruizmarc
Copy link

ruizmarc commented Dec 7, 2017

Hi,

I'm using mermaid 7.0.17 in a classDiagram and I'm trying to show cardinality following the example in the specs. However cardinality is not being showed. I know it is an experimental feature, but I think it is worth to mention the problem to take it into consideration.

This is an example of how I'm using cardinality:

User "1" *-- "many" Session

EDIT: Also tested with 7.1

@Vrixyz
Copy link
Contributor

Vrixyz commented Jul 27, 2018

As main maintainer is not available to fix that for the moment, I suggest delving into details here, so it helps him or whoever has time to fix it.

I'll post my findings in this issue, and eventually I might look into submit a Merge Request.

Technical understanding

Parser

From my understanding of classDiagram parser : the parsing of cardinality looks like it's done within STR, then transformed into properties relationTitle1 and relationTitle2, so my guess is we don't have to improve on classDiagram.jison 🎉

Renderer initialization

For each relations, the whole relation object we saw in the parser is passed to the "edge" within the graphlib graph. So we don't have to worry about how to pass our information to multiple layers of functions 🎉

Renderer last run

Next let's check the drawEdge function

We notice there is a title attached to a relation, its origin is not relevant but here it is

Here begins some maths, somewhere from there there is magical code to put the title at half the length of the edge/path/relation, that will be useful to help us add code for our awaited cardinality to appear! 🎉

I'll continue if/when I have time, maths without comments scared me out 🐇 . At least I think I know exactly where to input code to make cardinality to work!

Vrixyz added a commit to Vrixyz/mermaid that referenced this issue Jul 29, 2018
@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Type: New Shape Request for new shape label Jun 29, 2019
mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
…yarn/develop/lint-staged-12.2.1

chore(deps-dev): bump lint-staged from 12.2.0 to 12.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Shape Request for new shape
Projects
None yet
Development

No branches or pull requests

2 participants