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
@@ -37,12 +37,14 @@ function fakeEngine(
) {
const dispose = vi.fn();
const resize = vi.fn();
const setOption = vi.fn();
const init = vi.fn(
(container: HTMLElement): EChartsInstanceLike => {
dispose.mockImplementation(() => container.replaceChildren());
const handlers = new Map<string, () => void>();
return {
setOption() {
setOption(option, setOptionOptions) {
setOption(option, setOptionOptions);
const svg = document.createElementNS(
"http://www.w3.org/2000/svg",
"svg"
@@ -73,7 +75,8 @@ function fakeEngine(
engine: { init } satisfies EChartsEngine,
init,
dispose,
resize
resize,
setOption
};
}
@@ -103,6 +106,36 @@ describe("浏览器 ECharts 渲染", () => {
).toBeNull();
});
it("全局及系列级动画始终关闭", async () => {
createDocumentWithChart();
const { engine, setOption } = fakeEngine();
await renderEChartsBlocks(document, {
engine,
outputMode: "interactive"
});
expect(setOption).toHaveBeenCalledWith(
expect.objectContaining({
animation: false,
animationDelay: 0,
animationDelayUpdate: 0,
animationDuration: 0,
animationDurationUpdate: 0,
series: [
expect.objectContaining({
animation: false,
animationDelay: 0,
animationDelayUpdate: 0,
animationDuration: 0,
animationDurationUpdate: 0
})
]
}),
{ notMerge: true }
);
});
it("生成 SVG Data URL 图片", async () => {
createDocumentWithChart();
const { engine } = fakeEngine();