2.0.2 • Published 2 years ago

graph-art v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

graph-art

This project generates a visualisation of a graph everytime you refresh the page. You can add and remove nodes by interacting with the canvas.

The color of the joint between two nodes is a 50/50 blend of the 2 node colors.

The number of generated nodes when instantiated is calculated from the width and height of the canvas and capped at a limit of to prevent lagging. This limit is set to 100 by default, but can be changed via the config settings.

Setup

The instantiation of the graph canvas accepts a config file with default options when no options are given.

Config settings

  1. width: canvas width in pixels ( required)
  2. height: canvas height in pixels ( required )

Optional

  1. colors: an array of HSB colors ( example: [194, 100, 10] )
  2. nodeRadius: radius of the node in pixels. Default: 6
  3. nodeLimit: limit of nodes to render at first time in numbers. Default: 100
  4. nodeConnectionCap: limit of connections each node accepts when rendering. Default: 4.
  5. distanceCap: limit distance to other nodes to accept connections from in pixels. Default: 140.
{
    "width": 500,
    "height": 500,
    "colors":
    [
        [194, 100, 10],
        [169, 100, 45],
        [181, 93, 59],
        [159, 29, 83]
    ],
    "nodeRadius": 6,
    "nodeLimit": 100,
    "nodeConnectionCap": 4,
    "distanceCap": 150
}

Instantiate a new graph visualisation by calling new GraphCanvas(configObject).

Development

The following commands are available to build/run the project:

CommandDescription
yarn buildCreate production build within the dist folder
yarn lintLint the code via ESLint
2.0.2

2 years ago

1.0.1

2 years ago

2.0.1-alpha

2 years ago

2.0.1

2 years ago

2.0.0-alpha

2 years ago

1.1.0-alpha

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago