【Mermaid】画图工具使用笔记

简介: 【Mermaid】画图工具使用笔记

Mermaid简介

Mermaid 允许使用文本和代码创建图表和可视化效果。它是一个基于 JavaScript 的图表绘制和图表工具,可呈现受 Markdown 启发的文本定义,以动态创建和修改图表。

Mermaid使用方法

1、流程图(graph)

graph TD;
  A-->B;
  A-->C;
  B-->D;

微信截图_20230524182206.png

graph LR
    A[Square Rect] -- Link text --> B((Circle))
    A --> C(Round Rect)
    B --> D{Rhombus}
    C --> D

微信截图_20230524182231.png

graph TB
    sq[Square shape] --> ci((Circle shape))
    subgraph A
        od>Odd shape]-- Two line<br/>edge comment --> ro
        di{Diamond with <br/> line break} -.-> ro(Rounded<br>square<br>shape)
        di==>ro2(Rounded square shape)
    end
    %% Notice that no text in shape are added here instead that is appended further down
    e --> od3>Really long text with linebreak<br>in an Odd shape]
    %% Comments after double percent signs
    e((Inner / circle<br>and some odd <br>special characters)) --> f(,.?!+-*ز)
    cyr[Cyrillic]-->cyr2((Circle shape Начало));
     classDef green fill:#9f6,stroke:#333,stroke-width:2px;
     classDef orange fill:#f96,stroke:#333,stroke-width:4px;
     class sq,e green
     class di orange

微信截图_20230524182259.png

微信截图_20230524182313.png

2、时序图(sequenceDiagram)

sequenceDiagram
  Alcie->>Johb:hello John, how are you?
  John-->>Alice:Great!

微信截图_20230524182540.png

微信截图_20230524182555.png


3、状态图(stateDiagram)

stateDiagram
  [*]-->s1
  s1-->[*]

微信截图_20230524182643.png

4、类图

classDiagram
Class01 <|-- AveryLongClass : Cool
<<Interface>> Class01
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
class Class10 {
  <<service>>
  int id
  size()
}

微信截图_20230524182712.png

5、甘特图(gantt)

gantt
    section Section
    Completed :done,    des1, 2022-01-06,2022-01-08
    Active        :active,  des2, 2022-01-07, 3d
    Parallel 1   :         des3, after des1, 1d
    Parallel 2   :         des4, after des1, 1d
    Parallel 3   :         des5, after des3, 1d
    Parallel 4   :         des6, after des4, 1d


微信截图_20230524182739.png

6、饼图(pie)

pie
  title Key elements in Product X
  "Dogs" : 25
  "Cats" : 25
  "Rats" : 15
  "Iron" : 35


微信截图_20230524182807.png

7、需求图

flowchat
  st=>start: Start
  op=>operation: Your Operation
  cond=>condition: Yes or No?
  e=>end
  st->op->cond
  cond(yes)->e
  cond(no)->op

微信截图_20230524182835.png

相关文章
|
2月前
|
网络协议 Java
【工具】Mermaid + 大模型画流程图
最近看面试文章关于TCP三次握手和四次挥手的文章,时常会看到有类似的图去描述这样的过程。当然觉得这样的图还是蛮规范的,属于流程图的一种,是否有工具可以自动生成呢?但没有细想,昨天刷V2EX看到也有老哥发出了这样的问题。于是顺着评论区大佬的回答,我GET到了一个工具Mermaid 这里三次握手的图取自小林coding的文章
82 0
|
2月前
|
供应链 小程序 搜索推荐
Axure使用和画图入门到精通的步骤
Axure使用和画图入门到精通的步骤
|
数据可视化 Python
神操作!用 Python 操作 xmind 绘制思维导图!
在平时的工作中当我们要总结一些知识的时候就需要一款工具来画画流程图,这里推荐 XMind 软件,用 Xmind 绘制的思维导图看起来思路清晰,那么今天的文章介绍关于思维导图的相关知识以及用 Python 如何操作 Xmind 绘制思维导图。
1308 0
神操作!用 Python 操作 xmind 绘制思维导图!
|
5月前
|
算法 数据可视化 定位技术
【python实操】如何通过简单拖拽直接开发软件,避免手写界面布局
【python实操】如何通过简单拖拽直接开发软件,避免手写界面布局
60 0
|
3月前
|
设计模式 数据可视化 程序员
不会画uml?推荐使用代码画图的工具PlantUml
不会画uml?推荐使用代码画图的工具PlantUml
197 1
|
5月前
|
数据可视化 定位技术 数据格式
看完这篇文章,我才知道 Python 制作动态图表的正确方式
看完这篇文章,我才知道 Python 制作动态图表的正确方式
|
10月前
|
数据可视化 测试技术 vr&ar
UML画图笔记
UML画图笔记
52 0
|
9月前
|
存储 NoSQL 程序员
聊聊「画图」和工具
关于画图和工具选择;两句话能说明白;【1】示意清楚的都是「好图」;【2】免费,够用,支持云存储,都是好的画图「工具」;
88 0
|
10月前
|
人工智能 前端开发 数据处理
Python实现画图软件功能
Python实现画图软件功能
81 0
|
数据可视化 测试技术 Python
软件测试|神操作!用 Python 操作 xmind 绘制思维导图
软件测试|神操作!用 Python 操作 xmind 绘制思维导图
197 0
软件测试|神操作!用 Python 操作 xmind 绘制思维导图

相关实验场景

更多