UNPKG

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