feat: 扩展 ECharts 第二阶段图表支持

新增 tree、treemap、sunburst、graph、sankey、chord、funnel、gauge 和 pictorialBar 系列,并注册对应的 ECharts 按需模块。

完善层级与关系数据校验、节点和边数量限制、默认布局及错误占位规则,同时补充默认 Markdown 与 README 示例。

静态渲染全局关闭 ECharts 动画,修复 Treemap 标签冻结在透明动画帧的问题,并完成快速预览、精确 PDF、容器镜像和 147 项全项目测试验证。
This commit is contained in:
SkyJourney
2026-07-27 17:47:28 +08:00
parent f5a46f79f1
commit 92a5bfd016
13 changed files with 1162 additions and 21 deletions
+231 -1
View File
@@ -94,9 +94,11 @@ flowchart LR
## ECharts 图表
### 基础柱状图
\`\`\`echarts
caption: 各模块文档数量
height: 72mm
height: 58mm
option:
xAxis:
type: category
@@ -108,6 +110,234 @@ option:
data: [28, 18, 15, 22]
\`\`\`
### Tree 树图
\`\`\`echarts
caption: 产品能力树
height: 58mm
option:
series:
- type: tree
orient: LR
label:
position: left
data:
- name: 文档平台
children:
- name: Markdown
children:
- name: Mermaid
- name: ECharts
- name: PDF
children:
- name: 快速预览
- name: 精确预览
\`\`\`
### Treemap 矩形树图
\`\`\`echarts
caption: 模块工作量占比
height: 58mm
option:
series:
- type: treemap
roam: false
nodeClick: false
breadcrumb:
show: false
label:
show: true
formatter: "{b}"
color: "#1f2937"
fontWeight: bold
backgroundColor: "rgba(255, 255, 255, 0.88)"
borderRadius: 3
padding: [3, 6]
itemStyle:
borderColor: "#ffffff"
borderWidth: 2
gapWidth: 2
levels:
- itemStyle:
borderWidth: 0
gapWidth: 2
- upperLabel:
show: true
height: 28
color: "#1f2937"
fontWeight: bold
backgroundColor: "rgba(255, 255, 255, 0.88)"
padding: [3, 6]
itemStyle:
borderColor: "#ffffff"
borderWidth: 2
gapWidth: 2
- label:
show: true
formatter: "{b}"
color: "#1f2937"
fontWeight: bold
backgroundColor: "rgba(255, 255, 255, 0.88)"
borderRadius: 3
padding: [3, 6]
itemStyle:
borderColor: "#ffffff"
borderWidth: 2
gapWidth: 2
data:
- name: 渲染
children:
- { name: Markdown, value: 32 }
- { name: ECharts, value: 24 }
- { name: Mermaid, value: 18 }
- name: 导出
children:
- { name: PDF, value: 28 }
- { name: 主题, value: 12 }
\`\`\`
### Sunburst 旭日图
\`\`\`echarts
caption: 文档内容层级
height: 58mm
option:
series:
- type: sunburst
radius: [15%, 90%]
data:
- name: 技术文档
children:
- { name: 架构, value: 18 }
- { name: 接口, value: 24 }
- name: 项目文档
children:
- { name: 周报, value: 16 }
- { name: 计划, value: 12 }
\`\`\`
### Graph 关系图
\`\`\`echarts
caption: 渲染链路关系
height: 58mm
option:
series:
- type: graph
layout: circular
roam: false
label:
show: true
data:
- { name: Markdown, symbolSize: 42 }
- { name: HTML, symbolSize: 38 }
- { name: 预览, symbolSize: 34 }
- { name: PDF, symbolSize: 34 }
links:
- { source: Markdown, target: HTML }
- { source: HTML, target: 预览 }
- { source: HTML, target: PDF }
\`\`\`
### Sankey 桑基图
\`\`\`echarts
caption: 文档流转量
height: 58mm
option:
series:
- type: sankey
data:
- { name: Markdown }
- { name: HTML }
- { name: 快速预览 }
- { name: 精确预览 }
- { name: PDF }
links:
- { source: Markdown, target: HTML, value: 100 }
- { source: HTML, target: 快速预览, value: 55 }
- { source: HTML, target: 精确预览, value: 25 }
- { source: HTML, target: PDF, value: 20 }
\`\`\`
### Chord 和弦图
\`\`\`echarts
caption: 团队协作关系
height: 58mm
option:
series:
- type: chord
label:
show: true
data:
- { name: 研发 }
- { name: 产品 }
- { name: 设计 }
- { name: 运营 }
links:
- { source: 研发, target: 产品, value: 12 }
- { source: 产品, target: 设计, value: 8 }
- { source: 设计, target: 运营, value: 6 }
- { source: 运营, target: 研发, value: 4 }
\`\`\`
### Funnel 漏斗图
\`\`\`echarts
caption: 文档发布转化
height: 58mm
option:
series:
- type: funnel
sort: descending
label:
formatter: "{b}: {c}"
data:
- { name: 草稿, value: 100 }
- { name: 评审, value: 76 }
- { name: 定稿, value: 58 }
- { name: 发布, value: 45 }
\`\`\`
### Gauge 仪表盘
\`\`\`echarts
caption: 发布完成率
height: 58mm
option:
series:
- type: gauge
min: 0
max: 100
progress:
show: true
detail:
formatter: "{value}%"
data:
- { name: 完成率, value: 78 }
\`\`\`
### PictorialBar 象形柱图
\`\`\`echarts
caption: 各渠道文档数量
height: 58mm
option:
xAxis:
type: category
data: [知识库, 周报, 手册, 方案]
yAxis:
type: value
series:
- type: pictorialBar
symbol: "path://M0,10 L5,0 L10,10 Z"
symbolRepeat: true
symbolSize: [14, 10]
data: [12, 20, 16, 24]
\`\`\`
> 预览和 PDF 将共用同一份 HTML 与 CSS。
`;
-1
View File
@@ -216,7 +216,6 @@ export class PagedDocumentRuntime {
const { renderEChartsBlocks } = await this.loadECharts();
const outcomes = await renderEChartsBlocks(container, {
outputMode: "inline-svg",
animation: false,
concurrency: 2,
timeoutMs: 5_000
});