diff --git a/docs/old/dataset.html b/docs/old/dataset.html deleted file mode 100644 index 48007fad..00000000 --- a/docs/old/dataset.html +++ /dev/null @@ -1,949 +0,0 @@ - - - - - vis.js | DataSet documentation - - - - - - - - -
- -

DataSet documentation

- -

Contents

- - - -

Overview

- -

- Vis.js comes with a flexible DataSet, which can be used to hold and - manipulate unstructured data and listen for changes in the data. - The DataSet is key/value based. Data items can be added, updated and - removed from the DatSet, and one can subscribe to changes in the DataSet. - The data in the DataSet can be filtered and ordered, and fields (like - dates) can be converted to a specific type. Data can be normalized when - appending it to the DataSet as well. -

- - -

Example

- -

- The following example shows how to use a DataSet. -

- -
-// create a DataSet
-var options = {};
-var data = new vis.DataSet(options);
-
-// add items
-// note that the data items can contain different properties and data formats
-data.add([
-  {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
-  {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
-  {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
-  {id: 4, text: 'item 4'}
-]);
-
-// subscribe to any change in the DataSet
-data.on('*', function (event, properties, senderId) {
-  console.log('event', event, properties);
-});
-
-// update an existing item
-data.update({id: 2, group: 1});
-
-// remove an item
-data.remove(4);
-
-// get all ids
-var ids = data.getIds();
-console.log('ids', ids);
-
-// get a specific item
-var item1 = data.get(1);
-console.log('item1', item1);
-
-// retrieve a filtered subset of the data
-var items = data.get({
-  filter: function (item) {
-    return item.group == 1;
-  }
-});
-console.log('filtered items', items);
-
-// retrieve formatted items
-var items = data.get({
-  fields: ['id', 'date'],
-  type: {
-    date: 'ISODate'
-  }
-});
-console.log('formatted items', items);
-
- - - -

Construction

- -

- A DataSet can be constructed as: -

- -
-var data = new vis.DataSet([data] [, options])
-
- -

- After construction, data can be added to the DataSet using the methods - add and update, as described in section - Data Manipulation. -

- -

- The parameter data is optional and is an Array with items. -

- -

- The parameter options is optional and is an object which can - contain the following properties: -

- - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefault valueDescription
fieldIdString"id" - The name of the field containing the id of the items. - - When data is fetched from a server which uses some specific - field to identify items, this field name can be specified - in the DataSet using the option fieldId. - For example CouchDB uses the field - "_id" to identify documents. -
typeObject.<String, String>none - An object containing field names as key, and data types as - value. By default, the type of the properties of items are left - unchanged. Item properties can be normalized by specifying a - field type. This is useful for example to automatically convert - stringified dates coming from a server into JavaScript Date - objects. The available data types are listed in section - Data Types. -
queueObject | booleannone - Queue data changes ('add', 'update', 'remove') and flush them at once. - The queue can be flushed manually by calling - DataSet.flush(), or can be flushed after a configured delay - or maximum number of entries. -
-
- When queue is true, a queue is created - with default options. Options can be specified by providing an object: -
    -
  • delay: number
    - The queue will be flushed automatically after an inactivity of this - delay in milliseconds. Default value is null. -
  • max: number
    - When the queue exceeds the given maximum number - of entries, the queue is flushed automatically. - Default value is Infinity. -
  • -
-
- - -

Methods

- -

DataSet contains the following methods.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodReturn TypeDescription
add(data [, senderId])Number[]Add one or multiple items to the DataSet. data can be a single item or an array with items. Adding an item will fail when there already is an item with the same id. The function returns an array with the ids of the added items. See section Data Manipulation.
clear([senderId])Number[]Clear all data from the DataSet. The function returns an array with the ids of the removed items.
distinct(field)ArrayFind all distinct values of a specified field. Returns an unordered array containing all distinct values. If data items do not contain the specified field are ignored.
flush()noneFlush queued changes. Only available when the DataSet is configured with the option queue, see section Construction.
forEach(callback [, options])none - Execute a callback function for every item in the dataset. - The available options are described in section Data Selection. -
- get([options] [, data])
- get(id [,options] [, data])
- get(ids [, options] [, data]) -
Object | Array - Get a single item, multiple items, or all items from the DataSet. - Usage examples can be found in section Getting Data, and the available options are described in section Data Selection. -
- getDataSet() - DataSet - Get the DataSet itself. In case of a DataView, this function does not - return the DataSet to which the DataView is connected. -
- getIds([options]) - Number[] - Get ids of all items or of a filtered set of items. - Available options are described in section Data Selection, except that options fields and type are not applicable in case of getIds. -
map(callback [, options])Array - Map every item in the DataSet. - The available options are described in section Data Selection. -
max(field)Object | null - Find the item with maximum value of specified field. Returns null if no item is found. -
min(field)Object | null - Find the item with minimum value of specified field. Returns null if no item is found. -
off(event, callback)none - Unsubscribe from an event, remove an event listener. See section Subscriptions. -
on(event, callback)none - Subscribe to an event, add an event listener. See section Subscriptions. -
- remove(id [, senderId])
- remove(ids [, senderId]) -
Number[] - Remove one or multiple items by id or by the items themselves. Returns an array with the ids of the removed items. See section Data Manipulation. -
- setOptions(options) - none - Set options for the DataSet. Available options: - -
    -
  • - queue
    - Queue data changes ('add', 'update', 'remove') and flush them at once. - The queue can be flushed manually by calling - DataSet.flush(), or can be flushed after a configured delay - or maximum number of entries. -
    -
    - When queue is true, a queue is created with default options. - When queue is false, an existing queue will be flushed and removed. - Options can be specified by providing an object: -
      -
    • delay: number
      - The queue will be flushed automatically after an inactivity of this - delay in milliseconds. Default value is null. -
    • max: number
      - When the queue exceeds the given maximum number - of entries, the queue is flushed automatically. - Default value is Infinity. -
    • -
    -
  • -
-
- update(data [, senderId]) - Number[] - Update on ore multiple existing items. data can be a single item or an array with items. When an item doesn't exist, it will be created. Returns an array with the ids of the removed items. See section Data Manipulation. -
- - -

Properties

- -

DataSet contains the following properties.

- - - - - - - - - - - - - - - - - -
PropertyTypeDescription
lengthNumberThe number of items in the DataSet.
- - -

Subscriptions

- -

- One can subscribe on changes in a DataSet. - A subscription can be created using the method on, - and removed with off. -

- -
-// create a DataSet
-var data = new vis.DataSet();
-
-// subscribe to any change in the DataSet
-data.on('*', function (event, properties, senderId) {
-  console.log('event:', event, 'properties:', properties, 'senderId:', senderId);
-});
-
-// add an item
-data.add({id: 1, text: 'item 1'});              // triggers an 'add' event
-data.update({id: 1, text: 'item 1 (updated)'}); // triggers an 'update' event
-data.remove(1);                                 // triggers an 'remove' event
-
- - -

On

- -

- Subscribe to an event. -

- -Syntax: -
DataSet.on(event, callback)
- -Where: - - -

Off

- -

- Unsubscribe from an event. -

- -Syntax: -
DataSet.off(event, callback)
- -Where event and callback correspond with the -parameters used to subscribe to the event. - -

Events

- -

- The following events are available for subscription: -

- - - - - - - - - - - - - - - - - - - - - - -
EventDescription
add - The add event is triggered when an item - or a set of items is added, or when an item is updated while - not yet existing. -
update - The update event is triggered when an existing item - or a set of existing items is updated. -
remove - The remove event is triggered when an item - or a set of items is removed. -
* - The * event is triggered when any of the events - add, update, and remove - occurs. -
- -

Callback

- -

- The callback functions of subscribers are called with the following - parameters: -

- -
-function (event, properties, senderId) {
-  // handle the event
-});
-
- -

- where the parameters are defined as -

- - - - - - - - - - - - - - - - - - - - - - -
ParameterTypeDescription
eventString - Any of the available events: add, - update, or remove. -
propertiesObject | null - Optional properties providing more information on the event. - In case of the events add, - update, and remove, - properties is always an object containing a property - items, which contains an array with the ids of the affected - items. The update event has an extra field data - containing the original data of the updated items, i.e. the gives the - changed fields of the changed items. -
senderIdString | Number - An senderId, optionally provided by the application code - which triggered the event. If senderId is not provided, the - argument will be null. -
- - -

Data Manipulation

- -

- The data in a DataSet can be manipulated using the methods - add, - update, - and remove. - The DataSet can be emptied using the method - clear. -

- -
-// create a DataSet
-var data = new vis.DataSet();
-
-// add items
-data.add([
-  {id: 1, text: 'item 1'},
-  {id: 2, text: 'item 2'},
-  {id: 3, text: 'item 3'}
-]);
-
-// update an item
-data.update({id: 2, text: 'item 2 (updated)'});
-
-// remove an item
-data.remove(3);
-
- -

Add

- -

- Add a data item or an array with items. -

- -Syntax: -
var addedIds = DataSet.add(data [, senderId])
- -The argument data can contain: - - -

- After the items are added to the DataSet, the DataSet will - trigger an event add. When a senderId - is provided, this id will be passed with the triggered - event to all subscribers. -

- -

- The method will throw an Error when an item with the same id - as any of the added items already exists. -

- -

Update

- -

- Update a data item or an array with items. -

- -Syntax: -
var updatedIds = DataSet.update(data [, senderId])
- -The argument data can contain: - - -

- The provided properties will be merged in the existing item. - When an item does not exist, it will be created. -

- -

- After the items are updated, the DataSet will - trigger an event add for the added items, and - an event update. When a senderId - is provided, this id will be passed with the triggered - event to all subscribers. -

- -

Remove

- -

- Remove a data item or an array with items. -

- -Syntax: -
var removedIds = DataSet.remove(id [, senderId])
- -

- The argument id can be: -

- - -

- The method ignores removal of non-existing items, and returns an array - containing the ids of the items which are actually removed from the - DataSet. -

- -

- After the items are removed, the DataSet will - trigger an event remove for the removed items. - When a senderId is provided, this id will be passed with - the triggered event to all subscribers. -

- - -

Clear

- -

- Clear the complete DataSet. -

- -Syntax: -
var removedIds = DataSet.clear([senderId])
- -

- After the items are removed, the DataSet will - trigger an event remove for all removed items. - When a senderId is provided, this id will be passed with - the triggered event to all subscribers. -

- - -

Data Selection

- -

- The DataSet contains functionality to format, filter, and sort data retrieved via the - methods get, getIds, forEach, and map. These methods have the following syntax: -

- -
-DataSet.get([id] [, options]);
-DataSet.getIds([options]);
-DataSet.forEach(callback [, options]);
-DataSet.map(callback [, options]);
-
- -

- Where options is an Object which can have the following - properties: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fieldsString[ ] | Object.<String, String> - An array with field names, or an object with current field name and - new field name that the field is returned as. - By default, all properties of the items are emitted. - When fields is defined, only the properties - whose name is specified in fields will be included - in the returned items. -
typeObject.<String, String> - An object containing field names as key, and data types as value. - By default, the type of the properties of an item are left - unchanged. When a field type is specified, this field in the - items will be converted to the specified type. This can be used - for example to convert ISO strings containing a date to a - JavaScript Date object, or convert strings to numbers or vice - versa. The available data types are listed in section - Data Types. -
filterFunctionItems can be filtered on specific properties by providing a filter - function. A filter function is executed for each of the items in the - DataSet, and is called with the item as parameter. The function must - return a boolean. All items for which the filter function returns - true will be emitted. - See section Data Filtering.
orderString | FunctionOrder the items by a field name or custom sort function.
returnTypeStringDetermine the type of output of the get function. Allowed values are 'Array' | 'Object'. - The default returnType is an Array. The Object type will return a JSON object with the ID's as keys.
- -

- The following example demonstrates formatting properties and filtering - properties from items. -

- -
-// create a DataSet
-var data = new vis.DataSet();
-data.add([
-  {id: 1, text: 'item 1', date: '2013-06-20', group: 1, first: true},
-  {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
-  {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
-  {id: 4, text: 'item 4'}
-]);
-
-// retrieve formatted items
-var items = data.get({
-  fields: ['id', 'date', 'group'],    // output the specified fields only
-  type: {
-    date: 'Date',                   // convert the date fields to Date objects
-    group: 'String'                 // convert the group fields to Strings
-  }
-});
-
- -

Getting Data

- -

- Data can be retrieved from the DataSet using the method get. - This method can return a single item or a list with items. -

- -

A single item can be retrieved by its id:

- -
-var item1 = dataset.get(1);
-
- -

A selection of items can be retrieved by providing an array with ids:

- -
-var items = dataset.get([1, 3, 4]); // retrieve items 1, 3, and 4
-
- -

All items can be retrieved by simply calling get without - specifying an id:

- -
-var items = dataset.get();          // retrieve all items
-
- - -

Data Filtering

- -

- Items can be filtered on specific properties by providing a filter - function. A filter function is executed for each of the items in the - DataSet, and is called with the item as parameter. The function must - return a boolean. All items for which the filter function returns - true will be emitted. -

- -
-// retrieve all items having a property group with value 2
-var group2 = dataset.get({
-  filter: function (item) {
-    return (item.group == 2);
-  }
-});
-
-// retrieve all items having a property balance with a value above zero
-var positiveBalance = dataset.get({
-  filter: function (item) {
-    return (item.balance > 0);
-  }
-});
-
-
- - -

Data Types

- -

- DataSet supports the following data types: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionExamples
BooleanA JavaScript Boolean - true
- false -
NumberA JavaScript Number - 32
- 2.4 -
StringA JavaScript String - "hello world"
- "2013-06-28" -
DateA JavaScript Date object - new Date()
- new Date(2013, 5, 28)
- new Date(1372370400000) -
MomentA Moment object, created with - moment.js - moment()
- moment('2013-06-28') -
ISODateA string containing an ISO Date - new Date().toISOString()
- "2013-06-27T22:00:00.000Z" -
ASPDateA string containing an ASP Date - "/Date(1372370400000)/"
- "/Date(1198908717056-0700)/" -
- - -

Data Policy

-

- All code and data is processed and rendered in the browser. - No data is sent to any server. -

- -
- - diff --git a/docs/old/dataview.html b/docs/old/dataview.html deleted file mode 100644 index c6046d64..00000000 --- a/docs/old/dataview.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - vis.js | DataView documentation - - - - - - - - -
- -

DataView documentation

- -

Contents

- - - -

Overview

- -

- A DataView offers a filtered and/or formatted view on a - DataSet. - One can subscribe on changes in a DataView, and easily get filtered or - formatted data without having to specify filters and field types all - the time. -

- -

Example

- -

- The following example shows how to use a DataView. -

- -
-// create a DataSet
-var data = new vis.DataSet();
-data.add([
-  {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
-  {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
-  {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
-  {id: 4, text: 'item 4'}
-]);
-
-// create a DataView
-// the view will only contain items having a property group with value 1,
-// and will only output fields id, text, and date.
-var view = new vis.DataView(data, {
-  filter: function (item) {
-    return (item.group == 1);
-  },
-  fields: ['id', 'text', 'date']
-});
-
-// subscribe to any change in the DataView
-view.on('*', function (event, properties, senderId) {
-  console.log('event', event, properties);
-});
-
-// update an item in the data set
-data.update({id: 2, group: 1});
-
-// get all ids in the view
-var ids = view.getIds();
-console.log('ids', ids); // will output [1, 2]
-
-// get all items in the view
-var items = view.get();
-
- -

Construction

- - -

- A DataView can be constructed as: -

- -
-var data = new vis.DataView(dataset, options)
-
- -

- where: -

- - - -

Methods

- -

DataView contains the following methods.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodReturn TypeDescription
- get([options] [, data])
- get(id [,options] [, data])
- get(ids [, options] [, data]) -
Object | Array - Get a single item, multiple items, or all items from the DataView. - Usage examples can be found in section Getting Data, and the available options are described in section Data Selection. -
- getDataSet() - DataSet - Get the DataSet to which the DataView is connected. -
- getIds([options]) - Number[] - Get ids of all items or of a filtered set of items. - Available options are described in section Data Selection, except that options fields and type are not applicable in case of getIds. -
off(event, callback)none - Unsubscribe from an event, remove an event listener. See section Subscriptions. -
on(event, callback)none - Subscribe to an event, add an event listener. See section Subscriptions. -
refresh()none - Refresh the filter results of a DataView. Useful when the filter function contains dynamic properties, like: - -
var data = new vis.DataSet(...);
-var view = new vis.DataView(data, {
-  filter: function (item) {
-    return item.value > threshold;
-  }
-});
- In this example, threshold is an external parameter. When the value of threshold changes, the DataView must be notified that the filter results may have changed by calling DataView.refresh(). -
- setDataSet(data) - none - Replace the DataSet of the DataView. Parameter data can be a DataSet or a DataView. -
- - -

Properties

- -

DataView contains the following properties.

- - - - - - - - - - - - - - - - - -
PropertyTypeDescription
lengthNumberThe number of items in the DataView.
- -

Getting Data

- -

- Data of the DataView can be retrieved using the method get. -

- -
-var items = view.get();
-
- -

- Data of a DataView can be filtered and formatted again, in exactly the - same way as in a DataSet. See sections - Data Manipulation and - Data Selection for more - information. -

- -
-var items = view.get({
-  fields: ['id', 'score'],
-  filter: function (item) {
-    return (item.score > 50);
-  }
-});
-
- - - -

Subscriptions

-

- One can subscribe on changes in the DataView. Subscription works exactly - the same as for DataSets. See the documentation on - subscriptions in a DataSet - for more information. -

- -
-// create a DataSet and a view on the data set
-var data = new vis.DataSet();
-var view = new vis.DataView({
-  filter: function (item) {
-    return (item.group == 2);
-  }
-});
-
-// subscribe to any change in the DataView
-view.on('*', function (event, properties, senderId) {
-  console.log('event:', event, 'properties:', properties, 'senderId:', senderId);
-});
-
-// add, update, and remove data in the DataSet...
-
- - - -

Data Policy

-

- All code and data is processed and rendered in the browser. - No data is sent to any server. -

- -
- - \ No newline at end of file diff --git a/docs/old/graph3d.html b/docs/old/graph3d.html deleted file mode 100644 index 54250778..00000000 --- a/docs/old/graph3d.html +++ /dev/null @@ -1,673 +0,0 @@ - - - - vis.js | graph3d documentation - - - - - - - - -
- -

Graph3d documentation

- -

Overview

-

- Graph3d is an interactive visualization chart to draw data in a three dimensional - graph. You can freely move and zoom in the graph by dragging and scrolling in the - window. Graph3d also supports animation of a graph. -

-

- Graph3d uses HTML canvas - to render graphs, and can render up to a few thousands of data points smoothly. -

- -

Contents

- - -

Example

-

- The following code shows how to create a Graph3d and provide it with data. - More examples can be found in the examples directory. -

- -
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Graph 3D demo</title>
-
-  <style>
-    body {font: 10pt arial;}
-  </style>
-
-  <script type="text/javascript" src="../../dist/vis.js"></script>
-
-  <script type="text/javascript">
-  var data = null;
-  var graph = null;
-
-  function custom(x, y) {
-    return (Math.sin(x/50) * Math.cos(y/50) * 50 + 50);
-  }
-
-  // Called when the Visualization API is loaded.
-  function drawVisualization() {
-    // Create and populate a data table.
-    var data = new vis.DataSet();
-    // create some nice looking data with sin/cos
-    var steps = 50;  // number of datapoints will be steps*steps
-    var axisMax = 314;
-    var axisStep = axisMax / steps;
-    for (var x = 0; x < axisMax; x+=axisStep) {
-      for (var y = 0; y < axisMax; y+=axisStep) {
-        var value = custom(x, y);
-        data.add({
-          x: x,
-          y: y,
-          z: value,
-          style: value
-        });
-      }
-    }
-
-    // specify options
-    var options = {
-      width:  '600px',
-      height: '600px',
-      style: 'surface',
-      showPerspective: true,
-      showGrid: true,
-      showShadow: false,
-      keepAspectRatio: true,
-      verticalRatio: 0.5
-    };
-
-    // create a graph3d
-    var container = document.getElementById('mygraph');
-    graph3d = new vis.Graph3d(container, data, options);
-  }
-  </script>
-</head>
-
-<body onload="drawVisualization();">
-  <div id="mygraph"></div>
-</body>
-</html>
-
-
- - -

Loading

- -

- The class name of the Graph3d is vis.Graph3d. - When constructing a Graph3d, an HTML DOM container must be provided to attach - the graph to. Optionally, data an options can be provided. - Data is a vis DataSet or an Array, described in - section Data Format. - Options is a name-value map in the JSON format. The available options - are described in section Configuration Options. -

-
var graph = new vis.Graph3d(container [, data] [, options]);
- -

- Data and options can be set or changed later on using the functions - Graph3d.setData(data) and Graph3d.setOptions(options). -

- -

Data Format

-

- Graph3d can load data from an Array, a DataSet or a DataView. - JSON objects are added to this DataSet by using the add() function. - Data points must have properties x, y, and z, - and can optionally have a property style and filter. - -

Definition

-

- The DataSet JSON objects are defined as: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeRequiredDescription
xnumberyesLocation on the x-axis.
ynumberyesLocation on the y-axis.
znumberyesLocation on the z-axis.
stylenumbernoThe data value, required for graph styles dot-color and - dot-size. -
filter*noFilter values used for the animation. - This column may have any type, such as a number, string, or Date.
- - - -

Configuration Options

- -

- Options can be used to customize the graph. Options are defined as a JSON object. - All options are optional. -

- -
-var options = {
-    width:  '100%',
-    height: '400px',
-    style: 'surface'
-};
-
- -

- The following options are available. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
animationIntervalnumber1000The animation interval in milliseconds. This determines how fast - the animation runs.
animationPreloadbooleanfalseIf false, the animation frames are loaded as soon as they are requested. - if animationPreload is true, the graph will automatically load - all frames in the background, resulting in a smoother animation as soon as - all frames are loaded. The load progress is shown on screen.
animationAutoStartbooleanfalseIf true, the animation starts playing automatically after the graph - is created.
backgroundColorstring or Object'white'The background color for the main area of the chart. - Can be either a simple HTML color string, for example: 'red' or '#00cc00', - or an object with the following properties.
backgroundColor.strokestring'gray'The color of the chart border, as an HTML color string.
backgroundColor.strokeWidthnumber1The border width, in pixels.
backgroundColor.fillstring'white'The chart fill color, as an HTML color string.
cameraPositionObject{horizontal: 1.0, vertical: 0.5, distance: 1.7}Set the initial rotation and position of the camera. - The object cameraPosition contains three parameters: - horizontal, vertical, and distance. - Parameter horizontal is a value in radians and can have any - value (but normally in the range of 0 and 2*Pi). - Parameter vertical is a value in radians between 0 and 0.5*Pi. - Parameter distance is the (normalized) distance from the - camera to the center of the graph, in the range of 0.71 to 5.0. A - larger distance puts the graph further away, making it smaller. - All parameters are optional. -
heightstring'400px'The height of the graph in pixels or as a percentage.
keepAspectRatiobooleantrueIf keepAspectRatio is true, the x-axis and the y-axis - keep their aspect ratio. If false, the axes are scaled such that they - both have the same, maximum with.
showAnimationControlsbooleantrueIf true, animation controls are created at the bottom of the Graph. - The animation controls consists of buttons previous, start/stop, next, - and a slider showing the current frame. - Only applicable when the provided data contains an animation.
showGridbooleantrueIf true, grid lines are draw in the x-y surface (the bottom of the 3d - graph).
showPerspectivebooleantrueIf true, the graph is drawn in perspective: points and lines which - are further away are drawn smaller. - Note that the graph currently does not support a gray colored bottom side - when drawn in perspective. -
showShadowbooleanfalseShow shadow on the graph.
stylestring'dot'The style of the 3d graph. Available styles: - bar, - bar-color, - bar-size, - dot, - dot-line, - dot-color, - dot-size, - line, - grid, - or surface
tooltipboolean | functionfalseShow a tooltip showing the values of the hovered data point. - The contents of the tooltip can be customized by providing a callback - function as tooltip. In this case the function is called - with an object containing parameters x, - y, and z argument, - and must return a string which may contain HTML. -
valueMaxnumbernoneThe maximum value for the value-axis. Only available in combination - with the styles dot-color and dot-size.
valueMinnumbernoneThe minimum value for the value-axis. Only available in combination - with the styles dot-color and dot-size.
verticalRationumber0.5A value between 0.1 and 1.0. This scales the vertical size of the graph - When keepAspectRatio is set to false, and verticalRatio is set to 1.0, - the graph will be a cube.
widthstring'400px'The width of the graph in pixels or as a percentage.
xBarWidthnumbernoneThe width of bars in x direction. By default, the width is equal to the distance - between the data points, such that bars adjoin each other. - Only applicable for styles 'bar' and 'bar-color'.
xCenterstring'55%'The horizontal center position of the graph, as a percentage or in - pixels.
xMaxnumbernoneThe maximum value for the x-axis.
xMinnumbernoneThe minimum value for the x-axis.
xStepnumbernoneStep size for the grid on the x-axis.
xValueLabelfunctionnoneA function for custom formatting of the labels along the x-axis, - for example function (x) {return (x * 100) + '%'}. -
yBarWidthnumbernoneThe width of bars in y direction. By default, the width is equal to the distance - between the data points, such that bars adjoin each other. - Only applicable for styles 'bar' and 'bar-color'.
yCenterstring'45%'The vertical center position of the graph, as a percentage or in - pixels.
yMaxnumbernoneThe maximum value for the y-axis.
yMinnumbernoneThe minimum value for the y-axis.
yStepnumbernoneStep size for the grid on the y-axis.
yValueLabelfunctionnoneA function for custom formatting of the labels along the y-axis, - for example function (y) {return (y * 100) + '%'}. -
zMinnumbernoneThe minimum value for the z-axis.
zMaxnumbernoneThe maximum value for the z-axis.
zStepnumbernoneStep size for the grid on the z-axis.
zValueLabelfunctionnoneA function for custom formatting of the labels along the z-axis, - for example function (z) {return (z * 100) + '%'}. -
xLabelStringxLabel on the X axis.
yLabelStringyLabel on the Y axis.
zLabelStringzLabel on the Z axis.
filterLabelStringtimeLabel for the filter column.
legendLabelStringvalueLabel for the style description.
- - -

Methods

-

- Graph3d supports the following methods. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodReturn TypeDescription
animationStart()noneStart playing the animation. - Only applicable when animation data is available.
animationStop()noneStop playing the animation. - Only applicable when animation data is available.
getCameraPosition()An object with parameters horizontal, - vertical and distanceReturns an object with parameters horizontal, - vertical and distance, - which each one of them is a number, representing the rotation and position - of the camera.
redraw()noneRedraw the graph. Useful after the camera position is changed externally, - when data is changed, or when the layout of the webpage changed.
setData(data)noneReplace the data in the Graph3d.
setOptions(options)noneUpdate options of Graph3d. - The provided options will be merged with current options.
setSize(width, height)noneParameters width and height are strings, - containing a new size for the graph. Size can be provided in pixels - or in percentages.
setCameraPosition (pos){horizontal: 1.0, vertical: 0.5, distance: 1.7}Set the rotation and position of the camera. Parameter pos - is an object which contains three parameters: horizontal, - vertical, and distance. - Parameter horizontal is a value in radians and can have any - value (but normally in the range of 0 and 2*Pi). - Parameter vertical is a value in radians between 0 and 0.5*Pi. - Parameter distance is the (normalized) distance from the - camera to the center of the graph, in the range of 0.71 to 5.0. A - larger distance puts the graph further away, making it smaller. - All parameters are optional. -
- -

Events

-

- Graph3d fires events after the camera position has been changed. - The event can be catched by creating a listener. - Here an example on how to catch a cameraPositionChange event. -

- -
-function onCameraPositionChange(event) {
-  alert('The camera position changed to:\n' +
-        'Horizontal: ' + event.horizontal + '\n' +
-        'Vertical: ' + event.vertical + '\n' +
-        'Distance: ' + event.distance);
-}
-// assuming var graph3d = new vis.Graph3d(document.getElementById('mygraph'));
-graph3d.on('cameraPositionChange', onCameraPositionChange);
-
- -

- The following events are available. -

- - - - - - - - - - - - - - - - - -
nameDescriptionProperties
cameraPositionChangeThe camera position changed. Fired after the user modified the camera position - by moving (dragging) the graph, or by zooming (scrolling), - but not after a call to setCameraPosition method. - The new camera position can be retrieved by calling the method - getCameraPosition. -
    -
  • horizontal: Number. The horizontal angle of the camera.
  • -
  • vertical: Number. The vertical angle of the camera.
  • -
  • distance: Number. The distance of the camera to the center of the graph.
  • -
-
- -

Data Policy

-

- All code and data are processed and rendered in the browser. No data is sent to any server. -

- -
- - diff --git a/docs/old/index.html b/docs/old/index.html deleted file mode 100644 index 349712f5..00000000 --- a/docs/old/index.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - vis.js | documentation - - - - - - - - -
- -

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) -
-
- - - -

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 -

- -

- and -

- - -

- Vis.js may be distributed under either license. -

- - -
- - \ No newline at end of file diff --git a/docs/old/lib/prettify/lang-apollo.js b/docs/old/lib/prettify/lang-apollo.js deleted file mode 100644 index bfc0014c..00000000 --- a/docs/old/lib/prettify/lang-apollo.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, -null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]) \ No newline at end of file diff --git a/docs/old/lib/prettify/lang-css.js b/docs/old/lib/prettify/lang-css.js deleted file mode 100644 index 61157f38..00000000 --- a/docs/old/lib/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], -["com",/^(?: - - - - - - - - - - - - - - - - - - - - - - -
-

Network - canvas

- -

Handles the HTML part of the canvas.

- -

Options

- -

The options for the canvas have to be contained in an object titled 'canvas'.

-

Click on the options shown to show how these options are supposed to be used.

- -
- -

All of the individual options are explained here:

- - - - - - - - - - - - - - - - - - - - - - - - - -
nametypedefaultdescription
widthString'100%'the width of the canvas. Can be in percentages or pixels (ie. '400px').
heightString'100%'the height of the canvas. Can be in percentages or pixels (ie. '400px').
autoResizeBooleantrueIf true, the Network will automatically detect when its container is resized, and redraw itself - accordingly. If false, the Network can be forced to repaint after its container has been resized - using the function redraw() and setSize().
- -

Methods

- -

This is a list of all the methods in the public API. Options can be set directly to the module or you can use the - setOptions method of the network itself and use the module name as an object name.

- - - - - - - - - - - - - - - - - - - - - -
namereturnsdescription
setSize(
   String width,
   String - height
) -
noneSet the size of the canvas. This is automatically done on a window resize.
canvasToDOM({
   x: Number,
   y: - Number
}) -
ObjectThis function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of - {x:Number,y:Number}. The DOM values are relative to the network container. -
DOMtoCanvas({
   x: Number,
   y: - Number
}) -
ObjectThis function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of - {x:Number,y:Number}. The DOM values are relative to the network container. -
- -

Events

- -

This is a list of all the events in the public API. They are collected here from all individual modules.

- - - - - - - - - - - - -
namepropertiesdescription
resize -
-{
-  width: Number     // the new width  of the canvas
-  height: Number    // the new height of the canvas
-  oldWidth: Number  // the old width  of the canvas
-  oldHeight: Number // the old height of the canvas
-}
-
-
    -
-
Fired when the size of the canvas has been resized, either by a redraw call when the container div has - changed in size, a setSize() call with new values or a setOptions() with new width and/or height values. -
- -
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/docs/old/old_network/clustering.html b/docs/old/old_network/clustering.html deleted file mode 100644 index cb355f7f..00000000 --- a/docs/old/old_network/clustering.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - vis.js - A dynamic, browser based visualization library. - - - - - - - - - - - - - - - - - - - - - - - -
-

Network - clustering

-

Handles the HTML part of the canvas.

- -

Options

-

Clustering has no options, everything is done with methods.

- - -

Methods

-

This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.

- - - - - - - - - - -
namereturnsdescription
findNode(
-   String nodeId
)
Array Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of nodeIds showing where the node is. Example:
- cluster 'A' contains cluster 'B',
- cluster 'B' contains cluster 'C',
- cluster 'C' contains node 'fred'.
- network.clustering.findNode('fred') will return ['A','B','C','fred']. -
isCluster(
-   String nodeId
)
Boolean Returns true if the node whose ID has been supplied is a cluster.
openCluster(
   - String nodeId
)
none Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster edges.
cluster(
   - Object options
)
none The options object is explained in full below. The joinCondition function is presented with all nodes.
clusterByConnection(
-   String nodeId,
-   [Object options]
- )
none This method looks at the provided node and makes a cluster of it and all it's connected nodes. The behaviour can be customized by proving the options object. All options of this object are explained below. The joinCondition is only presented with the connected nodes.
clusterByHubsize(
-   Number hubsize,
-   [Object options]
)
none This method checks all nodes in the network and those with a equal or higher amount of edges than specified with the hubsize qualify. Cluster by connection is performed on each of them. The options object is described for clusterByConnection and does the same here.
clusterOutliers(
-   [Object options]
)
none This method will cluster all nodes with 1 edge with their respective connected node.
-
-

Cluster options object

-

The options object supplied to the cluster functions can contain these properties:

- - - - - - - -
nameTypedescription
joinCondition(
  Object nodeOptions
)
FunctionOptional for all but the cluster method. The cluster module loops over all nodes that are selected to be in the cluster and calls this function with their data as argument. - If this function returns true, this node will be added to the cluster. You have access to all options (including the default) - as well as any custom fields you may have added to the node to determine whether or not to include it in the cluster. Example: -
-var nodes = [
-  {id: 4, label: 'Node 4'},
-  {id: 5, label: 'Node 5'},
-  {id: 6, label: 'Node 6', cid:1},
-  {id: 7, label: 'Node 7', cid:1}
-]
-
-var options = {
-  joinCondition:function(nodeOptions) {
-    return nodeOptions.cid === 1;
-  }
-}
-
-network.clustering.cluster(options);
-
processProperties(
  Object nodeOptions
)
Function Optional. Before creating the new cluster node, this (optional) function will be called with the properties supplied by you (clusterNodeProperties), all contained nodes and all contained edges. You can use this to update the - properties of the cluster based on which items it contains. The function should return the properties to create the cluster node. In the example below, we ensure preservation of mass and value when forming the cluster: -
-var options = {
-  processProperties: function (clusterOptions, childNodes, childEdges) {
-    var totalMass = 0;
-    var totalValue = 0;
-    for (var i = 0; i < childNodes.length; i++) {
-        totalMass += childNodes[i].mass;
-        totalValue = childNodes[i].value ? totalValue + childNodes[i].value : totalValue;
-    }
-    clusterOptions.mass = totalMass;
-    if (totalValue > 0) {
-      clusterOptions.value = totalValue;
-    }
-    return clusterOptions;
-  },
-}
-
clusterNodeProperties Object Optional. This is an object containing the options for the cluster node. All options described in the nodes module are allowed. This allows you to style your cluster node any way you want. This is also the style object that is provided in the processProperties function for fine tuning. If undefined, default node options will be used.
clusterEdgeProperties Object Optional. This is an object containing the options for the edges connected to the cluster. All options described in the edges module are allowed. Using this, you can style the edges connecting to the cluster any way you want. If none are provided, the optoins from the edges that are replaced are used. If undefined, default edge options will be used.
-

- -

- -

-

Events

-

The clustering module does not have any events.

- -
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/docs/old/old_network/rendering.html b/docs/old/old_network/rendering.html deleted file mode 100644 index 15b285ca..00000000 --- a/docs/old/old_network/rendering.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - vis.js - A dynamic, browser based visualization library. - - - - - - - - - - - - - - - - - - - - - - - - -
-

Network - rendering

-

Handles the rendering aspect of vis. It governs the render loop, it draws the nodes and edges and provides events to allow users to hook into the drawing.

- -

Options

-

The options for the rendering have to be contained in an object titled 'rendering'.

-

Click on the options shown to show how these options are supposed to be used.

- -
- -

All of the individual options are explained here:

- - - - -
nametypedefaultdescription
hideEdgesOnDragBooleanfalseWhen true, the edges are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.
hideNodesOnDragBooleanfalseWhen true, the nodes are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.
- -

Methods

-

This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.

- - - -
namereturnsdescription
redraw()noneRedraw the network.
- -

Events

-

These events are fired by the renderer and can be used to move and draw custom elements on the same canvas as the rest of the network.

- - - - - -
namepropertiesdescription
initRedrawnoneFired before the redrawing begins. The simulation step has completed at this point. Can be used to move custom elements before starting drawing the new frame.
beforeDrawingcanvas contextFired after the canvas has been cleared, scaled and translated to the viewing position but before all edges and nodes are drawn. Can be used to draw behind the network.
initRedrawcanvas contextFired after drawing on the canvas has been completed. Can be used to draw on top of the network.
- -
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/docs/old/old_network/selection.html b/docs/old/old_network/selection.html deleted file mode 100644 index d1c45de6..00000000 --- a/docs/old/old_network/selection.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - vis.js - A dynamic, browser based visualization library. - - - - - - - - - - - - - - - - - - - - - - - - -
-

Network - selection

-

Handles the selection of nodes and edges.

- -

Options

-

The options for the selection have to be contained in an object titled 'selection'.

-

Click on the options shown to show how these options are supposed to be used.

- -
- -

All of the individual options are explained here:

- - - - -
nametypedefaultdescription
selectable BooleantrueWhen true, the nodes and edges can be selected by the user.
selectConnectedEdges BooleantrueWhen true, on selecting a node, its connecting edges are highlighted.
- -

Methods

-

This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.

- - - - - - - - - - - -
namereturnsdescription
getSelection() -
-{
-  nodes: [Array of selected nodeIds],
-  edges: [Array of selected edgeIds]
-}
Returns an object with selected nodes and edges ids.
getSelectedNodes() [nodeId1, nodeId2, ..]Returns an array of selected node ids.
getSelectedEdges() [edgeId1, edgeId2, ..]Returns an array of selected edge ids.
getNodeAt(
   {x: xPosition DOM,
   y: yPosition DOM}

)
nodeIdReturns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas.
getEdgeAt(
   {x: xPosition DOM,
   y: yPosition DOM}

)
edgeIdReturns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas..
selectNodes(
   Array with nodeIds,
   [Boolean highlightEdges]
)
noneSelects the nodes corresponding to the id's in the input array. If highlightEdges is true or undefined, the neighbouring edges will also be selected. This method unselects all other objects before selecting its own objects. Does not fire events.
selectEdges(
   Array with edgeIds
)
noneSelects the edges corresponding to the id's in the input array. This method unselects all other objects before selecting its own objects. Does not fire events.
unselectAll() none Unselect all objects. Does not fire events.
- -

Events

-

The selection handler does not fire events. All related events are fired by the interaction module because they are triggered by user interaction.

- -
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/docs/old/old_network/view.html b/docs/old/old_network/view.html deleted file mode 100644 index d038923f..00000000 --- a/docs/old/old_network/view.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - vis.js - A dynamic, browser based visualization library. - - - - - - - - - - - - - - - - - - - - - - - - -
-

Network - view

-

Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.

- -

Options

-

The view has no options.

- -

Methods

-

This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.

- - - - - - - - - - - - - - -
namereturnsdescription
getScale() NumberReturns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.
getPosition() NumberReturns the current central focus point of the camera.
fit([Object options])noneZooms out so all nodes fit on the canvas. You can supply options to customize this: -
-{
-  nodes:[Array of nodeIds],
-  animation: { // -------------------> can be a boolean too!
-    duration: Number
-    easingFunction: String
-  }
-}
-
- The nodes can be used to zoom to fit only specific nodes in the view.

- The other options are explained in the moveTo() description below. - All options are optional for the fit method. -
focus(
-    String nodeId,
-    [Object options]
)
noneYou can focus on a node with this function. What that means is the view will lock onto that node, if it is moving, the view will also move accordingly. If the view is dragged by the user, the focus is broken. - You can supply options to customize the effect: -
-{
-  scale: Number,
-  offset: {x:Number, y:Number}
-  locked: boolean
-  animation: { // -------------------> can be a boolean too!
-    duration: Number
-    easingFunction: String
-  }
-}
-
- All options except for locked are explained in the moveTo() description below. Locked denotes whether or not the view remains locked to the node once the zoom-in animation is finished. Default value is true. The options object is optional in the focus method.
moveTo(Object options) noneYou can animate or move the camera using the moveTo method. Options are: -
-{
-  position: {x:Number, y:Number},
-  scale: Number,
-  offset: {x:Number, y:Number}
-  animation: { // -------------------> can be a boolean too!
-    duration: Number
-    easingFunction: String
-  }
-}
-
- The position (in canvas units!) is the position of the central focus point of the camera.

- The scale is the target zoomlevel. Default value is 1.0.

- The offset (in DOM units) is how many pixels from the center the view is focussed. Default value is {x:0,y:0}.

- For animation you can either use a Boolean to use it with the default options or disable it or you can define the duration (in milliseconds) and easing function manually. Available are: - linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint.

- You will have to define at least a scale or a position. Otherwise, there is nothing to move to. -
releaseNode()noneProgramatically release the focussed node.
- -

Events

-

These events are fired by the renderer and can be used to move and draw custom elements on the same canvas as the rest of the network.

- - - -
namepropertiesdescription
animationFinishednoneFired when an animation is finished.
- -
-
-
-
-
-
-
-
- - - - - - - - diff --git a/docs/old/old_timeline.html b/docs/old/old_timeline.html deleted file mode 100644 index a7013b53..00000000 --- a/docs/old/old_timeline.html +++ /dev/null @@ -1,1510 +0,0 @@ - - - - vis.js | timeline documentation - - - - - - - - -
- -

Timeline documentation

- -

Overview

-

- The Timeline is an interactive visualization chart to visualize data in time. - The data items can take place on a single date, or have a start and end date (a range). - You can freely move and zoom in the timeline by dragging and scrolling in the - Timeline. Items can be created, edited, and deleted in the timeline. - The time scale on the axis is adjusted automatically, and supports scales ranging - from milliseconds to years. -

-

- Timeline uses regular HTML DOM to render the timeline and items put on the - timeline. This allows for flexible customization using css styling. -

- -

Contents

- - -

Example

-

- The following code shows how to create a Timeline and provide it with data. - More examples can be found in the examples directory. -

- -
<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Timeline | Basic demo</title>
-
-  <style type="text/css">
-    body, html {
-      font-family: sans-serif;
-    }
-  </style>
-
-  <script src="../../dist/vis.js"></script>
-  <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
-</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 items = 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, items, options);
-</script>
-</body>
-</html>
-
- - -

Loading

-

- Install or download the vis.js library. - in a subfolder of your project. Include the libraries script and css files in the - head of your html code: -

- -
-<script src="vis/dist/vis.js"></script>
-<link href="vis/dist/vis.css" rel="stylesheet" type="text/css" />
-
- -The constructor of the Timeline is vis.Timeline -
var timeline = new vis.Timeline(container, items, options);
-or when using groups: -
var timeline = new vis.Timeline(container, items, groups, options);
- -The constructor accepts four parameters: - - -

Data Format

- -

- The timeline can be provided with two types of data: -

- - -

Items

-

- The Timeline uses regular Arrays and Objects as data format. - Data items can contain the properties start, - end (optional), content, - group (optional), className (optional), - and style (optional). -

- -

- A table is constructed as: -

- -
-var items = [
-  {
-    start: new Date(2010, 7, 15),
-    end: new Date(2010, 8, 2),  // end is optional
-    content: 'Trajectory A'
-    // Optional: fields 'id', 'type', 'group', 'className', 'style'
-  }
-  // more items...
-]);
-
- -

- The item properties are defined as: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeRequiredDescription
classNameStringnoThis field is optional. A className can be used to give items - an individual css style. For example, when an item has className - 'red', one can define a css style like: -
-.vis.timeline .red {
-  color: white;
-  background-color: red;
-  border-color: darkred;
-}
- More details on how to style items can be found in the section - Styles. -
contentStringyesThe contents of the item. This can be plain text or html code.
endDate | number | string | MomentnoThe end date of the item. The end date is optional, and can be left null. - If end date is provided, the item is displayed as a range. - If not, the item is displayed as a box.
groupany typenoThis field is optional. When the group column is provided, - all items with the same group are placed on one line. - A vertical axis is displayed showing the groups. - Grouping items can be useful for example when showing availability of multiple - people, rooms, or other resources next to each other.
-
idString | NumbernoAn id for the item. Using an id is not required but highly - recommended. An id is needed when dynamically adding, updating, - and removing items in a DataSet.
startDate | number | string | MomentyesThe start date of the item, for example new Date(2010,9,23).
styleStringno - A css text string to apply custom styling for an individual item, for - example "color: red; background-color: pink;". -
subgroupString | NumbernoneThe id of a subgroup. - Groups all items within a group per subgroup, and positions them on the - same height instead of staking them on top of each other. can be ordered - by specifying the option subgroupOrder of a group. -
titleStringnoneAdd a title for the item, displayed when holding the mouse on the item. - The title can only contain plain text. -
typeString'box'The type of the item. Can be 'box' (default), 'point', 'range', or 'background'. - Types 'box' and 'point' need a start date, the types 'range' and 'background' needs both a start and end date. -
- -

Groups

-

- Like the items, groups are regular JavaScript Arrays and Objects. - Using groups, items can be grouped together. - Items are filtered per group, and displayed as - - Group items can contain the properties id, - content, and className (optional). -

-

- Groups can be applied to a timeline using the method setGroups or supplied in the constructor. - A table with groups can be created like: -

- -
-var groups = [
-  {
-    id: 1,
-    content: 'Group 1'
-    // Optional: a field 'className', 'style'
-  }
-  // more groups...
-]);
-
- - -

- Groups can have the following properties: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeRequiredDescription
classNameStringnoThis field is optional. A className can be used to give groups - an individual css style. For example, when a group has className - 'red', one can define a css style - - .red { - color: red; - } - . - More details on how to style groups can be found in the section - Styles. -
contentStringyesThe contents of the group. This can be plain text or html code.
idString | NumberyesAn id for the group. The group will display all items having a - property group which matches the id - of the group.
styleStringno - A css text string to apply custom styling for an individual group label, for - example "color: red; background-color: pink;". -
subgroupOrderString | FunctionnoneOrder the subgroups by a field name or custom sort function. - By default, groups are ordered by first-come, first-show. -
titleStringnoneA title for the group, displayed when holding the mouse on the groups label. - The title can only contain plain text. -
- - - -

Configuration Options

- -

- Options can be used to customize the timeline. - Options are defined as a JSON object. All options are optional. -

- -
-var options = {
-  width: '100%',
-  height: '30px',
-  margin: {
-    item: 20
-  }
-};
-
- -

- The following options are available. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
alignString"center"Alignment of items with type 'box', 'range', and 'background'. Available values are 'auto' (default), 'center', 'left', or 'right'. For 'box' items, the 'auto' alignment is 'center'. For 'range' items, the auto alignment is dynamic: positioned left and shifted such that the contents is always visible on screen.
autoResizebooleantrueIf true, the Timeline will automatically detect when its container is resized, and redraw itself accordingly. If false, the Timeline can be forced to repaint after its container has been resized using the function redraw().
clickToUsebooleanfalseWhen a Timeline is configured to be clickToUse, it will react to mouse and touch events only when active. - When active, a blue shadow border is displayed around the Timeline. The Timeline is set active by clicking on it, and is changed to inactive again by clicking outside the Timeline or by pressing the ESC key.
dataAttributesArray[String] | 'all'falseAn array of fields optionally defined on the timeline items that will be appended as data- attributes to the DOM element of the items.
- If value is 'all' then each field defined on the timeline item will become a data- attribute.
editableBoolean | ObjectfalseIf true, the items in the timeline can be manipulated. Only applicable when option selectable is true. See also the callbacks onAdd, onUpdate, onMove, and onRemove. When editable is an object, one can enable or disable individual manipulation actions. - See section Editing Items for a detailed explanation. -
editable.addBooleanfalseIf true, new items can be created by double tapping an empty space in the Timeline. See section Editing Items for a detailed explanation.
editable.removeBooleanfalseIf true, items can be deleted by first selecting them, and then clicking the delete button on the top right of the item. See section Editing Items for a detailed explanation.
editable.updateGroupBooleanfalseIf true, items can be dragged from one group to another. Only applicable when the Timeline has groups. See section Editing Items for a detailed explanation.
editable.updateTimeBooleanfalseIf true, items can be dragged to another moment in time. See section Editing Items for a detailed explanation.
endDate | Number | String | MomentnoneThe initial end date for the axis of the timeline. - If not provided, the latest date present in the items set is taken as - end date.
formatObjectnone - Apply custom date formatting of the labels on the time axis. The default value of format is: -
{
-  minorLabels: {
-    millisecond:'SSS',
-    second:     's',
-    minute:     'HH:mm',
-    hour:       'HH:mm',
-    weekday:    'ddd D',
-    day:        'D',
-    month:      'MMM',
-    year:       'YYYY'
-  },
-  majorLabels: {
-    millisecond:'HH:mm:ss',
-    second:     'D MMMM HH:mm',
-    minute:     'ddd D MMMM',
-    hour:       'ddd D MMMM',
-    weekday:    'MMMM YYYY',
-    day:        'MMMM YYYY',
-    month:      'YYYY',
-    year:       ''
-  }
-}
- For values which not provided in the customized options.format, the default values will be used. - All available formatting syntax is described in the docs of moment.js. -
groupOrderString | FunctionnoneOrder the groups by a field name or custom sort function. - By default, groups are not ordered. -
heightNumber | StringnoneThe height of the timeline in pixels or as a percentage. - When height is undefined or null, the height of the timeline is automatically - adjusted to fit the contents. - It is possible to set a maximum height using option maxHeight - to prevent the timeline from getting too high in case of automatically - calculated height. -
hiddenDatesObjectnoneThis option allows you to hide specific timespans from the time axis. The dates can be supplied as an object: - {start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00', [repeat:'daily']} or as an Array of these objects. The repeat argument is optional. - The possible values are (case-sensitive): daily, weekly, monthly, yearly. To hide a weekend, pick any Saturday as start and the following Monday as end - and set repeat to weekly. -
localeStringnoneSelect a locale for the Timeline. See section Localization for more information.
localesObjectnoneA map with i18n locales. See section Localization for more information.
marginNumber | ObjectObjectWhen a number, applies the margin to margin.axis, margin.item.horizontal, and margin.item.vertical.
margin.axisNumber20The minimal margin in pixels between items and the time axis.
margin.itemNumber10The minimal margin in pixels between items in both horizontal and vertical direction.
margin.item.horizontalNumber10The minimal horizontal margin in pixels between items.
margin.item.verticalNumber10The minimal vertical margin in pixels between items.
maxDate | Number | String | MomentnoneSet a maximum Date for the visible range. - It will not be possible to move beyond this maximum. -
maxHeightNumber | StringnoneSpecifies the maximum height for the Timeline. Can be a number in pixels or a string like "300px".
minDate | Number | String | MomentnoneSet a minimum Date for the visible range. - It will not be possible to move beyond this minimum. -
minHeightNumber | StringnoneSpecifies the minimum height for the Timeline. Can be a number in pixels or a string like "300px".
moveableBooleantrue - Specifies whether the Timeline can be moved and zoomed by dragging the window. - See also option zoomable. -
onAddFunctionnoneCallback function triggered when an item is about to be added: when the user double taps an empty space in the Timeline. See section Editing Items for more information. Only applicable when both options selectable and editable.add are set true. -
onUpdateFunctionnoneCallback function triggered when an item is about to be updated, when the user double taps an item in the Timeline. See section Editing Items for more information. Only applicable when both options selectable and editable.updateTime or editable.updateGroup are set true. -
onMoveFunctionnoneCallback function triggered when an item has been moved: after the user has dragged the item to an other position. See section Editing Items for more information. Only applicable when both options selectable and editable.updateTime or editable.updateGroup are set true. -
onMovingFunctionnoneCallback function triggered repeatedly when an item is being moved. See section Editing Items for more information. Only applicable when both options selectable and editable.updateTime or editable.updateGroup are set true. -
onRemoveFunctionnoneCallback function triggered when an item is about to be removed: when the user tapped the delete button on the top right of a selected item. See section Editing Items for more information. Only applicable when both options selectable and editable.remove are set true. -
orderFunctionnone -

Provide a custom sort function to order the items. The order of the - items is determining the way they are stacked. The function - order is called with two arguments containing the data of two items to be - compared. -

-

WARNING: Use with caution. Custom ordering is not suitable for large amounts of items. On load, the Timeline will render all items once to determine their width and height. Keep the number of items in this configuration limited to a maximum of a few hundred items.

-
orientationString | Object'bottom'Orientation of the timelines axis and items. When orientation is a string, the value is applied to both items and axis. Can be 'top', 'bottom' (default), or 'both'.
orientation.axisString'bottom'Orientation of the timeline axis: 'top', 'bottom' (default), or 'both'. If orientation is 'bottom', the time axis is drawn at the bottom. When 'top', the axis is drawn on top. When 'both', two axes are drawn, both on top and at the bottom.
orientation.itemString'bottom'Orientation of the timeline items: 'top' or 'bottom' (default). Determines whether items are aligned to the top or bottom of the Timeline.
selectableBooleantrueIf true, the items on the timeline can be selected. Multiple items can be selected by long pressing them, or by using ctrl+click or shift+click. The event select is fired each time the selection has changed (see section Events).
showCurrentTimebooleantrueShow a vertical bar at the current time.
showMajorLabelsbooleantrueBy default, the timeline shows both minor and major date labels on the - time axis. - For example the minor labels show minutes and the major labels show hours. - When showMajorLabels is false, no major labels - are shown.
showMinorLabelsbooleantrueBy default, the timeline shows both minor and major date labels on the - time axis. - For example the minor labels show minutes and the major labels show hours. - When showMinorLabels is false, no minor labels - are shown. When both showMajorLabels and - showMinorLabels are false, no horizontal axis will be - visible.
stackBooleantrueIf true (default), items will be stacked on top of each other such that they do not overlap.
snapfunction | nullfunctionWhen moving items on the Timeline, they will be snapped to nice dates like full hours or days, depending on the current scale. The snap function can be replaced with a custom function, or can be set to null to disable snapping. The signature of the snap function is: -
function snap(date: Date, scale: string, step: number) : Date | number
- The parameter scale can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'day, 'month, or 'year'. The parameter step is a number like 1, 2, 4, 5. -
startDate | Number | String | MomentnoneThe initial start date for the axis of the timeline. - If not provided, the earliest date present in the events is taken as start date.
templateFunctionnoneA template function used to generate the contents of the items. The function is called by the Timeline with an items data as argument, and must return HTML code as result. When the option template is specified, the items do not need to have a field content. See section Templates for a detailed explanation.
timeAxis.scalestringnoneSet a fixed scale for the time axis of the Timeline. Choose from 'millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'. Example usage: -
var options = {
-  timeAxis: {scale: 'minute', step: 5}
-}
-
timeAxis.stepnumber1 - Set a fixed step size for the time axis. Only applicable when used together with timeAxis.scale. - Choose for example 1, 2, 5, or 10.
typeStringnoneSpecifies the default type for the timeline items. Choose from 'box', 'point', 'range', and 'background'. Note that individual items can override this default type. If undefined, the Timeline will auto detect the type from the items data: if a start and end date is available, a 'range' will be created, and else, a 'box' is created. Items of type 'background' are not editable. -
widthString'100%'The width of the timeline in pixels or as a percentage.
zoomableBooleantrue - Specifies whether the Timeline can be zoomed by pinching or scrolling in the window. - Only applicable when option moveable is set true. -
zoomMaxNumber315360000000000Set a maximum zoom interval for the visible range in milliseconds. - It will not be possible to zoom out further than this maximum. - Default value equals about 10000 years. -
zoomMinNumber10Set a minimum zoom interval for the visible range in milliseconds. - It will not be possible to zoom in further than this minimum. -
- -

Methods

-

- The Timeline supports the following methods. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodReturn TypeDescription
addCustomTime([time] [, id])Number | String - Add new vertical bar representing a custom time that can be dragged by the user. - Parameter time can be a Date, Number, or String, and is new Date() by default. - Parameter id can be Number or String and is undefined by default.
- Returns id of the created bar. -
destroy()noneDestroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up. -
fit([options])noneAdjust the visible window such that it fits all items. See also function focus(id). - Available options: -
    -
  • animation: boolean | {duration: number, easingFunction: string}
    If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is 'easeInOutQuad'. Available easing functions: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint". -
  • -
-
focus(id | ids [, options])noneAdjust the visible window such that the selected item (or multiple items) are centered on screen. See also function fit(). Available options: -
    -
  • animation: boolean | {duration: number, easingFunction: string}
    If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is 'easeInOutQuad'. Available easing functions: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint".
  • -
-
getCurrentTime()DateGet the current time. Only applicable when option showCurrentTime is true. -
getCustomTime([id])DateRetrieve the custom time from the custom time bar with given id. Id is undefined by default. -
getEventProperties(event)Object - Returns an Object with relevant properties from an event: -
    -
  • group (Number | null): the id of the clicked group.
  • -
  • item (Number | null): the id of the clicked item.
  • -
  • pageX (Number): absolute horizontal position of the click event.
  • -
  • pageY (Number): absolute vertical position of the click event.
  • -
  • x (Number): relative horizontal position of the click event.
  • -
  • y (Number): relative vertical position of the click event.
  • -
  • time (Date): Date of the clicked event.
  • -
  • snappedTime (Date): Date of the clicked event, snapped to a nice value.
  • -
  • what (String | null): name of the clicked thing: item, background, axis, group-label, custom-time, or current-time.
  • -
  • event (Object): the original click event.
  • -
-
getSelection()Number[]Get an array with the ids of the currently selected items.
getVisibleItems()Number[]Get an array with the ids of the currently visible items.
getWindow()ObjectGet the current visible window. Returns an object with properties start: Date and end: Date.
moveTo(time [, options])noneMove the window such that given time is centered on screen. Parameter time can be a Date, Number, or String. Available options: -
    -
  • animation: boolean | {duration: number, easingFunction: string}
    If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is 'easeInOutQuad'. Available easing functions: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint".
  • -
-
on(event, callback)noneCreate an event listener. The callback function is invoked every time the event is triggered. Avialable events: rangechange, rangechanged, select. The callback function is invoked as callback(properties), where properties is an object containing event specific properties. See section Events for more information.
off(event, callback)noneRemove an event listener created before via function on(event, callback). See section Events for more information.
redraw()noneForce a redraw of the Timeline. The size of all items will be recalculated. - Can be useful to manually redraw when option autoResize=false and the window - has been resized, or when the items CSS has been changed. -
removeCustomTime(id)none - Remove vertical bars previously added to the timeline via addCustomTime method. Parameter id is the ID of the custom vertical bar returned by addCustomTime method. -
setCurrentTime(time)noneSet a current time. This can be used for example to ensure that a client's time is synchronized with a shared server time. - time can be a Date object, numeric timestamp, or ISO date string. - Only applicable when option showCurrentTime is true.
setCustomTime(time [, id])noneAdjust the time of a custom time bar. - Parameter time can be a Date object, numeric timestamp, or ISO date string. - Parameter id is the idof the custom time bar, and is undefined by default. -
setData({
  groups: groups,
  items: items
})
noneSet both groups and items at once. Both properties are optional. This is a convenience method for individually calling both setItems(items) and setGroups(groups). - Both items and groups can be an Array with Objects, - a DataSet, or a DataView. For each of the groups, the items of the - timeline are filtered on the property group, which - must correspond with the id of the group. -
setGroups(groups)noneSet a data set with groups for the Timeline. - groups can be an Array with Objects, - a DataSet, or a DataView. For each of the groups, the items of the - timeline are filtered on the property group, which - must correspond with the id of the group. -
setItems(items)noneSet a data set with items for the Timeline. - items can be an Array with Objects, - a DataSet, or a DataView. -
setOptions(options)noneSet or update options. It is possible to change any option of the timeline at any time. You can for example switch orientation on the fly. -
setSelection(id | ids [, options])noneSelect one or multiple items by their id. The currently selected items will be unselected. To unselect all selected items, call `setSelection([])`. Available options: -
    -
  • focus: boolean
    If true, focus will be set to the selected item(s)
  • -
  • animation: boolean | {duration: number, easingFunction: string}
    If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is 'easeInOutQuad'. Only applicable when option focus is true. Available easing functions: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint".
  • -
-
setWindow(start, end [, options])noneSet the current visible window. The parameters start and end can be a Date, Number, or String. If the parameter value of start or end is null, the parameter will be left unchanged. Available options: -
    -
  • animation: boolean | {duration: number, easingFunction: string}
    If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is 'easeInOutQuad'. Available easing functions: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint".
  • -
-
- - - -

Events

-

- Timeline fires events when changing the visible window by dragging, when - selecting items, and when dragging the custom time bar. -

- -

- Here an example on how to listen for a select event. -

- -
-timeline.on('select', function (properties) {
-  alert('selected items: ' + properties.nodes);
-});
-
- -

- A listener can be removed via the function off: -

- -
-function onSelect (properties) {
-  alert('selected items: ' + properties.nodes);
-}
-
-// add event listener
-timeline.on('select', onSelect);
-
-// do stuff...
-
-// remove event listener
-timeline.off('select', onSelect);
-
- - -

- The following events are available. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nameDescriptionProperties
clickFired when clicked inside the Timeline. - - Passes a properties object as returned by the method Timeline.getEventProperties(event). -
contextmenuFired when right-clicked inside the Timeline. Note that in order to prevent the context menu from showing up, default behavior of the event must be stopped: -
timeline.on('contextmenu', function (props) {
-  alert('Right click!');
-  props.event.preventDefault();
-});
-
-
- Passes a properties object as returned by the method Timeline.getEventProperties(event). -
doubleClickFired when double clicked inside the Timeline. - - Passes a properties object as returned by the method Timeline.getEventProperties(event). -
rangechangeFired repeatedly when the timeline window is being changed. - -
    -
  • start (Number): timestamp of the current start of the window.
  • -
  • end (Number): timestamp of the current end of the window.
  • -
  • byUser (Boolean): change happened because of user drag/zoom.
  • -
-
rangechangedFired once after the timeline window has been changed. - -
    -
  • start (Number): timestamp of the current start of the window.
  • -
  • end (Number): timestamp of the current end of the window.
  • -
  • byUser (Boolean): change happened because of user drag/zoom.
  • -
-
selectFired after the user selects or deselects items by tapping or holding them. - When a use taps an already selected item, the select event is fired again. - Not fired when the method setSelectionis executed. - -
    -
  • items: an array with the ids of the selected items
  • -
-
timechangeFired repeatedly when the user is dragging the custom time bar. - Only available when the custom time bar is enabled. - -
    -
  • id (Number | String): custom time bar id.
  • -
  • time (Date): the custom time.
  • -
-
timechangedFired once after the user has dragged the custom time bar. - Only available when the custom time bar is enabled. - -
    -
  • id (Number | String): custom time bar id.
  • -
  • time (Date): the custom time.
  • -
-
- -

Editing Items

-

- When the Timeline is configured to be editable (both options selectable and editable are true), the user can: -

- - -

Option editable accepts a boolean or an object. When editable is a boolean, all manipulation actions will be either enabled or disabled. When editable is an object, one can enable individual manipulation actions:

- -
// enable or disable all manipulation actions
-var options = {
-  editable: true       // true or false
-};
-
-// enable or disable individual manipulation actions
-var options = {
-  editable: {
-    add: true,         // add new items by double tapping
-    updateTime: true,  // drag items horizontally
-    updateGroup: true, // drag items from one group to another
-    remove: true       // delete an item by tapping the delete button top right
-  }
-};
- - -

- One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose: -

- - - -

- Each of the callbacks is invoked with two arguments: -

- - -

- Example code: -

- -
var options = {
-  onUpdate: function (item, callback) {
-    item.content = prompt('Edit items text:', item.content);
-    if (item.content != null) {
-      callback(item); // send back adjusted item
-    }
-    else {
-      callback(null); // cancel updating the item
-    }
-  }
-};
-
- -A full example is available here: 08_edit_items.html. - - -

Templates

- -

- Timeline supports templates to format item contents. Any template engine (such as handlebars or mustache) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an items data as argument, and outputs formatted HTML: -

- -
var options = {
-  template: function (item) {
-    var html = ... // generate HTML markup for this item
-    return html;
-  }
-};
-
- -

Create HTML manually

- -The HTML for an item can be created manually: - -
var options = {
-  template: function (item) {
-    return '<h1>' + item.header + '</h1><p>' + item.description + '</p>';
-  }
-};
-
- -

Using a template engine

- -Using handlebars, one can write the template in HTML: - -
-<script id="item-template" type="text/x-handlebars-template">
-  <h1>{{header}}</h1>
-  <p>{{description}}</p>
-</script>
-
- -Compile the template: - -
-var source = document.getElementById('item-template').innerHTML;
-var template = Handlebars.compile(source);
-
- -And then specify the template in the Timeline options - -
var options = {
-  template: template
-};
-
- -

Multiple templates

- -In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property: - -
-var templates = {
-  template1: Handlebars.compile(...),
-  template2: Handlebars.compile(...),
-  template2: Handlebars.compile(...),
-  ...
-};
-
-var options = {
-  template: function (item) {
-    var template = templates[item.template];  // choose the right template
-    return template(item);                    // execute the template
-  }
-};
-
- -Now the items can be extended with a property template, specifying which template to use for the item. - - -

Localization

-

- Timeline can be localized. For localization, Timeline depends largely on the localization of moment.js. Locales are not included in vis.js by default. To enable localization, moment.js must be loaded with locales. Moment.js offers a bundle named "moment-with-locales.min.js" for this and there are various alternative ways to load locales. -

- -

- To set a locale for the Timeline, specify the option locale: -

- -
var options = {
-  locale: 'nl'
-};
-
- -

Create a new locale

- -To load a locale into the Timeline not supported by default, one can add a new locale to the option locales: - -
var options = {
-  locales: {
-    // create a new locale (text strings should be replaced with localized strings)
-    mylocale: {
-      current: 'current',
-      time: 'time',
-    }
-  },
-
-  // use the new locale
-  locale: 'mylocale'
-};
-
- -

Available locales

- -

- Timeline comes with support for the following locales: -

- - - - - - - - - - - -
LanguageCode
English - en
- en_EN
- en_US -
Dutch - nl
- nl_NL
- nl_BE -
- - -

Styles

-

- All parts of the Timeline have a class name and a default css style. - The styles can be overwritten, which enables full customization of the layout - of the Timeline. -

- -

For example, to change the border and background color of all items, include the - following code inside the head of your html code or in a separate stylesheet.

-
<style>
-  .vis-item {
-    border-color: orange;
-    background-color: yellow;
-  }
-</style>
-
- -

Grid Backgrounds

-

- The background grid of the time axis can be styled, for example to highlight - weekends or to create grids with an alternating white/lightgray background. -

-

- Depending on the zoom level, the grids get certain css classes attached. - The following classes are available: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Descriptionvalues
Alternating columnseven, odd
Current datetoday, tomorrow, yesterday, current-week, current-month, current-year
Hoursh0, h1, ..., h23
Grouped hoursh0-h4 to h20-h24
Weekdaymonday, tuesday, wednesday, thursday, friday, saturday, sunday
Daysdate1, date2, ..., date31
Monthsjanuari, februari, march, april, may, june, july, august, september, october, november, december
Yearsyear2014, year2015, ...
- -

Examples:

- -
<style>
-  /* alternating column backgrounds */
-  .vis-time-axis .grid.odd {
-    background: #f5f5f5;
-  }
-
-  /* gray background in weekends, white text color */
-  .vis-time-axis .vis-grid.saturday,
-  .vis-time-axis .vis-grid.sunday {
-    background: gray;
-  }
-  .vis-time-axis .vis-text.saturday,
-  .vis-time-axis .vis-text.sunday {
-    color: white;
-  }
-</style>
-
- - -

Data Policy

-

- All code and data is processed and rendered in the browser. - No data is sent to any server. -

- -
- -