# vis.js documentation

Vis.js is a dynamic, browser based visualization library. The library is designed to be easy to use, handle large amounts of dynamic data, and enable manipulation of the data.

The library is developed by Almende B.V.. Vis.js runs fine on Chrome, Firefox, Opera, Safari, IE9+, and most mobile browsers (with full touch support).

## Components

Vis.js contains of the following components:

(click for a larger view)

- DataSet. A flexible key/value based data set. Add, update, and remove items. Subscribe on changes in the data set. A DataSet can filter and order items, and convert fields of items.
- DataView. A filtered and/or formatted view on a DataSet.
- Network. Display a network (force directed graph) with nodes and edges (previously called Graph).
- Graph2d. Plot data on a timeline with lines or barcharts.
- Graph3d. Display data in a three dimensional graph.
- Timeline. Display different types of data on a timeline.

## Install

### npm

    npm install vis

### bower

    bower install vis

### download

Download the library from the website: http://visjs.org.

## Load

To load vis.js, include the javascript and css files of vis in your web page:

    <!DOCTYPE HTML>
    <html>
    <head>
      <script src="components/vis/vis.js"></script>
      <link href="components/vis/vis.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <script type="text/javascript">
      // ... load a visualization
    </script>
    </body>
    </html>

or load vis.js using require.js:

    require.config({
      paths: {
        vis: 'path/to/vis',
      }
    });

    require(['vis'], function (math) {
      // ... load a visualization
    });

A timeline can be instantiated as follows. Other components can be created in a similar way.

    var timeline = new vis.Timeline(container, data, options);

Where `container` is an HTML element, `data` is an Array with data or a DataSet, and `options` is an optional object with configuration options for the component.

## Use

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

    <!DOCTYPE HTML>
    <html>
    <head>
      <title>Timeline basic demo</title>

      <script src="components/vis/vis.js"></script>
      <link href="components/vis/vis.css" rel="stylesheet" type="text/css" />

      <style type="text/css">
        body, html {
          font-family: sans-serif;
        }
      </style>
    </head>
    <body>
    <div id="visualization"></div>

    <script type="text/javascript">
      // DOM element where the Timeline will be attached
      var container = document.getElementById('visualization');

      // Create a DataSet (allows two way data-binding)
      var data = new vis.DataSet([
        {id: 1, content: 'item 1', start: '2013-04-20'},
        {id: 2, content: 'item 2', start: '2013-04-14'},
        {id: 3, content: 'item 3', start: '2013-04-18'},
        {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
        {id: 5, content: 'item 5', start: '2013-04-25'},
        {id: 6, content: 'item 6', start: '2013-04-27'}
      ]);

        // Configuration for the Timeline
      var options = {};

      // Create a Timeline
      var timeline = new vis.Timeline(container, data, options);
    </script>
    </body>
    </html>

## License

Copyright 2010-2014 Almende B.V.

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.