mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
#1920 Making flocharts adhere to the curve configuration also changing the default configuration for grpah and flowchart
This commit is contained in:
parent
cc1eb5dd98
commit
82618f0184
@ -350,6 +350,15 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
|
|||||||
const lineData = points.filter(p => !Number.isNaN(p.y));
|
const lineData = points.filter(p => !Number.isNaN(p.y));
|
||||||
|
|
||||||
// This is the accessor function we talked about above
|
// 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()
|
const lineFunction = line()
|
||||||
.x(function(d) {
|
.x(function(d) {
|
||||||
return d.x;
|
return d.x;
|
||||||
@ -357,7 +366,7 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
|
|||||||
.y(function(d) {
|
.y(function(d) {
|
||||||
return d.y;
|
return d.y;
|
||||||
})
|
})
|
||||||
.curve(curveBasis);
|
.curve(curve);
|
||||||
|
|
||||||
// Contruct stroke classes based on properties
|
// Contruct stroke classes based on properties
|
||||||
let strokeClasses;
|
let strokeClasses;
|
||||||
|
@ -184,9 +184,9 @@ const config = {
|
|||||||
*| curve | Defines how mermaid renders curves for flowcharts. | String | Required | Basis, Linear, Cardinal|
|
*| curve | Defines how mermaid renders curves for flowcharts. | String | Required | Basis, Linear, Cardinal|
|
||||||
*
|
*
|
||||||
***Notes:
|
***Notes:
|
||||||
*Default Vaue: Linear**
|
*Default Vaue: monotoneX**
|
||||||
*/
|
*/
|
||||||
curve: 'linear',
|
curve: 'monotoneX',
|
||||||
// Only used in new experimental rendering
|
// Only used in new experimental rendering
|
||||||
// represents the padding between the labels and the shape
|
// represents the padding between the labels and the shape
|
||||||
padding: 15,
|
padding: 15,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import graphlib from 'graphlib';
|
import graphlib from 'graphlib';
|
||||||
import { select, curveLinear, selectAll } from 'd3';
|
import { select, curveLinear, curveNatural, selectAll } from 'd3';
|
||||||
|
|
||||||
import flowDb from './flowDb';
|
import flowDb from './flowDb';
|
||||||
import flow from './parser/flow';
|
import flow from './parser/flow';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user