#1920 Making flocharts adhere to the curve configuration also changing the default configuration for grpah and flowchart

This commit is contained in:
Knut Sveidqvist 2021-02-28 11:29:56 +01:00
parent cc1eb5dd98
commit 82618f0184
3 changed files with 13 additions and 4 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,

View File

@ -1,5 +1,5 @@
import graphlib from 'graphlib';
import { select, curveLinear, selectAll } from 'd3';
import { select, curveLinear, curveNatural, selectAll } from 'd3';
import flowDb from './flowDb';
import flow from './parser/flow';