reactjs - “dagre”实用程序是强制性依赖项
问题描述
我正在使用jointjs并自动布局我正在使用dagre库的节点。我的代码在此代码处中断
joint.layout.DirectedGraph.layout(self.graph, {
setLinkVertices: false,
rankDir: "LR",
rankSep: 150,
marginX: 100,
marginY: 200,
nodeSep: 80,
edgeSep: 50
}
);
显示错误:“dagre”实用程序是强制性依赖项。我正在使用 dagre@0.7.3 和 jointjs@3.0.4,
解决方案
我刚刚遇到了同样的问题。Jointjs DirectedGraph 插件需要 dagre 和 graphlib 包。
为了解决这个问题,我 npm 安装了 dagre 和 graphlib。
所以你需要这样做......
import dagre from 'dagre';
import graphlib from 'graphlib';
import * as joint from 'jointjs';
joint.layout.DirectedGraph.layout(self.graph, {
dagre: dagre,
graphlib: graphlib
setLinkVertices: false,
rankDir: "LR",
rankSep: 150,
marginX: 100,
marginY: 200,
nodeSep: 80,
edgeSep: 50
}
);
推荐阅读
- python - 使用熊猫比较excel中的两列
- javascript - 使用纯 javascript 是否可以将未显示在窗口上的元素复制到剪贴板?
- amazon-web-services - 为什么我的仪表板中的 https://www.awseducate.com/ 缺少“AWS 账户”选项卡?
- r - R中的Cox PH时间相关协变量格式
- python-3.x - Lambda 函数中的 Boto3 - RequestsDependencyWarning
- amazon-web-services - 如何通过 CDK 向 DynamoDb 添加第三个可索引属性?
- javascript - 将单元格与数据库匹配并将不存在的单元格值添加到数据库的 Google 表格函数
- angular - 触发 mat-selct selectionChange。, 通过 patchValue 更新表单时
- arm - KeyVault 模板 - 多个访问策略
- c# - 在机器人框架中调用 CancelAllDialogsAsync 时如何传递结果?