跳到主要内容

Shapebar API 概述

Shapebar 是 Diagram Editor 的一部分,用于渲染 Diagram 项目(形状、组和泳道)的预览。使用 view 配置对象的 shapebar 属性来显示、隐藏和配置 Shapebar。您可以从以下两种初始化方式中进行选择:

  • 使用 shapebar:true 设置创建默认的 Shapebar:
const editor = new dhx.DiagramEditor("editor_container", {
type: "default",
view: {
shapebar: true // 显示默认的 Shapebar
}
});
  • 将 Shapebar 指定为具有一组属性的对象来进行配置:
const editor = new dhx.DiagramEditor("editor_container", {
type: "default",
view: {
// 通过对象配置 Shapebar
shapebar: {
css: "custom_css",
show: true,
width: 300,
preview: {
scale: 0.65,
gap: 8
},
sections: {
"Swimlane": [{ swimlane: true }],
"Groups": [{ group: true }],
"Flowchart shapes": [{ flowShapes: true }],
"Org shapes, text, topic": [{ org: true }, "text", "topic"]
}
}
}
});

请查看相关 API 部分以了解 Shapebar 的可用属性。