diff --git a/docs/css/newdocs.css b/docs/css/newdocs.css deleted file mode 100644 index f1989d99..00000000 --- a/docs/css/newdocs.css +++ /dev/null @@ -1,228 +0,0 @@ - -html { - height:100%; -} -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; - /*font-family: Lustria, Georgia, Times, "Times New Roman", serif !important;*/ - font-size:16px; - line-height: 1.5em; - background: url('../img/crosswordStrong.png') /* Background pattern from subtlepatterns.com */ -} - - -h1, h2, h3, h4, h5, h6 { - margin: 40px 0 20px 0; -} - -ul { - margin-top: 0.7em; - margin-bottom: 0.7em; -} - -p { - margin: 20px 0; -} - -img.icon { - position:relative; - top:-2px; -} - - -div.navbar-wrapper { - background-color:#07508E; - border-bottom: 3px solid #ffffff; - font-size:16px; -} - -div.blogHeader { - margin-left:auto; - margin-right:auto; - text-align:center; - width:910px; - padding: 0px 30px 0px 30px; - margin-top:-150px; - color:#ffffff; - text-shadow: 1px 1px 3px rgba(0, 0, 0, 1); - margin-bottom:60px; - -} - -div.full { - min-height:100%; - box-shadow:0 2px 10px rgba(0,0,0,0.4); - padding: 20px 10px 40px 10px; - background-color:#ffffff; -} - -@media (min-width: 768px) { - div.full { - padding: 40px 40px 80px 40px; - } -} - -@media (min-width: 992px) { - div.full { - padding: 80px 80px 160px 80px; - } -} - -table.moduleTable { -} - -table.moduleTable th, -table.moduleTable td { - padding: 5px 15px; - border: 1px solid #dddddd; -} - - -table.moduleTable th { - background-color: #f5f5f5; -} - -table.moduleTable td { - vertical-align: top; -} - - -/* TODO: cleanup */ -/*tr.header {*/ - /*color: #1f3350;*/ - /*background-color: #cccccc;*/ - /*border-bottom:1px solid #999999 !important;*/ - /*font-size:16px;*/ - /*font-style:italic;*/ -/*}*/ - -td.mid { - background-color: #f5f5f5; - - font-style:italic; -} - -/*td.properties {*/ - /*width:150px;*/ -/*}*/ - -/*p {*/ - /*max-width:1000px;*/ -/*}*/ - - -/*pre.code {*/ - /*padding:2px 4px;*/ - /*font-size:90%;*/ - /*color: #444444;*/ - /*background-color:#f9f2f4;*/ - /*border-radius:4px;*/ - /*border:0;*/ -/*}*/ - -pre { - margin: 20px 0; -} - -/*pre.top {*/ - /*margin-left:20px;*/ -/*}*/ - -tr.hidden { - max-height:0; - /*max-height: 0;*/ - overflow: hidden; -} - -tr.visible { - /* Set our transitions up. */ - -webkit-animation: - fadeIn 250ms ease-in; -} - - -@-webkit-keyframes fadeIn { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - - -span.caret { - opacity: 0.5; -} - -span.right-caret { - border-bottom: 4px solid transparent; - border-top: 4px solid transparent; - border-left: 4px solid #000000; - display: inline-block; - height: 0; - opacity: 0.5; - vertical-align: top; - width: 0; - margin-left:5px; - margin-top:6px; -} - -tr.toggle { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - cursor:pointer; -} - - - -tr.toggle.collapsible { - background-color: #f5f5f5; - border-left: 3px solid #89b3ff; -} - -td.indent { - padding-left:25px !important; -} - - -td.indent2 { - padding-left:50px !important; -} - -/* TODO: cleanup */ -/*td.name {*/ - /*width:230px;*/ -/*}*/ - -/*td.nameSmall {*/ - /*width:150px;*/ -/*}*/ - -/*td.type {*/ - /*width: 110px;*/ -/*}*/ - -/*td.default {*/ - /*width:60px;*/ -/*}*/ - -/*td.eventProperties {*/ - /*width:150px;*/ -/*}*/ - -/*td.methodName {*/ - /*width:250px;*/ -/*}*/ - -pre.options { - max-width:600px; -} - -pre.hidden { - display:none; -} \ No newline at end of file diff --git a/docs/css/old_style.css b/docs/css/old_style.css new file mode 100644 index 00000000..d9382b0d --- /dev/null +++ b/docs/css/old_style.css @@ -0,0 +1,83 @@ +html, body { + width: 100%; + height: 100%; + padding: 0; + margin: 0; +} + +body, td, th { + font-family: arial, sans-serif; + font-size: 11pt; + color: #4D4D4D; + line-height: 1.7em; +} + +#container { + position: relative; + margin: 0 auto; + padding: 10px 10px 50px 10px; + width: 970px; + max-width: 100%; + box-sizing: border-box; +} + +h1 { + font-size: 180%; + font-weight: bold; + padding: 0; + margin: 1em 0 1em 0; +} + +h2 { + padding-top: 20px; + padding-bottom: 10px; + border-bottom: 1px solid #e0e0e0; + color: #064880; +} + +h3 { + font-size: 140%; +} + +a > img { + border: none; +} + +a { + color: #064880; + text-decoration: none; +} + +a:visited { + color: #064880; + text-decoration: none; +} + +a:hover { + color: red; + text-decoration: underline; +} + +table { + border-collapse: collapse; +} + +th { + font-weight: bold; + border: 1px solid lightgray; + background-color: #E5E5E5; + text-align: left; + vertical-align: top; + padding: 5px; +} + +td { + border: 1px solid lightgray; + padding: 5px; + vertical-align: top; +} + +p.important_note { + color: #3a6baa; + font-weight:bold; +} \ No newline at end of file diff --git a/docs/css/style.css b/docs/css/style.css index d9382b0d..a91d3468 100644 --- a/docs/css/style.css +++ b/docs/css/style.css @@ -1,83 +1,193 @@ -html, body { - width: 100%; - height: 100%; - padding: 0; - margin: 0; + +html { + height:100%; +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; + /*font-family: Lustria, Georgia, Times, "Times New Roman", serif !important;*/ + font-size:16px; + line-height: 1.5em; + background: url('../img/crosswordStrong.png') /* Background pattern from subtlepatterns.com */ } -body, td, th { - font-family: arial, sans-serif; - font-size: 11pt; - color: #4D4D4D; - line-height: 1.7em; + +h1, h2, h3, h4, h5, h6 { + margin: 40px 0 20px 0; } -#container { - position: relative; - margin: 0 auto; - padding: 10px 10px 50px 10px; - width: 970px; - max-width: 100%; - box-sizing: border-box; +ul { + margin-top: 0.7em; + margin-bottom: 0.7em; } -h1 { - font-size: 180%; - font-weight: bold; - padding: 0; - margin: 1em 0 1em 0; +p { + margin: 20px 0; } -h2 { - padding-top: 20px; - padding-bottom: 10px; - border-bottom: 1px solid #e0e0e0; - color: #064880; +img.icon { + position:relative; + top:-2px; } -h3 { - font-size: 140%; + +div.navbar-wrapper { + background-color:#07508E; + border-bottom: 3px solid #ffffff; + font-size:16px; } -a > img { - border: none; +div.blogHeader { + margin-left:auto; + margin-right:auto; + text-align:center; + width:910px; + padding: 0px 30px 0px 30px; + margin-top:-150px; + color:#ffffff; + text-shadow: 1px 1px 3px rgba(0, 0, 0, 1); + margin-bottom:60px; + } -a { - color: #064880; - text-decoration: none; +div.full { + min-height:100%; + box-shadow:0 2px 10px rgba(0,0,0,0.4); + padding: 20px 10px 40px 10px; + background-color:#ffffff; } -a:visited { - color: #064880; - text-decoration: none; +@media (min-width: 768px) { + div.full { + padding: 40px 40px 80px 40px; + } } -a:hover { - color: red; - text-decoration: underline; +@media (min-width: 992px) { + div.full { + padding: 80px 80px 160px 80px; + } } table { - border-collapse: collapse; } -th { - font-weight: bold; - border: 1px solid lightgray; - background-color: #E5E5E5; - text-align: left; - vertical-align: top; - padding: 5px; +table th, +table td { + padding: 5px 15px; + border: 1px solid #dddddd; +} + + +table th { + background-color: #f5f5f5; +} + +table td { + vertical-align: top; +} + +/* +The following tables are used: +- A table 'properties' with data properties. Columns: Name, Type, Required, Description +- A table 'options' with configuration options. Columns: Name, Type, Default, Description +- A table 'methods' with methods. Columns: Method, Return Type, Description +- A table 'events' with events. Columns: Name, Properties, Description +- A table 'styles' with styles. Columns: Description, Values +- A table 'datatypes' with data types. Columns: Name, Description, Examples +*/ +table.properties td:nth-child(2), +table.properties td:nth-child(3), +table.options td:nth-child(2), +table.options td:nth-child(3), +table.methods td:nth-child(2), +table.methods td:nth-child(2), +table.events td:nth-child(2) { + background-color: #f5f5f5; + font-style: italic; +} + +pre { + margin: 20px 0; +} + +a code { + text-decoration: underline; +} + +/*pre.top {*/ + /*margin-left:20px;*/ +/*}*/ + +tr.hidden { + max-height:0; + /*max-height: 0;*/ + overflow: hidden; +} + +tr.visible { + /* Set our transitions up. */ + -webkit-animation: + fadeIn 250ms ease-in; +} + + +@-webkit-keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + + +span.caret { + opacity: 0.5; +} + +span.right-caret { + border-bottom: 4px solid transparent; + border-top: 4px solid transparent; + border-left: 4px solid #000000; + display: inline-block; + height: 0; + opacity: 0.5; + vertical-align: top; + width: 0; + margin-left:5px; + margin-top:6px; +} + +tr.toggle { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor:pointer; +} + + + +tr.toggle.collapsible { + background-color: #f5f5f5; + border-left: 3px solid #89b3ff; +} + +td.indent { + padding-left:25px !important; +} + + +td.indent2 { + padding-left:50px !important; } -td { - border: 1px solid lightgray; - padding: 5px; - vertical-align: top; +pre.options { + max-width:600px; } -p.important_note { - color: #3a6baa; - font-weight:bold; +pre.hidden { + display:none; } \ No newline at end of file diff --git a/docs/dataset/dataset.html b/docs/dataset/dataset.html new file mode 100644 index 00000000..c2d0c674 --- /dev/null +++ b/docs/dataset/dataset.html @@ -0,0 +1,1002 @@ + +
+ + + + + + ++ 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. +
+ + ++ The following example shows how to use a DataSet. +
+ ++// create a DataSet +var options = {}; +var data = new vis.DataSet(options); + +// add items +// note that the data items can contain different properties and data formats +data.add([ + {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true}, + {id: 2, text: 'item 2', date: '2013-06-23', group: 2}, + {id: 3, text: 'item 3', date: '2013-06-25', group: 2}, + {id: 4, text: 'item 4'} +]); + +// subscribe to any change in the DataSet +data.on('*', function (event, properties, senderId) { + console.log('event', event, properties); +}); + +// update an existing item +data.update({id: 2, group: 1}); + +// remove an item +data.remove(4); + +// get all ids +var ids = data.getIds(); +console.log('ids', ids); + +// get a specific item +var item1 = data.get(1); +console.log('item1', item1); + +// retrieve a filtered subset of the data +var items = data.get({ + filter: function (item) { + return item.group == 1; + } +}); +console.log('filtered items', items); + +// retrieve formatted items +var items = data.get({ + fields: ['id', 'date'], + type: { + date: 'ISODate' + } +}); +console.log('formatted items', items); ++ + + +
+ A DataSet can be constructed as: +
+ ++var data = new vis.DataSet([data] [, options]) ++ +
+ After construction, data can be added to the DataSet using the methods
+ add
and update
, as described in section
+ Data Manipulation.
+
+ The parameter data
is optional and is an Array with items.
+
+ The parameter options
is optional and is an object which can
+ contain the following properties:
+
Name | +Type | +Default value | +Description | +
---|---|---|---|
fieldId | +String | +"id" | +
+ The name of the field containing the id of the items.
+
+ When data is fetched from a server which uses some specific
+ field to identify items, this field name can be specified
+ in the DataSet using the option fieldId .
+ For example CouchDB uses the field
+ "_id" to identify documents.
+ |
+
type | +Object.<String, String> | +none | ++ An object containing field names as key, and data types as + value. By default, the type of the properties of items are left + unchanged. Item properties can be normalized by specifying a + field type. This is useful for example to automatically convert + stringified dates coming from a server into JavaScript Date + objects. The available data types are listed in section + Data Types. + | +
queue | +Object | boolean | +none | +
+ Queue data changes ('add', 'update', 'remove') and flush them at once.
+ The queue can be flushed manually by calling
+ DataSet.flush() , or can be flushed after a configured delay
+ or maximum number of entries.
+ + + When queue is true, a queue is created
+ with default options. Options can be specified by providing an object:
+
|
+
DataSet contains the following methods.
+ +Method | +Return Type | +Description | +
---|---|---|
add(data [, senderId]) | +Number[] | +Add one or multiple items to the DataSet. data can be a single item or an array with items. Adding an item will fail when there already is an item with the same id. The function returns an array with the ids of the added items. See section Data Manipulation. |
+
clear([senderId]) | +Number[] | +Clear all data from the DataSet. The function returns an array with the ids of the removed items. | +
distinct(field) | +Array | +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. | +
flush() | +none | +Flush queued changes. Only available when the DataSet is configured with the option queue , see section Construction. |
+
forEach(callback [, options]) | +none | ++ Execute a callback function for every item in the dataset. + The available options are described in section Data Selection. + | +
+ get([options] [, data]) + get(id [,options] [, data]) + get(ids [, options] [, data]) + |
+ Object | Array | +
+ Get a single item, multiple items, or all items from the DataSet.
+ Usage examples can be found in section Getting Data, and the available options are described in section Data Selection.
+ |
+
+ getDataSet() + | +DataSet | ++ Get the DataSet itself. In case of a DataView, this function does not + return the DataSet to which the DataView is connected. + | +
+ getIds([options]) + | +Number[] | +
+ Get ids of all items or of a filtered set of items.
+ Available options are described in section Data Selection, except that options fields and type are not applicable in case of getIds .
+ |
+
map(callback [, options]) | +Array | ++ Map every item in the DataSet. + The available options are described in section Data Selection. + | +
max(field) | +Object | null | +
+ Find the item with maximum value of specified field. Returns null if no item is found.
+ |
+
min(field) | +Object | null | +
+ Find the item with minimum value of specified field. Returns null if no item is found.
+ |
+
off(event, callback) | +none | ++ Unsubscribe from an event, remove an event listener. See section Subscriptions. + | +
on(event, callback) | +none | ++ Subscribe to an event, add an event listener. See section Subscriptions. + | +
+ remove(id [, senderId]) + remove(ids [, senderId]) + |
+ Number[] | ++ Remove one or multiple items by id or by the items themselves. Returns an array with the ids of the removed items. See section Data Manipulation. + | +
+ setOptions(options) + | +none | +
+ Set options for the DataSet. Available options:
+
+
|
+
+ update(data [, senderId]) + | +Number[] | +
+ Update on ore multiple existing items. data can be a single item or an array with items. When an item doesn't exist, it will be created. Returns an array with the ids of the removed items. See section Data Manipulation.
+ |
+
DataSet contains the following properties.
+ +Property | +Type | +Description | +
---|---|---|
length | +Number | +The number of items in the DataSet. | +
+ One can subscribe on changes in a DataSet.
+ A subscription can be created using the method on
,
+ and removed with off
.
+
+// create a DataSet +var data = new vis.DataSet(); + +// subscribe to any change in the DataSet +data.on('*', function (event, properties, senderId) { + console.log('event:', event, 'properties:', properties, 'senderId:', senderId); +}); + +// add an item +data.add({id: 1, text: 'item 1'}); // triggers an 'add' event +data.update({id: 1, text: 'item 1 (updated)'}); // triggers an 'update' event +data.remove(1); // triggers an 'remove' event ++ + +
+ Subscribe to an event. +
+ + Syntax: +DataSet.on(event, callback)+ + Where: +
event
is a String containing any of the events listed
+ in section Events.
+ callback
is a callback function which will be called
+ each time the event occurs. The callback function is described in
+ section Callback.
+ + Unsubscribe from an event. +
+ + Syntax: +DataSet.off(event, callback)+ + Where
event
and callback
correspond with the
+ parameters used to subscribe to the event.
+
+ + The following events are available for subscription: +
+ +Event | +Description | +
---|---|
add | +
+ The add event is triggered when an item
+ or a set of items is added, or when an item is updated while
+ not yet existing.
+ |
+
update | +
+ The update event is triggered when an existing item
+ or a set of existing items is updated.
+ |
+
remove | +
+ The remove event is triggered when an item
+ or a set of items is removed.
+ |
+
* | +
+ The * event is triggered when any of the events
+ add , update , and remove
+ occurs.
+ |
+
+ The callback functions of subscribers are called with the following + parameters: +
+ ++function (event, properties, senderId) { + // handle the event +}); ++ +
+ where the parameters are defined as +
+ +Parameter | +Type | +Description | +
---|---|---|
event | +String | +
+ Any of the available events: add ,
+ update , or remove .
+ |
+
properties | +Object | null | +
+ Optional properties providing more information on the event.
+ In case of the events add ,
+ update , and remove ,
+ properties is always an object containing a property
+ items , which contains an array with the ids of the affected
+ items. The update event has an extra field data
+ containing the original data of the updated items, i.e. the gives the
+ changed fields of the changed items.
+ |
+
senderId | +String | Number | +
+ An senderId, optionally provided by the application code
+ which triggered the event. If senderId is not provided, the
+ argument will be null .
+ |
+
+ The data in a DataSet can be manipulated using the methods
+ add
,
+ update
,
+ and remove
.
+ The DataSet can be emptied using the method
+ clear
.
+
+// create a DataSet +var data = new vis.DataSet(); + +// add items +data.add([ + {id: 1, text: 'item 1'}, + {id: 2, text: 'item 2'}, + {id: 3, text: 'item 3'} +]); + +// update an item +data.update({id: 2, text: 'item 2 (updated)'}); + +// remove an item +data.remove(3); ++ +
+ Add a data item or an array with items. +
+ + Syntax: +var addedIds = DataSet.add(data [, senderId])+ + The argument
data
can contain:
+ Object
containing a single item to be
+ added. The item must contain an id.
+ Array
containing a list with items to be added. Each item must contain an id.
+
+ After the items are added to the DataSet, the DataSet will
+ trigger an event add
. When a senderId
+ is provided, this id will be passed with the triggered
+ event to all subscribers.
+
+ The method will throw an Error when an item with the same id + as any of the added items already exists. +
+ ++ Update a data item or an array with items. +
+ + Syntax: +var updatedIds = DataSet.update(data [, senderId])+ + The argument
data
can contain:
+ Object
containing a single item to be
+ updated. The item must contain an id.
+ Array
containing a list with items to be updated. Each item must contain an id.
+ + The provided properties will be merged in the existing item. + When an item does not exist, it will be created. +
+ +
+ After the items are updated, the DataSet will
+ trigger an event add
for the added items, and
+ an event update
. When a senderId
+ is provided, this id will be passed with the triggered
+ event to all subscribers.
+
+ Remove a data item or an array with items. +
+ + Syntax: +var removedIds = DataSet.remove(id [, senderId])+ +
+ The argument id
can be:
+
Number
or String
containing the id
+ of a single item to be removed.
+ Object
containing the item to be deleted.
+ The item will be deleted by its id.
+ + The method ignores removal of non-existing items, and returns an array + containing the ids of the items which are actually removed from the + DataSet. +
+ +
+ After the items are removed, the DataSet will
+ trigger an event remove
for the removed items.
+ When a senderId
is provided, this id will be passed with
+ the triggered event to all subscribers.
+
+ Clear the complete DataSet. +
+ + Syntax: +var removedIds = DataSet.clear([senderId])+ +
+ After the items are removed, the DataSet will
+ trigger an event remove
for all removed items.
+ When a senderId
is provided, this id will be passed with
+ the triggered event to all subscribers.
+
+ The DataSet contains functionality to format, filter, and sort data retrieved via the
+ methods get
, getIds
, forEach
, and map
. These methods have the following syntax:
+
+DataSet.get([id] [, options]); +DataSet.getIds([options]); +DataSet.forEach(callback [, options]); +DataSet.map(callback [, options]); ++ +
+ Where options
is an Object which can have the following
+ properties:
+
Name | +Type | +Required | +Description | +
---|---|---|---|
fields | +String[ ] | Object.<String, String> | +no | +
+ An array with field names, or an object with current field name and
+ new field name that the field is returned as.
+ By default, all properties of the items are emitted.
+ When fields is defined, only the properties
+ whose name is specified in fields will be included
+ in the returned items.
+ |
+
type | +Object.<String, String> | +no | ++ An object containing field names as key, and data types as value. + By default, the type of the properties of an item are left + unchanged. When a field type is specified, this field in the + items will be converted to the specified type. This can be used + for example to convert ISO strings containing a date to a + JavaScript Date object, or convert strings to numbers or vice + versa. The available data types are listed in section + Data Types. + | +
filter | +Function | +no | +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 Data Filtering. | +
order | +String | Function | +no | +Order the items by a field name or custom sort function. | +
returnType | +String | +no | +Determine the type of output of the get function. Allowed values are 'Array' | 'Object' .
+ The default returnType is an Array. The Object type will return a JSON object with the ID's as keys. |
+
+ The following example demonstrates formatting properties and filtering + properties from items. +
+ ++// create a DataSet +var data = new vis.DataSet(); +data.add([ + {id: 1, text: 'item 1', date: '2013-06-20', group: 1, first: true}, + {id: 2, text: 'item 2', date: '2013-06-23', group: 2}, + {id: 3, text: 'item 3', date: '2013-06-25', group: 2}, + {id: 4, text: 'item 4'} +]); + +// retrieve formatted items +var items = data.get({ + fields: ['id', 'date', 'group'], // output the specified fields only + type: { + date: 'Date', // convert the date fields to Date objects + group: 'String' // convert the group fields to Strings + } +}); ++ +
+ Data can be retrieved from the DataSet using the method get
.
+ This method can return a single item or a list with items.
+
A single item can be retrieved by its id:
+ ++var item1 = dataset.get(1); ++ +
A selection of items can be retrieved by providing an array with ids:
+ ++var items = dataset.get([1, 3, 4]); // retrieve items 1, 3, and 4 ++ +
All items can be retrieved by simply calling get
without
+ specifying an id:
+var items = dataset.get(); // retrieve all items ++ + +
+ Items can be filtered on specific properties by providing a filter + function. A filter function is executed for each of the items in the + DataSet, and is called with the item as parameter. The function must + return a boolean. All items for which the filter function returns + true will be emitted. +
+ ++// retrieve all items having a property group with value 2 +var group2 = dataset.get({ + filter: function (item) { + return (item.group == 2); + } +}); + +// retrieve all items having a property balance with a value above zero +var positiveBalance = dataset.get({ + filter: function (item) { + return (item.balance > 0); + } +}); + ++ + +
+ DataSet supports the following data types: +
+ +Name | +Description | +Examples | +
---|---|---|
Boolean | +A JavaScript Boolean | +
+ true + false
+ |
+
Number | +A JavaScript Number | +
+ 32 + 2.4
+ |
+
String | +A JavaScript String | +
+ "hello world" + "2013-06-28"
+ |
+
Date | +A JavaScript Date object | +
+ new Date() + new Date(2013, 5, 28) + new Date(1372370400000)
+ |
+
Moment | +A Moment object, created with + moment.js | +
+ moment() + moment('2013-06-28')
+ |
+
ISODate | +A string containing an ISO Date | +
+ new Date().toISOString() + "2013-06-27T22:00:00.000Z"
+ |
+
ASPDate | +A string containing an ASP Date | +
+ "/Date(1372370400000)/" + "/Date(1198908717056-0700)/"
+ |
+
+ A DataView offers a filtered and/or formatted view on a + DataSet. + One can subscribe on changes in a DataView, and easily get filtered or + formatted data without having to specify filters and field types all + the time. +
+ ++ The following example shows how to use a DataView. +
+ ++// create a DataSet +var data = new vis.DataSet(); +data.add([ + {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true}, + {id: 2, text: 'item 2', date: '2013-06-23', group: 2}, + {id: 3, text: 'item 3', date: '2013-06-25', group: 2}, + {id: 4, text: 'item 4'} +]); + +// create a DataView +// the view will only contain items having a property group with value 1, +// and will only output fields id, text, and date. +var view = new vis.DataView(data, { + filter: function (item) { + return (item.group == 1); + }, + fields: ['id', 'text', 'date'] +}); + +// subscribe to any change in the DataView +view.on('*', function (event, properties, senderId) { + console.log('event', event, properties); +}); + +// update an item in the data set +data.update({id: 2, group: 1}); + +// get all ids in the view +var ids = view.getIds(); +console.log('ids', ids); // will output [1, 2] + +// get all items in the view +var items = view.get(); ++ +
+ A DataView can be constructed as: +
+ ++var data = new vis.DataView(dataset, options) ++ +
+ where: +
+ +dataset
is a DataSet or DataView.
+ options
is an object which can
+ contain the following properties. Note that these properties
+ are exactly the same as the properties available in methods
+ DataSet.get
and DataView.get
.
+
+ Name | +Type | +Default | +Description | +
---|---|---|---|
convert | +Object.<String, String> | +none | ++ An object containing field names as key, and data types as value. + By default, the type of the properties of an item are left + unchanged. When a field type is specified, this field in the + items will be converted to the specified type. This can be used + for example to convert ISO strings containing a date to a + JavaScript Date object, or convert strings to numbers or vice + versa. The available data types are listed in section + Data Types. + | +
fields | +String[ ] | Object.<String, String> | +none | +
+ An array with field names, or an object with current field name and
+ new field name that the field is returned as.
+ By default, all properties of the items are emitted.
+ When fields is defined, only the properties
+ whose name is specified in fields will be included
+ in the returned items.
+ |
+
filter | +function | +none | +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 Data Filtering. | +
DataView contains the following methods.
+ +Method | +Return Type | +Description | +
---|---|---|
+ get([options] [, data]) + get(id [,options] [, data]) + get(ids [, options] [, data]) + |
+ Object | Array | +
+ Get a single item, multiple items, or all items from the DataView.
+ Usage examples can be found in section Getting Data, and the available options are described in section Data Selection.
+ |
+
+ getDataSet() + | +DataSet | ++ Get the DataSet to which the DataView is connected. + | +
+ getIds([options]) + | +Number[] | +
+ Get ids of all items or of a filtered set of items.
+ Available options are described in section Data Selection, except that options fields and type are not applicable in case of getIds .
+ |
+
off(event, callback) | +none | ++ Unsubscribe from an event, remove an event listener. See section Subscriptions. + | +
on(event, callback) | +none | ++ Subscribe to an event, add an event listener. See section Subscriptions. + | +
refresh() | +none | +
+ Refresh the filter results of a DataView. Useful when the filter function contains dynamic properties, like:
+
+ var data = new vis.DataSet(...); +var view = new vis.DataView(data, { + filter: function (item) { + return item.value > threshold; + } +});+ In this example, threshold is an external parameter. When the value of threshold changes, the DataView must be notified that the filter results may have changed by calling DataView.refresh() .
+ |
+
+ setDataSet(data) + | +none | +
+ Replace the DataSet of the DataView. Parameter data can be a DataSet or a DataView.
+ |
+
DataView contains the following properties.
+ +Property | +Type | +Description | +
---|---|---|
length | +Number | +The number of items in the DataView. | +
+ Data of the DataView can be retrieved using the method get
.
+
+var items = view.get(); ++ +
+ Data of a DataView can be filtered and formatted again, in exactly the + same way as in a DataSet. See sections + Data Manipulation and + Data Selection for more + information. +
+ ++var items = view.get({ + fields: ['id', 'score'], + filter: function (item) { + return (item.score > 50); + } +}); ++ + + +
+ One can subscribe on changes in the DataView. Subscription works exactly + the same as for DataSets. See the documentation on + subscriptions in a DataSet + for more information. +
+ ++// create a DataSet and a view on the data set +var data = new vis.DataSet(); +var view = new vis.DataView({ + filter: function (item) { + return (item.group == 2); + } +}); + +// subscribe to any change in the DataView +view.on('*', function (event, properties, senderId) { + console.log('event:', event, 'properties:', properties, 'senderId:', senderId); +}); + +// add, update, and remove data in the DataSet... ++ +
+ Graph3d is an interactive visualization chart to draw data in a three dimensional + graph. You can freely move and zoom in the graph by dragging and scrolling in the + window. Graph3d also supports animation of a graph. +
++ Graph3d uses HTML canvas + to render graphs, and can render up to a few thousands of data points smoothly. +
+ ++ The following code shows how to create a Graph3d and provide it with data. + More examples can be found in the examples directory. +
+ ++<!DOCTYPE HTML> +<html> +<head> + <title>Graph 3D demo</title> + + <style> + body {font: 10pt arial;} + </style> + + <script type="text/javascript" src="../../dist/vis.js"></script> + + <script type="text/javascript"> + var data = null; + var graph = null; + + function custom(x, y) { + return (Math.sin(x/50) * Math.cos(y/50) * 50 + 50); + } + + // Called when the Visualization API is loaded. + function drawVisualization() { + // Create and populate a data table. + var data = new vis.DataSet(); + // create some nice looking data with sin/cos + var steps = 50; // number of datapoints will be steps*steps + var axisMax = 314; + var axisStep = axisMax / steps; + for (var x = 0; x < axisMax; x+=axisStep) { + for (var y = 0; y < axisMax; y+=axisStep) { + var value = custom(x, y); + data.add({ + x: x, + y: y, + z: value, + style: value + }); + } + } + + // specify options + var options = { + width: '600px', + height: '600px', + style: 'surface', + showPerspective: true, + showGrid: true, + showShadow: false, + keepAspectRatio: true, + verticalRatio: 0.5 + }; + + // create a graph3d + var container = document.getElementById('mygraph'); + graph3d = new vis.Graph3d(container, data, options); + } + </script> +</head> + +<body onload="drawVisualization();"> + <div id="mygraph"></div> +</body> +</html> + ++ + +
+ The class name of the Graph3d is vis.Graph3d
.
+ When constructing a Graph3d, an HTML DOM container must be provided to attach
+ the graph to. Optionally, data an options can be provided.
+ Data is a vis DataSet
or an Array
, described in
+ section Data Format.
+ Options is a name-value map in the JSON format. The available options
+ are described in section Configuration Options.
+
var graph = new vis.Graph3d(container [, data] [, options]);+ +
+ Data and options can be set or changed later on using the functions
+ Graph3d.setData(data)
and Graph3d.setOptions(options)
.
+
+ Graph3d can load data from an Array
, a DataSet
or a DataView
.
+ JSON objects are added to this DataSet by using the add()
function.
+ Data points must have properties x
, y
, and z
,
+ and can optionally have a property style
and filter
.
+
+
+ The DataSet JSON objects are defined as: +
+ +Name | +Type | +Required | +Description | +
---|---|---|---|
x | +number | +yes | +Location on the x-axis. | +
y | +number | +yes | +Location on the y-axis. | +
z | +number | +yes | +Location on the z-axis. | +
style | +number | +no | +The data value, required for graph styles dot-color and
+ dot-size .
+ |
+
filter | +* | +no | +Filter values used for the animation. + This column may have any type, such as a number, string, or Date. | +
+ Options can be used to customize the graph. Options are defined as a JSON object. + All options are optional. +
+ ++var options = { + width: '100%', + height: '400px', + style: 'surface' +}; ++ +
+ The following options are available. +
+ +Name | +Type | +Default | +Description | +
---|---|---|---|
animationInterval | +number | +1000 | +The animation interval in milliseconds. This determines how fast + the animation runs. | +
animationPreload | +boolean | +false | +If false, the animation frames are loaded as soon as they are requested.
+ if animationPreload is true, the graph will automatically load
+ all frames in the background, resulting in a smoother animation as soon as
+ all frames are loaded. The load progress is shown on screen. |
+
animationAutoStart | +boolean | +false | +If true, the animation starts playing automatically after the graph + is created. | +
backgroundColor | +string or Object | +'white' | +The background color for the main area of the chart. + Can be either a simple HTML color string, for example: 'red' or '#00cc00', + or an object with the following properties. | +
backgroundColor.stroke | +string | +'gray' | +The color of the chart border, as an HTML color string. | +
backgroundColor.strokeWidth | +number | +1 | +The border width, in pixels. | +
backgroundColor.fill | +string | +'white' | +The chart fill color, as an HTML color string. | +
cameraPosition | +Object | +{horizontal: 1.0, vertical: 0.5, distance: 1.7} | +Set the initial rotation and position of the camera.
+ The object cameraPosition contains three parameters:
+ horizontal , vertical , and distance .
+ Parameter horizontal is a value in radians and can have any
+ value (but normally in the range of 0 and 2*Pi).
+ Parameter vertical is a value in radians between 0 and 0.5*Pi.
+ Parameter distance is the (normalized) distance from the
+ camera to the center of the graph, in the range of 0.71 to 5.0. A
+ larger distance puts the graph further away, making it smaller.
+ All parameters are optional.
+ |
height | +string | +'400px' | +The height of the graph in pixels or as a percentage. | +
keepAspectRatio | +boolean | +true | +If keepAspectRatio is true, the x-axis and the y-axis
+ keep their aspect ratio. If false, the axes are scaled such that they
+ both have the same, maximum with. |
+
showAnimationControls | +boolean | +true | +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. | +
showGrid | +boolean | +true | +If true, grid lines are draw in the x-y surface (the bottom of the 3d + graph). | +
showPerspective | +boolean | +true | +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. + | +
showShadow | +boolean | +false | +Show shadow on the graph. | +
style | +string | +'dot' | +The style of the 3d graph. Available styles:
+ bar ,
+ bar-color ,
+ bar-size ,
+ dot ,
+ dot-line ,
+ dot-color ,
+ dot-size ,
+ line ,
+ grid ,
+ or surface |
+
tooltip | +boolean | function | +false | +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 tooltip . In this case the function is called
+ with an object containing parameters x ,
+ y , and z argument,
+ and must return a string which may contain HTML.
+ |
+
valueMax | +number | +none | +The maximum value for the value-axis. Only available in combination
+ with the styles dot-color and dot-size . |
+
valueMin | +number | +none | +The minimum value for the value-axis. Only available in combination
+ with the styles dot-color and dot-size . |
+
verticalRatio | +number | +0.5 | +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. | +
width | +string | +'400px' | +The width of the graph in pixels or as a percentage. | +
xBarWidth | +number | +none | +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 'bar' and 'bar-color' . |
+
xCenter | +string | +'55%' | +The horizontal center position of the graph, as a percentage or in + pixels. | +
xMax | +number | +none | +The maximum value for the x-axis. | +
xMin | +number | +none | +The minimum value for the x-axis. | +
xStep | +number | +none | +Step size for the grid on the x-axis. | +
xValueLabel | +function | +none | +A function for custom formatting of the labels along the x-axis,
+ for example function (x) {return (x * 100) + '%'} .
+ |
+
yBarWidth | +number | +none | +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 'bar' and 'bar-color' . |
+
yCenter | +string | +'45%' | +The vertical center position of the graph, as a percentage or in + pixels. | +
yMax | +number | +none | +The maximum value for the y-axis. | +
yMin | +number | +none | +The minimum value for the y-axis. | +
yStep | +number | +none | +Step size for the grid on the y-axis. | +
yValueLabel | +function | +none | +A function for custom formatting of the labels along the y-axis,
+ for example function (y) {return (y * 100) + '%'} .
+ |
+
zMin | +number | +none | +The minimum value for the z-axis. | +
zMax | +number | +none | +The maximum value for the z-axis. | +
zStep | +number | +none | +Step size for the grid on the z-axis. | +
zValueLabel | +function | +none | +A function for custom formatting of the labels along the z-axis,
+ for example function (z) {return (z * 100) + '%'} .
+ |
+
xLabel | +String | +x | +Label on the X axis. | +
yLabel | +String | +y | +Label on the Y axis. | +
zLabel | +String | +z | +Label on the Z axis. | +
filterLabel | +String | +time | +Label for the filter column. | +
legendLabel | +String | +value | +Label for the style description. | +
+ Graph3d supports the following methods. +
+ +Method | +Return Type | +Description | +
---|---|---|
animationStart() | +none | +Start playing the animation. + Only applicable when animation data is available. | +
animationStop() | +none | +Stop playing the animation. + Only applicable when animation data is available. | +
getCameraPosition() | +An object with parameters horizontal ,
+ vertical and distance |
+ Returns an object with parameters horizontal ,
+ vertical and distance ,
+ which each one of them is a number, representing the rotation and position
+ of the camera. |
+
redraw() | +none | +Redraw the graph. Useful after the camera position is changed externally, + when data is changed, or when the layout of the webpage changed. | +
setData(data) | +none | +Replace the data in the Graph3d. | +
setOptions(options) | +none | +Update options of Graph3d. + The provided options will be merged with current options. | +
setSize(width, height) | +none | +Parameters width and height are strings,
+ containing a new size for the graph. Size can be provided in pixels
+ or in percentages. |
+
setCameraPosition (pos) | +{horizontal: 1.0, vertical: 0.5, distance: 1.7} | +Set the rotation and position of the camera. Parameter pos
+ is an object which contains three parameters: horizontal ,
+ vertical , and distance .
+ Parameter horizontal is a value in radians and can have any
+ value (but normally in the range of 0 and 2*Pi).
+ Parameter vertical is a value in radians between 0 and 0.5*Pi.
+ Parameter distance is the (normalized) distance from the
+ camera to the center of the graph, in the range of 0.71 to 5.0. A
+ larger distance puts the graph further away, making it smaller.
+ All parameters are optional.
+ |
+
+ Graph3d fires events after the camera position has been changed.
+ The event can be catched by creating a listener.
+ Here an example on how to catch a cameraPositionChange
event.
+
+function onCameraPositionChange(event) { + alert('The camera position changed to:\n' + + 'Horizontal: ' + event.horizontal + '\n' + + 'Vertical: ' + event.vertical + '\n' + + 'Distance: ' + event.distance); +} +// assuming var graph3d = new vis.Graph3d(document.getElementById('mygraph')); +graph3d.on('cameraPositionChange', onCameraPositionChange); ++ +
+ The following events are available. +
+ +name | +Properties | +Description | +
---|---|---|
cameraPositionChange | +
+
|
+ 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 setCameraPosition method.
+ The new camera position can be retrieved by calling the method
+ getCameraPosition . |
+
+ All code and data are processed and rendered in the browser. No data is sent to any server. +
+ +As shown above, alternative to supplying an object, you can supply a String
, Array
, Function
or
Boolean
. These will do the same as the filter option described below.
name | -type | -default | -description | +Name | +Type | +Default | +Description |
---|---|---|---|---|---|---|---|
enabled | -Boolean | -true |
+ Boolean | +true |
Toggle the configuration interface on or off. This is an optional parameter. If left undefined and any of the other properties of this object are defined, this will be set to true. | ||
filter | -String, Array, Boolean, Function | -true |
+ String, Array, Boolean, Function | +true |
When a boolean, true gives you all options, false will not show any. If a string is supplied, any
combination of the following is allowed: nodes, edges, layout, interaction, manipulation, physics,
selection, renderer. Feel free to come up with a fun seperating character. Finally, when supplied an
array of strings, any of the previously mentioned fields are accepted. When supplying a function, you receive two arguments. The option and the path of the option within the options object. If it returns true, the options will be shown in the configurator. Example: - +This only shows the physics options.function (option, path) { return path.indexOf('physics') !== -1; -} -+} |
||
container | -DOM element | -undefined |
+ DOM element | +undefined |
This allows you to put the configure list in another HTML container than below the network. |
These options can also be set per individual edge.
-name | -type | -default | -description | +Name | +Type | +Default | +Description |
---|---|---|---|---|---|---|---|
arrows | -Object or String | -undefined |
+ Object or String | +undefined |
To draw an arrow with default settings a string can be supplied. For example: arrows:'to, from,
middle' or 'to;from' , any combination with any seperating symbol is fine. If you
want to control the size of the arrowheads, you can supply an object.
@@ -209,42 +209,42 @@ network.setOptions(options);
| ||
arrows.to | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
When true, an arrowhead on the 'to' side of the edge is drawn, pointing to the 'to' node with default settings. To customize the size of the arrow, supply an object. | ||
arrows.to.enabled | -Boolean | -false |
+ Boolean | +false |
Toggle the arrow on or off. This option is optional, if undefined and the scaleFactor property is set, enabled will be set to true. | ||
arrows.to.scaleFactor | -Number | -1 |
+ Number | +1 |
The scale factor allows you to change the size of the arrowhead. | ||
arrows.middle | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
Exactly the same as the to object but with an arrowhead in the center of the edge. | ||
arrows.from | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
Exactly the same as the to object but with an arrowhead at the from node of the edge. | ||
color | -Object or String | -Object |
+ Object or String | +Object |
The color object contains the color information of the edge in every situation. When the edge only needs
a single color, a color value like 'rgb(120,32,14)' , '#ffffff' or
'red' can be supplied instead of an object.
@@ -252,30 +252,30 @@ network.setOptions(options);
| ||
color.color | -String | -'#848484' |
+ String | +'#848484' |
The color of the border of the node when it is not selected or hovered over (assuming hover is enabled in the interaction module). | ||
color.highlight | -String | -'#848484' |
+ String | +'#848484' |
The color the edge when it is selected. | ||
color.hover | -String | -'#848484' |
+ String | +'#848484' |
The color the edge when the mouse hovers over it (assuming hover is enabled in the interaction module). | ||
color.inherit | -String or Boolean | -'from' |
+ String or Boolean | +'from' |
When color, highlight or hover are defined, inherit is set to false!
Supported options are: true, false, 'from','to','both' .
The default value is 'from' which does the same as true: the edge will inherit the color from @@ -288,8 +288,8 @@ network.setOptions(options); | ||
color.opacity | -Number | -1.0 |
+ Number | +1.0 |
It can be useful to set the opacity of an edge without manually changing all the colors. The opacity
option will convert all colors (also when using inherit) to adhere to the supplied opacity. The allowed
range of the opacity option is between 0 and 1 . This is only done once so the performance
@@ -298,8 +298,8 @@ network.setOptions(options);
| ||
dashes | -Array or Boolean | -false |
+ Array or Boolean | +false |
When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an Array. Array formart: Array of numbers, gap length, dash length, gap length, dash length, ... etc. The array is repeated until the distance is filled. @@ -308,56 +308,56 @@ network.setOptions(options); | ||
font | -Object or String | -false |
+ Object or String | +false |
This object defines the details of the label. A shorthand is also supported in the form 'size face
color' for example: '14px arial red' .
|
||
font.color | -String | -'#343434' |
+ String | +'#343434' |
Color of the label text. | ||
font.size | -Number | -14 |
+ Number | +14 |
Size of the label text. | ||
font.face | -String | -'arial' |
+ String | +'arial' |
Font face (or font family) of the label text. | ||
font.background | -String | -undefined |
+ String | +undefined |
When not undefined but a color string, a background rectangle will be drawn behind
the label in the supplied color.
|
||
font.strokeWidth | -Number | -2 |
+ Number | +2 |
As an alternative to the background rectangle, a stroke can be drawn around the text. When a value higher than 0 is supplied, the stroke will be drawn. | ||
font.strokeColor | -String | -'#ffffff' |
+ String | +'#ffffff' |
This is the color of the stroke assuming the value for stroke is higher than 0. | ||
font.align | -String | -'horizontal' |
+ String | +'horizontal' |
Possible options: 'horizontal','top','middle','bottom' . The alignment determines how the
label is aligned over the edge. The default value horizontal aligns the label horizontally,
regardless of the orientation of the edge. When an option other than horizontal is chosen,
@@ -366,14 +366,14 @@ network.setOptions(options);
| ||
hidden | -Boolean | -false |
+ Boolean | +false |
When true, the edge is not drawn. It is part still part of the physics simulation however! | ||
hoverWidth | -Number or Function | -0.5 |
+ Number or Function | +0.5 |
Assuming the hover behaviour is enabled in the interaction module, the hoverWidth determines the width of the edge when the user hovers over it with the mouse. If a number is supplied, this number will be added to the width. @@ -394,34 +394,34 @@ var options: { | ||
id | -String | -undefined |
+ String | +undefined |
The id of the edge. The id is optional for edges. When not supplied, an UUID will be assigned to the edge. | ||
label | -String | -undefined |
+ String | +undefined |
The label of the edge. HTML does not work in here because the network uses HTML5 Canvas. | ||
length | -Number | -undefined |
+ Number | +undefined |
The physics simulation gives edges a spring length. This value can override the length of the spring in rest. | ||
physics | -Boolean | -true |
+ Boolean | +true |
When true, the edge is part of the physics simulation. When false, it will not act as a spring. | ||
scaling | -Object | -Object |
+ Object | +Object |
If the value option is specified, the width of the edges will be scaled according to the
properties in this object. Keep in mind that when using scaling, the width option is
neglected.
@@ -429,58 +429,58 @@ var options: {
| ||
scaling.min | -Number | -1 |
+ Number | +1 |
If edges have a value, their widths are determined by the value, the scaling function and the min max values. The min value is the minimum allowed value. | ||
scaling.max | -Number | -15 |
+ Number | +15 |
This is the maximum allowed width when the edges are scaled using the value option. | ||
scaling.label | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
When false, the label is not allowed to scale with the edge. If true it will scale using default settigns. For further customization, you can supply an object. | ||
scaling.label.enabled | -Boolean | -false |
+ Boolean | +false |
Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of the properties in this object are defined. | ||
scaling.label.min | -Number | -14 |
+ Number | +14 |
The minimum font-size used for labels when scaling. | ||
scaling.label.max | -Number | -30 |
+ Number | +30 |
The maximum font-size used for labels when scaling. | ||
scaling.label.maxVisible | -Number | -30 |
+ Number | +30 |
When zooming in, the font is drawn larger as well. You can limit the perceived font size using this option. If set to 30, the font will never look larger than size 30 zoomed at 100%. | ||
scaling.label.drawThreshold | -Number | -3 |
+ Number | +3 |
When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn. When using font scaling, you can use this together with the maxVisible to first show labels of important edges when zoomed out and only show the rest when zooming in. @@ -488,8 +488,8 @@ var options: { | ||
scaling.customScalingFunction | -Function | -in description | +Function | +in description | If edges have value fields, this function determines how the size of the nodes are scaled
based on their values. The default function is:
@@ -515,8 +515,8 @@ myWidth = minWidth + diff * scale; | ||
selectionWidth | -Number or Function | -1 |
+ Number or Function | +1 |
The selectionWidth determines the width of the edge when the edge is selected. If a number is supplied, this number will be added to the width. Because the width can be altered by the value and the scaling functions, a constant multiplier or added @@ -535,48 +535,48 @@ var options: { | ||
selfReferenceSize | -Number | -false |
+ Number | +false |
When the to and from nodes are the same, a circle is drawn. This is the radius of that circle. | ||
shadow | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
When true, the edge casts a shadow using the default settings. This can be further refined by supplying an object. | ||
shadow.enabled | -Boolean | -false |
+ Boolean | +false |
Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties in this object are defined. | ||
shadow.size | -Number | -10 |
+ Number | +10 |
The blur size of the shadow. | ||
shadow.x | -Number | -5 |
+ Number | +5 |
The x offset. | ||
shadow.y | -Number | -5 |
+ Number | +5 |
The y offset. | ||
smooth | -Object or Boolean | -Object |
+ Object or Boolean | +Object |
When true, the edge is drawn as a dynamic quadratic bezier curve. The drawing of these curves takes longer than that of straight curves but it looks better. There is a difference between dynamic smooth curves and static smooth curves. The dynamic smooth curves @@ -586,16 +586,16 @@ var options: { | ||
smooth.enabled | -Boolean | -true |
+ Boolean | +true |
Toggle smooth curves on and off. This is an optional option. If any of the other properties in this object are set, this option will be set to true. | ||
smooth.type | -String | -'dynamic' |
+ String | +'dynamic' |
Possible options: 'dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal',
'vertical', 'curvedCW', 'curvedCCW' . Take a look at our example 26 to see what these look like
and pick the one that you like best!
@@ -606,29 +606,29 @@ var options: {
| ||
smooth.roundness | -Number | -0.5 |
+ Number | +0.5 |
Accepted range: 0 .. 1.0 . This parameter tweaks the roundness of the smooth curves for all types EXCEPT dynamic.
|
||
title | -String | -undefined |
+ String | +undefined |
The title is shown in a pop-up when the mouse moves over the edge. | ||
value | -Number | -undefined |
+ Number | +undefined |
When a value is set, the edges' width will be scaled using the options in the scaling object defined above. | ||
width | -Number | -1 |
+ Number | +1 |
The width of the edge. If value is set, this is not used. |
All of the individual options are explained here:
-name | -type | -default | -description | +Name | +Type | +Default | +Description |
---|---|---|---|---|---|---|---|
useDefaultGroups | -Boolean | -true |
+ Boolean | +true |
If your nodes have groups defined that are not in the Groups module, the module loops over the groups it does have, allocating one for each unknown group. When all are used, it goes back to the first group. By setting this to false, the default groups will not be used in this cycle. @@ -123,8 +123,8 @@ network.setOptions(options); | ||
group* | -Object | -
|
+ Object | +
|
You can add multiple groups containing styling information that applies to a certain subset of groups. All options described in the nodes module that make sense can be used here diff --git a/docs/network/index.html b/docs/network/index.html index a9212308..80b8ac47 100644 --- a/docs/network/index.html +++ b/docs/network/index.html @@ -11,7 +11,7 @@ - + - + - + B so B is a level lower than A. |
All of the individual options are explained here:
-name | type | default | description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
barnesHut | Object | Object | BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.gravitationalConstant | Number | -2000 | Gravity attracts. We like repulsion. So the value is negative. If you want the repulsion to be stronger, decrease the value (so -10000, -50000). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.centralGravity | Number | 0.3 | There is a central gravity attractor to pull the entire network back to the center. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.springLength | Number | 95 | The edges are modelled as springs. This springLength here is the the rest length of the spring. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.springConstant | Number | 0.04 | This is how 'sturdy' the springs are. Higher values mean stronger springs. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.damping | Number | 0.09 | Accepted range: [0 .. 1] . The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
barnesHut.avoidOverlap | Number | 0 | Accepted range: [0 .. 1] . When larger than 0, the size of the node is taken into account. The distance will be calculated from the radius of the encompassing circle of the node for both the gravity model and the spring model. Value 1 is maximum overlap avoidance. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
forceAtlas2Based | Object | Object | Force Atlas 2 has been developed by Jacomi et al (2014) for use with Gephi. The forceAtlas2Based solver makes use of some of the equations provided
+
ExampleThe following code shows how to create a Graph3d and provide it with data. - More examples can be found in the examples directory. + More examples can be found in the examples directory. diff --git a/docs/network/old/canvas.html b/docs/old/old_network/canvas.html similarity index 98% rename from docs/network/old/canvas.html rename to docs/old/old_network/canvas.html index 41b9770c..8e519b05 100644 --- a/docs/network/old/canvas.html +++ b/docs/old/old_network/canvas.html @@ -100,7 +100,7 @@ var options = { network.setOptions(options); All of the individual options are explained here: -
|