[Javascirpt] Developer-friendly Flow Charts with flowchart.js

Flowchart.js is a great tool for creating quick, simple flowcharts in a way that keeps you out of a WYSIWYG, and keeps your productive. No more drawing lines, no more determining how to draw a shape, no more deciding relative size and distance. Flowchart.js makes it easy to prototype new concepts and confirm product flows. Built in JavaScript, the library is complete with HTML rendering and a standard grammar and syntax for creating your flows.

 

复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Flowchart.js Example Project</title>
</head>
<body>

<div id="chart"></div>

<script type="text/javascript"
        src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.min.js"></script>
<script type="text/javascript"
        src="//cdnjs.cloudflare.com/ajax/libs/flowchart/1.6.6/flowchart.min.js"></script>
<script type="text/javascript"
        src="//cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>
<script type="text/javascript"
        src="script.js"></script>
</body>
复制代码

 

axios.get('/data/additional-sample.txt').then(({data}) => {
    const fc = flowchart.parse(data);
    fc.drawSVG('chart');
  });

 

Flowchart 1:

复制代码
start=>start
end=>end

operation=>operation: Operation Example
subroutine=>subroutine: Subroutine Example
condition=>condition: True or False?
inputoutput=>inputoutput: Input output example

start->operation->condition
condition(yes)->subroutine->end
condition(no)->inputoutput->end
复制代码

 

Flowchart 2:

复制代码
s=>start: User would like to use the application
e=>end: User is authenticated
e2=>end: User is not authenticated

o1=>operation: User logs in with email and password
c1=>condition: Email is valid?
c2=>condition: Password is valid?
io1=>inputoutput: Username or password is invalid, notify user

s->o1->c1
c1(yes)->c2
c1(no)->io1->e2
c2(yes)->e
c2(no)->io1->e2
复制代码

 

复制代码
st=>start: I wan't to go out with 4 friends
cond1=>condition: Vegans?
cond2=>condition: Vegetarians?
cond3=>condition: Kosher?
e1=>end: Veggie Sushi
e2=>end: Pizza
e3=>end: Oysters
e4=>end: Sarge's Deli (Open 24 Hours)
io1=>inputoutput: Argue about best option

st->cond1
cond1(yes)->e1
cond1(no)->cond2
cond2(yes)->e2
cond2(no)->cond3
cond3(yes)->io1->e4
cond3(no)->e3
复制代码

 

posted @   Zhentiw  阅读(611)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2017-02-05 [Angular] Organizing Your Exports with Barrels
2016-02-05 [Redux] Passing the Store Down Implicitly via Context
2016-02-05 [Redux] Passing the Store Down Explicitly via Props
点击右上角即可分享
微信分享提示