Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sigma/node-border

jacomyal11.6kMIT3.0.0TypeScript support: included

A node program that renders concentric discs in nodes for sigma.js

graph, graphology, sigma

readme

Build Status


Sigma.js

Website | Documentation | Storybook | Mastodon


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.

How to use in your project

To integrate sigma into your project, follow these simple steps:

  1. Installation: Add sigma and graphology to your project by running the following command:

    npm install sigma graphology
  2. Usage: 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"));

How to develop locally

To run the Storybook locally:

git clone git@github.com:jacomyal/sigma.js.git
cd sigma.js
npm install
npm run start

This will open the Storybook in your web browser, which live reloads when you modify the stories or the package sources.

Resources

  • GitHub Project: The source code and collaborative development efforts for Sigma.js are hosted on GitHub.
  • Website: The official website, sigmajs.org, kindly designed by Robin de Mourat from the Sciences-Po médialab team, showcases the library's capabilities.
  • Documentation: A detailed documentation, built with Docusaurus, is available at sigmajs.org/docs. It provides extensive guides and API references for users.
  • Storybook: Interactive examples can be found at sigmajs.org/storybook.
  • Demo: A comprehensive demo, available at sigmajs.org/demo, features a full-featured React-based web application utilizing Sigma.js.

How to contribute

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.

How to start a new package

Run npm run createPackage from the project root. It will:

  • Ask you the new package name
  • Copy the packages/template folder
  • Update the new package package.json entries (name, description, exports)
  • Update various other files (buildable packages list in tsconfig.json, Preconstruct compatible packages list in package.json...)

changelog

sigma.js - changelog:

3.0.0 - work in progress

Breaking changes

  • Completely rewrites programs API
  • Renames all existing programs
  • Restructures sources as a multi-package repository (using Lerna)
  • Replaces the default node program by NodeCircleProgram
  • Moves the node.image renderer as a new package @sigma/node-image
  • Moves labelRenderer, hoverRenderer and edgeLabelRenderer from settings to each renderer

Features

2.4.0

Features

  • #1289 - Adding Camera.updateState
  • Program classes given in settings (nodeProgramClasses, edgeProgramClasses) are now merged with default ones for convenience
  • #1287 - Adding the hoverNodeProgramClasses setting so that it is possible to have different programs rendering nodes and their hover
  • #1273 - Adding the Sigma.setGraph method to renderers
  • Adding renderer generic type to specify graph type (thanks to @lf-)

Bug fixes

  • #1285 - Fixing label selection when camera is rotated
  • #1206, #1257 - Fixing node.image program (thanks to @kaij and @boogheta)
  • #1286 - Fixing right-click erroneously triggering camera drag events
  • #1242, #1282 - Fixing multiple issues related to touch captor (thanks to @kaij and @boogheta)
  • #1272 - Fixing quadtree-related stack overflows
  • Fixing graph event leak on Sigma.kill
  • #1253 - Fixing edge.fast program not respecting hidden
  • Fixing edge.fast vert shader not unpacking color correctly
  • #1251 - Fixing alpha value parsing of hex colors (thanks to @kaij)

2.3.1

Feature

  • #1239 - Adds getContainer method to public API (thanks to @stefanprobst)

Bug fixes

  • #1230 - Updates broken link to graphology in README.md (thanks to @alexduhem)
  • #1236 - Fixes #.preventSigmaDefault scoping
  • #1237 - Updates pixelRatio on resize
  • #1240 - Fixes click events for touch devices
  • #1244 - Stops relying on graphology for types (issue only partially fixed yet)
  • #1249 - Fixes hovered nodes layer not being cleared

2.3.0

Features

  • undocumented - Publishes examples to the website
  • #1142 - Improves TypeScript typings for events
  • #1170 - Simplifies and optimizes multiplyVec internal function
  • #1196 - Adds new allowInvalidContainer to prevent sigma.js from throwing errors when it does not find valid width and/or height
  • #1205 - Adds a new example showcasing sigma's scalability and performances
  • #1215 - (ticket still opened) Improves animateNodes
  • #1224 - Adds new internal function floatArrayColor
  • #1225 - Adds new beforeRender and resize events
  • #1227 - Implements #preventSigmaDefault for mouse move events

Bug fixes

  • #1214 - Cleans graph lifecycle events handling
  • #1216 - Fixes CodeSandbox configuration for multiple examples (and the template)
  • #1219 - Fixes hidden / excess renderings from node.ts program
  • #1223 - Fixes dynamic constant color in various fragment shaders
  • #1226 - Fixes broken node.ts program

2.2.0

Features

  • #1161 - Adds minZoom and maxZoom settings
  • #1166 - Adds HTML colors support
  • #1167 - Adds events TypeScript types
  • #1176 - Cleans and improves event payloads
  • #1177 - Allows overriding arguments with #graphToViewport and #viewportToGraph
  • #1182 - Adds cached data (from custom reducers) to custom renderers
  • #1187 - Adds forceLabel for nodes and edges
  • #1188 - Drops graphology-metrics dependency

Bug fixes

  • undocumented - Updates dependencies
  • undocumented - Fixes various bugs with the node.image program
  • undocumented - Fixes the build/sigma.js and build/sigma.min.js expositions of sigma
  • #1172 - Fixes labels grid display (changes which node labels are displayed by default)
  • #1192 - Fixes alpha blending for most recent WebGL layers
  • #1193 - Fixes dragging with mouse out of stage
  • #1194 - Fixes camera transitions to angle: 0
  • #1195 - Improves edge events handling (thanks to @avenzi)
  • #1199 - Fixes issue with hidden nodes and labels rendering (thanks to @avenzi)
  • #1200 - Fixes issue with node labels ""
  • #1203 - Fixes examples build process

2.1.3

Bug fixes

  • #1178 - Fixes uncaught error in Firefox when using node.image with images with no size
  • #1180 - Fixes edge events not being fired when edge size not set in the graph
  • #1183 - Moves edge labels layer behind nodes layer
  • #1186 - Fixes hovered nodes when mouse not hover sigma container

2.1.2

Bug fixes

  • #1168 - Fixes hover and click events when mouse is hovering a hidden node
  • #1169 - Fixes x / y values in sigma events when mouse is not hovering the sigma container
  • #1173 - Fixes issue where unused program no longer deallocate back to zero
  • #1175 - Fixes zoom scrolling in a scrolled webpage

2.1.1

Bug fix

  • #1165 - Fixes "ghost hovered nodes" issue

2.1.0

Features

  • undocumented - Adds edge events
  • undocumented - Cleans and fixes all nodes and edges programs
  • #1153 - Adds double-click and wheel events for nodes and edges, with a new #preventSigmaDefault() method
  • #1149 - Graphology (and related libs) update to 0.22.1
  • #1102 - Allows custom node and edge label colors
  • #1150 - Adds public methods to enable implementing a proper PNG export, adds related png-export example

Bug fixes

  • undocumented - Edges thickness rendering is now pixel perfect at camera ratio 1, and no more twice bigger on Retina displays
  • undocumented - Cleans some browser warnings
  • #1157 - Fixes unexpected node interaction with zIndex
  • #1148 - Fixes mousemove unexpected behaviors
  • #1163 - Implements edge labels ellipsis

2.0.0

  • Complete rewrite of the library.