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

fixing class diagram #794

Closed
DanShai opened this issue Feb 11, 2019 · 4 comments
Closed

fixing class diagram #794

DanShai opened this issue Feb 11, 2019 · 4 comments
Labels
Type: New Shape Request for new shape

Comments

@DanShai
Copy link
Contributor

DanShai commented Feb 11, 2019

Hi ,
1- after debugging the class diagram there are many issues in the code mainly in the path.ponits assigned to and other variables like lineData = path.points; return NaN in the x and y of the points to the svg path hence the messed up diagrams.

2- if your using react like me and getting this kind of errors Expecting 'CLASS_DIAGRAM', got 'NEWLINE' you should write the graph like this :
for example :

 const graph = `classDiagram
  Class01 <|-- AveryLongClass : Cool
  Class03 *-- Class04
  Class01 : int chimp
  Class01 : int gorilla`;

no space nor new line at the start or the end
hope this helps! I saw many have this issue.

PS: for react users I created a Mermaid hook for easy to use in your app, a screenshot for the fix for class diagram can be found in the link below :
https://github.com/DanShai/useMermaid-hook

@gijswijs
Copy link
Contributor

Would you care to write a PR for this, to mitigate the NaN issues? Or do you consider this expected behavior?
Or could you explain how to reproduce this issue? Maybe I can write a PR for it if I can find the time.

@DanShai
Copy link
Contributor Author

DanShai commented Feb 12, 2019

PR done, changed some stuffs in the class renderer. there were problem with the g.nodes() and some extra classes got created which put some nodes "y" coordinates to NaN and hence the path.points picked up the NaNs so I had to remove them away and add more checkups on the g.nodes() also the number of classes was exceding the classes we have in the graph so I used a variable total to get exact classes number and I use that as modulo in the graph creation... its easier if you can view the diff in the renderer file I PRed.
cheers !

@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
@knsv
Copy link
Collaborator

knsv commented Jun 30, 2019

Thanks again @DanShai. I am closing this one as the PR is in place and released in 8.1.0.

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

3 participants