@ -1,949 +0,0 @@ | |||
<!doctype html> | |||
<html> | |||
<head> | |||
<title>vis.js | DataSet documentation</title> | |||
<link href="css/prettify.css" type="text/css" rel="stylesheet" /> | |||
<link href='css/old_style.css' type='text/css' rel='stylesheet'> | |||
<script type="text/javascript" src="js/prettify/prettify.js"></script> | |||
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head> | |||
<body onload="prettyPrint();"> | |||
<div id="container"> | |||
<h1>DataSet documentation</h1> | |||
<h2 id="Contents">Contents</h2> | |||
<ul> | |||
<li><a href="#Overview">Overview</a></li> | |||
<li><a href="#Example">Example</a></li> | |||
<li><a href="#Construction">Construction</a></li> | |||
<li><a href="#Methods">Methods</a></li> | |||
<li><a href="#Properties">Properties</a></li> | |||
<li><a href="#Subscriptions">Subscriptions</a></li> | |||
<li><a href="#Data_Manipulation">Data Manipulation</a></li> | |||
<li><a href="#Data_Selection">Data Selection</a></li> | |||
<li><a href="#Data_Policy">Data Policy</a></li> | |||
</ul> | |||
<h2 id="Overview">Overview</h2> | |||
<p> | |||
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. | |||
</p> | |||
<h2 id="Example">Example</h2> | |||
<p> | |||
The following example shows how to use a DataSet. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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); | |||
</pre> | |||
<h2 id="Construction">Construction</h2> | |||
<p> | |||
A DataSet can be constructed as: | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var data = new vis.DataSet([data] [, options]) | |||
</pre> | |||
<p> | |||
After construction, data can be added to the DataSet using the methods | |||
<code>add</code> and <code>update</code>, as described in section | |||
<a href="#Data_Manipulation">Data Manipulation</a>. | |||
</p> | |||
<p> | |||
The parameter <code>data</code> is optional and is an Array with items. | |||
</p> | |||
<p> | |||
The parameter <code>options</code> is optional and is an object which can | |||
contain the following properties: | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Name</th> | |||
<th>Type</th> | |||
<th>Default value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>fieldId</td> | |||
<td>String</td> | |||
<td>"id"</td> | |||
<td> | |||
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 <code>fieldId</code>. | |||
For example <a href="http://couchdb.apache.org/" | |||
target="_blank">CouchDB</a> uses the field | |||
<code>"_id"</code> to identify documents. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>type</td> | |||
<td>Object.<String, String></td> | |||
<td>none</td> | |||
<td> | |||
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 | |||
<a href="#Data_Types">Data Types</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>queue</td> | |||
<td>Object | boolean</td> | |||
<td>none</td> | |||
<td> | |||
Queue data changes ('add', 'update', 'remove') and flush them at once. | |||
The queue can be flushed manually by calling | |||
<code>DataSet.flush()</code>, or can be flushed after a configured delay | |||
or maximum number of entries. | |||
<br> | |||
<br> | |||
When <code>queue</code> is true, a queue is created | |||
with default options. Options can be specified by providing an object: | |||
<ul> | |||
<li><code>delay: number</code><br> | |||
The queue will be flushed automatically after an inactivity of this | |||
delay in milliseconds. Default value is <code>null</code>. | |||
<li><code>max: number</code><br> | |||
When the queue exceeds the given maximum number | |||
of entries, the queue is flushed automatically. | |||
Default value is <code>Infinity</code>. | |||
</li> | |||
</ul> | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Methods">Methods</h2> | |||
<p>DataSet contains the following methods.</p> | |||
<table> | |||
<colgroup> | |||
<col width="200"> | |||
</colgroup> | |||
<tr> | |||
<th>Method</th> | |||
<th>Return Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>add(data [, senderId])</td> | |||
<td>Number[]</td> | |||
<td>Add one or multiple items to the DataSet. <code>data</code> 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 <a href="#Data_Manipulation">Data Manipulation</a>.</td> | |||
</tr> | |||
<tr> | |||
<td>clear([senderId])</td> | |||
<td>Number[]</td> | |||
<td>Clear all data from the DataSet. The function returns an array with the ids of the removed items.</td> | |||
</tr> | |||
<tr> | |||
<td>distinct(field)</td> | |||
<td>Array</td> | |||
<td>Find 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.</td> | |||
</tr> | |||
<tr> | |||
<td>flush()</td> | |||
<td>none</td> | |||
<td>Flush queued changes. Only available when the DataSet is configured with the option <code>queue</code>, see section <a href="#Construction">Construction</a>.</td> | |||
</tr> | |||
<tr> | |||
<td>forEach(callback [, options])</td> | |||
<td>none</td> | |||
<td> | |||
Execute a callback function for every item in the dataset. | |||
The available options are described in section <a href="#Data_Selection">Data Selection</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
get([options] [, data])<br> | |||
get(id [,options] [, data])<br> | |||
get(ids [, options] [, data]) | |||
</td> | |||
<td>Object | Array</td> | |||
<td> | |||
Get a single item, multiple items, or all items from the DataSet. | |||
Usage examples can be found in section <a href="#Getting_Data">Getting Data</a>, and the available <code>options</code> are described in section <a href="#Data_Selection">Data Selection</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
getDataSet() | |||
</td> | |||
<td>DataSet</td> | |||
<td> | |||
Get the DataSet itself. In case of a DataView, this function does not | |||
return the DataSet to which the DataView is connected. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
getIds([options]) | |||
</td> | |||
<td>Number[]</td> | |||
<td> | |||
Get ids of all items or of a filtered set of items. | |||
Available <code>options</code> are described in section <a href="#Data_Selection">Data Selection</a>, except that options <code>fields</code> and <code>type</code> are not applicable in case of <code>getIds</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>map(callback [, options])</td> | |||
<td>Array</td> | |||
<td> | |||
Map every item in the DataSet. | |||
The available options are described in section <a href="#Data_Selection">Data Selection</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>max(field)</td> | |||
<td>Object | null</td> | |||
<td> | |||
Find the item with maximum value of specified field. Returns <code>null</code> if no item is found. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>min(field)</td> | |||
<td>Object | null</td> | |||
<td> | |||
Find the item with minimum value of specified field. Returns <code>null</code> if no item is found. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>off(event, callback)</td> | |||
<td>none</td> | |||
<td> | |||
Unsubscribe from an event, remove an event listener. See section <a href="#Subscriptions">Subscriptions</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>on(event, callback)</td> | |||
<td>none</td> | |||
<td> | |||
Subscribe to an event, add an event listener. See section <a href="#Subscriptions">Subscriptions</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
remove(id [, senderId])<br> | |||
remove(ids [, senderId]) | |||
</td> | |||
<td>Number[]</td> | |||
<td> | |||
Remove one or multiple items by id or by the items themselves. Returns an array with the ids of the removed items. See section <a href="#Data_Manipulation">Data Manipulation</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
setOptions(options) | |||
</td> | |||
<td>none</td> | |||
<td> | |||
Set options for the DataSet. Available options: | |||
<ul> | |||
<li> | |||
<code>queue</code><br> | |||
Queue data changes ('add', 'update', 'remove') and flush them at once. | |||
The queue can be flushed manually by calling | |||
<code>DataSet.flush()</code>, or can be flushed after a configured delay | |||
or maximum number of entries. | |||
<br> | |||
<br> | |||
When <code>queue</code> is true, a queue is created with default options. | |||
When <code>queue</code> is false, an existing queue will be flushed and removed. | |||
Options can be specified by providing an object: | |||
<ul> | |||
<li><code>delay: number</code><br> | |||
The queue will be flushed automatically after an inactivity of this | |||
delay in milliseconds. Default value is <code>null</code>. | |||
<li><code>max: number</code><br> | |||
When the queue exceeds the given maximum number | |||
of entries, the queue is flushed automatically. | |||
Default value is <code>Infinity</code>. | |||
</li> | |||
</ul> | |||
</li> | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
update(data [, senderId]) | |||
</td> | |||
<td>Number[]</td> | |||
<td> | |||
Update on ore multiple existing items. <code>data</code> 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 <a href="#Data_Manipulation">Data Manipulation</a>. | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Properties">Properties</h2> | |||
<p>DataSet contains the following properties.</p> | |||
<table> | |||
<colgroup> | |||
<col width="200"> | |||
</colgroup> | |||
<tr> | |||
<th>Property</th> | |||
<th>Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>length</td> | |||
<td>Number</td> | |||
<td>The number of items in the DataSet.</td> | |||
</tr> | |||
</table> | |||
<h2 id="Subscriptions">Subscriptions</h2> | |||
<p> | |||
One can subscribe on changes in a DataSet. | |||
A subscription can be created using the method <code>on</code>, | |||
and removed with <code>off</code>. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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 | |||
</pre> | |||
<h3 id="On">On</h3> | |||
<p> | |||
Subscribe to an event. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">DataSet.on(event, callback)</pre> | |||
Where: | |||
<ul> | |||
<li> | |||
<code>event</code> is a String containing any of the events listed | |||
in section <a href="#Events">Events</a>. | |||
</li> | |||
<li> | |||
<code>callback</code> is a callback function which will be called | |||
each time the event occurs. The callback function is described in | |||
section <a href="#Callback">Callback</a>. | |||
</li> | |||
</ul> | |||
<h3 id="Off">Off</h3> | |||
<p> | |||
Unsubscribe from an event. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">DataSet.off(event, callback)</pre> | |||
Where <code>event</code> and <code>callback</code> correspond with the | |||
parameters used to <a href="#On">subscribe</a> to the event. | |||
<h3 id="Events">Events</h3> | |||
<p> | |||
The following events are available for subscription: | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Event</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>add</td> | |||
<td> | |||
The <code>add</code> event is triggered when an item | |||
or a set of items is added, or when an item is updated while | |||
not yet existing. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>update</td> | |||
<td> | |||
The <code>update</code> event is triggered when an existing item | |||
or a set of existing items is updated. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>remove</td> | |||
<td> | |||
The <code>remove</code> event is triggered when an item | |||
or a set of items is removed. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>*</td> | |||
<td> | |||
The <code>*</code> event is triggered when any of the events | |||
<code>add</code>, <code>update</code>, and <code>remove</code> | |||
occurs. | |||
</td> | |||
</tr> | |||
</table> | |||
<h3 id="Callback">Callback</h3> | |||
<p> | |||
The callback functions of subscribers are called with the following | |||
parameters: | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
function (event, properties, senderId) { | |||
// handle the event | |||
}); | |||
</pre> | |||
<p> | |||
where the parameters are defined as | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Parameter</th> | |||
<th>Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>event</td> | |||
<td>String</td> | |||
<td> | |||
Any of the available events: <code>add</code>, | |||
<code>update</code>, or <code>remove</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>properties</td> | |||
<td>Object | null</td> | |||
<td> | |||
Optional properties providing more information on the event. | |||
In case of the events <code>add</code>, | |||
<code>update</code>, and <code>remove</code>, | |||
<code>properties</code> is always an object containing a property | |||
<code>items</code>, which contains an array with the ids of the affected | |||
items. The <code>update</code> event has an extra field <code>data</code> | |||
containing the original data of the updated items, i.e. the gives the | |||
changed fields of the changed items. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>senderId</td> | |||
<td>String | Number</td> | |||
<td> | |||
An senderId, optionally provided by the application code | |||
which triggered the event. If senderId is not provided, the | |||
argument will be <code>null</code>. | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Data_Manipulation">Data Manipulation</h2> | |||
<p> | |||
The data in a DataSet can be manipulated using the methods | |||
<a href="#Add"><code>add</code></a>, | |||
<a href="#Update"><code>update</code></a>, | |||
and <a href="#Remove"><code>remove</code></a>. | |||
The DataSet can be emptied using the method | |||
<a href="#Clear"><code>clear</code></a>. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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); | |||
</pre> | |||
<h3 id="Add">Add</h3> | |||
<p> | |||
Add a data item or an array with items. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">var addedIds = DataSet.add(data [, senderId])</pre> | |||
The argument <code>data</code> can contain: | |||
<ul> | |||
<li> | |||
An <code>Object</code> containing a single item to be | |||
added. The item must contain an id. | |||
</li> | |||
<li> | |||
An <code>Array</code> containing a list with items to be added. Each item must contain an id. | |||
</li> | |||
</ul> | |||
<p> | |||
After the items are added to the DataSet, the DataSet will | |||
trigger an event <code>add</code>. When a <code>senderId</code> | |||
is provided, this id will be passed with the triggered | |||
event to all subscribers. | |||
</p> | |||
<p> | |||
The method will throw an Error when an item with the same id | |||
as any of the added items already exists. | |||
</p> | |||
<h3 id="Update">Update</h3> | |||
<p> | |||
Update a data item or an array with items. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">var updatedIds = DataSet.update(data [, senderId])</pre> | |||
The argument <code>data</code> can contain: | |||
<ul> | |||
<li> | |||
An <code>Object</code> containing a single item to be | |||
updated. The item must contain an id. | |||
</li> | |||
<li> | |||
An <code>Array</code> containing a list with items to be updated. Each item must contain an id. | |||
</li> | |||
</ul> | |||
<p> | |||
The provided properties will be merged in the existing item. | |||
When an item does not exist, it will be created. | |||
</p> | |||
<p> | |||
After the items are updated, the DataSet will | |||
trigger an event <code>add</code> for the added items, and | |||
an event <code>update</code>. When a <code>senderId</code> | |||
is provided, this id will be passed with the triggered | |||
event to all subscribers. | |||
</p> | |||
<h3 id="Remove">Remove</h3> | |||
<p> | |||
Remove a data item or an array with items. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">var removedIds = DataSet.remove(id [, senderId])</pre> | |||
<p> | |||
The argument <code>id</code> can be: | |||
</p> | |||
<ul> | |||
<li> | |||
A <code>Number</code> or <code>String</code> containing the id | |||
of a single item to be removed. | |||
</li> | |||
<li> | |||
An <code>Object</code> containing the item to be deleted. | |||
The item will be deleted by its id. | |||
</li> | |||
<li> | |||
An Array containing ids or items to be removed. | |||
</li> | |||
</ul> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
After the items are removed, the DataSet will | |||
trigger an event <code>remove</code> for the removed items. | |||
When a <code>senderId</code> is provided, this id will be passed with | |||
the triggered event to all subscribers. | |||
</p> | |||
<h3 id="Clear">Clear</h3> | |||
<p> | |||
Clear the complete DataSet. | |||
</p> | |||
Syntax: | |||
<pre class="prettyprint lang-js">var removedIds = DataSet.clear([senderId])</pre> | |||
<p> | |||
After the items are removed, the DataSet will | |||
trigger an event <code>remove</code> for all removed items. | |||
When a <code>senderId</code> is provided, this id will be passed with | |||
the triggered event to all subscribers. | |||
</p> | |||
<h2 id="Data_Selection">Data Selection</h2> | |||
<p> | |||
The DataSet contains functionality to format, filter, and sort data retrieved via the | |||
methods <code>get</code>, <code>getIds</code>, <code>forEach</code>, and <code>map</code>. These methods have the following syntax: | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
DataSet.get([id] [, options]); | |||
DataSet.getIds([options]); | |||
DataSet.forEach(callback [, options]); | |||
DataSet.map(callback [, options]); | |||
</pre> | |||
<p> | |||
Where <code>options</code> is an Object which can have the following | |||
properties: | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Name</th> | |||
<th>Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>fields</td> | |||
<td>String[ ] | Object.<String, String></td> | |||
<td> | |||
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 <code>fields</code> is defined, only the properties | |||
whose name is specified in <code>fields</code> will be included | |||
in the returned items. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>type</td> | |||
<td>Object.<String, String></td> | |||
<td> | |||
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 | |||
<a href="#Data_Types">Data Types</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>filter</td> | |||
<td>Function</td> | |||
<td>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. | |||
See section <a href="#Data_Filtering">Data Filtering</a>.</td> | |||
</tr> | |||
<tr> | |||
<td>order</td> | |||
<td>String | Function</td> | |||
<td>Order the items by a field name or custom sort function.</td> | |||
</tr> | |||
<tr> | |||
<td>returnType</td> | |||
<td>String</td> | |||
<td>Determine the type of output of the get function. Allowed values are <code>'Array' | 'Object'</code>. | |||
The default returnType is an Array. The Object type will return a JSON object with the ID's as keys.</td> | |||
</tr> | |||
</table> | |||
<p> | |||
The following example demonstrates formatting properties and filtering | |||
properties from items. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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 | |||
} | |||
}); | |||
</pre> | |||
<h3 id="Getting_Data">Getting Data</h3> | |||
<p> | |||
Data can be retrieved from the DataSet using the method <code>get</code>. | |||
This method can return a single item or a list with items. | |||
</p> | |||
<p>A single item can be retrieved by its id:</p> | |||
<pre class="prettyprint lang-js"> | |||
var item1 = dataset.get(1); | |||
</pre> | |||
<p>A selection of items can be retrieved by providing an array with ids:</p> | |||
<pre class="prettyprint lang-js"> | |||
var items = dataset.get([1, 3, 4]); // retrieve items 1, 3, and 4 | |||
</pre> | |||
<p>All items can be retrieved by simply calling <code>get</code> without | |||
specifying an id:</p> | |||
<pre class="prettyprint lang-js"> | |||
var items = dataset.get(); // retrieve all items | |||
</pre> | |||
<h3 id="Data_Filtering">Data Filtering</h3> | |||
<p> | |||
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. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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); | |||
} | |||
}); | |||
</pre> | |||
<h3 id="Data_Types">Data Types</h3> | |||
<p> | |||
DataSet supports the following data types: | |||
</p> | |||
<table style="width: 100%"> | |||
<tr> | |||
<th>Name</th> | |||
<th>Description</th> | |||
<th>Examples</th> | |||
</tr> | |||
<tr> | |||
<td>Boolean</td> | |||
<td>A JavaScript Boolean</td> | |||
<td> | |||
<code>true</code><br> | |||
<code>false</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Number</td> | |||
<td>A JavaScript Number</td> | |||
<td> | |||
<code>32</code><br> | |||
<code>2.4</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>String</td> | |||
<td>A JavaScript String</td> | |||
<td> | |||
<code>"hello world"</code><br> | |||
<code>"2013-06-28"</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Date</td> | |||
<td>A JavaScript Date object</td> | |||
<td> | |||
<code>new Date()</code><br> | |||
<code>new Date(2013, 5, 28)</code><br> | |||
<code>new Date(1372370400000)</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Moment</td> | |||
<td>A Moment object, created with | |||
<a href="http://momentjs.com/" target="_blank">moment.js</a></td> | |||
<td> | |||
<code>moment()</code><br> | |||
<code>moment('2013-06-28')</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>ISODate</td> | |||
<td>A string containing an ISO Date</td> | |||
<td> | |||
<code>new Date().toISOString()</code><br> | |||
<code>"2013-06-27T22:00:00.000Z"</code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>ASPDate</td> | |||
<td>A string containing an ASP Date</td> | |||
<td> | |||
<code>"/Date(1372370400000)/"</code><br> | |||
<code>"/Date(1198908717056-0700)/"</code> | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Data_Policy">Data Policy</h2> | |||
<p> | |||
All code and data is processed and rendered in the browser. | |||
No data is sent to any server. | |||
</p> | |||
</div> | |||
</body> | |||
</html> |
@ -1,338 +0,0 @@ | |||
<!doctype html> | |||
<html> | |||
<head> | |||
<title>vis.js | DataView documentation</title> | |||
<link href="css/prettify.css" type="text/css" rel="stylesheet" /> | |||
<link href='css/old_style.css' type='text/css' rel='stylesheet'> | |||
<script type="text/javascript" src="js/prettify/prettify.js"></script> | |||
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head> | |||
<body onload="prettyPrint();"> | |||
<div id="container"> | |||
<h1>DataView documentation</h1> | |||
<h2 id="Contents">Contents</h2> | |||
<ul> | |||
<li><a href="#Overview">Overview</a></li> | |||
<li><a href="#Example">Example</a></li> | |||
<li><a href="#Construction">Construction</a></li> | |||
<li><a href="#Methods">Methods</a></li> | |||
<li><a href="#Properties">Properties</a></li> | |||
<li><a href="#Getting_Data">Getting Data</a></li> | |||
<li><a href="#Subscriptions">Subscriptions</a></li> | |||
<li><a href="#Data_Policy">Data Policy</a></li> | |||
</ul> | |||
<h2 id="Overview">Overview</h2> | |||
<p> | |||
A DataView offers a filtered and/or formatted view on a | |||
<a href="dataset.html">DataSet</a>. | |||
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. | |||
</p> | |||
<h2 id="Example">Example</h2> | |||
<p> | |||
The following example shows how to use a DataView. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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(); | |||
</pre> | |||
<h2 id="Construction">Construction</h2> | |||
<p> | |||
A DataView can be constructed as: | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var data = new vis.DataView(dataset, options) | |||
</pre> | |||
<p> | |||
where: | |||
</p> | |||
<ul> | |||
<li> | |||
<code>dataset</code> is a DataSet or DataView. | |||
</li> | |||
<li> | |||
<code>options</code> is an object which can | |||
contain the following properties. Note that these properties | |||
are exactly the same as the properties available in methods | |||
<code>DataSet.get</code> and <code>DataView.get</code>. | |||
<table> | |||
<tr> | |||
<th>Name</th> | |||
<th>Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>convert</td> | |||
<td>Object.<String, String></td> | |||
<td> | |||
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 | |||
<a href="dataset.html#Data_Types">Data Types</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>fields</td> | |||
<td>String[ ] | Object.<String, String></td> | |||
<td> | |||
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 <code>fields</code> is defined, only the properties | |||
whose name is specified in <code>fields</code> will be included | |||
in the returned items. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>filter</td> | |||
<td>function</td> | |||
<td>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. | |||
See also section <a href="dataset.html#Data_Filtering">Data Filtering</a>.</td> | |||
</tr> | |||
</table> | |||
</li> | |||
</ul> | |||
<h2 id="Methods">Methods</h2> | |||
<p>DataView contains the following methods.</p> | |||
<table> | |||
<colgroup> | |||
<col width="200"> | |||
</colgroup> | |||
<tr> | |||
<th>Method</th> | |||
<th>Return Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td> | |||
get([options] [, data])<br> | |||
get(id [,options] [, data])<br> | |||
get(ids [, options] [, data]) | |||
</td> | |||
<td>Object | Array</td> | |||
<td> | |||
Get a single item, multiple items, or all items from the DataView. | |||
Usage examples can be found in section <a href="#Getting_Data">Getting Data</a>, and the available <code>options</code> are described in section <a href="#Data_Selection">Data Selection</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
getDataSet() | |||
</td> | |||
<td>DataSet</td> | |||
<td> | |||
Get the DataSet to which the DataView is connected. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
getIds([options]) | |||
</td> | |||
<td>Number[]</td> | |||
<td> | |||
Get ids of all items or of a filtered set of items. | |||
Available <code>options</code> are described in section <a href="dataset.html#Data_Selection">Data Selection</a>, except that options <code>fields</code> and <code>type</code> are not applicable in case of <code>getIds</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>off(event, callback)</td> | |||
<td>none</td> | |||
<td> | |||
Unsubscribe from an event, remove an event listener. See section <a href="#Subscriptions">Subscriptions</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>on(event, callback)</td> | |||
<td>none</td> | |||
<td> | |||
Subscribe to an event, add an event listener. See section <a href="#Subscriptions">Subscriptions</a>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>refresh()</td> | |||
<td>none</td> | |||
<td> | |||
Refresh the filter results of a DataView. Useful when the filter function contains dynamic properties, like: | |||
<pre class="prettyprint lang-js">var data = new vis.DataSet(...); | |||
var view = new vis.DataView(data, { | |||
filter: function (item) { | |||
return item.value > threshold; | |||
} | |||
});</pre> | |||
In this example, <code>threshold</code> is an external parameter. When the value of <code>threshold</code> changes, the DataView must be notified that the filter results may have changed by calling <code>DataView.refresh()</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
setDataSet(data) | |||
</td> | |||
<td>none</td> | |||
<td> | |||
Replace the DataSet of the DataView. Parameter <code>data</code> can be a DataSet or a DataView. | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Properties">Properties</h2> | |||
<p>DataView contains the following properties.</p> | |||
<table> | |||
<colgroup> | |||
<col width="200"> | |||
</colgroup> | |||
<tr> | |||
<th>Property</th> | |||
<th>Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>length</td> | |||
<td>Number</td> | |||
<td>The number of items in the DataView.</td> | |||
</tr> | |||
</table> | |||
<h2 id="Getting_Data">Getting Data</h2> | |||
<p> | |||
Data of the DataView can be retrieved using the method <code>get</code>. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var items = view.get(); | |||
</pre> | |||
<p> | |||
Data of a DataView can be filtered and formatted again, in exactly the | |||
same way as in a DataSet. See sections | |||
<a href="dataset.html#Data_Manipulation">Data Manipulation</a> and | |||
<a href="dataset.html#Data_Selection">Data Selection</a> for more | |||
information. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var items = view.get({ | |||
fields: ['id', 'score'], | |||
filter: function (item) { | |||
return (item.score > 50); | |||
} | |||
}); | |||
</pre> | |||
<h2 id="Subscriptions">Subscriptions</h2> | |||
<p> | |||
One can subscribe on changes in the DataView. Subscription works exactly | |||
the same as for DataSets. See the documentation on | |||
<a href="dataset.html#Subscriptions">subscriptions in a DataSet</a> | |||
for more information. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
// 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... | |||
</pre> | |||
<h2 id="Data_Policy">Data Policy</h2> | |||
<p> | |||
All code and data is processed and rendered in the browser. | |||
No data is sent to any server. | |||
</p> | |||
</div> | |||
</body> | |||
</html> |
@ -1,673 +0,0 @@ | |||
<html> | |||
<head> | |||
<title>vis.js | graph3d documentation</title> | |||
<link href='../css/prettify.css' type='text/css' rel='stylesheet'> | |||
<link href='../css/style.css' type='text/css' rel='stylesheet'> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head> | |||
<body onload="prettyPrint();"> | |||
<div id="container"> | |||
<h1>Graph3d documentation</h1> | |||
<h2 id="Overview">Overview</h2> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
Graph3d uses <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Canvas">HTML canvas</a> | |||
to render graphs, and can render up to a few thousands of data points smoothly. | |||
</p> | |||
<h2 id="Contents">Contents</h2> | |||
<ul> | |||
<li><a href="#Overview">Overview</a></li> | |||
<li><a href="#Loading">Loading</a></li> | |||
<li><a href="#Data_Format">Data Format</a></li> | |||
<li><a href="#Configuration_Options">Configuration Options</a></li> | |||
<li><a href="#Methods">Methods</a></li> | |||
<li><a href="#Events">Events</a></li> | |||
<li><a href="#Data_Policy">Data Policy</a></li> | |||
</ul> | |||
<h2 id="Example">Example</h2> | |||
<p> | |||
The following code shows how to create a Graph3d and provide it with data. | |||
More examples can be found in the <a href="../../examples">examples</a> directory. | |||
</p> | |||
<pre class="prettyprint lang-html"> | |||
<!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> | |||
</pre> | |||
<h2 id="Loading">Loading</h2> | |||
<p> | |||
The class name of the Graph3d is <code>vis.Graph3d</code>. | |||
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 <code>DataSet</code> or an <code>Array</code>, described in | |||
section <a href="#Data_Format">Data Format</a>. | |||
Options is a name-value map in the JSON format. The available options | |||
are described in section <a href="#Configuration_Options">Configuration Options</a>. | |||
</p> | |||
<pre class="prettyprint lang-js">var graph = new vis.Graph3d(container [, data] [, options]);</pre> | |||
<p> | |||
Data and options can be set or changed later on using the functions | |||
<code>Graph3d.setData(data)</code> and <code>Graph3d.setOptions(options)</code>. | |||
</p> | |||
<h2 id="Data_Format">Data Format</h2> | |||
<p> | |||
Graph3d can load data from an <code>Array</code>, a <code>DataSet</code> or a <code>DataView</code>. | |||
JSON objects are added to this DataSet by using the <code>add()</code> function. | |||
Data points must have properties <code>x</code>, <code>y</code>, and <code>z</code>, | |||
and can optionally have a property <code>style</code> and <code>filter</code>. | |||
<h3>Definition</h3> | |||
<p> | |||
The DataSet JSON objects are defined as: | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Name</th> | |||
<th>Type</th> | |||
<th>Required</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>x</td> | |||
<td>number</td> | |||
<td>yes</td> | |||
<td>Location on the x-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>y</td> | |||
<td>number</td> | |||
<td>yes</td> | |||
<td>Location on the y-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>z</td> | |||
<td>number</td> | |||
<td>yes</td> | |||
<td>Location on the z-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>style</td> | |||
<td>number</td> | |||
<td>no</td> | |||
<td>The data value, required for graph styles <code>dot-color</code> and | |||
<code>dot-size</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>filter</td> | |||
<td>*</td> | |||
<td>no</td> | |||
<td>Filter values used for the animation. | |||
This column may have any type, such as a number, string, or Date.</td> | |||
</tr> | |||
</table> | |||
<h2 id="Configuration_Options">Configuration Options</h2> | |||
<p> | |||
Options can be used to customize the graph. Options are defined as a JSON object. | |||
All options are optional. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var options = { | |||
width: '100%', | |||
height: '400px', | |||
style: 'surface' | |||
}; | |||
</pre> | |||
<p> | |||
The following options are available. | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Name</th> | |||
<th>Type</th> | |||
<th>Default</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>animationInterval</td> | |||
<td>number</td> | |||
<td>1000</td> | |||
<td>The animation interval in milliseconds. This determines how fast | |||
the animation runs.</td> | |||
</tr> | |||
<tr> | |||
<td>animationPreload</td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>If false, the animation frames are loaded as soon as they are requested. | |||
if <code>animationPreload</code> 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.</td> | |||
</tr> | |||
<tr> | |||
<td>animationAutoStart</td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>If true, the animation starts playing automatically after the graph | |||
is created.</td> | |||
</tr> | |||
<tr> | |||
<td>backgroundColor</td> | |||
<td>string or Object</td> | |||
<td>'white'</td> | |||
<td>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.</td> | |||
</tr> | |||
<tr> | |||
<td>backgroundColor.stroke</td> | |||
<td>string</td> | |||
<td>'gray'</td> | |||
<td>The color of the chart border, as an HTML color string.</td> | |||
</tr> | |||
<tr> | |||
<td>backgroundColor.strokeWidth</td> | |||
<td>number</td> | |||
<td>1</td> | |||
<td>The border width, in pixels.</td> | |||
</tr> | |||
<tr> | |||
<td>backgroundColor.fill</td> | |||
<td>string</td> | |||
<td>'white'</td> | |||
<td>The chart fill color, as an HTML color string.</td> | |||
</tr> | |||
<tr> | |||
<td>cameraPosition</td> | |||
<td>Object</td> | |||
<td>{horizontal: 1.0, vertical: 0.5, distance: 1.7}</td> | |||
<td>Set the initial rotation and position of the camera. | |||
The object <code>cameraPosition</code> contains three parameters: | |||
<code>horizontal</code>, <code>vertical</code>, and <code>distance</code>. | |||
Parameter <code>horizontal</code> is a value in radians and can have any | |||
value (but normally in the range of 0 and 2*Pi). | |||
Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi. | |||
Parameter <code>distance</code> 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. | |||
</tr> | |||
<tr> | |||
<td>height</td> | |||
<td>string</td> | |||
<td>'400px'</td> | |||
<td>The height of the graph in pixels or as a percentage.</td> | |||
</tr> | |||
<tr> | |||
<td>keepAspectRatio</td> | |||
<td>boolean</td> | |||
<td>true</td> | |||
<td>If <code>keepAspectRatio</code> 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.</td> | |||
</tr> | |||
<tr> | |||
<td>showAnimationControls</td> | |||
<td>boolean</td> | |||
<td>true</td> | |||
<td>If 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.</td> | |||
</tr> | |||
<tr> | |||
<td>showGrid</td> | |||
<td>boolean</td> | |||
<td>true</td> | |||
<td>If true, grid lines are draw in the x-y surface (the bottom of the 3d | |||
graph).</td> | |||
</tr> | |||
<tr> | |||
<td>showPerspective</td> | |||
<td>boolean</td> | |||
<td>true</td> | |||
<td>If 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. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>showShadow</td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>Show shadow on the graph.</td> | |||
</tr> | |||
<tr> | |||
<td>style</td> | |||
<td>string</td> | |||
<td>'dot'</td> | |||
<td>The style of the 3d graph. Available styles: | |||
<code>bar</code>, | |||
<code>bar-color</code>, | |||
<code>bar-size</code>, | |||
<code>dot</code>, | |||
<code>dot-line</code>, | |||
<code>dot-color</code>, | |||
<code>dot-size</code>, | |||
<code>line</code>, | |||
<code>grid</code>, | |||
or <code>surface</code></td> | |||
</tr> | |||
<tr> | |||
<td>tooltip</td> | |||
<td>boolean | function</td> | |||
<td>false</td> | |||
<td>Show a tooltip showing the values of the hovered data point. | |||
The contents of the tooltip can be customized by providing a callback | |||
function as <code>tooltip</code>. In this case the function is called | |||
with an object containing parameters <code>x</code>, | |||
<code>y</code>, and <code>z</code> argument, | |||
and must return a string which may contain HTML. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>valueMax</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The maximum value for the value-axis. Only available in combination | |||
with the styles <code>dot-color</code> and <code>dot-size</code>.</td> | |||
</tr> | |||
<tr> | |||
<td>valueMin</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The minimum value for the value-axis. Only available in combination | |||
with the styles <code>dot-color</code> and <code>dot-size</code>.</td> | |||
</tr> | |||
<tr> | |||
<td>verticalRatio</td> | |||
<td>number</td> | |||
<td>0.5</td> | |||
<td>A 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.</td> | |||
</tr> | |||
<tr> | |||
<td>width</td> | |||
<td>string</td> | |||
<td>'400px'</td> | |||
<td>The width of the graph in pixels or as a percentage.</td> | |||
</tr> | |||
<tr> | |||
<td>xBarWidth</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The 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 <code>'bar'</code> and <code>'bar-color'</code>.</td> | |||
</tr> | |||
<tr> | |||
<td>xCenter</td> | |||
<td>string</td> | |||
<td>'55%'</td> | |||
<td>The horizontal center position of the graph, as a percentage or in | |||
pixels.</td> | |||
</tr> | |||
<tr> | |||
<td>xMax</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The maximum value for the x-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>xMin</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The minimum value for the x-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>xStep</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>Step size for the grid on the x-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>xValueLabel</td> | |||
<td>function</td> | |||
<td>none</td> | |||
<td>A function for custom formatting of the labels along the x-axis, | |||
for example <code>function (x) {return (x * 100) + '%'}</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>yBarWidth</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The 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 <code>'bar'</code> and <code>'bar-color'</code>.</td> | |||
</tr> | |||
<tr> | |||
<td>yCenter</td> | |||
<td>string</td> | |||
<td>'45%'</td> | |||
<td>The vertical center position of the graph, as a percentage or in | |||
pixels.</td> | |||
</tr> | |||
<tr> | |||
<td>yMax</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The maximum value for the y-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>yMin</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The minimum value for the y-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>yStep</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>Step size for the grid on the y-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>yValueLabel</td> | |||
<td>function</td> | |||
<td>none</td> | |||
<td>A function for custom formatting of the labels along the y-axis, | |||
for example <code>function (y) {return (y * 100) + '%'}</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>zMin</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The minimum value for the z-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>zMax</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>The maximum value for the z-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>zStep</td> | |||
<td>number</td> | |||
<td>none</td> | |||
<td>Step size for the grid on the z-axis.</td> | |||
</tr> | |||
<tr> | |||
<td>zValueLabel</td> | |||
<td>function</td> | |||
<td>none</td> | |||
<td>A function for custom formatting of the labels along the z-axis, | |||
for example <code>function (z) {return (z * 100) + '%'}</code>. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>xLabel</td> | |||
<td>String</td> | |||
<td>x</td> | |||
<td>Label on the X axis.</td> | |||
</tr> | |||
<tr> | |||
<td>yLabel</td> | |||
<td>String</td> | |||
<td>y</td> | |||
<td>Label on the Y axis.</td> | |||
</tr> | |||
<tr> | |||
<td>zLabel</td> | |||
<td>String</td> | |||
<td>z</td> | |||
<td>Label on the Z axis.</td> | |||
</tr> | |||
<tr> | |||
<td>filterLabel</td> | |||
<td>String</td> | |||
<td>time</td> | |||
<td>Label for the filter column.</td> | |||
</tr> | |||
<tr> | |||
<td>legendLabel</td> | |||
<td>String</td> | |||
<td>value</td> | |||
<td>Label for the style description.</td> | |||
</tr> | |||
</table> | |||
<h2 id="Methods">Methods</h2> | |||
<p> | |||
Graph3d supports the following methods. | |||
</p> | |||
<table> | |||
<tr> | |||
<th>Method</th> | |||
<th>Return Type</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>animationStart()</td> | |||
<td>none</td> | |||
<td>Start playing the animation. | |||
Only applicable when animation data is available.</td> | |||
</tr> | |||
<tr> | |||
<td>animationStop()</td> | |||
<td>none</td> | |||
<td>Stop playing the animation. | |||
Only applicable when animation data is available.</td> | |||
</tr> | |||
<tr> | |||
<td>getCameraPosition()</td> | |||
<td>An object with parameters <code>horizontal</code>, | |||
<code>vertical</code> and <code>distance</code></td> | |||
<td>Returns an object with parameters <code>horizontal</code>, | |||
<code>vertical</code> and <code>distance</code>, | |||
which each one of them is a number, representing the rotation and position | |||
of the camera.</td> | |||
</tr> | |||
<tr> | |||
<td>redraw()</td> | |||
<td>none</td> | |||
<td>Redraw the graph. Useful after the camera position is changed externally, | |||
when data is changed, or when the layout of the webpage changed.</td> | |||
</tr> | |||
<tr> | |||
<td>setData(data)</td> | |||
<td>none</td> | |||
<td>Replace the data in the Graph3d.</td> | |||
</tr> | |||
<tr> | |||
<td>setOptions(options)</td> | |||
<td>none</td> | |||
<td>Update options of Graph3d. | |||
The provided options will be merged with current options.</td> | |||
</tr> | |||
<tr> | |||
<td>setSize(width, height)</td> | |||
<td>none</td> | |||
<td>Parameters <code>width</code> and <code>height</code> are strings, | |||
containing a new size for the graph. Size can be provided in pixels | |||
or in percentages.</td> | |||
</tr> | |||
<tr> | |||
<td>setCameraPosition (pos)</td> | |||
<td>{horizontal: 1.0, vertical: 0.5, distance: 1.7}</td> | |||
<td>Set the rotation and position of the camera. Parameter <code>pos</code> | |||
is an object which contains three parameters: <code>horizontal</code>, | |||
<code>vertical</code>, and <code>distance</code>. | |||
Parameter <code>horizontal</code> is a value in radians and can have any | |||
value (but normally in the range of 0 and 2*Pi). | |||
Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi. | |||
Parameter <code>distance</code> 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. | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Events">Events</h2> | |||
<p> | |||
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 <code>cameraPositionChange</code> event. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
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); | |||
</pre> | |||
<p> | |||
The following events are available. | |||
</p> | |||
<table> | |||
<col width="10%"> | |||
<col width="60%"> | |||
<col width="30%"> | |||
<tr> | |||
<th>name</th> | |||
<th>Description</th> | |||
<th>Properties</th> | |||
</tr> | |||
<tr> | |||
<td>cameraPositionChange</td> | |||
<td>The 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 <code>setCameraPosition</code> method. | |||
The new camera position can be retrieved by calling the method | |||
<code>getCameraPosition</code>.</td> | |||
<td> | |||
<ul> | |||
<li><code>horizontal</code>: Number. The horizontal angle of the camera.</li> | |||
<li><code>vertical</code>: Number. The vertical angle of the camera.</li> | |||
<li><code>distance</code>: Number. The distance of the camera to the center of the graph.</li> | |||
</ul> | |||
</td> | |||
</tr> | |||
</table> | |||
<h2 id="Data_Policy">Data Policy</h2> | |||
<p> | |||
All code and data are processed and rendered in the browser. No data is sent to any server. | |||
</p> | |||
</div> | |||
</body> | |||
</html> |
@ -1,225 +0,0 @@ | |||
<!doctype html> | |||
<html> | |||
<head> | |||
<title>vis.js | documentation</title> | |||
<link href="css/prettify.css" type="text/css" rel="stylesheet" /> | |||
<link href='css/old_style.css' type='text/css' rel='stylesheet'> | |||
<script type="text/javascript" src="js/prettify/prettify.js"></script> | |||
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head> | |||
<body onload="prettyPrint();"> | |||
<div id="container"> | |||
<h1>vis.js documentation</h1> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
The library is developed by | |||
<a href="http://almende.com" target="_blank">Almende B.V.</a>. | |||
Vis.js runs fine on Chrome, Firefox, Opera, Safari, IE9+, and most mobile | |||
browsers (with full touch support). | |||
</p> | |||
<h2 id="Components">Components</h2> | |||
<p> | |||
Vis.js contains of the following components: | |||
</p> | |||
<div style="text-align: center; float: right; padding-left: 30px;"> | |||
<a href="img/vis_overview.png" target="_blank"> | |||
<img src="img/vis_overview.png" style="width: 350px; "/><br> | |||
(click for a larger view) | |||
</a> | |||
</div> | |||
<ul> | |||
<li> | |||
<a href="dataset.html"><b>DataSet</b></a>. | |||
A flexible key/value based data set. | |||
Add, update, and remove items. Subscribe on changes in the data set. | |||
A DataSet can filter and order items, and convert fields of items. | |||
</li> | |||
<li> | |||
<a href="dataview.html"><b>DataView</b></a>. | |||
A filtered and/or formatted view on a DataSet. | |||
</li> | |||
<li> | |||
<a href="network.html"><b>Network</b></a>. | |||
Display a network (force directed graph) with nodes and edges (previously called Graph). | |||
</li> | |||
<li> | |||
<a href="graph2d.html"><b>Graph2d</b></a>. | |||
Plot data on a timeline with lines or barcharts. | |||
</li> | |||
<li> | |||
<a href="old/graph3d.html"><b>Graph3d</b></a>. | |||
Display data in a three dimensional graph. | |||
</li> | |||
<li> | |||
<a href="timeline.html"><b>Timeline</b></a>. | |||
Display different types of data on a timeline. | |||
</li> | |||
</ul> | |||
<h2 id="Install">Install</h2> | |||
<h3>npm</h3> | |||
<pre class="prettyprint"> | |||
npm install vis | |||
</pre> | |||
<h3>bower</h3> | |||
<pre class="prettyprint"> | |||
bower install vis | |||
</pre> | |||
<h3>download</h3> | |||
Download the library from the website: | |||
<a href="http://visjs.org" target="_blank">http://visjs.org</a>. | |||
<h2 id="Load">Load</h2> | |||
<p> | |||
To load vis.js, include the javascript and css files of vis in your web page: | |||
</p> | |||
<pre class="prettyprint lang-html"><!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> | |||
</pre> | |||
<p> | |||
or load vis.js using require.js: | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
require.config({ | |||
paths: { | |||
vis: 'path/to/vis', | |||
} | |||
}); | |||
require(['vis'], function (math) { | |||
// ... load a visualization | |||
}); | |||
</pre> | |||
<p> | |||
A timeline can be instantiated as follows. Other components can be | |||
created in a similar way. | |||
</p> | |||
<pre class="prettyprint lang-js"> | |||
var timeline = new vis.Timeline(container, data, options); | |||
</pre> | |||
<p> | |||
Where <code>container</code> is an HTML element, <code>data</code> is | |||
an Array with data or a DataSet, and <code>options</code> is an optional | |||
object with configuration options for the component. | |||
</p> | |||
<h2 id="Use">Use</h2> | |||
<p> | |||
A basic example on using a Timeline is shown below. More examples can be | |||
found in the <a href="https://github.com/almende/vis/tree/master/examples" | |||
target="_blank">examples directory</a> of the project. | |||
</p> | |||
<pre class="prettyprint lang-html"> | |||
<!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> | |||
</pre> | |||
<h2 id="license">License</h2> | |||
<p> | |||
Copyright 2010-2014 Almende B.V. | |||
</p> | |||
<p> | |||
Vis.js is dual licensed under both | |||
</p> | |||
<ul> | |||
<li> | |||
The Apache 2.0 License<br> | |||
<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a> | |||
</li> | |||
</ul> | |||
<p> | |||
and | |||
</p> | |||
<ul> | |||
<li> | |||
The MIT License<br> | |||
<a href="http://opensource.org/licenses/MIT">http://opensource.org/licenses/MIT</a> | |||
</li> | |||
</ul> | |||
<p> | |||
Vis.js may be distributed under either license. | |||
</p> | |||
</div> | |||
</body> | |||
</html> |
@ -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"]) |
@ -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",/^(?:<!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^\)\"\']+/]]),["css-str"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/, | |||
null],["pln",/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],["pun",/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),["hs"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(/,null,"("],["clo",/^\)/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, | |||
null],["lit",/^[+\-]?(?:0x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["cl","el","lisp","scm"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],["str",/^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i], | |||
["pln",/^[a-z_]\w*/i],["pun",/^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]]),["lua"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/], | |||
["lit",/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^(?:[a-z_]\w*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],["pun",/^[^\t\n\r \xA0\"\'\w]+/]]),["fs","ml"]) |
@ -1 +0,0 @@ | |||
PR.registerLangHandler(PR.sourceDecorator({keywords:"bool bytes default double enum extend extensions false fixed32 fixed64 float group import int32 int64 max message option optional package repeated required returns rpc service sfixed32 sfixed64 sint32 sint64 string syntax to true uint32 uint64",cStyleComments:true}),["proto"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,null,'"'],["lit",/^`(?:[^\r\n\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],["lit",/^'[a-zA-Z_$][\w$]*(?!['$\w])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/], | |||
["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],["typ",/^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],["pln",/^[$a-zA-Z_][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i, | |||
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D]c|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/i,null,'"\u201c\u201d'],["com",/^[\'\u2018\u2019][^\r\n\u2028\u2029]*/,null,"'\u2018\u2019"]],[["kwd",/^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i, | |||
null],["com",/^REM[^\r\n\u2028\u2029]*/i],["lit",/^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*\])/i],["pun",/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],["pun",/^(?:\[|\])/]]),["vb","vbs"]) |
@ -1,3 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],["com",/^--[^\r\n]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, | |||
null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i], | |||
["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]]),["vhdl","vhd"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t \xA0a-gi-z0-9]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[=*~\^\[\]]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],["lang-",/^\{\{\{([\s\S]+?)\}\}\}/],["lang-",/^`([^\r\n`]+)`/],["str",/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]]),["wiki"]); | |||
PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]) |
@ -1,2 +0,0 @@ | |||
PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:|>?]+/,null,":|>?"],["dec",/^%(?:YAML|TAG)[^#\r\n]+/,null,"%"],["typ",/^[&]\S+/,null,"&"],["typ",/^!\S*/,null,"!"],["str",/^"(?:[^\\"]|\\.)*(?:"|$)/,null,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,null,"'"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^\s+/,null," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\r\n]|$)/],["pun",/^-/],["kwd",/^\w+:[ \r\n]/],["pln",/^\w+/]]), | |||
["yaml","yml"]) |
@ -1 +0,0 @@ | |||
.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} |
@ -1,33 +0,0 @@ | |||
window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y}; | |||
(function(){function y(b){return b.replace(L,"&").replace(M,"<").replace(N,">")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name<m.name?-1:q.name===m.name?0:1});l=r}for(j=0;j<n;++j){r=l[j];r.specified&&f.push(" ",r.name.toLowerCase(),'="',r.value.replace(L,"&").replace(M,"<").replace(N,">").replace(X,"""),'"')}}f.push(">"); | |||
for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("</",o,">");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1), | |||
8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e<h;++e){var g=d[e];switch(g){case "\\B":case "\\b":case "\\D":case "\\d":case "\\S":case "\\s":case "\\W":case "\\w":c.push(g); | |||
continue}g=f(g);var s;if(e+2<h&&"-"===d[e+1]){s=f(d[e+2]);e+=2}else s=g;a.push([g,s]);if(!(s<65||g>122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;e<a.length;++e){h=a[e];if(h[0]<=g[1]+1)g[1]=Math.max(g[1],h[1]);else d.push(g=h)}a=["["];k&&a.push("^");a.push.apply(a,c);for(e=0;e<d.length;++e){h=d[e];a.push(i(h[0]));if(h[1]>h[0]){h[1]+1>h[0]&&a.push("-"); | |||
a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e<a;++e){var g=d[e];if(g==="(")++h;else if("\\"===g.charAt(0))if((g=+g.substring(1))&&g<=h)k[g]=-1}for(e=1;e<k.length;++e)if(-1===k[e])k[e]=++n;for(h=e=0;e<a;++e){g=d[e];if(g==="("){++h;if(k[h]===undefined)d[e]="(?:"}else if("\\"=== | |||
g.charAt(0))if((g=+g.substring(1))&&g<=h)d[e]="\\"+k[h]}for(h=e=0;e<a;++e)if("^"===d[e]&&"^"!==d[e+1])d[e]="";if(c.ignoreCase&&r)for(e=0;e<a;++e){g=d[e];c=g.charAt(0);if(g.length>=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q<m;++q){var t=b[q];if(t.ignoreCase)j=true;else if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, | |||
""))){r=true;j=false;break}}var p=[];q=0;for(m=b.length;q<m;++q){t=b[q];if(t.global||t.multiline)throw Error(""+t);p.push("(?:"+l(t)+")")}return RegExp(p.join("|"),j?"gi":"g")}function Y(b){var f=0;return function(i){for(var o=null,l=0,n=0,r=i.length;n<r;++n)switch(i.charAt(n)){case "\t":o||(o=[]);o.push(i.substring(l,n));l=b-f%b;for(f+=l;l>=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b, | |||
f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m<t;++m){var p=r[m],c=p[3];if(c)for(var d=c.length;--d>=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c<d;++c){var a=t[c],k=p[a],e=void 0,h;if(typeof k==="string")h=false;else{var g=i[a.charAt(0)]; | |||
if(g){e=a.match(g[1]);k=g[0]}else{for(h=0;h<l;++h){g=f[h];if(e=a.match(g[1])){k=g[0];break}}e||(k=z)}if((h=k.length>=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, | |||
null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, | |||
null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, | |||
null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("</span>");j=null}if(!j&&q){j=q;n.push('<span class="',j,'">')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1 ");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g, | |||
d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?" \r\n":h===7?" <br>\r":" \r":" <br />":"<br />";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'</li><li class="L'+w+'">';var F=g[1]&&g[1].length?g[1]-1:0;n.push('<ol class="linenums"><li class="L',F%10,'"');F&&n.push(' value="',F+1,'"');n.push(">");s=function(){var D=v[++F%10];return j?"</span>"+D+'<span class="'+j+'">':D}}else s=h; | |||
for(;;)if(m<o.length?t<l.length?o[m]<=l[t]:true:false){f(o[m]);if(j){n.push("</span>");j=null}n.push(o[m+1]);m+=2}else if(t<l.length){f(l[t]);q=l[t+1];t+=2}else break;f(i.length);j&&n.push("</span>");g&&n.push("</li></ol>");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*</.test(f)?"default-markup":"default-code");return G[b]} | |||
function U(b){var f=b.f,i=b.e;b.a=f;try{var o,l=f.match(aa);f=[];var n=0,r=[];if(l)for(var j=0,q=l.length;j<q;++j){var m=l[j];if(m.length>1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c<q;++c){var d=l[c].match(W);if(d&& | |||
d[2]===t)if(d[1]==="/"){if(--p===0)break a}else++p}if(c<q){r.push(n,l.slice(j,c+1).join(""));j=c}else r.push(n,m)}else r.push(n,m)}else{var a;p=m;var k=p.indexOf("&");if(k<0)a=p;else{for(--k;(k=p.indexOf("&#",k+1))>=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja, | |||
"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=", | |||
"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i<b.length;++i)f+="|"+b[i].replace(/([^=<>:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=/</g,N=/>/g,X=/\"/g,ea=/</g,fa=/>/g,ga=/'/g,ha=/"/g,ja=/&/g,ia=/ /g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|<!--[\\s\\S]*?--\>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<","g"),ba=/^<\!--/,ca=/^<!\[CDATA\[/,da=/^<br\b/i,W=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/, | |||
la=x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ", | |||
hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),G={};u(la,["default-code"]);u(B([],[[z,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup", | |||
"htm","html","mxml","xhtml","xml","xsl"]);u(B([[z,/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i], | |||
["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);u(B([],[["atv",/^[\s\S]+/]]),["uq.val"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ", | |||
hashComments:true,cStyleComments:true}),["c","cc","cpp","cxx","cyc","m"]);u(x({keywords:"null true false"}),["json"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ", | |||
hashComments:true,cStyleComments:true,verbatimStrings:true}),["cs"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ", | |||
cStyleComments:true}),["java"]);u(x({keywords:"break continue do else for if return while case done elif esac eval fi function in local set then until ",hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);u(x({keywords:"break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]); | |||
u(x({keywords:"caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);u(x({keywords:"break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",hashComments:true, | |||
multiLineStrings:true,regexLiterals:true}),["rb"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",cStyleComments:true,regexLiterals:true}),["js"]);u(B([],[[A,/^[\s\S]+/]]), | |||
["regex"]);window.PR_normalizedHtml=H;window.prettyPrintOne=function(b,f){var i={f:b,e:f};U(i);return i.a};window.prettyPrint=function(b){function f(){for(var t=window.PR_SHOULD_USE_CONTINUATION?j.now()+250:Infinity;q<o.length&&j.now()<t;q++){var p=o[q];if(p.className&&p.className.indexOf("prettyprint")>=0){var c=p.className.match(/\blang-(\w+)\b/);if(c)c=c[1];for(var d=false,a=p.parentNode;a;a=a.parentNode)if((a.tagName==="pre"||a.tagName==="code"||a.tagName==="xmp")&&a.className&&a.className.indexOf("prettyprint")>= | |||
0){d=true;break}if(!d){a=p;if(null===K){d=document.createElement("PRE");d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));K=!/</.test(d.innerHTML)}if(K){d=a.innerHTML;if("XMP"===a.tagName)d=y(d);else{a=a;if("PRE"===a.tagName)a=true;else if(ka.test(d)){var k="";if(a.currentStyle)k=a.currentStyle.whiteSpace;else if(window.getComputedStyle)k=window.getComputedStyle(a,null).whiteSpace;a=!k||k==="pre"}else a=true;a||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,"$1").replace(/(?:[\r\n]+[ \t]*)+/g, | |||
" "))}d=d}else{d=[];for(a=a.firstChild;a;a=a.nextSibling)H(a,d);d=d.join("")}d=d.replace(/(?:\r\n?|\n)$/,"");m={f:d,e:c,b:p};U(m);if(p=m.a){c=m.b;if("XMP"===c.tagName){d=document.createElement("PRE");for(a=0;a<c.attributes.length;++a){k=c.attributes[a];if(k.specified)if(k.name.toLowerCase()==="class")d.className=k.value;else d.setAttribute(k.name,k.value)}d.innerHTML=p;c.parentNode.replaceChild(d,c)}else c.innerHTML=p}}}}if(q<o.length)setTimeout(f,250);else b&&b()}for(var i=[document.getElementsByTagName("pre"), | |||
document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],o=[],l=0;l<i.length;++l)for(var n=0,r=i[l].length;n<r;++n)o.push(i[l][n]);i=null;var j=Date;j.now||(j={now:function(){return(new Date).getTime()}});var q=0,m;f()};window.PR={combinePrefixPatterns:O,createSimpleLexer:B,registerLangHandler:u,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:C,PR_DECLARATION:"dec",PR_KEYWORD:R,PR_LITERAL:J,PR_NOCODE:V,PR_PLAIN:z,PR_PUNCTUATION:E,PR_SOURCE:P,PR_STRING:A, | |||
PR_TAG:"tag",PR_TYPE:S}})() |
@ -1,211 +0,0 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<meta name="description" content=""> | |||
<meta name="author" content=""> | |||
<link rel="icon" HREF="favicon.ico"> | |||
<title>vis.js - A dynamic, browser based visualization library.</title> | |||
<!-- Bootstrap core CSS --> | |||
<link href="../css/bootstrap.css" rel="stylesheet"> | |||
<link href="../css/newdocs.css" rel="stylesheet"> | |||
<link href="../css/prettify.css" type="text/css" rel="stylesheet" /> | |||
<script type="text/javascript" src="../js/toggleTable.js"></script> | |||
<script type="text/javascript" src="../js/googleAnalytics.js"></script> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |||
<!--[if lt IE 9]> | |||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
<![endif]--> | |||
<script src="../js/smooth-scroll.min.js"></script> | |||
<script language="JavaScript"> | |||
smoothScroll.init(); | |||
</script> | |||
</head> | |||
<!-- NAVBAR | |||
================================================== --> | |||
<body onload="prettyPrint();"> | |||
<div class="navbar-wrapper"> | |||
<div class="container"> | |||
<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> | |||
<div class="container"> | |||
<div class="navbar-header"> | |||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" | |||
aria-expanded="false" aria-controls="navbar"> | |||
<span class="sr-only">Toggle navigation</span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
</button> | |||
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a> | |||
</div> | |||
<div id="navbar" class="navbar-collapse collapse"> | |||
<ul class="nav navbar-nav"> | |||
<li><a href="../index.html#modules">Modules</a></li> | |||
<li><a href="../blog.html">Blog</a></li> | |||
<li><a href="../index.html#download_install">Download</a></li> | |||
<li><a href="../showcase/index.html">Showcase</a></li> | |||
<li><a href="../index.html#contribute">Contribute</a></li> | |||
<li><a href="../featureRequests.html">Feature requests</a></li> | |||
<li><a href="../index.html#licenses">License</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</nav> | |||
</div> | |||
</div> | |||
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img | |||
style="position: absolute; top: 0; right: 0; border: 0;" | |||
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" | |||
alt="Fork me on GitHub" | |||
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | |||
<div class="container full"> | |||
<h1>Network - canvas</h1> | |||
<p>Handles the HTML part of the canvas.</p> | |||
<h3>Options</h3> | |||
<p>The options for the canvas have to be contained in an object titled 'canvas'.</p> | |||
<p>Click on the options shown to show how these options are supposed to be used.</p> | |||
<ul class="nav nav-tabs"> | |||
<li role="presentation" class="active" onclick="hideOptions('fullTab','fullOptions');" id="hiddenTab"><a href="#">options hidden</a></li> | |||
<li role="presentation" onclick="toggleTab('fullTab','fullOptions');" id="fullTab"><a href="#">options shown</a></li> | |||
</ul> | |||
<br> | |||
<pre class="prettyprint lang-js options hidden" id="fullOptions"> | |||
var options = { | |||
canvas:{ | |||
width:'100%', // other format: '400px' | |||
height:'100%', | |||
autoResize: true | |||
} | |||
} | |||
network.setOptions(options); | |||
</pre> | |||
<p>All of the individual options are explained here:</p> | |||
<table> | |||
<tr class="header"> | |||
<td class="name">name</td> | |||
<td class="type">type</td> | |||
<td class="default">default</td> | |||
<td class="description">description</td> | |||
</tr> | |||
<tr> | |||
<td>width</td> | |||
<td class="mid">String</td> | |||
<td class="mid"><code>'100%'</code></td> | |||
<td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td> | |||
</tr> | |||
<tr> | |||
<td>height</td> | |||
<td class="mid">String</td> | |||
<td class="mid"><code>'100%'</code></td> | |||
<td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td> | |||
</tr> | |||
<tr> | |||
<td>autoResize</td> | |||
<td class="mid">Boolean</td> | |||
<td class="mid"><code>true</code></td> | |||
<td>If 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().</td> | |||
</tr> | |||
</table> | |||
<h3>Methods</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"> | |||
<td class="methodName">name</td> | |||
<td>returns</td> | |||
<td>description</td> | |||
</tr> | |||
<tr> | |||
<td>setSize(<br> <code><i>String width</i></code>,<br> <code><i>String | |||
height</i></code><br>) | |||
</td> | |||
<td class="mid">none</td> | |||
<td>Set the size of the canvas. This is automatically done on a window resize.</td> | |||
</tr> | |||
<tr> | |||
<td>canvasToDOM({<br> <code><i>x: Number</i></code>,<br> <code><i>y: | |||
Number</i></code><br>}) | |||
</td> | |||
<td class="mid">Object</td> | |||
<td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of | |||
<code>{x:Number,y:Number}</code>. The DOM values are relative to the network container. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>DOMtoCanvas({<br> <code><i>x: Number</i></code>,<br> <code><i>y: | |||
Number</i></code><br>}) | |||
</td> | |||
<td class="mid">Object</td> | |||
<td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of | |||
<code>{x:Number,y:Number}</code>. The DOM values are relative to the network container. | |||
</td> | |||
</tr> | |||
</table> | |||
<h3>Events</h3> | |||
<p>This is a list of all the events in the public API. They are collected here from all individual modules.</p> | |||
<table> | |||
<tr class="header"> | |||
<td class="eventName">name</td> | |||
<td class="eventProperties">properties</td> | |||
<td>description</td> | |||
</tr> | |||
<tr> | |||
<td>resize</td> | |||
<td class="mid"> | |||
<pre class="code"> | |||
{ | |||
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 | |||
} | |||
</pre> | |||
<ul> | |||
</ul> | |||
</td> | |||
<td>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. | |||
</td> | |||
</tr> | |||
</table> | |||
<br/> | |||
<br/> | |||
<br/> | |||
<br/> | |||
<br/> | |||
<br/> | |||
<br/> | |||
</div> | |||
<!-- Bootstrap core JavaScript | |||
================================================== --> | |||
<!-- Placed at the end of the document so the pages load faster --> | |||
<script src="../js/jquery.min.js"></script> | |||
<script src="../js/bootstrap.min.js"></script> | |||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | |||
<script src="../js/ie10-viewport-bug-workaround.js"></script> |
@ -1,182 +0,0 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"><head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<meta name="description" content=""> | |||
<meta name="author" content=""> | |||
<link rel="icon" HREF="favicon.ico"> | |||
<title>vis.js - A dynamic, browser based visualization library.</title> | |||
<!-- Bootstrap core CSS --> | |||
<link href="../css/bootstrap.css" rel="stylesheet"> | |||
<link href="../css/newdocs.css" rel="stylesheet"> | |||
<link href="../css/prettify.css" type="text/css" rel="stylesheet" /> | |||
<script type="text/javascript" src="../js/googleAnalytics.js"></script> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |||
<!--[if lt IE 9]> | |||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
<![endif]--> | |||
<script src="../js/smooth-scroll.min.js"></script> | |||
<script language="JavaScript"> | |||
smoothScroll.init(); | |||
</script> | |||
<style> | |||
td.properties { | |||
width:350px; | |||
} | |||
td.name { | |||
width:180px; | |||
} | |||
</style> | |||
</head> | |||
<!-- NAVBAR | |||
================================================== --> | |||
<body onload="prettyPrint();"> | |||
<div class="navbar-wrapper"> | |||
<div class="container"> | |||
<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> | |||
<div class="container"> | |||
<div class="navbar-header"> | |||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> | |||
<span class="sr-only">Toggle navigation</span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
</button> | |||
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a> | |||
</div> | |||
<div id="navbar" class="navbar-collapse collapse"> | |||
<ul class="nav navbar-nav"> | |||
<li><a href="../index.html#modules">Modules</a></li> | |||
<li><a href="../blog.html">Blog</a></li> | |||
<li><a href="../index.html#download_install">Download</a></li> | |||
<li><a href="../showcase/index.html">Showcase</a></li> | |||
<li><a href="../index.html#contribute">Contribute</a></li> | |||
<li><a href="../featureRequests.html">Feature requests</a></li> | |||
<li><a href="../index.html#licenses">License</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</nav> | |||
</div> | |||
</div> | |||
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | |||
<div class="container full"> | |||
<h1>Network - clustering</h1> | |||
<p>Handles the HTML part of the canvas.</p> | |||
<h3>Options</h3> | |||
<p>Clustering has no options, everything is done with methods.</p> | |||
<h3>Methods</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td class="name">name</td><td>returns</td><td>description</td></tr> | |||
<tr><td>findNode(<br> | |||
<code>String nodeId</code><br>)</td> <td class="mid">Array</td> <td>Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of nodeIds showing where the node is. Example: <br> | |||
cluster 'A' contains cluster 'B',<br> | |||
cluster 'B' contains cluster 'C',<br> | |||
cluster 'C' contains node 'fred'.<br> | |||
<code>network.clustering.findNode('fred')</code> will return <code>['A','B','C','fred']</code>. | |||
</td></tr> | |||
<tr><td>isCluster(<br> | |||
<code>String nodeId</code><br>)</td> <td class="mid">Boolean</td> <td>Returns true if the node whose ID has been supplied is a cluster.</td></tr> | |||
<tr><td>openCluster(<br> | |||
<code>String nodeId</code><br>)</td> <td class="mid">none</td> <td>Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster edges.</td></tr> | |||
<tr><td>cluster(<br> | |||
<code>Object options</code><br>)</td> <td class="mid">none</td> <td>The options object is explained in full <a data-scroll="" data-options="{ "easing": "easeInCubic" }" href="#optionsObject">below</a>. The joinCondition function is presented with all nodes.</td></tr> | |||
<tr><td>clusterByConnection(<br> | |||
<code>String nodeId</code>,<br> | |||
<code>[Object options]</code><br> | |||
)</td> <td class="mid">none</td> <td>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 <a data-scroll="" data-options="{ "easing": "easeInCubic" }" href="#optionsObject">below</a>. The joinCondition is only presented with the connected nodes.</td></tr> | |||
<tr><td>clusterByHubsize(<br> | |||
<code>Number hubsize</code>,<br> | |||
<code>[Object options]</code><br>)</td><td class="mid">none</td> <td>This method checks all nodes in the network and those with a equal or higher amount of edges than specified with the <code>hubsize</code> qualify. Cluster by connection is performed on each of them. The options object is described for <code>clusterByConnection</code> and does the same here.</td></tr> | |||
<tr><td>clusterOutliers(<br> | |||
<code>[Object options]</code><br>)</td><td class="mid">none</td> <td>This method will cluster all nodes with 1 edge with their respective connected node.</td></tr> | |||
</table> | |||
<br> | |||
<h4 id="optionsObject">Cluster options object</h4> | |||
<p>The options object supplied to the cluster functions can contain these properties:</p> | |||
<table> | |||
<tr class="header"><td class="name">name</td><td>Type</td><td>description</td></tr> | |||
<tr><td>joinCondition(<br> <code>Object nodeOptions</code><br>)</td> <td class="mid">Function</td> | |||
<td><i>Optional for all but the cluster method. </i> 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: | |||
<pre class="prettyprint lang-js"> | |||
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); | |||
</pre></td></tr> | |||
<tr><td>processProperties(<br> <code>Object nodeOptions</code><br>)</td> <td class="mid">Function</td> <td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with the properties supplied by you (<code>clusterNodeProperties</code>), 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: | |||
<pre class="prettyprint lang-js"> | |||
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; | |||
}, | |||
} | |||
</pre></td></tr> | |||
<tr><td>clusterNodeProperties</td> <td class="mid">Object</td> <td><i>Optional. </i> This is an object containing the options for the cluster node. All options described in the <a href="./nodes.html">nodes module</a> 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.</td></tr> | |||
<tr><td>clusterEdgeProperties</td> <td class="mid">Object</td> <td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster. All options described in the <a href="./edges.html">edges module</a> 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.</td></tr> | |||
</table> | |||
<p> | |||
</p> | |||
<br><br> | |||
<h3>Events</h3> | |||
<p>The clustering module does not have any events.</p> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
</div> | |||
<!-- Bootstrap core JavaScript | |||
================================================== --> | |||
<!-- Placed at the end of the document so the pages load faster --> | |||
<script src="../js/jquery.min.js"></script> | |||
<script src="../js/bootstrap.min.js"></script> | |||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | |||
<script src="../js/ie10-viewport-bug-workaround.js"></script> |
@ -1,127 +0,0 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"><head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<meta name="description" content=""> | |||
<meta name="author" content=""> | |||
<link rel="icon" HREF="favicon.ico"> | |||
<title>vis.js - A dynamic, browser based visualization library.</title> | |||
<!-- Bootstrap core CSS --> | |||
<link href="../css/bootstrap.css" rel="stylesheet"> | |||
<link href="../css/newdocs.css" rel="stylesheet"> | |||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |||
<!--[if lt IE 9]> | |||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
<![endif]--> | |||
<link href="../css/prettify.css" type="text/css" rel="stylesheet"/> | |||
<script type="text/javascript" src="../js/googleAnalytics.js"></script> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<script src="../js/smooth-scroll.min.js"></script> | |||
<script language="JavaScript"> | |||
smoothScroll.init(); | |||
</script> | |||
<script type="text/javascript" src="../js/toggleTable.js"></script> | |||
</head> | |||
<body onload="prettyPrint();"> | |||
<div class="navbar-wrapper"> | |||
<div class="container"> | |||
<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> | |||
<div class="container"> | |||
<div class="navbar-header"> | |||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" | |||
aria-expanded="false" aria-controls="navbar"> | |||
<span class="sr-only">Toggle navigation</span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
</button> | |||
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a> | |||
</div> | |||
<div id="navbar" class="navbar-collapse collapse"> | |||
<ul class="nav navbar-nav"> | |||
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li> | |||
<li><a href="http://www.visjs.org/blog.html">Blog</a></li> | |||
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li> | |||
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li> | |||
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li> | |||
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li> | |||
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</nav> | |||
</div> | |||
</div> | |||
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | |||
<div class="container full"> | |||
<h1>Network - rendering</h1> | |||
<p>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.</p> | |||
<h3>Options</h3> | |||
<p>The options for the rendering have to be contained in an object titled 'rendering'.</p> | |||
<p>Click on the options shown to show how these options are supposed to be used.</p> | |||
<ul class="nav nav-tabs"> | |||
<li role="presentation" class="active" onclick="hideOptions('fullTab','fullOptions');" id="hiddenTab"><a href="#">options hidden</a></li> | |||
<li role="presentation" onclick="toggleTab('fullTab','fullOptions');" id="fullTab"><a href="#">options shown</a></li> | |||
</ul> | |||
<br> | |||
<pre class="prettyprint lang-js options hidden" id="fullOptions"> | |||
var options = { | |||
rendering:{ | |||
hideEdgesOnDrag: true, | |||
hideNodesOnDrag: false | |||
} | |||
} | |||
network.setOptions(options); | |||
</pre> | |||
<p>All of the individual options are explained here:</p> | |||
<table> | |||
<tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr> | |||
<tr><td>hideEdgesOnDrag</td><td class="mid">Boolean</td><td class="mid"><code>false</code></td><td>When true, the edges are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.</td></tr> | |||
<tr><td>hideNodesOnDrag</td><td class="mid">Boolean</td><td class="mid"><code>false</code></td><td>When true, the nodes are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.</td></tr> | |||
</table> | |||
<h3>Methods</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td>name</td><td>returns</td><td>description</td></tr> | |||
<tr><td>redraw()</td><td class="mid">none</td><td>Redraw the network.</td></tr> | |||
</table> | |||
<h3>Events</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr> | |||
<tr><td>initRedraw</td><td class="mid">none</td><td>Fired 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.</td> | |||
<tr><td>beforeDrawing</td><td class="mid"><code>canvas context</code></td><td>Fired 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.</td> | |||
<tr><td>initRedraw</td><td class="mid"><code>canvas context</code></td><td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.</td></tr> | |||
</table> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
</div> | |||
<!-- Bootstrap core JavaScript | |||
================================================== --> | |||
<!-- Placed at the end of the document so the pages load faster --> | |||
<script src="../js/jquery.min.js"></script> | |||
<script src="../js/bootstrap.min.js"></script> | |||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | |||
<script src="../js/ie10-viewport-bug-workaround.js"></script> |
@ -1,135 +0,0 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<meta name="description" content=""> | |||
<meta name="author" content=""> | |||
<link rel="icon" HREF="favicon.ico"> | |||
<title>vis.js - A dynamic, browser based visualization library.</title> | |||
<!-- Bootstrap core CSS --> | |||
<link href="../css/bootstrap.css" rel="stylesheet"> | |||
<link href="../css/newdocs.css" rel="stylesheet"> | |||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |||
<!--[if lt IE 9]> | |||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
<![endif]--> | |||
<link href="../css/prettify.css" type="text/css" rel="stylesheet"/> | |||
<script type="text/javascript" src="../js/googleAnalytics.js"></script> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<script src="../js/smooth-scroll.min.js"></script> | |||
<script language="JavaScript"> | |||
smoothScroll.init(); | |||
</script> | |||
<script type="text/javascript" src="../js/toggleTable.js"></script> | |||
</head> | |||
<body onload="prettyPrint();"> | |||
<div class="navbar-wrapper"> | |||
<div class="container"> | |||
<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> | |||
<div class="container"> | |||
<div class="navbar-header"> | |||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" | |||
aria-expanded="false" aria-controls="navbar"> | |||
<span class="sr-only">Toggle navigation</span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
</button> | |||
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a> | |||
</div> | |||
<div id="navbar" class="navbar-collapse collapse"> | |||
<ul class="nav navbar-nav"> | |||
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li> | |||
<li><a href="http://www.visjs.org/blog.html">Blog</a></li> | |||
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li> | |||
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li> | |||
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li> | |||
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li> | |||
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</nav> | |||
</div> | |||
</div> | |||
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | |||
<div class="container full"> | |||
<h1>Network - selection</h1> | |||
<p>Handles the selection of nodes and edges.</p> | |||
<h3>Options</h3> | |||
<p>The options for the selection have to be contained in an object titled 'selection'.</p> | |||
<p>Click on the options shown to show how these options are supposed to be used.</p> | |||
<ul class="nav nav-tabs"> | |||
<li role="presentation" class="active" onclick="hideOptions('fullTab','fullOptions');" id="hiddenTab"><a href="#">options hidden</a></li> | |||
<li role="presentation" onclick="toggleTab('fullTab','fullOptions');" id="fullTab"><a href="#">options shown</a></li> | |||
</ul> | |||
<br> | |||
<pre class="prettyprint lang-js options hidden" id="fullOptions"> | |||
var options = { | |||
selection:{ | |||
selectable: true, | |||
selectConnectedEdges: false | |||
} | |||
} | |||
network.setOptions(options); | |||
</pre> | |||
<p>All of the individual options are explained here:</p> | |||
<table> | |||
<tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr> | |||
<tr><td>selectable</td> <td class="mid">Boolean</td><td class="mid"><code>true</code></td><td>When true, the nodes and edges can be selected by the user.</td></tr> | |||
<tr><td>selectConnectedEdges</td> <td class="mid">Boolean</td><td class="mid"><code>true</code></td><td>When true, on selecting a node, its connecting edges are highlighted.</td></tr> | |||
</table> | |||
<h3>Methods</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td class="methodName">name</td><td>returns</td><td>description</td></tr> | |||
<tr><td>getSelection()</td> <td class="mid"> | |||
<pre class="code"> | |||
{ | |||
nodes: [Array of selected nodeIds], | |||
edges: [Array of selected edgeIds] | |||
}</pre> </td><td>Returns an object with selected nodes and edges ids.</td></tr> | |||
<tr><td>getSelectedNodes()</td> <td class="mid"><code>[nodeId1, nodeId2, ..]</code></td><td>Returns an array of selected node ids.</td></tr> | |||
<tr><td>getSelectedEdges()</td> <td class="mid"><code>[edgeId1, edgeId2, ..]</code></td><td>Returns an array of selected edge ids.</td></tr> | |||
<tr><td>getNodeAt(<br> <code><i>{x: xPosition DOM,<br> y: yPosition DOM}</i></code><br>)</td> <td class="mid">nodeId</td><td>Returns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas.</td></tr> | |||
<tr><td>getEdgeAt(<br> <code><i>{x: xPosition DOM,<br> y: yPosition DOM}</i></code><br>)</td> <td class="mid">edgeId</code></td><td>Returns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas..</td></tr> | |||
<tr><td>selectNodes(<br> <code><i>Array with nodeIds</i></code>,<br> <code><i>[Boolean highlightEdges]</i></code><br>)</td> <td class="mid">none</td><td>Selects 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. <i>Does not fire events</i>.</td></tr> | |||
<tr><td>selectEdges(<br> <code><i>Array with edgeIds</i></code><br>)</td> <td class="mid">none</td><td>Selects the edges corresponding to the id's in the input array. This method unselects all other objects before selecting its own objects. <i>Does not fire events</i>.</td></tr> | |||
<tr><td>unselectAll()</td> <td class="mid">none</td> <td>Unselect all objects. <i>Does not fire events</i>.</td></tr> | |||
</table> | |||
<h3>Events</h3> | |||
<p>The selection handler does not fire events. All related events are fired by the <a href="./interaction.html">interaction module</a> because they are triggered by user interaction.</p> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
</div> | |||
<!-- Bootstrap core JavaScript | |||
================================================== --> | |||
<!-- Placed at the end of the document so the pages load faster --> | |||
<script src="../js/jquery.min.js"></script> | |||
<script src="../js/bootstrap.min.js"></script> | |||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | |||
<script src="../js/ie10-viewport-bug-workaround.js"></script> |
@ -1,161 +0,0 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"><head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<meta name="description" content=""> | |||
<meta name="author" content=""> | |||
<link rel="icon" HREF="favicon.ico"> | |||
<title>vis.js - A dynamic, browser based visualization library.</title> | |||
<!-- Bootstrap core CSS --> | |||
<link href="../css/bootstrap.css" rel="stylesheet"> | |||
<link href="../css/newdocs.css" rel="stylesheet"> | |||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |||
<!--[if lt IE 9]> | |||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
<![endif]--> | |||
<link href="../css/prettify.css" type="text/css" rel="stylesheet"/> | |||
<script type="text/javascript" src="../js/googleAnalytics.js"></script> | |||
<script type="text/javascript" src="../js/prettify/prettify.js"></script> | |||
<script src="../js/smooth-scroll.min.js"></script> | |||
<script language="JavaScript"> | |||
smoothScroll.init(); | |||
</script> | |||
<script type="text/javascript" src="../js/toggleTable.js"></script> | |||
</head> | |||
<body onload="prettyPrint();"> | |||
<div class="navbar-wrapper"> | |||
<div class="container"> | |||
<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> | |||
<div class="container"> | |||
<div class="navbar-header"> | |||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" | |||
aria-expanded="false" aria-controls="navbar"> | |||
<span class="sr-only">Toggle navigation</span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
<span class="icon-bar"></span> | |||
</button> | |||
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a> | |||
</div> | |||
<div id="navbar" class="navbar-collapse collapse"> | |||
<ul class="nav navbar-nav"> | |||
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li> | |||
<li><a href="http://www.visjs.org/blog.html">Blog</a></li> | |||
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li> | |||
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li> | |||
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li> | |||
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li> | |||
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</nav> | |||
</div> | |||
</div> | |||
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | |||
<div class="container full"> | |||
<h1>Network - view</h1> | |||
<p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p> | |||
<h3>Options</h3> | |||
<p>The view has no options.</p> | |||
<h3>Methods</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td class="methodName">name</td><td>returns</td><td>description</td></tr> | |||
<tr><td>getScale()</td> <td class="mid">Number</td><td>Returns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.</td></tr> | |||
<tr><td>getPosition()</td> <td class="mid">Number</td><td>Returns the current central focus point of the camera.</td></tr> | |||
<tr><td>fit(<code>[Object options]</code>)</td><td class="mid">none</td><td>Zooms out so all nodes fit on the canvas. You can supply options to customize this: | |||
<pre class="code"> | |||
{ | |||
nodes:[Array of nodeIds], | |||
animation: { // -------------------> can be a boolean too! | |||
duration: Number | |||
easingFunction: String | |||
} | |||
} | |||
</pre> | |||
The nodes can be used to zoom to fit only specific nodes in the view. <br /><br /> | |||
The other options are explained in the <code>moveTo()</code> description below. | |||
All options are optional for the fit method. | |||
</td></tr> | |||
<tr><td>focus(<br> | |||
<code>String nodeId</code>,<br> | |||
<code>[Object options]</code><br>)</td><td class="mid">none</td> | |||
<td>You 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: | |||
<pre class="code"> | |||
{ | |||
scale: Number, | |||
offset: {x:Number, y:Number} | |||
locked: boolean | |||
animation: { // -------------------> can be a boolean too! | |||
duration: Number | |||
easingFunction: String | |||
} | |||
} | |||
</pre> | |||
All options except for locked are explained in the <code>moveTo()</code> 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.</td></tr> | |||
<tr><td>moveTo(<code>Object options</code>)</td> <td class="mid">none</td><td>You can animate or move the camera using the moveTo method. Options are: | |||
<pre class="code"> | |||
{ | |||
position: {x:Number, y:Number}, | |||
scale: Number, | |||
offset: {x:Number, y:Number} | |||
animation: { // -------------------> can be a boolean too! | |||
duration: Number | |||
easingFunction: String | |||
} | |||
} | |||
</pre> | |||
The position (in canvas units!) is the position of the central focus point of the camera. <br><br> | |||
The scale is the target zoomlevel. Default value is 1.0. <br><br> | |||
The offset (in DOM units) is how many pixels from the center the view is focussed. Default value is {x:0,y:0}.<br><br> | |||
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: | |||
<code>linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint</code>. <br><br> | |||
<i>You will have to define at least a scale or a position. Otherwise, there is nothing to move to.</i> | |||
</td></tr> | |||
<tr><td>releaseNode()</td><td class="mid">none</td><td>Programatically release the focussed node.</td></tr> | |||
</table> | |||
<h3>Events</h3> | |||
<p>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.</p> | |||
<table> | |||
<tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr> | |||
<tr><td>animationFinished</td><td class="mid">none</td><td>Fired when an animation is finished.</td> | |||
</table> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
<br /> | |||
</div> | |||
<!-- Bootstrap core JavaScript | |||
================================================== --> | |||
<!-- Placed at the end of the document so the pages load faster --> | |||
<script src="../js/jquery.min.js"></script> | |||
<script src="../js/bootstrap.min.js"></script> | |||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | |||
<script src="../js/ie10-viewport-bug-workaround.js"></script> | |||