前言
甘特图这图很适合任务排期,在各种敏捷开发系统或者任务编排软件都能看到身影。
基础语法
字段解析
| 字段 | 解释 |
|---|---|
| title | 标题 |
| dateFormat | 日期格式 |
| section | 区域块 |
| excludes | 排除日期 |
| axisFormat | 图标 x轴日期格式调整,比如只显示月日%m-%d |
任务修饰符
| 字段 | 解释 |
|---|---|
| :done | 完成 |
| :active | 任务激活 |
| :crit | 强调、关键任务 |
| after | 在某个日期之后, after des1 2d(任务 x des1日期之后两天) |
| :d | 相对上个任务结束时间排期 |
- d - h |
- 天数 - 小时 |
基本姿势
ganttdateFormat YYYY-MM-DD HH MMtitle 这是一个演示的甘特图section x云35迭代主题3.0 :active,2019-12-10,5d@h3/antd :crit,2019-12-15,7d单元测试 :3d
排除周六日及任务推后
ganttdateFormat YYYY-MM-DDtitle 这是一个演示的甘特图excludes weekdays saturday,sundaysection x云35迭代主题3.0 :active,des1,2019-12-10,5d@h3/antd :crit,after des1 3d,7d
X轴日期显示调整
ganttdateFormat YYYY-MM-DD HH MMtitle 这是一个演示的甘特图excludes weekdays saturday,sundayaxisFormat %m-%dsection x云35迭代主题3.0 :active ,a1 ,2019-12-10,5d@h3/antd :crit, after a1 3d,7dsection x云34迭代报表批量编辑 :done,2019-11-10, 2019-12-01
# axisFormat 可用的参数%a - abbreviated weekday name.%A - full weekday name.%b - abbreviated month name.%B - full month name.%c - date and time, as "%a %b %e %H:%M:%S %Y".%d - zero-padded day of the month as a decimal number [01,31].%e - space-padded day of the month as a decimal number [ 1,31]; equivalent to %_d.%H - hour (24-hour clock) as a decimal number [00,23].%I - hour (12-hour clock) as a decimal number [01,12].%j - day of the year as a decimal number [001,366].%m - month as a decimal number [01,12].%M - minute as a decimal number [00,59].%L - milliseconds as a decimal number [000, 999].%p - either AM or PM.%S - second as a decimal number [00,61].%U - week number of the year (Sunday as the first day of the week) as a decimal number [00,53].%w - weekday as a decimal number [0(Sunday),6].%W - week number of the year (Monday as the first day of the week) as a decimal number [00,53].%x - date, as "%m/%d/%Y".%X - time, as "%H:%M:%S".%y - year without century as a decimal number [00,99].%Y - year with century as a decimal number.%Z - time zone offset, such as "-0700".%% - a literal "%" character.
官方综合例子
ganttdateFormat YYYY-MM-DDtitle Adding GANTT diagram functionality to mermaidsection A sectionCompleted task :done, des1, 2014-01-06,2014-01-08Active task :active, des2, 2014-01-09, 3dFuture task : des3, after des2, 5dFuture task2 : des4, after des3, 5dsection Critical tasksCompleted task in the critical line :crit, done, 2014-01-06,24hImplement parser and jison :crit, done, after des1, 2dCreate tests for parser :crit, active, 3dFuture task in critical line :crit, 5dCreate tests for renderer :2dAdd to mermaid :1dsection DocumentationDescribe gantt syntax :active, a1, after des1, 3dAdd gantt diagram to demo page :after a1 , 20hAdd another diagram to demo page :doc1, after a1 , 48hsection Last sectionDescribe gantt syntax :after doc1, 3dAdd gantt diagram to demo page :20hAdd another diagram to demo page :48h
总结
熟悉了这个,写任务排期就跟写 markdown列表一样,速度很快。
请不要和专业的任务排期软件对比,没有可比性!两个的出发点和量级都不是同等的。
