Merge pull request #1921 from mermaid-js/1920_curve_for_flowcharts

1920 curve for flowcharts
This commit is contained in:
Knut Sveidqvist 2021-02-28 12:48:16 +01:00 committed by GitHub
commit c583386175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -350,6 +350,15 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
const lineData = points.filter(p => !Number.isNaN(p.y));
// This is the accessor function we talked about above
let curve;
// Currently only flowcharts get the curve from the settings, perhaps this should
// be expanded to a common setting? Restricting it for now in order not to cause side-effects that
// have not been thought through
if (diagramType === 'graph' || diagramType === 'flowchart') {
curve = edge.curve || curveBasis;
} else {
curve = curveBasis;
}
const lineFunction = line()
.x(function(d) {
return d.x;
@ -357,7 +366,7 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
.y(function(d) {
return d.y;
})
.curve(curveBasis);
.curve(curve);
// Contruct stroke classes based on properties
let strokeClasses;

View File

@ -184,9 +184,9 @@ const config = {
*| curve | Defines how mermaid renders curves for flowcharts. | String | Required | Basis, Linear, Cardinal|
*
***Notes:
*Default Vaue: Linear**
*Default Vaue: monotoneX**
*/
curve: 'linear',
curve: 'monotoneX',
// Only used in new experimental rendering
// represents the padding between the labels and the shape
padding: 15,