找回密码
 register

QQ登录

只需一步,快速开始

[*网络运维*] Discuz支持mermaid流程图、甘特图、 时序图、 状态图等多种图表

[复制链接]

[*网络运维*] Discuz支持mermaid流程图、甘特图、 时序图、 状态图等多种图表

[复制链接]
Waylee

主题

0

回帖

7910

积分

仙帝

积分
7910
Waylee 2024-11-14 00:58 | 显示全部楼层 |阅读模式 | Google Chrome | Windows 10

马上注册,查看网站隐藏内容!!

您需要 登录 才可以下载或查看,没有账号?register

×

Discuz 的 Mermaid 1.2 插件默认是不支持流程图的,这里进行一些修改就可以完美支持了。
同时支持 流程图、甘特图、 时序图、 类图、 状态图、 饼图 、用户体验旅程图、 C4图、象限图、XY图表

你可以使用npm或yarn库来安装mermaid库。

cd /opt
yarn add mermaid  
npm install -g mermaid  

这样就可以在/opt/node_modules/mermaid/dist目录中生成mermaid.js文件,将整个dist文件夹放到网站内,比如
https://waylee.net/mermaid/11.4.0/mermaid.min.js
https://waylee.net/mermaid/11.4.0/themes/mermaid.default.min.css
(css用插件默认的即可,不改也可以)
这样我们就可以直接访问了。
然后我们在Mermaid 1.2插件中自定义JS文件即可。



甘特图演示:Gantt chart [docs - live editor]
gantt     section Section     Completed :done,    des1, 2014-01-06,2014-01-08     Active        :active,  des2, 2014-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


流程图演示: Flowchart [docs - live editor]
%%{init: { 'themeVariables': { 'fontFamily': 'Comic Sans MS' } }}%% flowchart LR A[Hard] -->|Text| B(Round) B --> C{Decision} C -->|One| D[Result 1] C -->|Two| E[Result 2]


时序图 Sequence diagram [docs - live editor]
sequenceDiagram Alice->>John: Hello John, how are you? loop HealthCheck     John->>John: Fight against hypochondria end Note right of John: Rational thoughts! John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good!


类图 Class diagram [docs - live editor]
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() }


状态图 [docs - live editor]

stateDiagram-v2    
  • --> Still     Still -->
  •     Still --> Moving     Moving --> Still     Moving --> Crash     Crash -->



  • 饼图
    pie "Dogs" : 386 "Cats" : 85 "Rats" : 15


    用户体验旅程图 [文档 - live editor]
    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: 3: Me


    C4 图 [文档]
    C4Context title System Context diagram for Internet Banking System Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.") Person(customerB, "Banking Customer B") Person_Ext(customerC, "Banking Customer C") System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.") Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.") Enterprise_Boundary(b1, "BankBoundary") {   SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")   System_Boundary(b2, "BankBoundary2") {     System(SystemA, "Banking System A")     System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")   }   System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")   SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")   Boundary(b3, "BankBoundary3", "boundary") {     SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")     SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")   } } BiRel(customerA, SystemAA, "Uses") BiRel(SystemAA, SystemE, "Uses") Rel(SystemAA, SystemC, "Sends e-mails", "SMTP") Rel(SystemC, customerA, "Sends e-mails to")


    Entity Relationship Diagram - ❗ experimental  /  实体关系图
    erDiagram     CUSTOMER ||--o{ ORDER : places     ORDER ||--|{ LINE-ITEM : contains     CUSTOMER }|..|{ DELIVERY-ADDRESS : uses


    Quadrant Chart / 象限图
    quadrantChart     title Reach and engagement of campaigns     x-axis Low Reach --> High Reach     y-axis Low Engagement --> High Engagement     quadrant-1 We should expand     quadrant-2 Need to promote     quadrant-3 Re-evaluate     quadrant-4 May be improved     Campaign A: [0.3, 0.6]     Campaign B: [0.45, 0.23]     Campaign C: [0.57, 0.69]     Campaign D: [0.78, 0.34]     Campaign E: [0.40, 0.34]     Campaign F: [0.35, 0.78]


    XY Chart / XY图表
    xychart-beta     title "Sales Revenue"     x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]     y-axis "Revenue (in $)" 4000 --> 11000     bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]     line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]


    Discuz Mermaid 1.2 插件下载(5金币购买后显示):

    开源项目地址:https://github.com/mermaid-js/mermaid
    中文简易文档:https://github.com/mermaid-js/mermaid/blob/develop/README.zh-CN.md
    英文超详细文档:https://mermaid.js.org/intro/

    雪舞PS:状态图(目前显示有点问题),可能是最新版本11.4.0的BUG,下次更新后再测试一下吧。
    付费看帖
    剩余 1% 内容需要支付 5.00 金币 后可完整阅读
    支持付费阅读,激励作者创作更好的作品。

    雪舞知识库 | 浙ICP备15015590号-1 | 萌ICP备20232229号|浙公网安备33048102000118号 |网站地图|天天打卡

    GMT+8, 2024-11-24 08:20 , Processed in 0.083694 second(s), 9 queries , Redis On.

    Powered by XueWu Licensed

    Copyright © Tencent Cloud.

    快速回复 返回顶部 返回列表