9.0 KB332 lines
Blame
1<html>
2 <head>
3 <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
4 <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
5 <link
6 rel="stylesheet"
7 href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/font-awesome.min.css"
8 />
9 <link
10 href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
11 rel="stylesheet"
12 />
13 <style>
14 body {
15 /* background: rgb(221, 208, 208); */
16 /* background:#333; */
17 font-family: 'Arial';
18 height: 100%;
19 width: 100%;
20 margin: 0;
21 padding: 0;
22 }
23 h1 {
24 color: grey;
25 }
26 .mermaid2 {
27 display: none;
28 }
29 .height {
30 min-height: 600px;
31 height: 600px;
32 }
33 .height2 {
34 min-height: 600px;
35 height: 1300px;
36 }
37 .width {
38 width: 33%;
39 border: 1px solid blue;
40 padding: 10px;
41 }
42 </style>
43 </head>
44 <body>
45 <h1>Showcases of diagrams</h1>
46 <div class="flex flex-wrap">
47 <pre class="mermaid width height">
48 %%{init: {'theme': 'forest'}}%%
49 graph TD
50 A[Christmas] -->|Get money| B(Go shopping)
51 B --> C{Let me think}
52 B --> G[/Another/]
53 C ==>|One| D[Laptop]
54 C -->|Two| E[iPhone]
55 C -->|Three| F[fa:fa-car Car]
56 subgraph section
57 C
58 D
59 E
60 F
61 G
62 end
63 </pre>
64 <pre class="mermaid width height">
65 flowchart TD
66 A[Christmas] -->|Get money| B(Go shopping)
67 B --> C{Let me think}
68 B --> G[Another]
69 C ==>|One| D[Laptop]
70 C x--x|Two| E[iPhone]
71 C o--o|Three| F[fa:fa-car Car]
72 subgraph section
73 C
74 D
75 E
76 F
77 G
78 end
79 </pre>
80 <pre class="mermaid width height">
81 sequenceDiagram
82 autonumber
83 par Action 1
84 Alice->>John: Hello John, how are you?
85 and Action 2
86 Alice->>Bob: Hello Bob, how are you?
87 end
88 Alice->>+John: Hello John, how are you?
89 Alice->>+John: John, can you hear me?
90 John-->>-Alice: Hi Alice, I can hear you!
91 Note right of John: John is perceptive
92 John-->>-Alice: I feel great!
93 loop Every minute
94 John-->Alice: Great!
95 end
96 </pre>
97 <pre class="mermaid width height">
98%%{init: {'theme':'forest'}}%%
99
100classDiagram
101 Animal "1" <|-- Duck
102 Animal <|-- Fish
103 Animal <--o Zebra
104 Animal : +int age
105 Animal : +String gender
106 Animal: +isMammal()
107 Animal: +mate()
108 class Duck{
109 +String beakColor
110 +swim()
111 +quack()
112 }
113 class Fish{
114 -int sizeInFeet
115 -canEat()
116 }
117 class Zebra{
118 +bool is_wild
119 +run()
120 }
121 </pre>
122 <pre class="mermaid width height">
123gantt
124 dateFormat :YYYY-MM-DD
125 title Adding GANTT diagram functionality to mermaid
126 excludes :excludes the named dates/days from being included in a charted task..
127 section A section
128 Completed task :done, des1, 2014-01-06,2014-01-08
129 Active task :active, des2, 2014-01-09, 3d
130 Future task : des3, after des2, 5d
131 Future task2 : des4, after des3, 5d
132
133 section Critical tasks
134 Completed task in the critical line :crit, done, 2014-01-06,24h
135 Implement parser and jison :crit, done, after des1, 2d
136 Create tests for parser :crit, active, 3d
137 Future task in critical line :crit, 5d
138 Create tests for renderer :2d
139 Add to mermaid :1d
140
141 section Documentation
142 Describe gantt syntax :active, a1, after des1, 3d
143 Add gantt diagram to demo page :after a1 , 20h
144 Add another diagram to demo page :doc1, after a1 , 48h
145
146 section Last section
147 Describe gantt syntax :after doc1, 3d
148 Add gantt diagram to demo page :20h
149 Add another diagram to demo page :48h
150 </pre>
151 <pre class="mermaid width height2">
152 stateDiagram
153 [*] --> Active
154
155 state Active {
156 [*] --> NumLockOff
157 NumLockOff --> NumLockOn : EvNumLockPressed
158 NumLockOn --> NumLockOff : EvNumLockPressed
159 --
160 [*] --> CapsLockOff
161 CapsLockOff --> CapsLockOn : EvCapsLockPressed
162 CapsLockOn --> CapsLockOff : EvCapsLockPressed
163 --
164 [*] --> ScrollLockOff
165 ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
166 ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
167 }
168 state SomethingElse {
169 A --> B
170 B --> A
171 }
172
173 Active --> SomethingElse
174 note right of SomethingElse : This is the note to the right.
175 SomethingElse --> [*]
176 </pre>
177 <pre class="mermaid width height2">
178 stateDiagram-v2
179 [*] --> Active
180
181 state Active {
182 [*] --> NumLockOff
183 NumLockOff --> NumLockOn : EvNumLockPressed
184 NumLockOn --> NumLockOff : EvNumLockPressed
185 --
186 [*] --> CapsLockOff
187 CapsLockOff --> CapsLockOn : EvCapsLockPressed
188 CapsLockOn --> CapsLockOff : EvCapsLockPressed
189 --
190 [*] --> ScrollLockOff
191 ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
192 ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
193 }
194 state SomethingElse {
195 A --> B
196 B --> A
197 }
198
199 Active --> SomethingElse2
200 note right of SomethingElse2 : This is the note to the right.
201 </pre>
202 <pre class="mermaid width height2">
203 erDiagram
204 CUSTOMER }|..|{ DELIVERY-ADDRESS : has
205 CUSTOMER ||--o{ ORDER : places
206 CUSTOMER ||--o{ INVOICE : "liable for"
207 DELIVERY-ADDRESS ||--o{ ORDER : receives
208 INVOICE ||--|{ ORDER : covers
209 ORDER ||--|{ ORDER-ITEM : includes
210 PRODUCT-CATEGORY ||--|{ PRODUCT : contains
211 PRODUCT ||--o{ ORDER-ITEM : "ordered in"
212 </pre>
213 <pre class="mermaid width height">
214 journey
215 title My working day
216 section Go to work
217 Make tea: 5: Me
218 Go upstairs: 3: Me
219 Do work: 1: Me, Cat
220 section Go home
221 Go downstairs: 5: Me
222 Sit down: 5: Me
223 </pre>
224 <pre class="mermaid width height">
225requirementDiagram
226
227 requirement test_req {
228 id: 1
229 text: the test text.
230 risk: high
231 verifymethod: test
232 }
233
234 functionalRequirement test_req2 {
235 id: 1.1
236 text: the second test text.
237 risk: low
238 verifymethod: inspection
239 }
240
241 performanceRequirement test_req3 {
242 id: 1.2
243 text: the third test text.
244 risk: medium
245 verifymethod: demonstration
246 }
247
248 element test_entity {
249 type: simulation
250 }
251
252 element test_entity2 {
253 type: word doc
254 docRef: reqs/test_entity
255 }
256
257
258 test_entity - satisfies -> test_req2
259 test_req - traces -> test_req2
260 test_req - contains -> test_req3
261 test_req <- copies - test_entity2
262 </pre>
263 <pre class="mermaid" class="width height">
264 gitGraph:
265 commit
266 branch hotfix
267 checkout hotfix
268 commit
269 branch develop
270 checkout develop
271 commit id:"An id" tag:"A tag"
272 branch featureB
273 checkout featureB
274 commit type:HIGHLIGHT
275 checkout main
276 checkout hotfix
277 commit type:NORMAL
278 checkout develop
279 commit type:REVERSE
280 checkout featureB
281 commit
282 checkout main
283 merge hotfix
284 checkout featureB
285 commit
286 checkout develop
287 branch featureA
288 commit
289 checkout develop
290 merge hotfix
291 checkout featureA
292 commit
293 checkout featureB
294 commit
295 checkout develop
296 merge featureA
297 branch release
298 checkout release
299 commit
300 checkout main
301 commit
302 checkout release
303 merge main
304 checkout develop
305 merge release
306 </pre>
307 </div>
308 <script type="module">
309 import mermaid from './mermaid.esm.mjs';
310 mermaid.parseError = function (err, hash) {
311 // console.error('Mermaid error: ', err);
312 };
313 mermaid.initialize({
314 theme: 'forest',
315 // arrowMarkerAbsolute: true,
316 // themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
317 logLevel: 0,
318 flowchart: { curve: 'cardinal', htmlLabels: false },
319 // gantt: { axisFormat: '%m/%d/%Y' },
320 sequence: { actorMargin: 50, showSequenceNumbers: true },
321 // sequenceDiagram: { actorMargin: 300 } // deprecated
322 fontFamily: '"arial", sans-serif',
323 curve: 'cardinal',
324 securityLevel: 'strict',
325 });
326 function callback() {
327 alert('It worked');
328 }
329 </script>
330 </body>
331</html>
332