vis-network

Display dynamic, automatically organised, customizable network views.

README

vis-network


example chart

Network is a visualization to display networks and networks consisting of nodes and edges. The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more. The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.

Badges


semantic-release
Renovate
npm

dependencies Status
devDependencies Status
peerDependencies Status

GitHub contributors
Backers on Open Collective
Sponsors on Open Collective

Install


Install via npm:

    $ npm install vis-network

Example


A basic example on loading a Network is shown below. More examples can be
found in the examples directory
of the project.

  1. ```html
  2. <!DOCTYPE html>
  3. <html lang="en">
  4.   <head>
  5.     <title>Network</title>
  6.     <script
  7.       type="text/javascript"
  8.       src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
  9.     </script>
  10.     <style type="text/css">
  11.       #mynetwork {
  12.         width: 600px;
  13.         height: 400px;
  14.         border: 1px solid lightgray;
  15.       }
  16.     </style>
  17.   </head>
  18.   <body>
  19.     <div id="mynetwork"></div>
  20.     <script type="text/javascript">
  21.       // create an array with nodes
  22.       var nodes = new vis.DataSet([
  23.         { id: 1, label: "Node 1" },
  24.         { id: 2, label: "Node 2" },
  25.         { id: 3, label: "Node 3" },
  26.         { id: 4, label: "Node 4" },
  27.         { id: 5, label: "Node 5" },
  28.       ]);
  29.       // create an array with edges
  30.       var edges = new vis.DataSet([
  31.         { from: 1, to: 3 },
  32.         { from: 1, to: 2 },
  33.         { from: 2, to: 4 },
  34.         { from: 2, to: 5 },
  35.         { from: 3, to: 3 },
  36.       ]);
  37.       // create a network
  38.       var container = document.getElementById("mynetwork");
  39.       var data = {
  40.         nodes: nodes,
  41.         edges: edges,
  42.       };
  43.       var options = {};
  44.       var network = new vis.Network(container, data, options);
  45.     </script>
  46.   </body>
  47. </html>
  48. ```

Build


To build the library from source, clone the project from github

    $ git clone git://github.com/visjs/vis-network.git

The source code uses the module style of node (require and module.exports) to
organize dependencies. To install all dependencies and build the library,
run npm install in the root of the project.

    $ cd vis-network
    $ npm install

Then, the project can be build running:

    $ npm run build

Test


To test the library, install the project dependencies once:

    $ npm install

Then run the tests:

    $ npm run test

Contribute


Contributions to the vis.js library are very welcome! We can't do this alone!

Backers


Thank you to all our backers! 🙏


Sponsors


Support this project by becoming a sponsor. Your logo will show up here with a link to your website.


License


Copyright (C) 2010-2018 Almende B.V. and Contributors
Copyright (c) 2018-2021 Vis.js contributors

Vis.js is dual licensed under both

- The Apache 2.0 License
  http://www.apache.org/licenses/LICENSE-2.0

and

- The MIT License
  http://opensource.org/licenses/MIT

Vis.js may be distributed under either license.