diff --git a/docs/css/style.css b/docs/css/style.css index f7048a9c..3a1d060e 100644 --- a/docs/css/style.css +++ b/docs/css/style.css @@ -106,6 +106,8 @@ table.events td:nth-child(2) { pre { margin: 20px 0; + white-space: pre-wrap; + max-width: 100%; } a code { diff --git a/docs/graph3d/index.html b/docs/graph3d/index.html index 85829ad1..69d28ad6 100644 --- a/docs/graph3d/index.html +++ b/docs/graph3d/index.html @@ -386,6 +386,24 @@ var options = {
dot-size
.dot-size
.true
snap
function can be replaced with a custom function, or can be set to null
to disable snapping. The signature of the snap function is:
function snap(date: Date, scale: string, step: number) : Date or number- The parameter
scale
can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'day, 'month, or 'year'. The parameter step
is a number like 1, 2, 4, 5.
+ The parameter scale
can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'week', 'day, 'month, or 'year'. The parameter step
is a number like 1, 2, 4, 5.
'millisecond'
, 'second'
, 'minute'
, 'hour'
, 'weekday'
, 'day'
, 'month'
, 'year'
. Example usage:
+ 'millisecond'
, 'second'
, 'minute'
, 'hour'
, 'weekday'
, 'week'
, 'day'
, 'month'
, 'year'
. Example usage:
var options = { timeAxis: {scale: 'minute', step: 5} }+
Note: The 'week' scale only works properly when locales are enabled.
Timeline.getEventProperties(event)
.
+ Timeline.getEventProperties(event)
.
+ Timeline.getEventProperties(event)
.
+ vis-day1
, vis-day2
, ..., vis-day31
vis-week1
, vis-week2
, ..., vis-week53
vis-january
, vis-february
, vis-march
, vis-april
, vis-may
, vis-june
, vis-july
, vis-august
, vis-september
, vis-october
, vis-november
, vis-december
vis-year2014
, vis-year2015
, ...+ Note: the 'week' scale is not included in the automatic zoom levels as its scale is not a direct logical successor of 'days' nor a logical predecessor of 'months' +
Examples:
diff --git a/examples/graph3d/08_dot_cloud_size.html b/examples/graph3d/08_dot_cloud_size.html index 1d6fb47f..99ab8ffd 100644 --- a/examples/graph3d/08_dot_cloud_size.html +++ b/examples/graph3d/08_dot_cloud_size.html @@ -49,7 +49,9 @@ horizontal: -0.54, vertical: 0.5, distance: 1.6 - } + }, + dotSizeMinFraction: 0.5, + dotSizeMaxFraction: 2.5 }; // create our graph diff --git a/examples/network/other/saveAndLoad.html b/examples/network/other/saveAndLoad.html index ee71b528..6f96df34 100644 --- a/examples/network/other/saveAndLoad.html +++ b/examples/network/other/saveAndLoad.html @@ -71,15 +71,6 @@ draw(); } - function addContextualInformation(elem, index, array) { - addId(elem, index); - addConnections(elem, index); - } - - function addId(elem, index) { - elem.id = index; - } - function addConnections(elem, index) { // need to replace this with a tree of the network, then get child direct children of the element elem.connections = network.getConnectedNodes(index); @@ -107,7 +98,7 @@ var nodes = objectToArray(network.getPositions()); - nodes.forEach(addContextualInformation); + nodes.forEach(addConnections); // pretty print node data var exportValue = JSON.stringify(nodes, undefined, 2); @@ -141,30 +132,47 @@ return new vis.DataSet(networkNodes); } + function getNodeById(data, id) { + for (var n = 0; n < data.length; n++) { + if (data[n].id == id) { // double equals since id can be numeric or string + return data[n]; + } + }; + + throw 'Can not find id \'' + id + '\' in data'; + } + function getEdgeData(data) { var networkEdges = []; - data.forEach(function(node, index, array) { + data.forEach(function(node) { // add the connection node.connections.forEach(function(connId, cIndex, conns) { networkEdges.push({from: node.id, to: connId}); + let cNode = getNodeById(data, connId); - var elementConnections = array[connId].connections; + var elementConnections = cNode.connections; // remove the connection from the other node to prevent duplicate connections var duplicateIndex = elementConnections.findIndex(function(connection) { - connection === node.id; + return connection == node.id; // double equals since id can be numeric or string }); - elementConnections = elementConnections.splice(0, duplicateIndex - 1).concat(elementConnections.splice(duplicateIndex + 1, elementConnections.length)) - }); + + if (duplicateIndex != -1) { + elementConnections.splice(duplicateIndex, 1); + }; + }); }); return new vis.DataSet(networkEdges); } function objectToArray(obj) { - return Object.keys(obj).map(function (key) { return obj[key]; }); + return Object.keys(obj).map(function (key) { + obj[key].id = key; + return obj[key]; + }); } function resizeExportArea() { @@ -174,4 +182,4 @@ init();