#962 added color setting for default link style

This commit is contained in:
Marc Faber
2020-02-04 22:07:10 +01:00
parent 2dd4aa31e5
commit a0e7789d50
3 changed files with 16 additions and 3 deletions

View File

@@ -152,8 +152,12 @@ export const addEdges = function(edges, g) {
let cnt = 0;
let defaultStyle;
let defaultLabelStyle;
if (typeof edges.defaultStyle !== 'undefined') {
defaultStyle = edges.defaultStyle.toString().replace(/,/g, ';');
const defaultStyles = getStylesFromArray(edges.defaultStyle);
defaultStyle = defaultStyles.style;
defaultLabelStyle = defaultStyles.labelStyle;
}
edges.forEach(function(edge) {
@@ -181,6 +185,9 @@ export const addEdges = function(edges, g) {
if (typeof defaultStyle !== 'undefined') {
style = defaultStyle;
}
if (typeof defaultLabelStyle !== 'undefined') {
labelStyle = defaultLabelStyle;
}
break;
case 'dotted':
style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
@@ -219,9 +226,9 @@ export const addEdges = function(edges, g) {
if (typeof edge.style === 'undefined') {
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
} else {
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
}
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
}
}
// Add the edge to the graph