Typora使用技巧_流程图

流程图

基本语法

申明方向

  • TB - top bottom
  • BT - bottom top
  • RL - right left
  • LR - left right
  • TD - same as TB

节点与形状

默认节点

graph LR
id1
id1

注意:’id’显示在节点内部。

文本节点

graph LR 
id[This is the text in the box]
This is the text in the box

圆角节点

graph LR
id(This is the text in the box)
This is the text in the box

圆节点

graph LR
id((this is the Text in the circle))
this is the Text in the circle

非对称节点(asymetric shape)

graph LR
id>this is the text in the box]
this is the text in the box

菱形节点(rhombus)

graph LR
id{this is the text in the box}
this is the text in the box

连接线

  • 箭头形连接 A–>B
  • 开放行连接 A—B
  • 标签连接 A->|text|B\ 或者A–text–>B
  • 虚线(dotted link)
    • A-.->B
    • A-.-.B
  • 粗实线
    • A==>B
    • A===B
text
A
B
C
D
E
F
H
G
I
.J
K
L
M
N

特殊语法

  1. 使用引号可以抑制一些特殊字符的使用,避免异议
graph LR
d1["this is the (text) in the box"]
this is the (text) in the box
  1. 子图(subgraphs)
subgraph title\
graph definition\
end
three
two
one
c1
c2
b1
b2
a1
a2

常用模板

1、横向流程图源码格式:

graph LR
A[方形] -->B(圆角)
    B --> C{条件a}
    C -->|a=1| D[结果1]
    C -->|a=2| E[结果2]
    F[横向流程图]
a=1
a=2
方形
圆角
条件a
结果1
结果2
横向流程图

2、竖向流程图源码格式:

graph TD
A[方形] --> B(圆角)
    B --> C{条件a}
    C --> |a=1| D[结果1]
    C --> |a=2| E[结果2]
    F[竖向流程图]
a=1
a=2
方形
圆角
条件a
结果1
结果2
竖向流程图

3、标准流程图源码格式:

flowchat
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->op
Created with Raphaël 2.2.0 开始框 处理框 判断框(是或否?) 输入输出框 结束框 子流程 yes no

4、标准流程图源码格式(横向):

flowchat
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st(right)->op(right)->cond
cond(yes)->io(bottom)->e
cond(no)->sub1(right)->op
Created with Raphaël 2.2.0 开始框 处理框 判断框(是或否?) 输入输出框 结束框 子流程 yes no

5、UML时序图源码样例:

sequenceDiagram
对象A->>对象B: 对象B你好吗?(请求)
Note right of 对象B: 对象B的描述
Note left of 对象A: 对象A的描述(提示)
对象B-->>对象A: 我很好(响应)
对象A->>对象B: 你真的好吗?
对象A 对象B 对象B你好吗?(请求) 对象B的描述 对象A的描述(提示) 我很好(响应) 你真的好吗? 对象A 对象B 标题:复杂使用

6、UML时序图源码复杂样例:

sequenceDiagram
Title: 标题:复杂使用
对象A->>对象B: 对象B你好吗?(请求)
Note right of 对象B: 对象B的描述
Note left of 对象A: 对象A的描述(提示)
对象B-->>对象A: 我很好(响应)
对象B->>小三: 你好吗
小三-->>对象A: 对象B找我了
对象A->>对象B: 你真的好吗?
Note over 小三,对象B: 我们是朋友
participant C
Note right of C: 没人陪我玩
对象A 对象B 小三 C 对象B你好吗?(请求) 对象B的描述 对象A的描述(提示) 我很好(响应) 你好吗 对象B找我了 你真的好吗? 我们是朋友 没人陪我玩 对象A 对象B 小三 C 标题:复杂使用

7、UML标准时序图样例:

%% 时序图例子,-> 直线,-->虚线,->>实线箭头
  sequenceDiagram
    participant 张三
    participant 李四
    张三->王五: 王五你好吗?
    loop 健康检查
        王五->王五: 与疾病战斗
    end
    Note right of 王五: 合理 食物 <br/>看医生...
    李四-->>张三: 很好!
    王五->李四: 你怎么样?
    李四-->王五: 很好!
张三 李四 王五 王五你好吗? 与疾病战斗 loop [ 健康检查 ] 合理 食物 看医生... 很好! 你怎么样? 很好! 张三 李四 王五 标题:复杂使用

8、甘特图样例:

gantt
        dateFormat  YYYY-MM-DD
        title 软件开发甘特图
        section 设计
        需求                      :done,    des1, 2014-01-06,2014-01-08
        原型                      :active,  des2, 2014-01-09, 3d
        UI设计                     :         des3, after des2, 5d
    未来任务                     :         des4, after des3, 5d
        section 开发
        学习准备理解需求                      :crit, done, 2014-01-06,24h
        设计框架                             :crit, done, after des2, 2d
        开发                                 :crit, active, 3d
        未来任务                              :crit, 5d
        耍                                   :2d
        section 测试
        功能测试                              :active, a1, after des3, 3d
        压力测试                               :after a1  , 20h
        测试报告                               : 48h
Mon 06 Mon 13 Mon 20 需求 原型 UI设计 未来任务 学习准备理解需求 设计框架 开发 未来任务 功能测试 压力测试 测试报告 设计 开发 测试 软件开发甘特图
发布了20 篇原创文章 · 获赞 6 · 访问量 869

猜你喜欢

转载自blog.csdn.net/qq_43605381/article/details/104411274