@cosmograph/cosmograph

中文文档
2.5.1发布于 2026/08/15CC-BY-NC-4.0TypeScriptES Module近 30 天下载 6.7万

宇宙图:网络上最快的图形可视化库

中文使用文档
文档目录6 节
  1. * 特性
  2. QQ 快速启动
  3. 问题和贡献
  4. 许可证
  5. 宇宙空间
  6. 联系人

宇宙图

npm version license GitHub Issues Discord Docs

一个强大的 JavaScript 图形可视化库 GPU 加速力布局 引擎为 二维和三维 支助。 它特别适合 知识图大型的实体、关系和本体学网络,你需要在浏览器中看到和浏览——以及 语义图 从机器学习嵌入。 宇宙图使这些图表在规模上具有响应性,并将渲染器配以交互式工具来进行搜索、过滤和探索.

* 特性

  • 🕸️ 知识图友好:可视化实体 - 规模关系网络,其布局和互动可帮助您建立点状结构、邻接点和外围点
  • 🧊 二维和三维: 在平面视图和带有轨道相机的GPU 3D力布局之间切换(spaceDimensions: 3),包括嵌入式的可选 Z 坐标
  • * 现代硬件上数百万分和边的高性能处理
  • QQ 准备使用交互式组件,包括时间线,搜索,直方图,传说等.
  • QQ 完全定制于图形行为和外观的灵活配置 API
  • * 丰富的基于数据的自动配色和大小化策略
  • * 点和链接的实时添加、去除和定位
  • 对标准数据格式的支持,包括 .csv, (中文(简体) ), .parquet, (中文(简体) ), .arrow 财务报告和审定财务报表 .json
  • SQL 强大的数据转换和过滤能力
  • 与外部 DuckDB 实例中的表格直接连接
  • QQ TypeScript 支持, 包含全面的类型和 API 提示

QQ 快速启动

1️⃣ 安装软件包 :

npm install @cosmograph/cosmograph

2️⃣ 在提供的容器中获取数据,配置图表并渲染宇宙图:

import { Cosmograph, prepareCosmographData } from '@cosmograph/cosmograph'

// Points and links data can be:
// - Array of objects
// - File (.csv/.tsv, .parquet/.pq, .arrow, .json)
// - URL string to a file
// - Apache Arrow Table (binary data Uint8Array/ArrayBuffer)
// - DuckDB table name if connection is passed into the Cosmograph constructor

const rawPoints = [{ id: 'a' }, { id: 'b' }, { id: 'c' }]

const rawLinks = [
  { source: 'a', target: 'b' },
  { source: 'b', target: 'c' },
  { source: 'c', target: 'a' },
]

// Create a config to map your data into Cosmograph's internal format
const dataConfig = {
  points: {
    pointIdBy: 'id',
  },
  links: {
    linkSourceBy: 'source',
    linkTargetsBy: ['target'],
  },
}

const createCosmograph = async (container: HTMLElement): Promise<void> => {
  // Prepare data and config for Cosmograph
  const result = await prepareCosmographData(dataConfig, rawPoints, rawLinks)

  // Create Cosmograph instance from prepared data and config
  if (result) {
    const { points, links, cosmographConfig } = result
    const cosmograph = new Cosmograph(container, { points, links, ...cosmographConfig })
  }
}

// Render Cosmograph in the provided container
createCosmograph(document.getElementById('cosmograph-container'))

看看这个 宇宙图文件 更多信息和实例.

问题和贡献

虽然目前已关闭来源,我们欢迎您的反馈! 帮助改进宇宙图,方法是提交错误报告,并在我们中突出想法 问题存放处。 。 。 .

许可证

宇宙图根据 CC-BY-NC-4.0. 许可证 任何非商业用途都可以免费使用。 如果你想在商业项目中使用,请 联系我们。 。 。 .

宇宙空间

@ cosmograph/ 反应 - 反应应用的宇宙图
py 相册 - Python 数据科学工作流程的 Jupyter 部件

联系人

🌎 相册. app
📩 嗨@cosmograph.app
👾 宇宙图 Discord 频道

版本与发布记录

@cosmograph/cosmograph 共发布 79 个版本,首次发布于 2023/07/04;过去 12 个月发布了 21 个版本。

版本发布日期距今
2.5.1latest2026/08/152 个月前
2.5.02026/08/112 个月前
2.4.12026/07/233 个月前
2.4.02026/07/223 个月前
2.4.0-beta.4beta2026/07/223 个月前
2.3.32026/07/163 个月前

其他发布通道:test → 2.0.0-test.16.2,beta → 2.4.0-beta.4。

关于 @cosmograph/cosmograph 的常见问题

@cosmograph/cosmograph 是什么?

宇宙图:网络上最快的图形可视化库

如何安装 @cosmograph/cosmograph?

在项目目录运行 npm install @cosmograph/cosmograph,或使用 pnpm add / yarn add / bun add。

@cosmograph/cosmograph 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cosmograph/cosmograph 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cosmograph/cosmograph 可以商用吗?

@cosmograph/cosmograph 使用 CC-BY-NC-4.0 许可。声明的许可为 CC-BY-NC-4.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@cosmograph/cosmograph 的下载量有多少?

根据 npm 官方下载统计,@cosmograph/cosmograph 在 2026/10/11 – 2026/11/09 这 30 天内被下载 66,890 次,日均约 2,230 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cosmograph/cosmograph 还在维护吗?

最新版本 2.5.1 发布于 2026/08/15(2 个月前);至今共发布 79 个版本,其中过去 12 个月发布了 21 个;首次发布于 2023/07/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。