antvis/G6

官网-教程-核心概念-图元素:节点/边/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

https://g6.antv.antgroup.com/manual/middle/elements/nodes/custom-node#%E7%BB%98%E5%88%B6%E5%9B%BE%E5%BD%A2

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


This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 12 months ago

Fund this Issue

$0.00
Funded

Pull requests