-
Notifications
You must be signed in to change notification settings - Fork 0
/
people-process-technology.js
98 lines (85 loc) · 2.29 KB
/
people-process-technology.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/// <reference path="./node_modules/mxgraph/javascript/mxClient.js" />
/**
*
* @param {mxGraph} graph
*/
function buildGraph(graph) {
console.log('Building custom graph...');
const canvasPadding = 10;
const width = 120;
const height = 60;
const xPadding = 35;
const yPadding = 30;
const xCenter = canvasPadding + ((width * 2 + xPadding) / 2);
const xPeople = xCenter - (width / 2);
const xTechnology = width + xPadding;
const yBottom = canvasPadding + height + yPadding;
const fontSize = 12;
const strokeColor = '#333333';
const strokeWidth = 2;
const defaultStyles = {
strokeColor,
strokeWidth,
html: true,
};
const boxStyles = {
...defaultStyles,
fontSize,
rounded: true,
whiteSpace: 'wrap',
};
const edgeStyles = {
...defaultStyles,
endArrow: 'none',
};
const peopleData = graph.buildLabel({
label: 'People',
url: 'https://ourchitecture.github.io/people',
});
const people = graph.drawRectangle(
peopleData,
xPeople,
canvasPadding,
width,
height,
{
...boxStyles,
fillColor: '#d5e8d4',
strokeColor: '#82b366',
});
const processData = graph.buildLabel({
label: 'Process',
url: 'https://ourchitecture.github.io/process',
});
const process = graph.drawRectangle(
processData,
canvasPadding,
yBottom,
width,
height,
{
...boxStyles,
fillColor: '#dae8fc',
strokeColor: '#6c8ebf',
});
const technologyData = graph.buildLabel({
label: 'Technology',
url: 'https://ourchitecture.github.io/technology',
});
const technology = graph.drawRectangle(
technologyData,
xTechnology,
yBottom,
width,
height,
{
...boxStyles,
fillColor: '#e1d5e7',
strokeColor: '#9673a6',
});
const edges = [];
edges.push(graph.drawEdge(people, process, '', edgeStyles));
edges.push(graph.drawEdge(process, technology, '', edgeStyles));
edges.push(graph.drawEdge(technology, people, '', edgeStyles));
graph.orderCells(true, edges);
}