Skip to content

[Bug]: 使用复合布局时, 当我的数据中没有combo时, 无法渲染,g6版本为5.0.49 #7356

@aiyeye

Description

@aiyeye

Describe the bug / 问题描述

我是从v4升级到v5, v4时我使用comboCombined布局, outerLayout和innerLayout都使用new G6.Layout['dagre']布局,切换到v5时使用combo-combined布局, demo 如下

import { Graph } from '@antv/g6';
import { DagreLayout } from '@antv/layout';

const data = {
  nodes: [
    { id: 'node1', style: { x: 250, y: 150 } },
    { id: 'node2', style: { x: 350, y: 150 } },
    { id: 'node3', style: { x: 250, y: 300 } },
  ],
  edges: [],
  combos: [],
};

const graph = new Graph({
  container: 'container',
  data,
  node: {
    style: {
      labelText: (d) => d.id,
    },
  },
  combo: {
    type: 'rect',
    style: {
      padding: 20,
    },
  },
  behaviors: ['drag-element', 'collapse-expand'],
  layout: {
    type: 'combo-combined',
    outerLayout: new DagreLayout({

    }),
    innerLayout: new DagreLayout({
      
    }),
  }
});


graph.render();

控制台报错如下

Image

Reproduction link / 复现链接

No response

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

No response

Version / 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't workinglayoutIssue about layout

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions