@sigma/node-border
TypeScript icon, indicating that this package has built-in type declarations

3.0.0-beta.3 • Public • Published

Sigma.js - Node border renderer

This package contains a node border renderer for sigma.js.

It handles various aspects, such as:

  • Variable or fixed border thickness
  • Relative (ie percentage of the nodes radius) or "pixels" border thickness
  • Variable or fixed colors
  • Multiple borders

The shaders are generated according to these varying options, so the main export is createNodeBorderProgram, a factory that creates a renderer class.

It also exports one core class, built with the default settings, to help using it in an easier way: NodeBorderProgram is configured to render nodes with a 10% border of color borderColor (read in the nodes data), and filled with the nodes color.

How to use

Within your application that uses sigma.js, you can use @sigma/node-border as following:

import { NodeBorderProgram } from "@sigma/node-border";

const graph = new Graph();
graph.addNode("some-node", {
  x: 0,
  y: 0,
  size: 10,
  type: "border",
  label: "Some node",
  color: "blue",
  borderColor: "red",
});

const sigma = new Sigma(graph, container, {
  nodeProgramClasses: {
    border: NodeBorderProgram,
  },
});

Please check the related Storybook for more advanced examples.

Readme

Keywords

Package Sidebar

Install

npm i @sigma/node-border

Weekly Downloads

53

Version

3.0.0-beta.3

License

MIT

Unpacked Size

58.2 kB

Total Files

13

Last publish

Collaborators

  • jacomyal