antvis/G6

How to adjust the glow color of a rectangular node to red #6645

yvonneyx posted onGitHub

Describe the bug / 问题描述

如何将矩形节点的光晕颜色调整为红色

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

要将矩形节点的光晕颜色调整为红色,您可以通过设置节点的样式来实现。在 G6 5.x 版本中,您可以通过以下方式设置节点的光晕颜色:

const graph = new G6.Graph({
  container: 'mountNode', // 容器 ID
  width: 800,
  height: 600,
  defaultNode: {
    type: 'rect',
    style: {
      fill: '#fff',
      stroke: '#000',
      shadowColor: 'red', // 设置光晕颜色为红色
      shadowBlur: 10, // 设置光晕的模糊程度
    },
  },
  modes: {
    default: ['drag-canvas', 'zoom-canvas'],
  },
});

graph.data({
  nodes: [
    {
      id: 'node1',
      x: 100,
      y: 100,
      label: '矩形节点',
    },
  ],
});

graph.render();

在上面的代码中,shadowColor 属性用于设置光晕的颜色,而 shadowBlur 属性用于设置光晕的模糊程度。您可以根据需要调整这些属性的值来实现不同的效果。

如果您有其他问题或需要进一步的帮助,请随时告诉我。

<details> <summary>🪧 Tips</summary> For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. </details>

posted by petercat-assistant[bot] 4 months ago

Fund this Issue

$0.00
Funded

Pull requests