一个 JavaScript 库,用于可视化数千个节点和边的图形
Website | Documentation | Storybook | Mastodon
[!NOTE] Sigma v4 is now available as an alpha release. See v4.sigmajs.org for the website, or the
v4branch for the source code.
Sigma.js is an open-source JavaScript library aimed at visualizing graphs of thousands of nodes and edges using WebGL, mainly developed by @jacomyal and @Yomguithereal, and built on top of graphology.
To integrate sigma into your project, follow these simple steps:
Installation: Add sigma and graphology to your project by running the following command:
npm install sigma graphologyUsage: Import sigma into your JavaScript or TypeScript file:
import Graph from "graphology";
import Sigma from "sigma";Then, create a new Sigma instance with your graph data and target container:
const graph = new Graph();
graph.addNode("1", { label: "Node 1", x: 0, y: 0, size: 10, color: "blue" });
graph.addNode("2", { label: "Node 2", x: 1, y: 1, size: 20, color: "red" });
graph.addEdge("1", "2", { size: 5, color: "purple" });
const sigmaInstance = new Sigma(graph, document.getElementById("container"));To run the Storybook locally:
git clone [email protected]:jacomyal/sigma.js.git
cd sigma.js
npm install
npm run startThis will open the Storybook in your web browser, which live reloads when you modify the stories or the package sources.
You can contribute by submitting issues tickets and proposing pull requests. Make sure that tests and linting pass before submitting any pull request.
You can also browse the related documentation here.
Run npm run createPackage from the project root. It will:
packages/template folderpackage.json entries (name, description, exports)tsconfig.json, Preconstruct compatible packages list in package.json...)功能想法: 支持将节点和链接按照组合风格进行分组,以实现数据可视化
背景图像
为每个网格单元的标签数添加某种上限常数
尝试设置标签防碰撞选项
支持图形批量更新的事件优化
在图形学中使用数字作为关键值会导致 SigmaJS 出现一些意想不到的行为
节点中的图像的高度和宽度
使用 Vue.js 的 Sigma
从 LabelGrid.getLabelsToDisplay 执行标签的视锥体,而不是直接从 Sigma.renderLabels 执行