mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
294 lines
8.5 KiB
HTML
294 lines
8.5 KiB
HTML
<html>
|
|
<head>
|
|
<link
|
|
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
/* background: rgb(221, 208, 208); */
|
|
/* background:#333; */
|
|
font-family: 'Arial';
|
|
/* font-size: 18px !important; */
|
|
width: 100%;
|
|
display: flex;
|
|
}
|
|
h1 { color: grey;}
|
|
.mermaid2,.mermaid3 {
|
|
display: none;
|
|
}
|
|
.mermaid svg {
|
|
/* font-size: 18px !important; */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="mermaid2" style="width: 50%;">
|
|
pie title Pets adopted by volunteers
|
|
"Dogs" : 386
|
|
"Cats" : 85
|
|
"Rats" : 15
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
gantt
|
|
title Adding GANTT diagram functionality to mermaid
|
|
excludes :excludes the named dates/days from being included in a charted task..
|
|
section Screening
|
|
Lexplore :active, des1, 2023-01-06,2023-01-08
|
|
H4 :active, des2, 2024-01-09, 3d
|
|
Future task : des3, after des2, 5d
|
|
Future task2 : des4, after des3, 5d
|
|
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
info
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
gitGraph:
|
|
options
|
|
{
|
|
"nodeSpacing": 150,
|
|
"nodeRadius": 10
|
|
}
|
|
end
|
|
commit
|
|
branch newbranch
|
|
checkout newbranch
|
|
commit
|
|
commit
|
|
checkout master
|
|
commit
|
|
commit
|
|
merge newbranch
|
|
</div>
|
|
<div class="mermaid" style="width: 50%;">
|
|
sequenceDiagram
|
|
participant a as Alice
|
|
participant j as John
|
|
note right of a: Hello world!
|
|
properties a: {"class": "internal-service-actor", "type": "@clock"}
|
|
properties j: {"class": "external-service-actor", "type": "@computer"}
|
|
links a: {"Repo": "https://www.contoso.com/repo", "Swagger": "https://www.contoso.com/swagger"}
|
|
links j: {"Repo": "https://www.contoso.com/repo"}
|
|
links a: {"Dashboard": "https://www.contoso.com/dashboard", "On-Call": "https://www.contoso.com/oncall"}
|
|
link a: Contacts @ https://contacts.contoso.com/?contact=alice@contoso.com
|
|
a->>j: Hello John, how are you?
|
|
j-->>a: Great! </div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
journey
|
|
title My working day
|
|
section Go to work
|
|
Make tea: 5: Me
|
|
Go upstairs: 3: Me
|
|
Do work: 1: Me, Cat
|
|
section Go home
|
|
Go downstairs: 5: Me
|
|
Sit down: 5: Me
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
requirementDiagram
|
|
|
|
requirement test_req {
|
|
id: 1
|
|
text: the test text.
|
|
risk: high
|
|
verifymethod: test
|
|
}
|
|
|
|
functionalRequirement test_req2 {
|
|
id: 1.1
|
|
text: the second test text.
|
|
risk: low
|
|
verifymethod: inspection
|
|
}
|
|
|
|
performanceRequirement test_req3 {
|
|
id: 1.2
|
|
text: the third test text.
|
|
risk: medium
|
|
verifymethod: demonstration
|
|
}
|
|
|
|
element test_entity {
|
|
type: simulation
|
|
}
|
|
|
|
element test_entity2 {
|
|
type: word doc
|
|
docRef: reqs/test_entity
|
|
}
|
|
|
|
|
|
test_entity - satisfies -> test_req2
|
|
test_req - traces -> test_req2
|
|
test_req - contains -> test_req3
|
|
test_req <- copies - test_entity2
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
erDiagram
|
|
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
|
CUSTOMER ||--o{ ORDER : places
|
|
CUSTOMER ||--o{ INVOICE : "liable for"
|
|
DELIVERY-ADDRESS ||--o{ ORDER : receives
|
|
INVOICE ||--|{ ORDER : covers
|
|
ORDER ||--|{ ORDER-ITEM : includes
|
|
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
|
|
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
graph TB
|
|
subgraph One
|
|
a1-->a2-->a3
|
|
end
|
|
</div>
|
|
<div class="mermaid" style="width: 50%;">
|
|
flowchart LR
|
|
Function-->URL-->A-->B-->C
|
|
click Function clickByFlow "Add a div"
|
|
click URL "https://mermaid-js.github.io/mermaid/#/" "Visit <strong>mermaid docs</strong>" _blank
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
gantt
|
|
dateFormat YYYY-MM-DD
|
|
axisFormat %d/%m
|
|
title Adding GANTT diagram to mermaid
|
|
excludes weekdays 2014-01-10
|
|
|
|
section A section
|
|
Completed task :done, des1, 2014-01-06,2014-01-08
|
|
Active task :active, des2, 2014-01-09, 3d
|
|
Future task : des3, after des2, 5d
|
|
Future task2 : des4, after des3, 5d
|
|
|
|
section Critical tasks
|
|
Completed task in the critical line :crit, done, 2014-01-06,24h
|
|
Implement parser and jison :crit, done, after des1, 2d
|
|
Create tests for parser :crit, active, 3d
|
|
Future task in critical line :crit, 5d
|
|
Create tests for renderer :2d
|
|
Add to mermaid :1d
|
|
|
|
section Documentation
|
|
Describe gantt syntax :active, a1, after des1, 3d
|
|
Add gantt diagram to demo page :after a1 , 20h
|
|
Add another diagram to demo page :doc1, after a1 , 48h
|
|
|
|
section Clickable
|
|
Visit mermaidjs :active, cl1, 2014-01-07,2014-01-10
|
|
Calling a Callback (look at the console log) :cl2, after cl1, 3d
|
|
Calling a Callback with args :cl3, after cl1, 3d
|
|
|
|
click cl1 href "https://mermaid-js.github.io/mermaid/#/"
|
|
click cl2 call clickByGantt()
|
|
click cl3 call clickByGantt("test1", test2, test3)
|
|
|
|
section Last section
|
|
Describe gantt syntax :after doc1, 3d
|
|
Add gantt diagram to demo page : 20h
|
|
Add another diagram to demo page : 48h
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
classDiagram
|
|
Class01 <|-- AveryLongClass : Cool
|
|
Class09 --> C2 : Where am i?
|
|
Class09 --* C3
|
|
Class09 --|> Class07
|
|
Class07 : equals()
|
|
Class07 : Object[] elementData
|
|
Class01 : size()
|
|
Class01 : int chimp
|
|
Class01 : int gorilla
|
|
class Class10 {
|
|
int id
|
|
size()
|
|
}
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
stateDiagram
|
|
[*] --> S1
|
|
state "Some long name" as S1
|
|
</div>
|
|
<div class="mermaid2" style="width: 100%;">
|
|
classDiagram
|
|
Animal "1" <|-- Duck
|
|
Animal <|-- Fish
|
|
Animal <--o Zebra
|
|
Animal : +int age
|
|
Animal : +String gender
|
|
Animal: +isMammal()
|
|
Animal: +mate()
|
|
class Duck{
|
|
+String beakColor
|
|
+swim()
|
|
+quack()
|
|
}
|
|
class Fish{
|
|
-int sizeInFeet
|
|
-canEat()
|
|
}
|
|
class Zebra{
|
|
+bool is_wild
|
|
+run()
|
|
}
|
|
</div>
|
|
|
|
<script src="./mermaid.js"></script>
|
|
<script>
|
|
mermaid.parseError = function (err, hash) {
|
|
// console.error('Mermaid error: ', err);
|
|
};
|
|
mermaid.initialize({
|
|
// theme: 'dark',
|
|
// theme: 'forest',
|
|
// arrowMarkerAbsolute: true,
|
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
|
flowchart: {
|
|
nodeSpacing: 10,
|
|
curve: 'cardinal',
|
|
htmlLabels: true,
|
|
defaultRenderer: 'dagre-d3',
|
|
},
|
|
class: {
|
|
defaultRenderer: 'dagre-d3',
|
|
htmlLabels: true,
|
|
},
|
|
// gantt: { axisFormat: '%m/%d/%Y' },
|
|
sequence: {
|
|
actorFontFamily: 'courier',
|
|
actorMargin: 50,
|
|
showSequenceNumbers: false,
|
|
// forceMenus: true,
|
|
},
|
|
// sequenceDiagram: { actorMargin: 300, forceMenus: false }, // deprecated
|
|
// fontFamily: '"times", sans-serif',
|
|
// fontFamily: 'courier',
|
|
state: {
|
|
nodeSpacing: 50,
|
|
rankSpacing: 50,
|
|
defaultRenderer: 'dagre-d3',
|
|
},
|
|
logLevel: 0,
|
|
fontSize: 18,
|
|
curve: 'cardinal',
|
|
// securityLevel: 'sandbox',
|
|
// themeVariables: {relationLabelColor: 'red'}
|
|
});
|
|
function callback() {
|
|
alert('It worked');
|
|
}
|
|
|
|
function clickByFlow(elemName) {
|
|
const div = document.createElement('div');
|
|
div.className = 'created-by-click';
|
|
div.style = 'padding: 20px; background: green; color: white;';
|
|
div.innerText = 'Clicked By Flow';
|
|
|
|
document.getElementsByTagName('body')[0].appendChild(div);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|