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

Rounded connections #580

Closed
eduo opened this issue Sep 28, 2017 · 6 comments
Closed

Rounded connections #580

eduo opened this issue Sep 28, 2017 · 6 comments

Comments

@eduo
Copy link

eduo commented Sep 28, 2017

Hello.

Have you considered adding the possibility of making the connectors in flowcharts rounded when not exactly vertical or horizontal?

Currently a straight line is drawn, unless it overlaps with another one in which case both are angled. This is a good solution but visually it looks a bit weird. Especially for roundtrips.

Smoothing out those angles into curves (and nothing else) would immediately improve visibility.

I'm not saying improve collision detection or smart paths for complex diagrams. Although this would be nice it's also orders of magnitude more complex.

@liyawang
Copy link

Second this. I actually see very sharp angles as attached.
screen shot 2017-11-10 at 8 44 40 pm

@tylerlong
Copy link
Collaborator

tylerlong commented Mar 17, 2018

I believe there is a feature in D3 called interpolate (in D3 4.x it has been replaced by curve). I've seen some code about it in mermaid but not sure it works.

@tylerlong
Copy link
Collaborator

tylerlong commented Mar 17, 2018

I've added an new option to mermaid:

mermaid.initialize({
  flowchart: { 
    curve: 'basis' 
  }
});

flowchart.curve by default is linear and you think it is not rounded enough. Change it to basis will be much better.

curve === 'linear':

image

curve === 'basis':

image

All D3 curves are supported!

Please try different curves to find your favorite!

@Apachez-
Copy link

Apachez- commented Apr 22, 2018

It doesnt seem to work to set this option when testing through https://mermaidjs.github.io/mermaid-live-editor

Edit: Seems to be a syntax thingy for the live-editor, use this if you want curved lines in live-editor:

{
"theme": "default",
"flowchart": {
"curve": "basis"
}
}

@kitsu
Copy link

kitsu commented Dec 20, 2018

To enable this for a flow chart without access to the Mermaid object (i.e. in a markdown document) use linkStyle default interpolate basis.

graph TD
  %% Set edges to be curved (try monotoneX for a nice alternative)
  linkStyle default interpolate basis
  A[Christmas] -->|Get money| B(Go shopping)
  B --> C{Let me think}
  C -->|One| D[Laptop]
  C -->|Two| E[iPhone]
  C -->|Three| F[fa:fa-car Car]
Loading

Your Jison grammar is a little hard to read, but it is a good reference!

@legoming
Copy link

Can I use the same method to change the curve line of sequenceDiagram -- the loop line point to self?

mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
…evelop/node-17.3.1

chore(deps): bump node from 17.3.0 to 17.3.1
amyq added a commit to amyq/mermaid that referenced this issue Aug 25, 2022
An extremely basic MVC explaining that it is possible to adjust how lines in a flowchart are curved, while listing (some of?) the available options.

I doubt I've captured all of the curve options, but capturing the existence of curve options is a start.

Sources:

- mermaid-js#580 (comment) where a user references adding the feature to Mermaid
- Which references https://github.com/d3/d3-shape/blob/master/README.md#curves and I think is worth including here
@amyq amyq mentioned this issue Aug 25, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants