antvis / layout

Layout algorithms for graphs.
193 stars 55 forks source link

feat: adapt d3-force-3d layout #214

Closed Aarebecca closed 5 months ago

Aarebecca commented 5 months ago

Apr-09-2024 17-16-11

d3 force 3d Apr-09-2024 21-33-10 d3 force

配置项完全遵守 d3-force-3d,会基于配置项自动添加力

import { D3Force3DLayout } from '@antv/layout';

const force = new D3Force3DLayout({
  // 启用中心力并设置中心位置
  center: {
    x: 250,
    y: 250,
    z: 0
  },
  manyBody: {
    // 配置多体力
  }
});

由于 d3-force-3d 缺少类型定义,因此内部使用了临时版本,已经给其提了 PR https://github.com/vasturiano/d3-force-3d/pull/24