跳到主要内容

add()

描述

添加一个新状态

信息

新状态是自动添加的,因此不建议手动使用此方法

用法

add(newState: array): void;

参数

  • newState - (必需)表示图表当前状态的 JSON 对象数组

示例

const editor = new dhx.DiagramEditor("editor_container", {
type: "default"
});
// ...
editor.history.add([
{ "id": "shape_1", "type": "start", "x": 200, y: 0, "text": "Start" },
{ "id": "shape_2", "type": "process", "x": 200, y: 120, "text": "Call the client" },
{ "id": "line_1", "type": "line", "from": "shape_1", "to": "shape_2" }
]);

更新日志:v4.1 中新增