Skip to content

Commit

Permalink
add shape datastore (for nodes of data flow diagram)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Maier committed Oct 9, 2021
1 parent cefafba commit cd427ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/diagrams/flowchart/flowChartShapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,24 @@ function subroutine(parent, bbox, node) {
return shapeSvg;
}

function datastore(parent, bbox, node) {
const shapeSvg = parent
.insert('rect', ':first-child')
.attr('class', 'basic label-container')
.attr('style', node.style)
.attr('rx', node.rx)
.attr('ry', node.ry)
.attr('x', -bbox.width / 2)
.attr('y', -bbox.height / 2)
.attr('width', bbox.width)
.attr('height', bbox.height)
.attr('stroke-dasharray', bbox.width + ' ' + bbox.height);
node.intersect = function (point) {
return dagreD3.intersect.rect(node, point);
};
return shapeSvg;
}

function cylinder(parent, bbox, node) {
const w = bbox.width;
const rx = w / 2;
Expand Down Expand Up @@ -244,6 +262,7 @@ export function addToRender(render) {
render.shapes().hexagon = hexagon;
render.shapes().stadium = stadium;
render.shapes().subroutine = subroutine;
render.shapes().datastore = datastore;
render.shapes().cylinder = cylinder;

// Add custom shape for box with inverted arrow on left side
Expand All @@ -270,6 +289,7 @@ export function addToRenderV2(addShape) {
addShape({ hexagon });
addShape({ stadium });
addShape({ subroutine });
addShape({ datastore });
addShape({ cylinder });

// Add custom shape for box with inverted arrow on left side
Expand Down
3 changes: 3 additions & 0 deletions src/diagrams/flowchart/flowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export const addVertices = function (vert, g, svgId) {
case 'subroutine':
_shape = 'subroutine';
break;
case 'datastore':
_shape = 'datastore';
break;
case 'cylinder':
_shape = 'cylinder';
break;
Expand Down

0 comments on commit cd427ab

Please sign in to comment.