Browse Source

Addresses code review comments from PR 3382 (#3398)

* Corrects usage of @static jsdoc annotation

* Correct unresolvable types

* Correct types in jsdoc and remove extraneous @class & @constructor jsdoc

* Remove incorrect @static jsdoc

* Adds missing jsdoc for param copyFromGlobals

* correct jsdoc in util

* Corrects casing on jsdocs

* Swaps @inheritDoc to @ignore for constructors where constructor args are documented in the class

* Instantiates Errors with `new`

* Addresses improperly defined @callback tags.

* Split callbacks out to separate jsdoc

* Moves constructor jsdocs back to constructor and drop @ignore.
revert-3409-performance
macleodbroad-wf 6 years ago
committed by Yotam Berkowitz
parent
commit
c325418244
93 changed files with 766 additions and 847 deletions
  1. +4
    -4
      examples/graph3d/playground/playground.js
  2. +9
    -9
      lib/DOMutil.js
  3. +47
    -47
      lib/DataSet.js
  4. +13
    -13
      lib/DataView.js
  5. +9
    -9
      lib/graph3d/Camera.js
  6. +13
    -13
      lib/graph3d/DataGroup.js
  7. +7
    -7
      lib/graph3d/Filter.js
  8. +17
    -19
      lib/graph3d/Graph3d.js
  9. +2
    -2
      lib/graph3d/Point2d.js
  10. +4
    -4
      lib/graph3d/Point3d.js
  11. +4
    -4
      lib/graph3d/Settings.js
  12. +4
    -4
      lib/graph3d/Slider.js
  13. +11
    -11
      lib/graph3d/StepNumber.js
  14. +6
    -8
      lib/network/CachedImage.js
  15. +8
    -5
      lib/network/Images.js
  16. +10
    -6
      lib/network/NetworkUtil.js
  17. +13
    -13
      lib/network/dotparser.js
  18. +3
    -7
      lib/network/modules/Canvas.js
  19. +3
    -4
      lib/network/modules/CanvasRenderer.js
  20. +22
    -23
      lib/network/modules/Clustering.js
  21. +6
    -7
      lib/network/modules/EdgesHandler.js
  22. +2
    -3
      lib/network/modules/Groups.js
  23. +11
    -12
      lib/network/modules/InteractionHandler.js
  24. +11
    -14
      lib/network/modules/KamadaKawai.js
  25. +45
    -47
      lib/network/modules/LayoutEngine.js
  26. +10
    -11
      lib/network/modules/ManipulationSystem.js
  27. +14
    -15
      lib/network/modules/NodesHandler.js
  28. +4
    -5
      lib/network/modules/PhysicsEngine.js
  29. +15
    -16
      lib/network/modules/SelectionHandler.js
  30. +12
    -13
      lib/network/modules/View.js
  31. +11
    -13
      lib/network/modules/components/Edge.js
  32. +3
    -4
      lib/network/modules/components/NavigationHandler.js
  33. +12
    -10
      lib/network/modules/components/Node.js
  34. +6
    -5
      lib/network/modules/components/algorithms/FloydWarshall.js
  35. +4
    -8
      lib/network/modules/components/edges/BezierEdgeDynamic.js
  36. +5
    -7
      lib/network/modules/components/edges/BezierEdgeStatic.js
  37. +3
    -5
      lib/network/modules/components/edges/CubicBezierEdge.js
  38. +0
    -3
      lib/network/modules/components/edges/StraightEdge.js
  39. +3
    -5
      lib/network/modules/components/edges/util/BezierEdgeBase.js
  40. +2
    -4
      lib/network/modules/components/edges/util/CubicBezierEdgeBase.js
  41. +20
    -25
      lib/network/modules/components/edges/util/EdgeBase.js
  42. +1
    -3
      lib/network/modules/components/nodes/Cluster.js
  43. +0
    -2
      lib/network/modules/components/nodes/shapes/Box.js
  44. +0
    -2
      lib/network/modules/components/nodes/shapes/Circle.js
  45. +1
    -3
      lib/network/modules/components/nodes/shapes/CircularImage.js
  46. +0
    -2
      lib/network/modules/components/nodes/shapes/Database.js
  47. +2
    -4
      lib/network/modules/components/nodes/shapes/Diamond.js
  48. +2
    -4
      lib/network/modules/components/nodes/shapes/Dot.js
  49. +4
    -6
      lib/network/modules/components/nodes/shapes/Ellipse.js
  50. +6
    -8
      lib/network/modules/components/nodes/shapes/Icon.js
  51. +6
    -8
      lib/network/modules/components/nodes/shapes/Image.js
  52. +2
    -4
      lib/network/modules/components/nodes/shapes/Square.js
  53. +2
    -4
      lib/network/modules/components/nodes/shapes/Star.js
  54. +2
    -4
      lib/network/modules/components/nodes/shapes/Text.js
  55. +6
    -8
      lib/network/modules/components/nodes/shapes/Triangle.js
  56. +6
    -8
      lib/network/modules/components/nodes/shapes/TriangleDown.js
  57. +1
    -4
      lib/network/modules/components/nodes/util/CircleImageBase.js
  58. +3
    -6
      lib/network/modules/components/nodes/util/NodeBase.js
  59. +10
    -12
      lib/network/modules/components/nodes/util/ShapeBase.js
  60. +8
    -9
      lib/network/modules/components/physics/BarnesHutSolver.js
  61. +3
    -5
      lib/network/modules/components/physics/CentralGravitySolver.js
  62. +2
    -4
      lib/network/modules/components/physics/FA2BasedCentralGravitySolver.js
  63. +1
    -4
      lib/network/modules/components/physics/FA2BasedRepulsionSolver.js
  64. +1
    -2
      lib/network/modules/components/physics/HierarchicalRepulsionSolver.js
  65. +1
    -2
      lib/network/modules/components/physics/HierarchicalSpringSolver.js
  66. +1
    -2
      lib/network/modules/components/physics/RepulsionSolver.js
  67. +3
    -4
      lib/network/modules/components/physics/SpringSolver.js
  68. +1
    -1
      lib/network/modules/components/shared/ComponentUtil.js
  69. +22
    -19
      lib/network/modules/components/shared/Label.js
  70. +44
    -44
      lib/network/shapes.js
  71. +4
    -5
      lib/shared/ColorPicker.js
  72. +10
    -14
      lib/shared/Configurator.js
  73. +0
    -2
      lib/shared/Popup.js
  74. +24
    -15
      lib/shared/Validator.js
  75. +19
    -19
      lib/timeline/Core.js
  76. +12
    -12
      lib/timeline/DateUtil.js
  77. +31
    -31
      lib/timeline/Range.js
  78. +1
    -1
      lib/timeline/Stack.js
  79. +4
    -4
      lib/timeline/TimeStep.js
  80. +3
    -3
      lib/timeline/Timeline.js
  81. +1
    -1
      lib/timeline/component/BackgroundGroup.js
  82. +1
    -1
      lib/timeline/component/CurrentTime.js
  83. +1
    -1
      lib/timeline/component/GraphGroup.js
  84. +2
    -2
      lib/timeline/component/Group.js
  85. +28
    -28
      lib/timeline/component/ItemSet.js
  86. +5
    -5
      lib/timeline/component/LineGraph.js
  87. +16
    -16
      lib/timeline/component/TimeAxis.js
  88. +4
    -4
      lib/timeline/component/graph2d_types/bar.js
  89. +5
    -5
      lib/timeline/component/graph2d_types/line.js
  90. +2
    -2
      lib/timeline/component/graph2d_types/points.js
  91. +1
    -1
      lib/timeline/component/item/BoxItem.js
  92. +1
    -1
      lib/timeline/component/item/PointItem.js
  93. +42
    -42
      lib/util.js

+ 4
- 4
examples/graph3d/playground/playground.js View File

@ -304,7 +304,7 @@ function getDataType() {
/**
* Retrieve the datatable from the entered contents of the csv text
* @param {boolean} [skipValue] | if true, the 4th element is a filter value
* @return {vis DataSet}
* @return {vis.DataSet}
*/
function getDataCsv() {
var csv = document.getElementById("csvTextarea").value;
@ -366,7 +366,7 @@ function trim(text) {
/**
* Retrieve the datatable from the entered contents of the javascript text
* @return {vis Dataset}
* @return {vis.DataSet}
*/
function getDataJson() {
var json = document.getElementById("jsonTextarea").value;
@ -378,7 +378,7 @@ function getDataJson() {
/**
* Retrieve the datatable from the entered contents of the javascript text
* @return {vis Dataset}
* @return {vis.DataSet}
*/
function getDataJavascript() {
var js = document.getElementById("javascriptTextarea").value;
@ -391,7 +391,7 @@ function getDataJavascript() {
/**
* Retrieve the datatable from the entered contents of the datasource text
* @return {vis Dataset}
* @return {vis.DataSet}
*/
function getDataDatasource() {
}

+ 9
- 9
lib/DOMutil.js View File

@ -50,7 +50,7 @@ exports.resetElements = function(JSONcontainer) {
* Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
* the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
*
* @param {String} elementType
* @param {string} elementType
* @param {Object} JSONcontainer
* @param {Object} svgContainer
* @returns {Element}
@ -86,7 +86,7 @@ exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) {
* Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
* the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
*
* @param {String} elementType
* @param {string} elementType
* @param {Object} JSONcontainer
* @param {Element} DOMContainer
* @param {Element} insertBefore
@ -135,8 +135,8 @@ exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, inse
* The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions
* as well.
*
* @param {Number} x
* @param {Number} y
* @param {number} x
* @param {number} y
* @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' }
* @param {Object} JSONcontainer
* @param {Object} svgContainer
@ -192,11 +192,11 @@ exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, l
/**
* draw a bar SVG element centered on the X coordinate
*
* @param {Number} x
* @param {Number} y
* @param {Number} width
* @param {Number} height
* @param {String} className
* @param {number} x
* @param {number} y
* @param {number} width
* @param {number} height
* @param {string} className
* @param {Object} JSONcontainer
* @param {Object} svgContainer
* @param {string} style

+ 47
- 47
lib/DataSet.js View File

@ -32,9 +32,9 @@ var Queue = require('./Queue');
*
* @param {Array} [data] Optional array with initial data
* @param {Object} [options] Available options:
* {String} fieldId Field name of the id in the
* {string} fieldId Field name of the id in the
* items, 'id' by default.
* {Object.<String, String} type
* {Object.<string, string} type
* A map with field names as key,
* and the field type as value.
* {Object} queue Queue changes to the DataSet,
@ -117,12 +117,12 @@ DataSet.prototype.setOptions = function(options) {
/**
* Subscribe to an event, add an event listener
* @param {String} event Event name. Available events: 'add', 'update',
* @param {string} event Event name. Available events: 'add', 'update',
* 'remove'
* @param {function} callback Callback method. Called with three parameters:
* {String} event
* {string} event
* {Object | null} params
* {String | Number} senderId
* {string | number} senderId
*/
DataSet.prototype.on = function(event, callback) {
var subscribers = this._subscribers[event];
@ -138,7 +138,7 @@ DataSet.prototype.on = function(event, callback) {
/**
* Unsubscribe from an event, remove an event listener
* @param {String} event
* @param {string} event
* @param {function} callback
*/
DataSet.prototype.off = function(event, callback) {
@ -150,9 +150,9 @@ DataSet.prototype.off = function(event, callback) {
/**
* Trigger an event
* @param {String} event
* @param {string} event
* @param {Object | null} params
* @param {String} [senderId] Optional id of the sender.
* @param {string} [senderId] Optional id of the sender.
* @private
*/
DataSet.prototype._trigger = function (event, params, senderId) {
@ -180,8 +180,8 @@ DataSet.prototype._trigger = function (event, params, senderId) {
* Add data.
* Adding an item will fail when there already is an item with the same id.
* @param {Object | Array} data
* @param {String} [senderId] Optional sender id
* @return {Array} addedIds Array with the ids of the added items
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} addedIds Array with the ids of the added items
*/
DataSet.prototype.add = function (data, senderId) {
var addedIds = [],
@ -214,8 +214,8 @@ DataSet.prototype.add = function (data, senderId) {
/**
* Update existing items. When an item does not exist, it will be created
* @param {Object | Array} data
* @param {String} [senderId] Optional sender id
* @return {Array} updatedIds The ids of the added or updated items
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} updatedIds The ids of the added or updated items
* @throws {Error} Unknown Datatype
*/
DataSet.prototype.update = function (data, senderId) {
@ -287,23 +287,23 @@ DataSet.prototype.update = function (data, senderId) {
* get()
* get(options: Object)
*
* get(id: Number | String)
* get(id: Number | String, options: Object)
* get(id: number | string)
* get(id: number | string, options: Object)
*
* get(ids: Number[] | String[])
* get(ids: Number[] | String[], options: Object)
* get(ids: number[] | string[])
* get(ids: number[] | string[], options: Object)
*
* Where:
*
* {Number | String} id The id of an item
* {Number[] | String{}} ids An array with ids of items
* {number | string} id The id of an item
* {number[] | string{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {String} [returnType] Type of data to be returned.
* {string} [returnType] Type of data to be returned.
* Can be 'Array' (default) or 'Object'.
* {Object.<String, String>} [type]
* {String[]} [fields] field names to be returned
* {Object.<string, string>} [type]
* {string[]} [fields] field names to be returned
* {function} [filter] filter items
* {String | function} [order] Order the items by a field name or custom sort function.
* {string | function} [order] Order the items by a field name or custom sort function.
* @param {Array} args
* @returns {DataSet}
* @throws Error
@ -417,9 +417,9 @@ DataSet.prototype.get = function (args) { // eslint-disable-line no-unused-vars
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array} ids
* @return {Array.<string|number>} ids
*/
DataSet.prototype.getIds = function (options) {
var data = this._data,
@ -506,10 +506,10 @@ DataSet.prototype.getDataSet = function () {
* Execute a callback function for every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<String, String>} [type]
* {String[]} [fields] filter fields
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
*/
DataSet.prototype.forEach = function (callback, options) {
@ -548,10 +548,10 @@ DataSet.prototype.forEach = function (callback, options) {
* Map every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<String, String>} [type]
* {String[]} [fields] filter fields
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Object[]} mappedItems
*/
@ -586,7 +586,7 @@ DataSet.prototype.map = function (callback, options) {
/**
* Filter the fields of an item
* @param {Object | null} item
* @param {String[]} fields Field names
* @param {string[]} fields Field names
* @return {Object | null} filteredItem or null if no item is provided
* @private
*/
@ -623,7 +623,7 @@ DataSet.prototype._filterFields = function (item, fields) {
/**
* Sort the provided array with items
* @param {Object[]} items
* @param {String | function} order A field name or custom sort function.
* @param {string | function} order A field name or custom sort function.
* @private
*/
DataSet.prototype._sort = function (items, order) {
@ -640,7 +640,7 @@ DataSet.prototype._sort = function (items, order) {
// order by sort function
items.sort(order);
}
// TODO: extend order by an Object {field:String, direction:String}
// TODO: extend order by an Object {field:string, direction:string}
// where direction can be 'asc' or 'desc'
else {
throw new TypeError('Order must be a function or a string');
@ -649,10 +649,10 @@ DataSet.prototype._sort = function (items, order) {
/**
* Remove an object by pointer or by id
* @param {String | Number | Object | Array} id Object or id, or an array with
* @param {string | number | Object | Array.<string|number>} id Object or id, or an array with
* objects or ids to be removed
* @param {String} [senderId] Optional sender id
* @return {Array} removedIds
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} removedIds
*/
DataSet.prototype.remove = function (id, senderId) {
var removedIds = [],
@ -683,8 +683,8 @@ DataSet.prototype.remove = function (id, senderId) {
/**
* Remove an item by its id
* @param {Number | String | Object} id id or item
* @returns {Number | String | null} id
* @param {number | string | Object} id id or item
* @returns {number | string | null} id
* @private
*/
DataSet.prototype._remove = function (id) {
@ -711,8 +711,8 @@ DataSet.prototype._remove = function (id) {
/**
* Clear the data
* @param {String} [senderId] Optional sender id
* @return {Array} removedIds The ids of all removed items
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} removedIds The ids of all removed items
*/
DataSet.prototype.clear = function (senderId) {
var i, len;
@ -733,7 +733,7 @@ DataSet.prototype.clear = function (senderId) {
/**
* Find the item with maximum value of a specified field
* @param {String} field
* @param {string} field
* @return {Object | null} item Item containing max value, or null if no items
*/
DataSet.prototype.max = function (field) {
@ -759,7 +759,7 @@ DataSet.prototype.max = function (field) {
/**
* Find the item with minimum value of a specified field
* @param {String} field
* @param {string} field
* @return {Object | null} item Item containing max value, or null if no items
*/
DataSet.prototype.min = function (field) {
@ -785,7 +785,7 @@ DataSet.prototype.min = function (field) {
/**
* Find all distinct values of a specified field
* @param {String} field
* @param {string} field
* @return {Array} values Array containing all distinct values. If data items
* do not contain the specified field are ignored.
* The returned array is unordered.
@ -829,7 +829,7 @@ DataSet.prototype.distinct = function (field) {
/**
* Add a single item. Will fail when an item with the same id already exists.
* @param {Object} item
* @return {String} id
* @return {string} id
* @private
*/
DataSet.prototype._addItem = function (item) {
@ -865,8 +865,8 @@ DataSet.prototype._addItem = function (item) {
/**
* Get an item. Fields can be converted to a specific type
* @param {String} id
* @param {Object.<String, String>} [types] field types to convert
* @param {string} id
* @param {Object.<string, string>} [types] field types to convert
* @return {Object | null} item
* @private
*/
@ -911,7 +911,7 @@ DataSet.prototype._getItem = function (id, types) {
* Will fail when the item has no id, or when there does not exist an item
* with the same id.
* @param {Object} item
* @return {String} id
* @return {string} id
* @private
*/
DataSet.prototype._updateItem = function (item) {

+ 13
- 13
lib/DataView.js View File

@ -143,15 +143,15 @@ DataView.prototype.refresh = function () {
*
* Where:
*
* {Number | String} id The id of an item
* {Number[] | String{}} ids An array with ids of items
* {number | string} id The id of an item
* {number[] | string{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {String} [type] Type of data to be returned. Can
* {string} [type] Type of data to be returned. Can
* be 'DataTable' or 'Array' (default)
* {Object.<String, String>} [convert]
* {String[]} [fields] field names to be returned
* {Object.<string, string>} [convert]
* {string[]} [fields] field names to be returned
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
* {Array | DataTable} [data] If provided, items will be appended to this
* array or table. Required in case of Google
@ -202,9 +202,9 @@ DataView.prototype.get = function (args) { // eslint-disable-line no-unused-var
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array} ids
* @return {Array.<string|number>} ids
*/
DataView.prototype.getIds = function (options) {
var ids;
@ -243,10 +243,10 @@ DataView.prototype.getIds = function (options) {
* Map every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<String, String>} [type]
* {String[]} [fields] filter fields
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {String | function} [order] Order the items by
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Object[]} mappedItems
*/
@ -299,9 +299,9 @@ DataView.prototype.getDataSet = function () {
* Event listener. Will propagate all events from the connected data set to
* the subscribers of the DataView, but will filter the items and only trigger
* when there are changes in the filtered data set.
* @param {String} event
* @param {string} event
* @param {Object | null} params
* @param {String} senderId
* @param {string} senderId
* @private
*/
DataView.prototype._onEvent = function (event, params, senderId) {

+ 9
- 9
lib/graph3d/Camera.js View File

@ -27,8 +27,8 @@ function Camera() {
/**
* Set offset camera in camera coordinates
* @param {Number} x offset by camera horisontal
* @param {Number} y offset by camera vertical
* @param {number} x offset by camera horisontal
* @param {number} y offset by camera vertical
*/
Camera.prototype.setOffset = function(x, y) {
var abs = Math.abs,
@ -58,9 +58,9 @@ Camera.prototype.getOffset = function() {
/**
* Set the location (origin) of the arm
* @param {Number} x Normalized value of x
* @param {Number} y Normalized value of y
* @param {Number} z Normalized value of z
* @param {number} x Normalized value of x
* @param {number} y Normalized value of y
* @param {number} z Normalized value of z
*/
Camera.prototype.setArmLocation = function(x, y, z) {
this.armLocation.x = x;
@ -72,9 +72,9 @@ Camera.prototype.setArmLocation = function(x, y, z) {
/**
* Set the rotation of the camera arm
* @param {Number} horizontal The horizontal rotation, between 0 and 2*PI.
* @param {number} horizontal The horizontal rotation, between 0 and 2*PI.
* Optional, can be left undefined.
* @param {Number} vertical The vertical rotation, between 0 and 0.5*PI
* @param {number} vertical The vertical rotation, between 0 and 0.5*PI
* if vertical=0.5*PI, the graph is shown from the
* top. Optional, can be left undefined.
*/
@ -108,7 +108,7 @@ Camera.prototype.getArmRotation = function() {
/**
* Set the (normalized) length of the camera arm.
* @param {Number} length A length between 0.71 and 5.0
* @param {number} length A length between 0.71 and 5.0
*/
Camera.prototype.setArmLength = function(length) {
if (length === undefined)
@ -128,7 +128,7 @@ Camera.prototype.setArmLength = function(length) {
/**
* Retrieve the arm length
* @return {Number} length
* @return {number} length
*/
Camera.prototype.getArmLength = function() {
return this.armLength;

+ 13
- 13
lib/graph3d/DataGroup.js View File

@ -32,11 +32,11 @@ function DataGroup() {
* the given instance.
* TODO: Pass settings only instead.
*
* @param {vis.Graph3D} graph3d Reference to the calling Graph3D instance.
* @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance.
* @param {Array | DataSet | DataView} rawData The data containing the items for
* the Graph.
* @param {Number} style Style Number
* @returns {Array<Object>}
* @param {number} style Style Number
* @returns {Array.<Object>}
*/
DataGroup.prototype.initializeData = function(graph3d, rawData, style) {
if (rawData === undefined) return;
@ -143,7 +143,7 @@ DataGroup.prototype.initializeData = function(graph3d, rawData, style) {
* @private
*
* @param {'x'|'y'|'z'} column The data column to process
* @param {vis.Graph3D} graph3d Reference to the calling Graph3D instance;
* @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance;
* required for access to settings
* @returns {Object}
*/
@ -176,9 +176,9 @@ DataGroup.prototype._collectRangeSettings = function(column, graph3d) {
*
* @param {DataSet | DataView} data The data containing the items for the Graph
* @param {'x'|'y'|'z'} column The data column to process
* @param {Graph3D} graph3d Reference to the calling Graph3D instance;
* @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance;
* required for access to settings
* @param {Boolean} withBars True if initializing for bar graph
* @param {boolean} withBars True if initializing for bar graph
*/
DataGroup.prototype._initializeRange = function(data, column, graph3d, withBars) {
var NUMSTEPS = 5;
@ -230,7 +230,7 @@ DataGroup.prototype.getDistinctValues = function(column, data) {
* @param {DataSet|DataView|undefined} data The data containing the items for the Graph
* @param {'x'|'y'|'z'} column The data column to process
*
* @returns {Number|null} Smallest difference value or
* @returns {number|null} Smallest difference value or
* null, if it can't be determined.
*/
DataGroup.prototype.getSmallestDifference = function(data, column) {
@ -276,7 +276,7 @@ DataGroup.prototype.getColumnRange = function(data, column) {
/**
* Determines the number of rows in the current data.
*
* @returns {Number}
* @returns {number}
*/
DataGroup.prototype.getNumberOfRows = function() {
return this.dataTable.length;
@ -325,8 +325,8 @@ DataGroup.prototype.getDataSet = function() {
/**
* Return all data values as a list of Point3d objects
* @param {Array<Object>} data
* @returns {Array<Object>}
* @param {Array.<Object>} data
* @returns {Array.<Object>}
*/
DataGroup.prototype.getDataPoints = function(data) {
var dataPoints = [];
@ -359,8 +359,8 @@ DataGroup.prototype.getDataPoints = function(data) {
* Copy all values from the data table to a matrix.
*
* The provided values are supposed to form a grid of (x,y) positions.
* @param {Array<Object>} data
* @returns {Array<Object>}
* @param {Array.<Object>} data
* @returns {Array.<Object>}
* @private
*/
DataGroup.prototype.initDataAsMatrix = function(data) {
@ -467,7 +467,7 @@ DataGroup.prototype._getDataPoints = function (data) {
*
* Throws if a problem is detected.
*
* @param {Array<Object>} data
* @param {Array.<Object>} data
* @private
*/
DataGroup.prototype._checkValueField = function (data) {

+ 7
- 7
lib/graph3d/Filter.js View File

@ -4,8 +4,8 @@ var DataView = require('../DataView');
* @class Filter
*
* @param {DataGroup} dataGroup the data group
* @param {Number} column The index of the column to be filtered
* @param {Graph} graph The graph
* @param {number} column The index of the column to be filtered
* @param {Graph3d} graph The graph
*/
function Filter (dataGroup, column, graph) {
this.dataGroup = dataGroup;
@ -49,7 +49,7 @@ Filter.prototype.isLoaded = function() {
/**
* Return the loaded progress
* @return {Number} percentage between 0 and 100
* @return {number} percentage between 0 and 100
*/
Filter.prototype.getLoadedProgress = function() {
var len = this.values.length;
@ -74,7 +74,7 @@ Filter.prototype.getLabel = function() {
/**
* Return the columnIndex of the filter
* @return {Number} columnIndex
* @return {number} columnIndex
*/
Filter.prototype.getColumn = function() {
return this.column;
@ -101,7 +101,7 @@ Filter.prototype.getValues = function() {
/**
* Retrieve one value of the filter
* @param {Number} index
* @param {number} index
* @return {*} value
*/
Filter.prototype.getValue = function(index) {
@ -114,7 +114,7 @@ Filter.prototype.getValue = function(index) {
/**
* Retrieve the (filtered) dataPoints for the currently selected filter index
* @param {Number} [index] (optional)
* @param {number} [index] (optional)
* @return {Array} dataPoints
*/
Filter.prototype._getDataPoints = function(index) {
@ -157,7 +157,7 @@ Filter.prototype.setOnLoadCallback = function(callback) {
/**
* Add a value to the list with available values for this filter
* No double entries will be created.
* @param {Number} index
* @param {number} index
*/
Filter.prototype.selectValue = function(index) {
if (index >= this.values.length)

+ 17
- 19
lib/graph3d/Graph3d.js View File

@ -24,7 +24,6 @@ Graph3d.STYLE = Settings.STYLE;
*/
var autoByDefault = undefined;
/**
* Default values for option settings.
*
@ -93,7 +92,6 @@ Graph3d.DEFAULTS = {
}
},
dataColor : {
fill : '#7DC1FF',
stroke : '#3267D2',
@ -106,7 +104,6 @@ Graph3d.DEFAULTS = {
distance : 1.7
},
/*
The following fields are 'auto by default', see above.
*/
@ -305,7 +302,7 @@ Graph3d.prototype._convertTranslationToScreen = function(translation) {
/**
* Calculate the translations and screen positions of all points
*
* @param {Array<Point3d>} points
* @param {Array.<Point3d>} points
* @private
*/
Graph3d.prototype._calcTranslations = function(points) {
@ -360,7 +357,7 @@ Graph3d.prototype._initializeRanges = function() {
* Return all data values as a list of Point3d objects
*
* @param {vis.DataSet} data
* @returns {Array<Object>}
* @returns {Array.<Object>}
*/
Graph3d.prototype.getDataPoints = function(data) {
var dataPoints = [];
@ -551,7 +548,8 @@ Graph3d.prototype._resizeCanvas = function() {
/**
* Start animation, if requested and filter present
* Start playing the animation, if requested and filter present. Only applicable
* when animation data is available.
*/
Graph3d.prototype.animationStart = function() {
// start animation when option is true
@ -1293,9 +1291,9 @@ Graph3d.prototype._redrawAxis = function() {
/**
* Calculate the color based on the given value.
* @param {Number} H Hue, a value be between 0 and 360
* @param {Number} S Saturation, a value between 0 and 1
* @param {Number} V Value, a value between 0 and 1
* @param {number} H Hue, a value be between 0 and 360
* @param {number} S Saturation, a value between 0 and 1
* @param {number} V Value, a value between 0 and 1
* @returns {string}
* @private
*/
@ -1434,7 +1432,7 @@ Graph3d.prototype._redrawBar = function(ctx, point, xWidth, yWidth, color, borde
* Draw a polygon using the passed points and fill it with the passed style and stroke.
*
* @param {CanvasRenderingContext2D} ctx
* @param {Array<vis.Point3d>} points an array of points.
* @param {Array.<vis.Point3d>} points an array of points.
* @param {string} [fillStyle] the fill style to set
* @param {string} [strokeStyle] the stroke style to set
*/
@ -2145,8 +2143,8 @@ Graph3d.prototype._insideTriangle = function (point, triangle) {
/**
*
* @param {Number} x
* @returns {Number}
* @param {number} x
* @returns {number}
*/
function sign (x) {
return x > 0 ? 1 : x < 0 ? -1 : 0;
@ -2165,8 +2163,8 @@ Graph3d.prototype._insideTriangle = function (point, triangle) {
/**
* Find a data point close to given screen position (x, y)
*
* @param {Number} x
* @param {Number} y
* @param {number} x
* @param {number} y
* @returns {Object | null} The closest data point or null if not close to any
* data point
* @private
@ -2338,7 +2336,7 @@ Graph3d.prototype._hideTooltip = function () {
* Get the horizontal mouse position from a mouse event
*
* @param {Event} event
* @returns {Number} mouse x
* @returns {number} mouse x
*/
function getMouseX (event) {
if ('clientX' in event) return event.clientX;
@ -2349,7 +2347,7 @@ function getMouseX (event) {
* Get the vertical mouse position from a mouse event
*
* @param {Event} event
* @returns {Number} mouse y
* @returns {number} mouse y
*/
function getMouseY (event) {
if ('clientY' in event) return event.clientY;
@ -2365,12 +2363,12 @@ function getMouseY (event) {
* Set the rotation and distance of the camera
*
* @param {Object} pos An object with the camera position
* @param {?Number} pos.horizontal The horizontal rotation, between 0 and 2*PI.
* @param {number} [pos.horizontal] The horizontal rotation, between 0 and 2*PI.
* Optional, can be left undefined.
* @param {?Number} pos.vertical The vertical rotation, between 0 and 0.5*PI.
* @param {number} [pos.vertical] The vertical rotation, between 0 and 0.5*PI.
* if vertical=0.5*PI, the graph is shown from
* the top. Optional, can be left undefined.
* @param {?Number} pos.distance The (normalized) distance of the camera to the
* @param {number} [pos.distance] The (normalized) distance of the camera to the
* center of the graph, a value between 0.71 and
* 5.0. Optional, can be left undefined.
*/

+ 2
- 2
lib/graph3d/Point2d.js View File

@ -1,7 +1,7 @@
/**
* @prototype Point2d
* @param {Number} [x]
* @param {Number} [y]
* @param {number} [x]
* @param {number} [y]
*/
function Point2d (x, y) {
this.x = x !== undefined ? x : 0;

+ 4
- 4
lib/graph3d/Point3d.js View File

@ -1,8 +1,8 @@
/**
* @prototype Point3d
* @param {Number} [x]
* @param {Number} [y]
* @param {Number} [z]
* @param {number} [x]
* @param {number} [y]
* @param {number} [z]
*/
function Point3d(x, y, z) {
this.x = x !== undefined ? x : 0;
@ -72,7 +72,7 @@ Point3d.crossProduct = function(a, b) {
/**
* Rtrieve the length of the vector (or the distance from this point to the origin
* @return {Number} length
* @return {number} length
*/
Point3d.prototype.length = function() {
return Math.sqrt(

+ 4
- 4
lib/graph3d/Settings.js View File

@ -336,7 +336,7 @@ function setShowLegend(showLegend, dst) {
/**
* Retrieve the style index from given styleName
* @param {string} styleName Style name such as 'dot', 'grid', 'dot-line'
* @return {Number} styleNumber Enumeration value representing the style, or -1
* @return {number} styleNumber Enumeration value representing the style, or -1
* when not found
*/
function getStyleNumberByName(styleName) {
@ -353,7 +353,7 @@ function getStyleNumberByName(styleName) {
/**
* Check if given number is a valid style number.
*
* @param {String | Number} style
* @param {string | number} style
* @return {boolean} true if valid, false otherwise
*/
function checkStyleNumber(style) {
@ -371,7 +371,7 @@ function checkStyleNumber(style) {
/**
*
* @param {String | Number} style
* @param {string | number} style
* @param {Object} dst
*/
function setStyle(style, dst) {
@ -432,7 +432,7 @@ function setBackgroundColor(backgroundColor, dst) {
/**
*
* @param {String | Object} dataColor
* @param {string | Object} dataColor
* @param {Object} dst
*/
function setDataColor(dataColor, dst) {

+ 4
- 4
lib/graph3d/Slider.js View File

@ -176,7 +176,7 @@ Slider.prototype.setOnChangeCallback = function(callback) {
/**
* Set the interval for playing the list
* @param {Number} interval The interval in milliseconds
* @param {number} interval The interval in milliseconds
*/
Slider.prototype.setPlayInterval = function(interval) {
this.playInterval = interval;
@ -184,7 +184,7 @@ Slider.prototype.setPlayInterval = function(interval) {
/**
* Retrieve the current play interval
* @return {Number} interval The interval in milliseconds
* @return {number} interval The interval in milliseconds
*/
Slider.prototype.getPlayInterval = function() {
return this.playInterval;
@ -246,7 +246,7 @@ Slider.prototype.setValues = function(values) {
/**
* Select a value by its index
* @param {Number} index
* @param {number} index
*/
Slider.prototype.setIndex = function(index) {
if (index < this.values.length) {
@ -262,7 +262,7 @@ Slider.prototype.setIndex = function(index) {
/**
* retrieve the index of the currently selected vaue
* @return {Number} index
* @return {number} index
*/
Slider.prototype.getIndex = function() {
return this.index;

+ 11
- 11
lib/graph3d/StepNumber.js View File

@ -17,9 +17,9 @@
*
* Version: 1.0
*
* @param {Number} start The start value
* @param {Number} end The end value
* @param {Number} step Optional. Step size. Must be a positive value.
* @param {number} start The start value
* @param {number} end The end value
* @param {number} step Optional. Step size. Must be a positive value.
* @param {boolean} prettyStep Optional. If true, the step size is rounded
* To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
*/
@ -52,9 +52,9 @@ StepNumber.prototype.isNumeric = function(n) {
/**
* Set a new range: start, end and step.
*
* @param {Number} start The start value
* @param {Number} end The end value
* @param {Number} step Optional. Step size. Must be a positive value.
* @param {number} start The start value
* @param {number} end The end value
* @param {number} step Optional. Step size. Must be a positive value.
* @param {boolean} prettyStep Optional. If true, the step size is rounded
* To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
*/
@ -77,7 +77,7 @@ StepNumber.prototype.setRange = function(start, end, step, prettyStep) {
/**
* Set a new step size
* @param {Number} step New step size. Must be a positive value
* @param {number} step New step size. Must be a positive value
* @param {boolean} prettyStep Optional. If true, the provided step is rounded
* to a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
*/
@ -98,8 +98,8 @@ StepNumber.prototype.setStep = function(step, prettyStep) {
* Calculate a nice step size, closest to the desired step size.
* Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an
* integer Number. For example 1, 2, 5, 10, 20, 50, etc...
* @param {Number} step Desired step size
* @return {Number} Nice step size
* @param {number} step Desired step size
* @return {number} Nice step size
*/
StepNumber.calculatePrettyStep = function (step) {
var log10 = function (x) {return Math.log(x) / Math.LN10;};
@ -124,7 +124,7 @@ StepNumber.calculatePrettyStep = function (step) {
/**
* returns the current value of the step
* @return {Number} current value
* @return {number} current value
*/
StepNumber.prototype.getCurrent = function () {
return parseFloat(this._current.toPrecision(this.precision));
@ -132,7 +132,7 @@ StepNumber.prototype.getCurrent = function () {
/**
* returns the current step size
* @return {Number} current step size
* @return {number} current step size
*/
StepNumber.prototype.getStep = function () {
return this._step;

+ 6
- 8
lib/network/CachedImage.js View File

@ -8,13 +8,11 @@
* NOTE: Images can also be of type 'data:svg+xml`. This code also works
* for svg, but the mipmapping may not be necessary.
*
* @class CachedImage
* @param {Image} image
*/
class CachedImage {
/**
* Create a Chached Image
* @param {Image} image
* @constructor
*/
constructor(image) { // eslint-disable-line no-unused-vars
this.NUM_ITERATIONS = 4; // Number of items in the coordinates array
@ -25,7 +23,7 @@ class CachedImage {
/**
* Called when the image has been succesfully loaded.
* Called when the image has been successfully loaded.
*/
init() {
if (this.initialized()) return;
@ -110,10 +108,10 @@ class CachedImage {
*
* @param {CanvasRenderingContext2D} ctx context on which to draw zoomed image
* @param {Float} factor scale factor at which to draw
* @param {Number} left
* @param {Number} top
* @param {Number} width
* @param {Number} height
* @param {number} left
* @param {number} top
* @param {number} width
* @param {number} height
*/
drawImageAtPosition(ctx, factor, left, top, width, height) {
if (factor > 2 && this.initialized()) {

+ 8
- 5
lib/network/Images.js View File

@ -1,16 +1,19 @@
import CachedImage from './CachedImage';
/**
* This callback is a callback that accepts an Image.
* @callback ImageCallback
* @param {Image} image
*/
/**
* This class loads images and keeps them stored.
* class Images
*
* @param {ImageCallback} callback
*/
class Images {
/**
* Create a Images
* @callback callback
* @param {function} callback
* @constructor Images
* @param {ImageCallback} callback
*/
constructor(callback){
this.images = {};

+ 10
- 6
lib/network/NetworkUtil.js View File

@ -1,20 +1,21 @@
let util = require("../util");
/**
* @class NetworkUtil
* Utility Class
*/
class NetworkUtil {
/**
* @constructor NetworkUtil
* @ignore
*/
constructor() {}
/**
* Find the center position of the network considering the bounding boxes
*
* @param {Array<vis.Node>} allNodes
* @param {Array<vis.Node>} [specificNodes=[]]
* @param {Array.<Node>} allNodes
* @param {Array.<Node>} [specificNodes=[]]
* @returns {{minX: number, maxX: number, minY: number, maxY: number}}
* @static
*/
static getRange(allNodes, specificNodes = []) {
var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node;
@ -45,9 +46,10 @@ class NetworkUtil {
/**
* Find the center position of the network
*
* @param {Array<vis.Node>} allNodes
* @param {Array<vis.Node>} [specificNodes=[]]
* @param {Array.<Node>} allNodes
* @param {Array.<Node>} [specificNodes=[]]
* @returns {{minX: number, maxX: number, minY: number, maxY: number}}
* @static
*/
static getRangeCore(allNodes, specificNodes = []) {
var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node;
@ -79,6 +81,7 @@ class NetworkUtil {
/**
* @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
* @returns {{x: number, y: number}}
* @static
*/
static findCenter(range) {
return {x: (0.5 * (range.maxX + range.minX)),
@ -91,6 +94,7 @@ class NetworkUtil {
* @param {vis.Item} item
* @param {'node'|undefined} type
* @returns {{}}
* @static
*/
static cloneOptions(item, type) {
let clonedOptions = {};

+ 13
- 13
lib/network/dotparser.js View File

@ -6,7 +6,7 @@
*
* DOT language attributes: http://graphviz.org/content/attrs
*
* @param {String} data Text containing a graph in DOT-notation
* @param {string} data Text containing a graph in DOT-notation
* @return {Object} graph An object containing two parameters:
* {Object[]} nodes
* {Object[]} edges
@ -104,7 +104,7 @@ function next() {
/**
* Preview the next character from the dot file.
* @return {String} cNext
* @return {string} cNext
*/
function nextPreview() {
return dot.charAt(index + 1);
@ -113,7 +113,7 @@ function nextPreview() {
var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/;
/**
* Test whether given character is alphabetic or numeric
* @param {String} c
* @param {string} c
* @return {Boolean} isAlphaNumeric
*/
function isAlphaNumeric(c) {
@ -149,7 +149,7 @@ function merge (a, b) {
* setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}}
*
* @param {Object} obj
* @param {String} path A parameter name or dot-separated parameter path,
* @param {string} path A parameter name or dot-separated parameter path,
* like "color.highlight.border".
* @param {*} value
*/
@ -248,9 +248,9 @@ function addEdge(graph, edge) {
/**
* Create an edge to a graph object
* @param {Object} graph
* @param {String | Number | Object} from
* @param {String | Number | Object} to
* @param {String} type
* @param {string | number | Object} from
* @param {string | number | Object} to
* @param {string} type
* @param {Object | null} attr
* @return {Object} edge
*/
@ -621,7 +621,7 @@ function parseAttributeStatement (graph) {
/**
* parse a node statement
* @param {Object} graph
* @param {String | Number} id
* @param {string | number} id
*/
function parseNodeStatement(graph, id) {
// node statement
@ -641,7 +641,7 @@ function parseNodeStatement(graph, id) {
/**
* Parse an edge or a series of edges
* @param {Object} graph
* @param {String | Number} from Id of the from node
* @param {string | number} from Id of the from node
*/
function parseEdge(graph, from) {
while (token === '->' || token === '--') {
@ -734,7 +734,7 @@ function parseAttributeList() {
/**
* Create a syntax error with extra information on current token and index.
* @param {String} message
* @param {string} message
* @returns {SyntaxError} err
*/
function newSyntaxError(message) {
@ -743,8 +743,8 @@ function newSyntaxError(message) {
/**
* Chop off text after a maximum length
* @param {String} text
* @param {Number} maxLength
* @param {string} text
* @param {number} maxLength
* @returns {String}
*/
function chop (text, maxLength) {
@ -843,7 +843,7 @@ function convertAttr (attr, mapping) {
/**
* Convert a string containing a graph in DOT language into a map containing
* with nodes and edges in the format of graph.
* @param {String} data Text containing a graph in DOT-notation
* @param {string} data Text containing a graph in DOT-notation
* @return {Object} graphData
*/
function DOTToGraph (data) {

+ 3
- 7
lib/network/modules/Canvas.js View File

@ -8,13 +8,10 @@ let util = require('../../util');
* This function is executed once when a Network object is created. The frame
* contains a canvas, and this canvas contains all objects like the axis and
* nodes.
*
* @class Canvas
*/
class Canvas {
/**
* @param {Object} body
* @constructor Canvas
*/
constructor(body) {
this.body = body;