Today we released vis.js version 3.11.0. The Timeline has gotten quite some attention in this release: For example, the Timeline finally has gotten more event handlers to enable custom behavior in a flexible way. Network is evolving at a steady speed. It's really great to get more and more substantial contributions from the community latest months! Thanks.
</p>
<p>Changelog:</p>
<h3>Network</h3>
<ul>
<li>(added gradient coloring for lines, but set for release in 4.0 due to required refactoring of options).</li>
<li>Fixed bug where a network that has frozen physics would resume redrawing after setData, setOptions etc.</li>
<li>Added option to bypass default groups. If more groups are specified in the nodes than there are in the groups, loop over supplied groups instead of default.</li>
<li>Added two new static smooth curves modes: curveCW and curve CCW.</li>
<li>Added request redraw for certain internal processes to reduce number of draw calls (performance improvements!).</li>
<li>Added pull request for usage of Icons. Thanks @Dude9177!
<li>Allow hierarchical view to be set in setOptions.</li>
<li>Fixed manipulation bar for mobile.</li>
<li>Fixed #670: Bug when updating data in a DataSet, when Network is connected to the DataSet via a DataView.</li>
<li>Fixed #688: Added a css class to be able to distinguish buttons "Edit node" and "Edit edge".</li>
</ul>
<h3>Timeline</h3>
<ul>
<li>Implemented orientation option `'both'`, displaying a time axis both on top
and bottom (#665).</li>
<li>Implemented creating new range items by dragging in an empty space with the
ctrl key down.</li>
<li>Implemented configuration option `order: function` to define a custom ordering
for the items (see #538, #234).</li>
<li>Implemented events `click`, `doubleClick`, and `contextMenu`.</li>
Version 3.10.0 has been released. Lots of improvements in Network, and some smaller bug fixes and improvements in Timeline and DataSet.
</p>
<p>Changelog:</p>
<h3>Network</h3>
<ulclass="task-list">
<li>Added option bindToWindow (default true) to choose whether the keyboard binds are global or to the network div.</li>
<li>Improved images handling so broken images are shown on all references of images that are broken.</li>
<li>Added getConnectedNodes method.</li>
<li>Added fontSizeMin, fontSizeMax, fontSizeMaxVisible, scaleFontWithValue, fontDrawThreshold to Nodes.</li>
<li>Added fade in of labels (on nodes) near the fontDrawThreshold.</li>
<li>Added nodes option to zoomExtent to zoom in on specific set of nodes.</li>
<li>Added stabilizationIterationsDone event which fires at the end of the internal stabilization run. Does not imply that the network is stabilized.</li>
<li>Added freezeSimulation method.</li>
<li>Added clusterByZoom option.</li>
<li>Added class name 'network-tooltip' to the tooltip, allowing custom styling.</li>
<li>Fixed bug when redrawing was not right on zoomed-out browsers.</li>
<li>Added opacity option to edges. Opacity is only used for the unselected state.</li>
<li>Fixed bug where selections from removed data elements persisted.</li>
</ul>
<h3>Timeline</h3>
<ulclass="task-list">
<li>`Timeline.redraw()` now also recalculates the size of items.</li>
<li>Implemented option `snap: function` to customize snapping to nice date when dragging items.</li>
<li>Implemented option `timeAxis: {scale: string, step: number}` to set fixed scale.</li>
<li>Fixed width of range items not always being maintained when moving due to snapping to nice dates.</li>
<li>Fixed not being able to drag items to an other group on mobile devices.</li>
<li>Fixed `setWindow` not working when applying an interval larger than the configured `zoomMax`.</li>
</ul>
<h3>DataSet/DataView</h3>
<ulclass="task-list">
<li>Added property `length` holding the total number of items to the `DataSet and `DataView`.</li>
<li>Added a method `refresh()` to the `DataView`, to update filter results.</li>
<li>Fixed a bug in the `DataSet` returning an empty object instead of `null` when no item was found when using both a filter and specifying fields.</li>
</ul>
</div>
</div>
<divclass="post">
<divclass="postHeader"id="Released version 3.9.0">Released version 3.9.0</div>
We have been very busy fixing a lot of the open Github issues over the last week. We have also received multiple pull requests that could be added quickly! Special thanks to
our community members contributing this release: @klmdb, @pavlos256, @T-rav, @brendon1982.
Since this is a release with new features, we push the version number up to 3.9.0. Next up: big refactoring and version 4.0.0!
<li>Added byUser flag to options of the rangechange and rangechanged event.</li>
</ul>
</div>
</div>
<divclass="post">
<divclass="postHeader"id="The 2015 roadmap for vis.js">The 2015 roadmap for vis.js</div>
@ -202,12 +363,12 @@
<divclass="postDate">9th of January 2015</div>
<divclass="postContent">
<p>
I initially wanted to do a small recap of vis.js so far but it became larger (and more off topic) than I expected. To understand some of the motivations for our roadmap, <ahref="#A look back on vis.js">take a look at the post below this one first</a>.
I initially wanted to do a small recap of vis.js so far but it became larger (and more off topic) than I expected. To understand some of the motivations for our roadmap, <ahref="#A look back on vis.js">take a look at the post below this one first</a>.
</p><p>
So now for our plans for 2015! We have added a lot of features over the last year, and we have to be careful that vis does not die of option-obesity. To mediate this we thought of a few solutions.
Firstly, we will make the docs collapsible using a similar system to <ahref="https://www.jsoneditoronline.org/"target="_blank">Jos′s great online JSON editor</a>. This is naturally a temporary fix but
the docs are one of the most important ways to get information. We think we ourselves may be the most frequent visitor of those pages so it's a good start!
</p><p>
</p><p>
Secondly, the actual changes, we plan to reorganize some of the option structure. This will unfortunately (but by definition) be a breaking change from our old versions. The new structure will be clearer and more intuitive. The work our current
users will have to do to update will be minimal. If you're using the options we reorganize, you'll have to update your options. Breaking releases are always a shame, but we feel it is necessary.
</p><p>
@ -215,7 +376,7 @@
</p><p>
Once everything is modularized, we want to change the API to allow users to plug their own parts of vis together. As an example: You start a network module, plug in the type of node module, edge module, physics module and optionally navigation module (etc.) and you're good to go!
All of these modules will be individually configured. This means the huge list of options will be segmented into smaller, more manageable parts. Additionally, the docs will become smaller and clearer.
</p><p>
</p><p>
Of course, we do not want to abandon all our plug-and-play functionality! We will also start to supply more preconfigured constructors (i.e. a vis.BarChart that will give you a preconfigured graph2d module). Apart from these constructors
we will continue to publish examples which will include code snippets that you can use in your own project.
</p><p>
@ -226,15 +387,15 @@
</p><p>
To wrap up, there are a few things I did not mention here but I'd like to add to the post anyway.
<ul>
<li>We want to improve the fusion of graph2d and the timeline, with the ideal that a graph2d can be used like a group in timeline now.</li>
<li>Examples will be split in simple option/configuration examples and larger, feature demonstration/exploration examples.</li>
<li>Graph2d will be expanded.</li>
<li>We will move to hammer.js 2.0.</li>
<li>We will add features <ahref="./featureRequests.html"target="_blank">from the list</a> when we can</li>
<li>We hope to keep up the <communi></communi>cation with our community!</li>
<li>We want to improve the fusion of graph2d and the timeline, with the ideal that a graph2d can be used like a group in timeline now.</li>
<li>Examples will be split in simple option/configuration examples and larger, feature demonstration/exploration examples.</li>
<li>Graph2d will be expanded.</li>
<li>We will move to hammer.js 2.0.</li>
<li>We will add features <ahref="./featureRequests.html"target="_blank">from the list</a> when we can</li>
<li>We hope to keep up the <communi></communi>cation with our community!</li>
</ul>
Let's make 2015 as good as last year!
</p>
</p>
</div>
</div>
@ -246,22 +407,22 @@
<p>
In April 2013, the initial commit was made for vis.js by <ahref="https://github.com/josdejong">Jos</a> because the old CHAP LINKS library was becoming too large to expand and maintain.
Vis.js was a clean, new start using all the knowledge gathered from the CHAP library with the ideal that the new infrastructure would be more stable, faster and easier to maintain.
</p><p>
In January 2014, I joined the project and started to expand the Network module, which was called Graph back then. I have been working alongside Jos since then we have poured a lot of hours into vis.
</p><p>
On the 16th of April 2014, exactly a year after the initial commit, <ahref="https://twitter.com/hackernewsbot/status/456231005678874624"target="_blank">a twitterbot with a lot of followers</a> notified
the world that we were featured on hackernews! This was the boost we needed to really reach a large community. We saw the amount of visitors and Github stars increase greatly over the months that followed.
</p><p>
The 14th of October, we have altered the license of vis.js to MIT or APACHE 2.0. This allowed <ahref="http://tiddlywiki.com/"target="_blank">Tiddlywiki</a> to add vis.js to their keychain. From what we hear,
In January 2014, I joined the project and started to expand the Network module, which was called Graph back then. I have been working alongside Jos since then we have poured a lot of hours into vis.
</p><p>
On the 16th of April 2014, exactly a year after the initial commit, <ahref="https://twitter.com/hackernewsbot/status/456231005678874624"target="_blank">a twitterbot with a lot of followers</a> notified
the world that we were featured on hackernews! This was the boost we needed to really reach a large community. We saw the amount of visitors and Github stars increase greatly over the months that followed.
</p><p>
The 14th of October, we have altered the license of vis.js to MIT or APACHE 2.0. This allowed <ahref="http://tiddlywiki.com/"target="_blank">Tiddlywiki</a> to add vis.js to their keychain. From what we hear,
their developers really enjoy working with vis and we look forward to hearing how their community uses our software!
</p><p>
Now, we have a great community that helps out in issues, fixes our typos in the docs, notifies us of bugs and sometimes fixes them for us. We have received pull requests with new features and improvements and
it has been fantastic!
</p><p>
This post started out as the roadmap for vis in 2015, but the review was longer than I initially expected thereby deserving its own post.
</p><p>
</p><p>
Have fun using vis!
</p>
</p>
</div>
</div>
@ -274,26 +435,26 @@
The old website served us well, but now that we arrived in 2015... it is really time for an upgrade! We hope the new website is more informative, modern and a good promotion for vis.js!
It also allows us to keep the community updated through this blog and to <ahref="./showcase/index.html"target="_blank">show off great projects that make use of vis.js in our showcase</a>.
</p><p>If you have made something and would like it featured,
please make an <ahref="https://github.com/almende/vis/issues"target="_blank">issue on Github</a> with your project and how you'd like to be credited.</p>
</p><p>
The new website is in beta so if anyone spots a typo or other mistake, please let us know on our <ahref="https://www.github.com/almende/vis"target="_blank">Github</a> page.
please make an <ahref="https://github.com/almende/vis/issues"target="_blank">issue on Github</a> with your project and how you'd like to be credited.</p>
</p><p>
There is no forum on this website. We prefer to keep all the communication with the community through Github. We believe this is the best solution so everyone only has to check the Github issues
when there is a problem or suggestion.
</p><p>
A big change introduced with our new website, is the <ahref="./featureRequests.html"target="_blank">feature request page</a>. There are a lot of issues on Github that suggest features but we do not
always have time to implement these ourselves. On the other hand, there have been issues where people tell us they want to contribute but are now sure where to start. To mediate this (and to make a clear overview
for ourselves) we listed everything <ahref="./featureRequests.html"target="_blank">here</a>.
</p><p>Once a feature is added to <ahref="./featureRequests.html"target="_blank">the list</a>, it is not the end of the line. At each new release, we'll look at the list and see which features we may want to pick up for the next one. Discussions on these features
can still continue on the referenced Github issues. When we have added a feature to this list, we will close the Github issue that requested it to keep our open issues more of a bug-todo list. The main motivation for this
is because we have noticed that old bugs (on pages after 2) would be overlooked from time to time.
</p><p>
This feature page is an experiment. If it turns out that the community does not like us closing issues with open feature requests or if it does not have the impact we'd like it to have, we'll revert back to the old model.
</p><p>
We thank you all for using vis! Last year has seen a great increase in our user base and it is a great motivating factor knowing that our work is used by others!
</p><p>
Here's to a great 2015!
</p>
The new website is in beta so if anyone spots a typo or other mistake, please let us know on our <ahref="https://www.github.com/almende/vis"target="_blank">Github</a> page.
</p><p>
There is no forum on this website. We prefer to keep all the communication with the community through Github. We believe this is the best solution so everyone only has to check the Github issues
when there is a problem or suggestion.
</p><p>
A big change introduced with our new website, is the <ahref="./featureRequests.html"target="_blank">feature request page</a>. There are a lot of issues on Github that suggest features but we do not
always have time to implement these ourselves. On the other hand, there have been issues where people tell us they want to contribute but are now sure where to start. To mediate this (and to make a clear overview
for ourselves) we listed everything <ahref="./featureRequests.html"target="_blank">here</a>.
</p><p>Once a feature is added to <ahref="./featureRequests.html"target="_blank">the list</a>, it is not the end of the line. At each new release, we'll look at the list and see which features we may want to pick up for the next one. Discussions on these features
can still continue on the referenced Github issues. When we have added a feature to this list, we will close the Github issue that requested it to keep our open issues more of a bug-todo list. The main motivation for this
is because we have noticed that old bugs (on pages after 2) would be overlooked from time to time.
</p><p>
This feature page is an experiment. If it turns out that the community does not like us closing issues with open feature requests or if it does not have the impact we'd like it to have, we'll revert back to the old model.
</p><p>
We thank you all for using vis! Last year has seen a great increase in our user base and it is a great motivating factor knowing that our work is used by others!
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
@ -152,6 +155,122 @@ var data = new vis.DataView(dataset, options)
</li>
</ul>
<h2id="Methods">Methods</h2>
<p>DataView contains the following methods.</p>
<table>
<colgroup>
<colwidth="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 | DataTable</td>
<td>
Get a single item, multiple items, or all items from the DataView.
Usage examples can be found in section <ahref="#Getting_Data">Getting Data</a>, and the available <code>options</code> are described in section <ahref="#Data_Selection">Data Selection</a>. If parameter <code>data</code> is provided, items will be appended to this array or table, which is required in case of Google DataTable.
</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 <ahref="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 <ahref="#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 <ahref="#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:
<preclass="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>
<h2id="Properties">Properties</h2>
<p>DataView contains the following properties.</p>
<table>
<colgroup>
<colwidth="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>
<h2id="Getting_Data">Getting Data</h2>
<p>
@ -165,8 +284,8 @@ var items = view.get();
<p>
Data of a DataView can be filtered and formatted again, in exactly the
same way as in a DataSet. See sections
<ahref="dataset.html#Data_Filtering">Data Filtering</a> and
<ahref="dataset.html#Data_Formatting">Data Formatting</a> for more
<ahref="dataset.html#Data_Manipulation">Data Manipulation</a> and
<ahref="dataset.html#Data_Selection">Data Selection</a> for more
<td>The ID of the group this point belongs to.</td>
</tr>
<tr>
<td>label</td>
<td>object</td>
<td>no</td>
<td>A label object which will be displayed near to the item. A label object has one requirement - a <b> content </b> property. In addition you can set the <b> xOffset, yOffset and className </b> for further appearance customisations </td>
</tr>
</table>
<h3id="groups">Groups</h3>
@ -672,7 +678,7 @@ The options colored in green can also be used as options for the groups. All opt
<td>orientation</td>
<td>String</td>
<td>'bottom'</td>
<td>Orientation of the timeline: 'top' or 'bottom' (default). If orientation is 'bottom', the time axis is drawn at the bottom, and if 'top', the axis is drawn on top.</td>
<td>Orientation of the timeline: 'top', 'bottom' (default), or 'both'. If orientation is 'bottom', the time axis is drawn at the bottom. When 'top', the axis is drawn on top. When 'both', two axes are drawn, both on top and at the bottom.</td>
</tr>
<tr>
@ -737,6 +743,22 @@ The options colored in green can also be used as options for the groups. All opt
If not provided, the earliest date present in the events is taken as start date.</td>
</tr>
<tr>
<td>timeAxis.scale</td>
<td>string</td>
<td>none</td>
<td>Set a fixed scale for the time axis of the Timeline. Choose from <code>'millisecond'</code>, <code>'second'</code>, <code>'minute'</code>, <code>'hour'</code>, <code>'weekday'</code>, <code>'day'</code>, <code>'month'</code>, <code>'year'</code>.</td>
</tr>
<tr>
<td>timeAxis.step</td>
<td>number</td>
<td>1</td>
<td>
Set a fixed step size for the time axis. Only applicable when used together with <code>timeAxis.scale</code>.
Choose for example 1, 2, 5, or 10.</td>
</tr>
<tr>
<td>width</td>
<td>String</td>
@ -791,6 +813,29 @@ Graph2d.clear({options: true}); // clear options only
</td>
</tr>
<tr>
<td>click</td>
<td>Fired when clicked inside the Graph2d.
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Graph2d.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>contextmenu</td>
<td>Fired when right-clicked inside the Graph2d. Note that in order to prevent the context menu from showing up, default behavior of the event must be stopped:
<preclass="prettyprint lang-js">graph2d.on('contextmenu', function (props) {
alert('Right click!');
props.event.preventDefault();
});
</pre>
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Graph2d.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>destroy()</td>
<td>none</td>
@ -798,6 +843,22 @@ Graph2d.clear({options: true}); // clear options only
</td>
</tr>
<tr>
<td>doubleClick</td>
<td>Fired when double clicked inside the Graph2d.
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Graph2d.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>fit()</td>
<td>none</td>
<td>Adjust the visible window such that it fits all items.
</td>
</tr>
<tr>
<td>getCurrentTime()</td>
<td>Date</td>
@ -812,6 +873,24 @@ Graph2d.clear({options: true}); // clear options only
</td>
</tr>
<trid="getEventProperties">
<td>getEventProperties(event)</td>
<td>Object</td>
<td>
Returns an Object with relevant properties from an event:
<ul>
<li><code>pageX</code> (Number): absolute horizontal position of the click event.</li>
<li><code>pageY</code> (Number): absolute vertical position of the click event.</li>
<li><code>x</code> (Number): relative horizontal position of the click event.</li>
<li><code>y</code> (Number): relative vertical position of the click event.</li>
<li><code>time</code> (Date): Date of the clicked event.</li>
<li><code>value</code> (Number[]): The data value of the click event. The array contains one value when there is one data axis visible, and two values when there are two visible data axes.</li>
<li><code>what</code> (String | null): name of the clicked thing: <code>background</code>, <code>axis</code>, <code>dat-axis</code>, <code>custom-time</code>, or <code>current-time</code>, <code>legend</code>.</li>
<li><code>event</code> (Object): the original click event.</li>
@ -832,9 +911,13 @@ Graph2d.clear({options: true}); // clear options only
</tr>
<tr>
<td>fit()</td>
<td>hiddenDates</td>
<td>Object</td>
<td>none</td>
<td>Adjust the visible window such that it fits all items.
<td>This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object:
<code>{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00', [repeat:'daily']}</code> or as an Array of these objects. The repeat argument is optional.
The possible values are (case-sensitive): <code>daily, weekly, monthly, yearly</code>. To hide a weekend, pick any Saturday as start and the following Monday as end
Options can be provided as third parameter in the network constructor
as well. Section <ahref="#Configuration_Options">Configuration Options</a>
as well. Section <ahref="#Configuration_options">Configuration Options</a>
describes the available options.
</li>
@ -280,13 +280,13 @@ When using a DataSet, the network is automatically updating to changes in the Da
<td>allowedToMoveX</td>
<td>Boolean</td>
<td>no</td>
<td>If allowedToMoveX is false, then the node will not move in the X direction from its position.</td>
<td>If allowedToMoveX is false, then the node will not move in the X direction from its position. This does not do anything in hierarchical views.</td>
</tr>
<tr>
<td>allowedToMoveY</td>
<td>Boolean</td>
<td>no</td>
<td>If allowedToMoveY is false, then the node will not move in the Y direction from its position.</td>
<td>If allowedToMoveY is false, then the node will not move in the Y direction from its position. This does not do anything in hierarchical views.</td>
</tr>
<tr>
@ -303,7 +303,8 @@ When using a DataSet, the network is automatically updating to changes in the Da
<td>level</td>
<td>number</td>
<td>no</td>
<td>This level is used in the hierarchical layout. If this is not selected, the level does not do anything.</td>
<td>This level is used in the hierarchical layout. If this is not selected, the level does not do anything. This must be a postive number (min value: 0).
Fractions are possible but only integers are supported.</td>
</tr>
<tr>
@ -342,7 +343,7 @@ When using a DataSet, the network is automatically updating to changes in the Da
<td>no</td>
<td>Horizontal position in pixels.
The horizontal position of the node will be fixed unless combined with the allowedToMoveX:true option.
The vertical position y may remain undefined.</td>
The vertical position y may remain undefined. This does not work with hierarchical layout.</td>
</tr>
<tr>
<td>y</td>
@ -350,7 +351,7 @@ When using a DataSet, the network is automatically updating to changes in the Da
<td>no</td>
<td>Vertical position in pixels.
The vertical position of the node will be fixed unless combined with the allowedToMoveY:true option.
The horizontal position x may remain undefined.</td>
The horizontal position x may remain undefined. This does not work with hierarchical layout.</td>
</tr>
</table>
@ -598,7 +599,14 @@ var options = {
<td>When a Network is configured to be <code>clickToUse</code>, it will react to mouse, touch, and keyboard events only when active.
When active, a blue shadow border is displayed around the Network. The Network is set active by clicking on it, and is changed to inactive again by clicking outside the Network or by pressing the ESC key.</td>
</tr>
<tr>
<td>useDefaultGroups</td>
<td>boolean</td>
<td>true</td>
<td>If true, the default groups are used when groups are used. If you have defined your own groups those will be used. If you have an item with a group that is NOT in your own group list,
setting useDefaultGroups true will iterate over the default groups for unknown groups. If it is set to false, it will iterate over your own groups for unknown groups.
</td>
</tr>
<tr>
<td><ahref="#Physics">physics</a></td>
<td>Object</td>
@ -646,7 +654,7 @@ var options = {
</tr>
<tr>
<td>freezeForStabilization</a></td>
<td>freezeForStabilization</td>
<td>Boolean</td>
<td>false</td>
<td>
@ -757,7 +765,7 @@ var options = {
<td>smoothCurves.type</td>
<td>String</td>
<td>"continuous"</td>
<td>This option only affects NONdynamic smooth curves. The supported types are: <code>continuous, discrete, diagonalCross, straightCross, horizontal, vertical</code>. The effects of these types
<td>This option only affects NONdynamic smooth curves. The supported types are: <code>continuous, discrete, diagonalCross, straightCross, horizontal, vertical, curvedCW, curvedCCW</code>. The effects of these types
are shown in examples <ahref="../examples/network/26_staticSmoothCurves.html">26</a> and <ahref="../examples/network/27_world_cup_network.html">27</a></td>
</tr>
<tr>
@ -848,6 +856,13 @@ var options = {
inside an object <code>nodes</code> in the networks options object.</p> All options in green boxes can be defined per-node as well.
All options defined per-node override these global settings.
<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<tdclass="greenField">borderWidth</td>
<td>Number</td>
@ -860,6 +875,31 @@ All options defined per-node override these global settings.
<td>undefined</td>
<td>The width of the border of the node when it is selected. If left at undefined, double the borderWidth will be used.</td>
</tr>
<tr>
<td>customScalingFunction</td>
<td>Function</td>
<td>Function</td>
<td>This is a function you can override to make the nodes scale the way you want them based on their values. The default function is this: <br>
<preclass="prettyprint lang-js">
function (min,max,total,value) {
if (max == min) {
return 0.5;
}
else {
var scale = 1 / (max - min);
return Math.max(0,(value - min)*scale);
}
};
</pre>
The function receives the minimum value of the set, the maximum value, the total sum of all values and finally the value of the node or edge it works on. It has to return a value between 0 and 1.
The nodes and edges then calculate their size as follows:
<preclass="prettyprint lang-js">
var scale = customScalingFunction(min,max,total,value);
var diff = maxSize - minSize;
mySize = minSize + diff * scale;</pre>
</td>
</tr>
<tr>
<tdclass="greenField">color</td>
<td>String | Object</td>
@ -926,13 +966,56 @@ All options defined per-node override these global settings.
<td>14</td>
<td>Font size in pixels for label in the node.</td>
</tr>
<tr>
<td>scaleFontWithValue</td>
<td>Boolean</td>
<td>false</td>
<td>When using values, you can let the font scale with the size of the nodes if you enable the this option.</td>
</tr>
<tr>
<td>fontSizeMin</td>
<td>Number</td>
<td>14</td>
<td>When using values, you can let the font scale with the size of the nodes if you enable the scaleFontWithValue option. This is the minimum value of the fontSize.</td>
</tr>
<tr>
<td>fontSizeMax</td>
<td>Number</td>
<td>30</td>
<td>When using values, you can let the font scale with the size of the nodes if you enable the scaleFontWithValue option. This is the maximum value of the fontSize.</td>
</tr>
<tr>
<td>fontSizeMaxVisible</td>
<td>Number</td>
<td>30</td>
<td>When using values, you can let the font scale with the size of the nodes if you enable the scaleFontWithValue option. If you have a wide distribution of values and have a large max fontSize,
the text will become huge if you zoom in on it. This option limits the percieved fontSize to avoid this. If you set it to 20, no label will be larger than fontsize 20 (at scale = 1) regardless of the scale.</td>
</tr>
<tr>
<td>fontDrawThreshold</td>
<td>Number</td>
<td>3</td>
<td>When zooming out, the text becomes smaller. This option sets the minimum size of the label before not being drawn. Just like the fontSizeMaxVisible option, this is the relative fontSize (fontSize * scale).
You can combine this with the min and max values to have the labels of influential nodes show earlier when zooming in.</td>
</tr>
<tr>
<tdclass="greenField">fontFill</td>
<td>String</td>
<td>undefined</td>
<td>If a color is supplied, there will be a background color behind the label. If left undefined, no background color is shown.</td>
</tr>
<tr>
<tdclass="greenField">fontStrokeWidth</td>
<td>Number</td>
<td>0</td>
<td>The width of the label stroke (border around label's text) in pixels.</td>
</tr>
<tr>
<tdclass="greenField">fontStrokeColor</td>
<td>String</td>
<td>'white'</td>
<td>The color of the label stroke.</td>
</tr>
<tr>
<tdclass="greenField">shape</td>
<td>string</td>
@ -941,7 +1024,7 @@ All options defined per-node override these global settings.
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, and <code>square</code>.
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and <code>icon</code>.
<br><br>
In case of <code>image</code> and <code>circularImage</code>, a property with name <code>image</code> must
@ -988,13 +1071,13 @@ All options defined per-node override these global settings.
<td>widthMin</td>
<td>Number</td>
<td>16</td>
<td>The minimum width for a scaled image. Only applicable to shape <code>image</code>.</td>
<td>The minimum width for a scaled image. Only applicable to shape <code>image</code>. This only does something if you supply a value.</td>
</tr>
<tr>
<td>widthMax</td>
<td>Number</td>
<td>64</td>
<td>The maximum width for a scaled image. Only applicable to shape <code>image</code>.</td>
<td>The maximum width for a scaled image. Only applicable to shape <code>image</code>. This only does something if you supply a value.</td>
</tr>
<tr>
@ -1009,15 +1092,39 @@ All options defined per-node override these global settings.
<td>Number</td>
<td>10</td>
<td>The minimum radius for a scaled node. Only applicable to shapes <code>dot</code>,
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, and <code>square</code>.</td>
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, and <code>square</code>. This only does something if you supply a value.</td>
</tr>
<tr>
<td>radiusMax</td>
<td>Number</td>
<td>30</td>
<td>The maximum radius for a scaled node. Only applicable to shapes <code>dot</code>,
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, and <code>square</code>.</td>
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, and <code>square</code>. This only does something if you supply a value.</td>
</tr>
<tr>
<tdclass="greenField">iconFontFace</td>
<td>String</td>
<td>undefined</td>
<td>Font face for icons, for example <code>FontAwesome</code> or <code>Ionicon</code>.<br/><em>You have to link to the css defining the font by yourself (see Examples)</em></td>
</tr>
<tr>
<tdclass="greenField">icon</td>
<td>String</td>
<td>undefined</td>
<td>Unicode of the icon f.e. <code>\uf0c0</code> (user-icon in FontAwesome)</td>
</tr>
<tr>
<tdclass="greenField">iconSize</td>
<td>Number</td>
<td>50</td>
<td>Size of the icon</td>
</tr>
<tr>
<tdclass="greenField">color</td>
<td>String</td>
<td>black</td>
<td>Color of the icon</td>
</tr>
</table>
@ -1156,15 +1263,19 @@ var options = {
<td>Font fill for the background color of the text label of the edge.
Only applicable when property <code>label</code> is defined.</td>
</tr>
<tr>
<tdclass="greenField">style</td>
<td>string</td>
<td>line</td>
<td>Define a line style for the edge.
Choose from <code>line</code> (default), <code>arrow</code>,
<code>arrow-center</code>, or <code>dash-line</code>.
</td>
<tdclass="greenField">fontStrokeWidth</td>
<td>Number</td>
<td>0</td>
<td>The width of the label stroke (border around label's text) in pixels.
Only applicable when property <code>label</code> is defined.</td>
</tr>
<tr>
<tdclass="greenField">fontStrokeColor</td>
<td>String</td>
<td>'white'</td>
<td>The color of the label stroke.
Only applicable when property <code>label</code> is defined.</td>
</tr>
<tr>
<tdclass="greenField">inheritColor</td>
@ -1173,6 +1284,28 @@ var options = {
<td>Possible values: <code>"to","from", true, false</code>. If this value is set to false, the edge color information is used. If the value is set to true or "from",
the color data from the borders of the "from" node is used. If this value is "to", the color data from the borders of the "to" node is used.</td>
</tr>
<tr>
<tdclass="greenField">labelAlignment</td>
<td>String</td>
<td>horizontal</td>
<td>Possible values: <code>"line-above", "line-center", "line-below"</code>. The alignment of the label when drawn on the edge.
If <code>horizontal</code> it will align the label absolute horizontial.</td>
</tr>
<tr>
<tdclass="greenField">opacity</td>
<td>Number</td>
<td>1.0</td>
<td>Possible values: <code>[0 .. 1]</code>. This opacity value is added on top of the color information. This only happens for the unselected state.</td>
</tr>
<tr>
<tdclass="greenField">style</td>
<td>string</td>
<td>line</td>
<td>Define a line style for the edge.
Choose from <code>line</code> (default), <code>arrow</code>,
<code>arrow-center</code>, or <code>dash-line</code>.
</td>
</tr>
<tr>
<tdclass="greenField">width</td>
<td>number</td>
@ -1191,13 +1324,13 @@ var options = {
<td>widthMin</td>
<td>Number</td>
<td>1</td>
<td>The minimum thickness of the line when using per-edge defined values.</td>
<td>The minimum thickness of the line when using per-edge defined values. This does nothing if you have not defined a value.</td>
</tr>
<tr>
<td>widthMax</td>
<td>Number</td>
<td>15</td>
<td>The maximum thickness of the line when using per-edge defined values.</td>
<td>The maximum thickness of the line when using per-edge defined values. This does nothing if you have not defined a value.</td>
</tr>
</table>
@ -1316,6 +1449,18 @@ var nodes = [
<td>14</td>
<td>Font size for the node in pixels.</td>
</tr>
<tr>
<td>fontStrokeWidth</td>
<td>Number</td>
<td>0</td>
<td>The width of the label stroke (border around label's text) in pixels.</td>
</tr>
<tr>
<td>fontStrokeColor</td>
<td>String</td>
<td>"white"</td>
<td>The color of the label stroke.</td>
</tr>
<tr>
<td>shape</td>
<td>String</td>
@ -1345,7 +1490,7 @@ To unify the physics system, the damping, repulsion distance and edge length hav
If no options for the physics system are supplied, the Barnes-Hut method will be used with the default parameters. If you want to customize the physics system easily, you can use the configurePhysics option. <br/>
When using the hierarchical display option, hierarchicalRepulsion is automatically used as the physics solver. Similarly, if you use the hierarchicalRepulsion physics option, hierarchical display is automatically turned on with default settings.
<pclass="important_note">Note: if the behaviour of your network is not the way you want it, use configurePhysics as described <u><ahref="#PhysicsConfiguration">below</a></u> or by <u><ahref="../examples/network/25_physics_configuration.html">example 25</a></u>.</p>
<pclass="important_note">Note: if the behaviour of your network is not the way you want it, use configurePhysics as described <u><ahref="#PhysicsConfiguration">below</a></u> or by <u><ahref="../examples/network/25_physics_configuration.html">example 25</a></u>.
</p>
<preclass="prettyprint">
// These variables must be defined in an options object named physics.
@ -1681,7 +1826,8 @@ var options = {
radius: 1},
maxNodeSizeIncrements: 600,
activeAreaBoxSize: 100,
clusterLevelDifference: 2
clusterLevelDifference: 2,
clusterByZoom: true
}
}
// OR to just load the module with default values:
@ -1824,6 +1970,12 @@ var options = {
If the highest level of your network at any given time is 3, nodes that have not clustered or
have clustered only once will join their neighbour with the lowest cluster level.</td>
</tr>
<tr>
<td>clusterByZoom</td>
<td>Boolean</td>
<td>true</td>
<td>You can toggle the clustering by zoom level using this option.</td>
<td>This defines the zoomspeed when using the keyboard navigation.</td>
</tr>
<tr>
<td>bindToWindow</td>
<td>Boolean</td>
<td>true</td>
<td>If this is true, global keyboard events will be used. If it is false, the keyboard events are only used when the network is active. It is activated on mouseOver automatically.</td>
</tr>
</table>
@ -2156,11 +2315,18 @@ var options = {
</td>
</tr>
<tr>
<td>getBoundingBox()</td>
<td>getBoundingBox(nodeId)</td>
<td>Object</td>
<td>Returns a bounding box for the node including label in the format: {top:Number,left:Number,right:Number,bottom:Number}. These values are in canvas space.
</td>
</tr>
<tr>
<td>getConnectedNodes(nodeId)</td>
<td>Array</td>
<td>Returns an array with nodeIds of nodes that are connected to this node. Network keeps track of the connected nodes so this function allows you
to quickly get them without iterating over all edges manually. This is a lot faster for cases with many edges.
<td>Calling freezeSimulation(true) immmediately stops the simulation and triggerst the stabilized event. This does not mean that the network
is physically stabilized but the nodes are not moving anymore. To continue the simulation call freezeSimulation(false).
</td>
</tr>
<tr>
<td>releaseNode()</td>
<td>none</td>
@ -2276,6 +2449,12 @@ var options = {
nodes with id 3 and 5. The highlisghEdges boolean can be used to automatically select the edges connected to the node.
</td>
</tr>
<tr>
<td>getConnectedNodes(nodeId)</td>
<td>Array</td>
<td>Get an array of (unique) nodeIds that are directly connected to this node.
</td>
</tr>
<tr>
<td>selectEdges(selection)</td>
<td>none</td>
@ -2295,7 +2474,7 @@ var options = {
or in percentages.</td>
</tr>
<tr>
<td>getPositions([ids])</td>
<td>getPositions([nodeIds])</td>
<td>Object</td>
<td>This will return an object of all nodes' positions. Data can be accessed with object[nodeId].x and .y. You can optionally supply an id as string or number or an array of ids. If no id or array of ids have been supplied, all positions are returned.
</td>
@ -2317,6 +2496,7 @@ var options = {
options can just be a boolean. When true, the zoom is animated, when false there is no animation.
Alternatively, you can supply an object.
<br/><br/> The object can consist of:<br/>
<b><code>nodes: [nodeIds]</code></b><br/> - an optional subset of nodes to zoom in on,<br/>
<b><code>duration: Number</code></b><br/> - the duration of the animation in milliseconds,<br/>
<b><code>easingFunction: String</code></b><br/> - the easing function of the animation, available are:<br/>
<td>Fired once when the network finished the initial stabilization run. This is fired REGARDLESS if the network has stabilized. It only means that the amount of configured stabilizationIterations have been completed.
<td>
none
</td>
</tr>
<tr>
<td>stabilized</td>
<td>Fired every time the network has been stabilized. This event can be used to trigger the .storePositions() function after stabilization. Fired with an object having the following properties:</td>
<td>The end date of the item. The end date is optional, and can be left <code>null</code>.
If end date is provided, the item is displayed as a range.
@ -232,7 +232,7 @@ var items = [
</tr>
<tr>
<td>start</td>
<td>Date</td>
<td>Date | number | string | Moment</td>
<td>yes</td>
<td>The start date of the item, for example <code>new Date(2010,9,23)</code>.</td>
</tr>
@ -468,7 +468,7 @@ var options = {
<tr>
<td>end</td>
<td>Date | Number | String</td>
<td>Date | Number | String | Moment</td>
<td>none</td>
<td>The initial end date for the axis of the timeline.
If not provided, the latest date present in the items set is taken as
@ -554,6 +554,13 @@ var options = {
<td>A map with i18n locales. See section <ahref="#Localization">Localization</a> for more information.</td>
</tr>
<tr>
<td>margin</td>
<td>Number | Object</td>
<td>Object</td>
<td>When a number, applies the margin to <code>margin.axis</code>, <code>margin.item.horizontal</code>, and <code>margin.item.vertical</code>.</td>
</tr>
<tr>
<td>margin.axis</td>
<td>Number</td>
@ -584,7 +591,7 @@ var options = {
<tr>
<td>max</td>
<td>Date | Number | String</td>
<td>Date | Number | String | Moment</td>
<td>none</td>
<td>Set a maximum Date for the visible range.
It will not be possible to move beyond this maximum.
@ -600,7 +607,7 @@ var options = {
<tr>
<td>min</td>
<td>Date | Number | String</td>
<td>Date | Number | String | Moment</td>
<td>none</td>
<td>Set a minimum Date for the visible range.
It will not be possible to move beyond this minimum.
@ -664,24 +671,39 @@ var options = {
</td>
</tr>
<!-- TODO: cleanup option order
<tr>
<td>order</td>
<td>Function</td>
<td>none</td>
<td>Provide a custom sort function to order the items. The order of the
<td>
<p>Provide a custom sort function to order the items. The order of the
items is determining the way they are stacked. The function
order is called with two parameters, both of type
`vis.components.items.Item`.
order is called with two arguments containing the data of two items to be
compared.
</p>
<pstyle="font-style: italic">WARNING: Use with caution. Custom ordering is not suitable for large amounts of items. On load, the Timeline will render all items once to determine their width and height. Keep the number of items in this configuration limited to a maximum of a few hundred items.</p>
</td>
</tr>
-->
<tr>
<td>orientation</td>
<td>String | Object</td>
<td>'bottom'</td>
<td>Orientation of the timelines axis and items. When orientation is a string, the value is applied to both items and axis. Can be 'top', 'bottom' (default), or 'both'.</td>
</tr>
<tr>
<td>orientation.axis</td>
<td>String</td>
<td>'bottom'</td>
<td>Orientation of the timeline: 'top' or 'bottom' (default). If orientation is 'bottom', the time axis is drawn at the bottom, and if 'top', the axis is drawn on top.</td>
<td>Orientation of the timeline axis: 'top', 'bottom' (default), or 'both'. If orientation is 'bottom', the time axis is drawn at the bottom. When 'top', the axis is drawn on top. When 'both', two axes are drawn, both on top and at the bottom.</td>
</tr>
<tr>
<td>orientation.item</td>
<td>String</td>
<td>'bottom'</td>
<td>Orientation of the timeline items: 'top' or 'bottom' (default). Determines whether items are aligned to the top or bottom of the Timeline.</td>
</tr>
<tr>
@ -742,6 +764,7 @@ var options = {
<code>showMinorLabels</code> are false, no horizontal axis will be
visible.</td>
</tr>
<tr>
<td>stack</td>
<td>Boolean</td>
@ -749,9 +772,19 @@ var options = {
<td>If true (default), items will be stacked on top of each other such that they do not overlap.</td>
</tr>
<tr>
<td>snap</td>
<td>function | null</td>
<td>function</td>
<td>When moving items on the Timeline, they will be snapped to nice dates like full hours or days, depending on the current scale. The <code>snap</code> function can be replaced with a custom function, or can be set to <code>null</code> to disable snapping. The signature of the snap function is:
The parameter <code>scale</code> can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'day, 'month, or 'year'. The parameter <code>step</code> is a number like 1, 2, 4, 5.
</td>
</tr>
<tr>
<td>start</td>
<td>Date | Number | String</td>
<td>Date | Number | String | Moment</td>
<td>none</td>
<td>The initial start date for the axis of the timeline.
If not provided, the earliest date present in the events is taken as start date.</td>
@ -764,6 +797,26 @@ var options = {
<td>A template function used to generate the contents of the items. The function is called by the Timeline with an items data as argument, and must return HTML code as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <ahref="#Templates">Templates</a> for a detailed explanation.</td>
</tr>
<tr>
<td>timeAxis.scale</td>
<td>string</td>
<td>none</td>
<td>Set a fixed scale for the time axis of the Timeline. Choose from <code>'millisecond'</code>, <code>'second'</code>, <code>'minute'</code>, <code>'hour'</code>, <code>'weekday'</code>, <code>'day'</code>, <code>'month'</code>, <code>'year'</code>. Example usage:
<preclass="prettyprint lang-js">var options = {
timeAxis: {scale: 'minute', step: 5}
}</pre>
</td>
</tr>
<tr>
<td>timeAxis.step</td>
<td>number</td>
<td>1</td>
<td>
Set a fixed step size for the time axis. Only applicable when used together with <code>timeAxis.scale</code>.
Choose for example 1, 2, 5, or 10.</td>
</tr>
<tr>
<td>type</td>
<td>String</td>
@ -823,6 +876,15 @@ var options = {
<th>Description</th>
</tr>
<tr>
<td>addCustomTime(time[, id])</td>
<td>Number | String</td>
<td>
Only applicable when the option showCustomTime is true.<br>
Add new vertical bar representing custom time that can be dragged by the user. Parameter <code>time</code> can be a Date, Number, or String. Parameter <code>id</code> can be Number or String. If <code>id</code> is provided, it will be used as ID for the new vertical bar, otherwise the ID will be auto generated.<br>
Returns ID of the newly created bar.
</td>
</tr>
<tr>
<td>clear([what])</td>
<td>none</td>
@ -872,9 +934,29 @@ timeline.clear({options: true}); // clear options only
</tr>
<tr>
<td>getCustomTime()</td>
<td>getCustomTime([id])</td>
<td>Date</td>
<td>Retrieve the custom time. Only applicable when the option <code>showCustomTime</code> is true.
<td>Retrieve the custom time. Only applicable when the option <code>showCustomTime</code> is true. If parameter <code>id</code> is provided, time of the custom time bar under that ID is returned.
</td>
</tr>
<trid="getEventProperties">
<td>getEventProperties(event)</td>
<td>Object</td>
<td>
Returns an Object with relevant properties from an event:
<ul>
<li><code>group</code> (Number | null): the id of the clicked group.</li>
<li><code>item</code> (Number | null): the id of the clicked item.</li>
<li><code>pageX</code> (Number): absolute horizontal position of the click event.</li>
<li><code>pageY</code> (Number): absolute vertical position of the click event.</li>
<li><code>x</code> (Number): relative horizontal position of the click event.</li>
<li><code>y</code> (Number): relative vertical position of the click event.</li>
<li><code>time</code> (Date): Date of the clicked event.</li>
<li><code>snappedTime</code> (Date): Date of the clicked event, snapped to a nice value.</li>
<li><code>what</code> (String | null): name of the clicked thing: <code>item</code>, <code>background</code>, <code>axis</code>, <code>group-label</code>, <code>custom-time</code>, or <code>current-time</code>.</li>
<li><code>event</code> (Object): the original click event.</li>
</ul>
</td>
</tr>
@ -921,7 +1003,17 @@ timeline.clear({options: true}); // clear options only
<tr>
<td>redraw()</td>
<td>none</td>
<td>Force a redraw of the Timeline. Can be useful to manually redraw when option autoResize=false.
<td>Force a redraw of the Timeline. The size of all items will be recalculated.
Can be useful to manually redraw when option <code>autoResize=false</code> and the window
has been resized, or when the items CSS has been changed.
</td>
</tr>
<tr>
<td>removeCustomTime(id)</td>
<td>none</td>
<td>
Remove vertical bars previously added to the timeline via <code>addCustomTime</code> method. Parameter <code>id</code> is the ID of the custom vertical bar returned by <code>addCustomTime</code> method.
</td>
</tr>
@ -934,9 +1026,9 @@ timeline.clear({options: true}); // clear options only
</tr>
<tr>
<td>setCustomTime(time)</td>
<td>setCustomTime(time [, id])</td>
<td>none</td>
<td>Adjust the custom time bar. Only applicable when the option <code>showCustomTime</code> is true. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
<td>Adjust the custom time bar. Only applicable when the option <code>showCustomTime</code> is true. Parameter <code>time</code> can be a Date object, numeric timestamp, or ISO date string. Parameter <code>id</code> represents ID of the custom time bar, provided by <code>addCustomTime</code> method and can be a Number or String.
<td>Fired after a redraw is complete. When moving the timeline around, this could be fired frequently.
</td>
<td>
none.
</td>
</tr>
<tr>
<tr>
<td>click</td>
<td>Fired when clicked inside the Timeline.
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>contextmenu</td>
<td>Fired when right-clicked inside the Timeline. Note that in order to prevent the context menu from showing up, default behavior of the event must be stopped:
<preclass="prettyprint lang-js">timeline.on('contextmenu', function (props) {
alert('Right click!');
props.event.preventDefault();
});
</pre>
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>doubleClick</td>
<td>Fired when double clicked inside the Timeline.
</td>
<td>
Passes a properties object as returned by the method <ahref="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
</td>
</tr>
<tr>
<td>finishedRedraw</td>
<td>Fired after a redraw is complete. When moving the timeline around, this could be fired frequently.
</td>
<td>
none.
</td>
</tr>
<tr>
<td>rangechange</td>
<td>Fired repeatedly when the user is dragging the timeline window.
<td>Fired repeatedly when the timeline window is being changed.
</td>
<td>
<ul>
<li><code>start</code> (Number): timestamp of the current start of the window.</li>
<li><code>end</code> (Number): timestamp of the current end of the window.</li>
<li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
</ul>
</td>
</tr>
<tr>
<td>rangechanged</td>
<td>Fired once after the user has dragged the timeline window.
<td>Fired once after the timeline window has been changed.
</td>
<td>
<ul>
<li><code>start</code> (Number): timestamp of the current start of the window.</li>
<li><code>end</code> (Number): timestamp of the current end of the window.</li>
<li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code>true</code>), the user can move items by dragging them, can create a new item by double tapping on an empty space, can update an item by double tapping it, and can delete a selected item by clicking the delete button on the top right.
When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code>true</code>), the user can:
</p>
<ul>
<li>Select an item by clicking it, and use ctrl+click to or shift+click to select multiple items</li>
<li>Move selected items by dragging them.</li>
<li>Create a new item by double tapping on an empty space.</li>
<li>Create a new range item by dragging on an empty space with the ctrl key down.</li>
<li>Update an item by double tapping it.</li>
<li>Delete a selected item by clicking the delete button on the top right.</li>
</ul>
<p>Option <code>editable</code> accepts a boolean or an object. When <code>editable</code> is a boolean, all manipulation actions will be either enabled or disabled. When <code>editable</code> is an object, one can enable individual manipulation actions:</p>
This example shows the how to add a label to each point in Graph2d. Each item can have a label object which contains the content and CSS class.In addition, xOffset and yOffset will adjust the location of the label relative to the point being labelled.
<br/><br/>
</div>
<br/>
<divid="visualization"></div>
<scripttype="text/javascript">
var container = document.getElementById('visualization');
var label1 = {
content: "offset label",
xOffset: 20,
yOffset: 20
}
var label2 = {
content: "Label2",
className: "red"
}
var items = [
{x: '2014-06-11', y: 10,label:label1},
{x: '2014-06-12', y: 25,label:label2},
{x: '2014-06-13', y: 30},
{x: '2014-06-14', y: 10},
{x: '2014-06-15', y: 15},
{x: '2014-06-16', y: 30}
];
var dataset = new vis.DataSet(items);
var options = {
start: '2014-06-10',
end: '2014-06-18',
};
var graph2d = new vis.Graph2d(container, dataset, options);
Roundness (0..1): <inputtype="range"min="0"max="1"value="0.5"step="0.05"style="width:200px"id="roundnessSlider"><inputid="roundnessScreen"value="0.5"> (0.5 is max roundness for continuous, 1.0 for the others)
<divid="mynetwork"></div>
<scripttype="text/javascript">
var dropdown = document.getElementById("dropdownID");
dropdown.onchange = update;
var roundnessSlider = document.getElementById("roundnessSlider");
roundnessSlider.onchange = update;
var roundnessScreen = document.getElementById("roundnessScreen");
// create an array with nodes
var nodes = [
{id: 1, label: 'Node 1'},
@ -53,7 +60,7 @@ dropdown.onchange = update;
// create an array with edges
var edges = [
{from: 1, to: 2}
{from: 1, to: 2, style:"arrow"}
];
// create a network
@ -68,8 +75,14 @@ dropdown.onchange = update;
function update() {
var type = dropdown.value;
network.setOptions({smoothCurves:{type:type}});
var roundness = roundnessSlider.value;
roundnessScreen.value = roundness;
var options = {smoothCurves:{type:type, roundness:roundness}}