antvis/G6

The issue has been closed
官网-教程-核心概念-图元素:节点/边/Combo-节点-自定义节点-1. 从无到有定义节点-绘制图形 #4756
nishilao6 posted onGitHub
Describe the bug
官网-教程-核心概念-图元素:节点/边/Combo-节点-自定义节点-1. 从无到有定义节点-绘制图形中的示例代码. draw函数内的配置给一个需要给默认的颜色,在本地运行示例时,只出现了一个菱形标志,而不是官网上的四个不同的菱形.原因是代码中并没有给出边颜色的默认值,而是直接使用的节点数据node中的值.需要进行如下调整
const keyShape = group.addShape('path', {
attrs: {
path: this.getPath(cfg),
stroke: cfg.color || "black", // 这里是具体调整 原来是 stroke: cfg.color
},
name: 'path-shape',
draggable: true,
});
Your Example Website or App
Steps to Reproduce the Bug or Issue
官网-教程-核心概念-图元素:节点/边/Combo-节点-自定义节点-1. 从无到有定义节点-绘制图形中的示例代码-本地运行
Expected behavior
期望本地能显示4个不同的菱形,和官网一致.
Screenshots or Videos
<img width="512" alt="image" src="https://github.com/antvis/G6/assets/140131672/ac519993-98fd-49fd-8fd5-484abe12ad21">
<img width="549" alt="image" src="https://github.com/antvis/G6/assets/140131672/33b3ca6d-3536-4993-9df2-67de915b9373">
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response