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

changing default node shape to circle does not work #4765

Open
gonzalobg opened this issue Aug 23, 2023 · 5 comments
Open

changing default node shape to circle does not work #4765

gonzalobg opened this issue Aug 23, 2023 · 5 comments
Labels
Area: Development Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@gonzalobg
Copy link

gonzalobg commented Aug 23, 2023

Description

When I do:

graph TD;
classDef node shape:circle;
  subgraph thread1
    D-->E-->F;
  end
  subgraph thread10
    A-->B-->C;
  end
  F-->C
Loading

the default shape of the nodes in the graph is rectangles, not circles.

Steps to reproduce

See above.

Screenshots

No response

Code Sample

graph TD;
classDef node shape:circle;
  subgraph thread1
    D-->E-->F;
  end
  subgraph thread10
    A-->B-->C;
  end
  F-->C

Setup

  • Mermaid version:
  • Browser and Version: [Chrome, Edge, Firefox]

Suggested Solutions

Fix this so that the default shape changes.

Additional Context

No response

@gonzalobg gonzalobg added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Aug 23, 2023
@tomperr
Copy link
Contributor

tomperr commented Aug 28, 2023

Is this supposed to work? I am not aware of all the flowchart features, but I can't find anything about this in the documentation

@gonzalobg
Copy link
Author

Hard to tell. Is flowchart used for these graphs?

My understanding from skimming from some of the source code is that there is a default shape that can be overriden, but I could not find anything in the documentation about how to do that.

I couldn't find much documentation about graph either, so I'm not sure if this not being documented is a "bug", or whether this is not documented because it is not supported yet, or whether the bug is on my side because I am trying to change the default in the wrong way.

@tomperr
Copy link
Contributor

tomperr commented Aug 28, 2023

graph and flowchart identify the same type of diagram, but I guess graph was the old identifier.
By default, nodes are rendered with rect tag, so I don't think using classDef to modify its shape is really appropriated

@ssgosh
Copy link

ssgosh commented Feb 17, 2024

How does one make all nodes circular by default in Mermaid?

@nirname nirname added Area: Development Type: Enhancement New feature or request Status: Triage Needs to be verified, categorized, etc and removed Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jun 19, 2024
@nirname
Copy link
Contributor

nirname commented Jun 19, 2024

classDef is not for modifying shapes.

Shape can have some special meaning in a diagram. There is no way to configure which shape corresponds to a type of node/vertex at the moment. By default they are square
https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/diagrams/flowchart/parser/flow.jison#L381

e.g.

Label Shape
A square
A( ) rounded square
A(( )) circle

etc.

So it is in the grammar and all the matching between syntax & shapes are here

So I believe this is an enhancement.

Consider adding a configuration option for default shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Development Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants