UNPKG

5.8 kBMarkdownView Raw
1# vis-network
2
3![example chart](common-docs-files/img/network.png)
4
5Network 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.
6
7## Badges
8
9[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
10[![Renovate](https://badges.renovateapi.com/github/visjs/vis-network)](https://app.renovatebot.com/)
11[![npm](https://img.shields.io/npm/v/vis-network)](https://www.npmjs.com/package/vis-network)
12
13[![dependencies Status](https://david-dm.org/visjs/vis-network/status.svg)](https://david-dm.org/visjs/vis-network)
14[![devDependencies Status](https://david-dm.org/visjs/vis-network/dev-status.svg)](https://david-dm.org/visjs/vis-network?type=dev)
15[![peerDependencies Status](https://david-dm.org/visjs/vis-network/peer-status.svg)](https://david-dm.org/visjs/vis-network?type=peer)
16
17[![GitHub contributors](https://img.shields.io/github/contributors/visjs/vis-network.svg)](https://github.com/visjs/vis-network/graphs/contributors)
18[![Backers on Open Collective](https://opencollective.com/visjs/backers/badge.svg)](#backers)
19[![Sponsors on Open Collective](https://opencollective.com/visjs/sponsors/badge.svg)](#sponsors)
20
21## Install
22
23Install via npm:
24
25 $ npm install vis-network
26
27## Example
28
29A basic example on loading a Network is shown below. More examples can be
30found in the [examples directory](https://github.com/visjs/vis-network/tree/master/examples/)
31of the project.
32
33```html
34<!DOCTYPE html>
35<html lang="en">
36 <head>
37 <title>Network</title>
38 <script
39 type="text/javascript"
40 src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
41 ></script>
42 <style type="text/css">
43 #mynetwork {
44 width: 600px;
45 height: 400px;
46 border: 1px solid lightgray;
47 }
48 </style>
49 </head>
50 <body>
51 <div id="mynetwork"></div>
52 <script type="text/javascript">
53 // create an array with nodes
54 var nodes = new vis.DataSet([
55 { id: 1, label: "Node 1" },
56 { id: 2, label: "Node 2" },
57 { id: 3, label: "Node 3" },
58 { id: 4, label: "Node 4" },
59 { id: 5, label: "Node 5" },
60 ]);
61
62 // create an array with edges
63 var edges = new vis.DataSet([
64 { from: 1, to: 3 },
65 { from: 1, to: 2 },
66 { from: 2, to: 4 },
67 { from: 2, to: 5 },
68 { from: 3, to: 3 },
69 ]);
70
71 // create a network
72 var container = document.getElementById("mynetwork");
73 var data = {
74 nodes: nodes,
75 edges: edges,
76 };
77 var options = {};
78 var network = new vis.Network(container, data, options);
79 </script>
80 </body>
81</html>
82```
83
84## Build
85
86To build the library from source, clone the project from github
87
88 $ git clone git://github.com/visjs/vis-network.git
89
90The source code uses the module style of node (require and module.exports) to
91organize dependencies. To install all dependencies and build the library,
92run `npm install` in the root of the project.
93
94 $ cd vis-network
95 $ npm install
96
97Then, the project can be build running:
98
99 $ npm run build
100
101## Test
102
103To test the library, install the project dependencies once:
104
105 $ npm install
106
107Then run the tests:
108
109 $ npm run test
110
111## Contribute
112
113Contributions to the vis.js library are very welcome! We can't do this alone!
114
115### Backers
116
117Thank you to all our backers! 🙏
118
119<a href="https://opencollective.com/visjs#backers" target="_blank"><img src="https://opencollective.com/visjs/backers.svg?width=890"></a>
120
121### Sponsors
122
123Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
124
125<a href="https://opencollective.com/visjs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/0/avatar.svg"></a>
126<a href="https://opencollective.com/visjs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/1/avatar.svg"></a>
127<a href="https://opencollective.com/visjs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/2/avatar.svg"></a>
128<a href="https://opencollective.com/visjs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/3/avatar.svg"></a>
129<a href="https://opencollective.com/visjs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/4/avatar.svg"></a>
130<a href="https://opencollective.com/visjs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/5/avatar.svg"></a>
131<a href="https://opencollective.com/visjs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/6/avatar.svg"></a>
132<a href="https://opencollective.com/visjs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/7/avatar.svg"></a>
133<a href="https://opencollective.com/visjs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/8/avatar.svg"></a>
134<a href="https://opencollective.com/visjs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/visjs/sponsor/9/avatar.svg"></a>
135
136## License
137
138Copyright (C) 2010-2018 Almende B.V. and Contributors
139Copyright (c) 2018-2021 Vis.js contributors
140
141Vis.js is dual licensed under both
142
143- The Apache 2.0 License
144 http://www.apache.org/licenses/LICENSE-2.0
145
146and
147
148- The MIT License
149 http://opensource.org/licenses/MIT
150
151Vis.js may be distributed under either license.