diff --git a/lib/DOMutil.js b/lib/DOMutil.js index 52d507806..329b49789 100644 --- a/lib/DOMutil.js +++ b/lib/DOMutil.js @@ -1,8 +1,18 @@ // DOM utility methods +/** + * @typedef {Object.} JSONContainerEntry + * @property {Element[]} used + * @property {Element[]} redundant + */ + +/** + * @typedef {Object.} JSONContainer + */ + /** * this prepares the JSON container for allocating SVG elements - * @param {Object} JSONcontainer + * @param {JSONContainer} JSONcontainer * @private */ exports.prepareElements = function(JSONcontainer) { @@ -19,7 +29,7 @@ exports.prepareElements = function(JSONcontainer) { * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from * which to remove the redundant elements. * - * @param {Object} JSONcontainer + * @param {JSONContainer} JSONcontainer * @private */ exports.cleanupElements = function(JSONcontainer) { @@ -38,7 +48,7 @@ exports.cleanupElements = function(JSONcontainer) { /** * Ensures that all elements are removed first up so they can be recreated cleanly - * @param {Object} JSONcontainer + * @param {JSONContainer} JSONcontainer */ exports.resetElements = function(JSONcontainer) { exports.prepareElements(JSONcontainer); @@ -51,8 +61,8 @@ exports.resetElements = function(JSONcontainer) { * 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 {Object} JSONcontainer - * @param {Object} svgContainer + * @param {JSONContainer} JSONcontainer + * @param {HTMLElement} svgContainer * @returns {Element} * @private */ @@ -87,7 +97,7 @@ exports.getSVGElement = function (elementType, JSONcontainer, 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 {Object} JSONcontainer + * @param {JSONContainer} JSONcontainer * @param {Element} DOMContainer * @param {Element} insertBefore * @returns {*} @@ -137,11 +147,11 @@ exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, inse * * @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 - * @param {Object} labelObj - * @returns {vis.PointItem} + * @param {GroupTemplate} groupTemplate + * @param {JSONContainer} JSONcontainer + * @param {HTMLElement} svgContainer + * @param {Element} labelObj + * @returns {PointItem} */ exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) { var point; @@ -197,8 +207,8 @@ exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, l * @param {number} width * @param {number} height * @param {string} className - * @param {Object} JSONcontainer - * @param {Object} svgContainer + * @param {JSONContainer} JSONcontainer + * @param {HTMLElement} svgContainer * @param {string} style */ exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) { @@ -207,7 +217,7 @@ exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgCo height *= -1; y -= height; } - var rect = exports.getSVGElement('rect',JSONcontainer, svgContainer); + var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer); rect.setAttributeNS(null, "x", x - 0.5 * width); rect.setAttributeNS(null, "y", y); rect.setAttributeNS(null, "width", width); diff --git a/lib/DataSet.js b/lib/DataSet.js index 19eaabe9d..30659cbc6 100644 --- a/lib/DataSet.js +++ b/lib/DataSet.js @@ -1,11 +1,21 @@ var util = require('./util'); var Queue = require('./Queue'); +/** + * @typedef {Object.} DataSet~Options + * @property {string} fieldId - Field name of the id in the items, 'id' by default. + * @property {Object.} type - A map with field names as key, and the field type as value. + * @property {Queue|Queue~Options} queue - Queue changes to the DataSet, flush them all at once. + */ + /** * DataSet - * // TODO: add a DataSet constructor DataSet(data, options) + * A data set can: + * - add/remove/update data + * - gives triggers upon changes in the data + * - can import/export data in various data formats * - * Usage: + * @example * var dataSet = new DataSet({ * fieldId: '_id', * type: { @@ -25,24 +35,11 @@ var Queue = require('./Queue'); * var data = dataSet.get(ids, options, data); * dataSet.clear(); * - * A data set can: - * - add/remove/update data - * - gives triggers upon changes in the data - * - can import/export data in various data formats + * @param {Array.} [data] Optional array with initial data + * @param {DataSet~Options} [options] * - * @param {Array} [data] Optional array with initial data - * @param {Object} [options] Available options: - * {string} fieldId Field name of the id in the - * items, 'id' by default. - * {Object.} Queue~Options + * @property {number} [delay=null] When provided, the queue will be flushed + * automatically after an inactivity of this delay + * in milliseconds. + * @property {number} [max=Infinity] When the queue exceeds the given maximum number + * of entries, the queue is flushed automatically. + */ + /** * A queue - * @param {Object} options - * Available options: - * - delay: number When provided, the queue will be flushed - * automatically after an inactivity of this delay - * in milliseconds. - * Default value is null. - * - max: number When the queue exceeds the given maximum number - * of entries, the queue is flushed automatically. - * Default value of max is Infinity. + * @param {Queue~Options} options * @constructor Queue */ function Queue(options) { diff --git a/lib/graph3d/DataGroup.js b/lib/graph3d/DataGroup.js index f7a12094c..85c3072bb 100644 --- a/lib/graph3d/DataGroup.js +++ b/lib/graph3d/DataGroup.js @@ -32,7 +32,7 @@ function DataGroup() { * the given instance. * TODO: Pass settings only instead. * - * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance. + * @param {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 @@ -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 {Graph3d} graph3d Reference to the calling Graph3D instance; * required for access to settings * @returns {Object} */ @@ -176,7 +176,7 @@ 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 {vis.Graph3d} graph3d Reference to the calling Graph3D instance; + * @param {Graph3d} graph3d Reference to the calling Graph3D instance; * required for access to settings * @param {boolean} withBars True if initializing for bar graph */ @@ -292,7 +292,7 @@ DataGroup.prototype.getNumberOfRows = function() { * to pass in a range already set with the min/max set from the data. Otherwise, * it's quite hard to process the min/max properly. * - * @param {vis.Range} range + * @param {Range} range * @param {number} [defaultMin=range.min] * @param {number} [defaultMax=range.max] * @private diff --git a/lib/graph3d/Graph3d.js b/lib/graph3d/Graph3d.js index 8f816e6d7..de9af6050 100755 --- a/lib/graph3d/Graph3d.js +++ b/lib/graph3d/Graph3d.js @@ -21,6 +21,8 @@ Graph3d.STYLE = Settings.STYLE; * * Using 'undefined' directly achieves the same thing, but this is more * descriptive by describing the intent. + * + * @ignore */ var autoByDefault = undefined; @@ -32,6 +34,8 @@ var autoByDefault = undefined; * * If a field is not in this list, a default value of 'autoByDefault' is assumed, * which is just an alias for 'undefined'. + * + * @ignore */ Graph3d.DEFAULTS = { width : '400px', @@ -356,7 +360,7 @@ Graph3d.prototype._initializeRanges = function() { /** * Return all data values as a list of Point3d objects * - * @param {vis.DataSet} data + * @param {DataSet} data * @returns {Array.} */ Graph3d.prototype.getDataPoints = function(data) { @@ -617,7 +621,7 @@ Graph3d.prototype.getCameraPosition = function() { /** * Load data into the 3D Graph * - * @param {vis.DataSet} data + * @param {DataSet} data * @private */ Graph3d.prototype._readData = function(data) { @@ -976,8 +980,8 @@ Graph3d.prototype._redrawInfo = function() { * If stroke style specified, set that as well. * * @param {CanvasRenderingContext2D} ctx - * @param {vis.Point2d} from - * @param {vis.Point2d} to + * @param {Point2d} from + * @param {Point2d} to * @param {string} [strokeStyle] * @private */ @@ -995,7 +999,7 @@ Graph3d.prototype._line = function(ctx, from, to, strokeStyle) { /** * * @param {CanvasRenderingContext2D} ctx - * @param {vis.Point3d} point3d + * @param {Point3d} point3d * @param {string} text * @param {number} armAngle * @param {number} [yMargin=0] @@ -1029,7 +1033,7 @@ Graph3d.prototype.drawAxisLabelX = function(ctx, point3d, text, armAngle, yMargi /** * * @param {CanvasRenderingContext2D} ctx - * @param {vis.Point3d} point3d + * @param {Point3d} point3d * @param {string} text * @param {number} armAngle * @param {number} [yMargin=0] @@ -1063,7 +1067,7 @@ Graph3d.prototype.drawAxisLabelY = function(ctx, point3d, text, armAngle, yMargi /** * * @param {CanvasRenderingContext2D} ctx - * @param {vis.Point3d} point3d + * @param {Point3d} point3d * @param {string} text * @param {number} [offset=0] */ @@ -1089,8 +1093,8 @@ Graph3d.prototype.drawAxisLabelZ = function(ctx, point3d, text, offset) { * If stroke style specified, set that as well. * * @param {CanvasRenderingContext2D} ctx - * @param {vis.Point2d} from - * @param {vis.Point2d} to + * @param {Point2d} from + * @param {Point2d} to * @param {string} [strokeStyle] * @private */ @@ -1321,7 +1325,7 @@ Graph3d.prototype._hsv2rgb = function(H, S, V) { /** * - * @param {vis.Point3d} point + * @param {Point3d} point * @returns {*} * @private */ @@ -1432,7 +1436,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.} points an array of points. + * @param {Array.} points an array of points. * @param {string} [fillStyle] the fill style to set * @param {string} [strokeStyle] the stroke style to set */ @@ -2130,8 +2134,8 @@ Graph3d.prototype._onWheel = function(event) { /** * Test whether a point lies inside given 2D triangle * - * @param {vis.Point2d} point - * @param {vis.Point2d[]} triangle + * @param {Point2d} point + * @param {Point2d[]} triangle * @returns {boolean} true if given point lies inside or on the edge of the * triangle, false otherwise * @private diff --git a/lib/graph3d/Point3d.js b/lib/graph3d/Point3d.js index 4dba71e06..3d971398b 100644 --- a/lib/graph3d/Point3d.js +++ b/lib/graph3d/Point3d.js @@ -71,7 +71,7 @@ Point3d.crossProduct = function(a, b) { /** - * Rtrieve the length of the vector (or the distance from this point to the origin + * Rtrieve the length of the vector (or the distance) from this point to the origin * @return {number} length */ Point3d.prototype.length = function() { diff --git a/lib/graph3d/Settings.js b/lib/graph3d/Settings.js index 560543a35..dfbc7131f 100755 --- a/lib/graph3d/Settings.js +++ b/lib/graph3d/Settings.js @@ -42,6 +42,7 @@ var STYLENAME = { * * Specifically, these are the fields which require no special handling, * and can be directly copied over. + * @ignore */ var OPTIONKEYS = [ 'width', @@ -81,6 +82,7 @@ var OPTIONKEYS = [ * * Same as OPTIONKEYS, but internally these fields are stored with * prefix 'default' in the name. + * @ignore */ var PREFIXEDOPTIONKEYS = [ 'xBarWidth', diff --git a/lib/graph3d/options.js b/lib/graph3d/options.js index 95ff370c7..f577ea688 100644 --- a/lib/graph3d/options.js +++ b/lib/graph3d/options.js @@ -4,6 +4,7 @@ * * __any__ means that the name of the property does not matter. * __type__ is a required field for all objects and contains the allowed types of all objects + * @ignore */ let string = 'string'; let bool = 'boolean'; @@ -28,6 +29,7 @@ let colorOptions = { * - x/y/z-prefixes ignored in sorting * - __type__ always at end * - globals at end + * @ignore */ let allOptions = { animationAutoStart: { boolean: bool, 'undefined': 'undefined' }, diff --git a/lib/hammerUtil.js b/lib/hammerUtil.js index e9cb66655..efb56fccf 100644 --- a/lib/hammerUtil.js +++ b/lib/hammerUtil.js @@ -17,7 +17,7 @@ exports.onTouch = function (hammer, callback) { * Register a release event, taking place after a gesture * @param {Hammer} hammer A hammer instance * @param {function} callback Callback, called as callback(event) - * @returns {*} + * @returns {function} */ exports.onRelease = function (hammer, callback) { callback.inputHandler = function (event) { @@ -43,6 +43,7 @@ exports.offTouch = function (hammer, callback) { * Unregister a release event, taking place before a gesture * @param {Hammer} hammer A hammer instance * @param {function} callback Callback, called as callback(event) + * @ignore */ exports.offRelease = exports.offTouch; diff --git a/lib/network/Images.js b/lib/network/Images.js index 850a7be05..ec6da07f9 100644 --- a/lib/network/Images.js +++ b/lib/network/Images.js @@ -46,7 +46,7 @@ class Images { /** * - * @param {vis.Image} imageToRedrawWith + * @param {Image} imageToRedrawWith * @private */ _redrawWithImage (imageToRedrawWith) { @@ -99,7 +99,7 @@ class Images { * IE11 fix -- thanks dponch! * * Local helper function - * @param {vis.Image} imageToCache + * @param {Image} imageToCache * @private */ _fixImageCoordinates(imageToCache) { diff --git a/lib/network/Network.js b/lib/network/Network.js index fbe2b9de0..19aca606f 100644 --- a/lib/network/Network.js +++ b/lib/network/Network.js @@ -64,6 +64,8 @@ function Network(container, data, options) { * that case there will be nodes and edges not displayed. * The bottom line is that all code with actions related to visibility, *must* use * 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly. + * + * @ignore */ this.body = { container: container, @@ -111,7 +113,6 @@ function Network(container, data, options) { }; - // bind the event listeners this.bindEventListeners(); diff --git a/lib/network/NetworkUtil.js b/lib/network/NetworkUtil.js index ec608c22a..03deaa394 100644 --- a/lib/network/NetworkUtil.js +++ b/lib/network/NetworkUtil.js @@ -91,7 +91,7 @@ class NetworkUtil { /** * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes. - * @param {vis.Item} item + * @param {Item} item * @param {'node'|undefined} type * @returns {{}} * @static diff --git a/lib/network/dotparser.js b/lib/network/dotparser.js index 6b2740e1a..936f03401 100644 --- a/lib/network/dotparser.js +++ b/lib/network/dotparser.js @@ -587,7 +587,7 @@ function parseSubgraph (graph) { * Available keywords are 'node', 'edge', 'graph'. * The previous list with default attributes will be replaced * @param {Object} graph - * @returns {String | null} keyword Returns the name of the parsed attribute + * @returns {string | null} keyword Returns the name of the parsed attribute * (node, edge, graph), or null if nothing * is parsed. */ @@ -745,7 +745,7 @@ function newSyntaxError(message) { * Chop off text after a maximum length * @param {string} text * @param {number} maxLength - * @returns {String} + * @returns {string} */ function chop (text, maxLength) { return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); diff --git a/lib/network/modules/Clustering.js b/lib/network/modules/Clustering.js index 5b9ad9605..298f4d65f 100644 --- a/lib/network/modules/Clustering.js +++ b/lib/network/modules/Clustering.js @@ -395,8 +395,8 @@ class ClusterEngine { * This function creates the edges that will be attached to the cluster * It looks for edges that are connected to the nodes from the "outside' of the cluster. * - * @param {{Node.id: vis.Node}} childNodesObj - * @param {{vis.Edge.id: vis.Edge}} childEdgesObj + * @param {{Node.id: Node}} childNodesObj + * @param {{Edge.id: Edge}} childEdgesObj * @param {Object} clusterNodeProperties * @param {Object} clusterEdgeProperties * @private @@ -456,8 +456,8 @@ class ClusterEngine { /** * Find a cluster edge which matches the given created edge. - * @param {vis.Edge} createdEdge - * @returns {vis.Edge} + * @param {Edge} createdEdge + * @returns {Edge} */ var getNewEdge = function(createdEdge) { for (let j = 0; j < newEdges.length; j++) { @@ -686,7 +686,7 @@ class ClusterEngine { /** * Open a cluster by calling this function. - * @param {vis.Edge.id} clusterNodeId | the ID of the cluster node + * @param {Edge.id} clusterNodeId | the ID of the cluster node * @param {Object} options * @param {boolean} refreshData | wrap up afterwards if not true */ @@ -896,7 +896,7 @@ class ClusterEngine { /** * Using a clustered nodeId, update with the new options - * @param {vis.Edge.id} clusteredNodeId + * @param {Edge.id} clusteredNodeId * @param {object} newOptions */ updateClusteredNode(clusteredNodeId, newOptions) { @@ -910,7 +910,7 @@ class ClusterEngine { /** * Using a base edgeId, update all related clustered edges with the new options - * @param {vis.Edge.id} startEdgeId + * @param {Edge.id} startEdgeId * @param {object} newOptions */ updateEdge(startEdgeId, newOptions) { @@ -928,8 +928,8 @@ class ClusterEngine { /** * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId) - * @param {vis.Edge.id} edgeId - * @returns {Array.} + * @param {Edge.id} edgeId + * @returns {Array.} */ getClusteredEdges(edgeId) { let stack = []; @@ -947,8 +947,8 @@ class ClusterEngine { /** * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge - * @param {vis.Edge.id} clusteredEdgeId - * @returns {vis.Edge.id} baseEdgeId + * @param {Edge.id} clusteredEdgeId + * @returns {Edge.id} baseEdgeId * * TODO: deprecate in 5.0.0. Method getBaseEdges() is the correct one to use. */ @@ -961,8 +961,8 @@ class ClusterEngine { /** * Get all regular edges for this clustered edge id. * - * @param {vis.Edge.id} clusteredEdgeId - * @returns {Array.} all baseEdgeId's under this clustered edge + * @param {Edge.id} clusteredEdgeId + * @returns {Array.} all baseEdgeId's under this clustered edge */ getBaseEdges(clusteredEdgeId) { let IdsToHandle = [clusteredEdgeId]; @@ -1006,7 +1006,7 @@ class ClusterEngine { /** * Get the Id the node is connected to - * @param {vis.Edge} edge + * @param {Edge} edge * @param {Node.id} nodeId * @returns {*} * @private @@ -1067,7 +1067,7 @@ class ClusterEngine { * * @param {Node.id} fromId * @param {Node.id} toId - * @param {vis.Edge} baseEdge + * @param {Edge} baseEdge * @param {Object} clusterEdgeProperties * @param {Object} extraOptions * @returns {Edge} newly created clustered edge @@ -1437,7 +1437,7 @@ class ClusterEngine { * - it is directly replaced by a clustering edge * - any of its connecting nodes is in a cluster * - * @param {vis.Edge.id} edgeId + * @param {Edge.id} edgeId * @return {boolean} true if part of a cluster. */ _isClusteredEdge(edgeId) { diff --git a/lib/network/modules/InteractionHandler.js b/lib/network/modules/InteractionHandler.js index 75cd0f1dd..e617046cd 100644 --- a/lib/network/modules/InteractionHandler.js +++ b/lib/network/modules/InteractionHandler.js @@ -252,9 +252,9 @@ class InteractionHandler { /** * Remove all node and edge id's from the first set that are present in the second one. * - * @param {{nodes: Array., edges: Array.}} firstSet - * @param {{nodes: Array., edges: Array.}} secondSet - * @returns {{nodes: Array., edges: Array.}} + * @param {{nodes: Array., edges: Array.}} firstSet + * @param {{nodes: Array., edges: Array.}} secondSet + * @returns {{nodes: Array., edges: Array.}} * @private */ _determineDifference(firstSet, secondSet) { diff --git a/lib/network/modules/KamadaKawai.js b/lib/network/modules/KamadaKawai.js index 415b021dc..2c1948d8d 100644 --- a/lib/network/modules/KamadaKawai.js +++ b/lib/network/modules/KamadaKawai.js @@ -42,7 +42,7 @@ class KamadaKawai { /** * Position the system * @param {Array.} nodesArray - * @param {Array.} edgesArray + * @param {Array.} edgesArray * @param {boolean} [ignoreClusters=false] */ solve(nodesArray, edgesArray, ignoreClusters = false) { diff --git a/lib/network/modules/LayoutEngine.js b/lib/network/modules/LayoutEngine.js index a25d40e7d..57d183d59 100644 --- a/lib/network/modules/LayoutEngine.js +++ b/lib/network/modules/LayoutEngine.js @@ -29,6 +29,7 @@ * A hierarchical layout is a different thing from a hierarchical network. * The layout is a way to arrange the nodes in the view; this can be done * on non-hierarchical networks as well. The converse is also possible. + * @ignore */ let util = require('../../util'); var NetworkUtil = require('../NetworkUtil').default; @@ -1134,7 +1135,7 @@ class LayoutEngine { * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map. * This is used to only get the distances to nodes outside of a branch. * @param {Node} node - * @param {{Node.id: vis.Node}} map + * @param {{Node.id: Node}} map * @returns {number[]} * @private */ @@ -1376,7 +1377,7 @@ class LayoutEngine { * Return the active (i.e. visible) edges for this node * * @param {Node} node - * @returns {Array.} Array of edge instances + * @returns {Array.} Array of edge instances * @private */ _getActiveEdges(node) { @@ -1776,7 +1777,7 @@ class LayoutEngine { * Determine the center position of a branch from the passed list of child nodes * * This takes into account the positions of all the child nodes. - * @param {Array.} childNodes Array of either child nodes or node id's + * @param {Array.} childNodes Array of either child nodes or node id's * @return {number} * @private */ diff --git a/lib/network/modules/SelectionHandler.js b/lib/network/modules/SelectionHandler.js index 61a710a49..0a6772e63 100644 --- a/lib/network/modules/SelectionHandler.js +++ b/lib/network/modules/SelectionHandler.js @@ -551,7 +551,7 @@ class SelectionHandler { * * @param {Event} event * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse - * @param {Node|vis.Edge} object + * @param {Node|Edge} object * @private */ emitBlurEvent(event, pointer, object) { @@ -576,7 +576,7 @@ class SelectionHandler { * * @param {Event} event * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse - * @param {Node|vis.Edge} object + * @param {Node|Edge} object * @returns {boolean} hoverChanged * @private */ diff --git a/lib/network/modules/components/physics/CentralGravitySolver.js b/lib/network/modules/components/physics/CentralGravitySolver.js index ec914d015..2e642b76e 100644 --- a/lib/network/modules/components/physics/CentralGravitySolver.js +++ b/lib/network/modules/components/physics/CentralGravitySolver.js @@ -46,7 +46,7 @@ class CentralGravitySolver { * @param {number} distance * @param {number} dx * @param {number} dy - * @param {Object} forces + * @param {Object} forces * @param {Node} node * @private */ diff --git a/lib/network/options.js b/lib/network/options.js index 3db878dde..a80354304 100644 --- a/lib/network/options.js +++ b/lib/network/options.js @@ -4,6 +4,7 @@ * * __any__ means that the name of the property does not matter. * __type__ is a required field for all objects and contains the allowed types of all objects + * @ignore */ let string = 'string'; let bool = 'boolean'; diff --git a/lib/timeline/DateUtil.js b/lib/timeline/DateUtil.js index 61eb00231..d83e2ce1c 100644 --- a/lib/timeline/DateUtil.js +++ b/lib/timeline/DateUtil.js @@ -286,7 +286,7 @@ exports.stepOverHiddenDates = function(moment, timeStep, previousTime) { /** * replaces the Core toScreen methods * - * @param {vis.Core} Core + * @param {Core} Core * @param {Date} time * @param {number} width * @returns {number} @@ -328,7 +328,7 @@ exports.toScreen = function (Core, time, width) { /** * Replaces the core toTime methods * - * @param {vis.Core} Core + * @param {Core} Core * @param {number} x * @param {number} width * @returns {Date} diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index 198f86a71..df6373711 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -19,8 +19,8 @@ var Validator = require('../shared/Validator').default; /** * Create a timeline visualization * @param {HTMLElement} container - * @param {vis.DataSet | Array} [items] - * @param {vis.DataSet | Array | vis.DataView | Object} [groups] + * @param {DataSet | Array} [items] + * @param {DataSet | Array | DataView | Object} [groups] * @param {Object} [options] See Graph2d.setOptions for the available options. * @constructor Graph2d * @extends Core @@ -150,7 +150,7 @@ Graph2d.prototype.setOptions = function (options) { /** * Set items - * @param {vis.DataSet | Array | null} items + * @param {DataSet | Array | null} items */ Graph2d.prototype.setItems = function(items) { var initialLoad = (this.itemsData == null); @@ -191,7 +191,7 @@ Graph2d.prototype.setItems = function(items) { /** * Set groups - * @param {vis.DataSet | Array} groups + * @param {DataSet | Array} groups */ Graph2d.prototype.setGroups = function(groups) { // convert to type DataSet when needed @@ -213,7 +213,7 @@ Graph2d.prototype.setGroups = function(groups) { /** * Returns an object containing an SVG element with the icon of the group (size determined by iconWidth and iconHeight), the label of the group (content) and the yAxisOrientation of the group (left or right). - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup.id} groupId * @param {number} width * @param {number} height * @returns {{icon: SVGElement, label: string, orientation: string}|string} @@ -231,7 +231,7 @@ Graph2d.prototype.getLegend = function(groupId, width, height) { /** * This checks if the visible option of the supplied group (by ID) is true or false. - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup.id} groupId * @returns {boolean} */ Graph2d.prototype.isGroupVisible = function(groupId) { diff --git a/lib/timeline/Stack.js b/lib/timeline/Stack.js index 0aac7b730..c63364217 100644 --- a/lib/timeline/Stack.js +++ b/lib/timeline/Stack.js @@ -108,7 +108,7 @@ exports.nostack = function(items, margin, subgroups, stackSubgroups) { /** * Adjust vertical positions of the subgroups such that they don't overlap each * other. - * @param {Array.} items + * @param {Array.} items * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin Margins between items and between items and the axis. * @param {subgroups[]} subgroups * All subgroups diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index 9cb5e07ca..d9ccfd6bc 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -564,7 +564,7 @@ TimeStep.prototype.isMajor = function() { * date and the scale. For example when scale is MINUTE, the current time is * formatted as "hh:mm". * @param {Date} [date=this.current] custom date. if not provided, current date is taken - * @returns {String} + * @returns {string} */ TimeStep.prototype.getLabelMinor = function(date) { if (date == undefined) { @@ -595,7 +595,7 @@ TimeStep.prototype.getLabelMinor = function(date) { * date and the scale. For example when scale is MINUTE, the major scale is * hours, and the hour will be formatted as "hh". * @param {Date} [date=this.current] custom date. if not provided, current date is taken - * @returns {String} + * @returns {string} */ TimeStep.prototype.getLabelMajor = function(date) { if (date == undefined) { @@ -623,7 +623,7 @@ TimeStep.prototype.getClassName = function() { /** * * @param {number} value - * @returns {String} + * @returns {string} */ function even(value) { return (value / step % 2 == 0) ? ' vis-even' : ' vis-odd'; @@ -632,7 +632,7 @@ TimeStep.prototype.getClassName = function() { /** * * @param {Date} date - * @returns {String} + * @returns {string} */ function today(date) { if (date.isSame(new Date(), 'day')) { @@ -650,7 +650,7 @@ TimeStep.prototype.getClassName = function() { /** * * @param {Date} date - * @returns {String} + * @returns {string} */ function currentWeek(date) { return date.isSame(new Date(), 'week') ? ' vis-current-week' : ''; @@ -659,7 +659,7 @@ TimeStep.prototype.getClassName = function() { /** * * @param {Date} date - * @returns {String} + * @returns {string} */ function currentMonth(date) { return date.isSame(new Date(), 'month') ? ' vis-current-month' : ''; @@ -668,7 +668,7 @@ TimeStep.prototype.getClassName = function() { /** * * @param {Date} date - * @returns {String} + * @returns {string} */ function currentYear(date) { return date.isSame(new Date(), 'year') ? ' vis-current-year' : ''; diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index c1089613e..2cb374381 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -20,8 +20,8 @@ var Validator = require('../shared/Validator').default; /** * Create a timeline visualization * @param {HTMLElement} container - * @param {vis.DataSet | vis.DataView | Array} [items] - * @param {vis.DataSet | vis.DataView | Array} [groups] + * @param {DataSet | DataView | Array} [items] + * @param {DataSet | DataView | Array} [groups] * @param {Object} [options] See Timeline.setOptions for the available options. * @constructor Timeline * @extends Core @@ -250,7 +250,7 @@ Timeline.prototype.setOptions = function (options) { /** * Set items - * @param {vis.DataSet | Array | null} items + * @param {DataSet | Array | null} items */ Timeline.prototype.setItems = function(items) { // convert to type DataSet when needed @@ -278,7 +278,7 @@ Timeline.prototype.setItems = function(items) { /** * Set groups - * @param {vis.DataSet | Array} groups + * @param {DataSet | Array} groups */ Timeline.prototype.setGroups = function(groups) { // convert to type DataSet when needed @@ -306,7 +306,7 @@ Timeline.prototype.setGroups = function(groups) { /** * Set both items and groups in one go - * @param {{items: (Array | vis.DataSet), groups: (Array | vis.DataSet)}} data + * @param {{items: (Array | DataSet), groups: (Array | DataSet)}} data */ Timeline.prototype.setData = function (data) { if (data && data.groups) { @@ -345,7 +345,7 @@ Timeline.prototype.setSelection = function(ids, options) { /** * Get the selected items by their id - * @return {Array} ids The ids of the selected items + * @return {Array.} ids The ids of the selected items */ Timeline.prototype.getSelection = function() { return this.itemSet && this.itemSet.getSelection() || []; @@ -354,7 +354,7 @@ Timeline.prototype.getSelection = function() { /** * Adjust the visible window such that the selected item (or multiple items) * are centered on screen. - * @param {string | String[]} id An item id or array with item ids + * @param {string | string[]} id An item id or array with item ids * @param {Object} [options] Available options: * `animation: boolean | {duration: number, easingFunction: string}` * If true (default), the range is animated @@ -431,7 +431,7 @@ Timeline.prototype.fit = function (options) { /** * - * @param {vis.Item} item + * @param {Item} item * @returns {number} */ function getStart(item) { @@ -440,7 +440,7 @@ function getStart(item) { /** * - * @param {vis.Item} item + * @param {Item} item * @returns {number} */ function getEnd(item) { diff --git a/lib/timeline/component/GraphGroup.js b/lib/timeline/component/GraphGroup.js index e3431e9aa..45623c2a4 100644 --- a/lib/timeline/component/GraphGroup.js +++ b/lib/timeline/component/GraphGroup.js @@ -100,7 +100,7 @@ GraphGroup.prototype.setOptions = function (options) { /** * this updates the current group class with the latest group dataset entree, used in _updateGroup in linegraph - * @param {vis.Group} group + * @param {Group} group */ GraphGroup.prototype.update = function (group) { this.group = group; diff --git a/lib/timeline/component/Group.js b/lib/timeline/component/Group.js index 306d0f4c5..0dfcb5015 100644 --- a/lib/timeline/component/Group.js +++ b/lib/timeline/component/Group.js @@ -321,7 +321,7 @@ Group.prototype.redraw = function(range, margin, forceRestack) { /** * recalculate the height of the subgroups * - * @param {{item: vis.Item}} margin + * @param {{item: Item}} margin * @private */ Group.prototype._calculateSubGroupHeights = function (margin) { @@ -342,8 +342,8 @@ Group.prototype._calculateSubGroupHeights = function (margin) { /** * check if group is visible * - * @param {vis.Range} range - * @param {{axis: vis.DataAxis}} margin + * @param {Range} range + * @param {{axis: DataAxis}} margin * @returns {boolean} is visible * @private */ @@ -743,7 +743,7 @@ Group.prototype._checkIfVisible = function(item, visibleItems, range) { * this one is for brute forcing and hiding. * * @param {Item} item - * @param {Array.} visibleItems + * @param {Array.} visibleItems * @param {Object} visibleItemsLookup * @param {{start:number, end:number}} range * @private diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 51f9a02a7..840a373f1 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -22,7 +22,7 @@ var BACKGROUND = '__background__'; // reserved group id for background items wit * is determined by the size of the items. * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body * @param {Object} [options] See ItemSet.setOptions for the available options. - * @constructor ItemSet + * @type ItemSet * @extends Component */ function ItemSet(body, options) { @@ -783,7 +783,7 @@ ItemSet.prototype.getLabelSet = function() { /** * Set items - * @param {vis.DataSet | null} items + * @param {DataSet | null} items */ ItemSet.prototype.setItems = function(items) { var me = this, @@ -832,7 +832,7 @@ ItemSet.prototype.setItems = function(items) { /** * Get the current items - * @returns {vis.DataSet | null} + * @returns {DataSet | null} */ ItemSet.prototype.getItems = function() { return this.itemsData; @@ -840,7 +840,7 @@ ItemSet.prototype.getItems = function() { /** * Set groups - * @param {vis.DataSet} groups + * @param {DataSet} groups */ ItemSet.prototype.setGroups = function(groups) { var me = this, @@ -912,7 +912,7 @@ ItemSet.prototype.setGroups = function(groups) { /** * Get the current groups - * @returns {vis.DataSet | null} groups + * @returns {DataSet | null} groups */ ItemSet.prototype.getGroups = function() { return this.groupsData; @@ -2014,7 +2014,7 @@ ItemSet.prototype._onMouseWheel = function(event) { /** * Handle updates of an item on double tap - * @param {vis.Item} item The item + * @param {Item} item The item * @private */ ItemSet.prototype._onUpdateItem = function (item) { diff --git a/lib/timeline/component/Legend.js b/lib/timeline/component/Legend.js index da99bc30f..08c334186 100644 --- a/lib/timeline/component/Legend.js +++ b/lib/timeline/component/Legend.js @@ -5,10 +5,10 @@ var Component = require('./Component'); /** * Legend for Graph2d * - * @param {vis.Graph2d.body} body - * @param {vis.Graph2d.options} options + * @param {Graph2d.body} body + * @param {Graph2d.options} options * @param {number} side - * @param {vis.LineGraph.options} linegraphOptions + * @param {LineGraph.options} linegraphOptions * @constructor Legend * @extends Component */ diff --git a/lib/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js index cddbcfc0a..77bcfe2b9 100644 --- a/lib/timeline/component/LineGraph.js +++ b/lib/timeline/component/LineGraph.js @@ -15,7 +15,7 @@ var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items /** * This is the constructor of the LineGraph. It requires a Timeline body and options. * - * @param {vis.Timeline.body} body + * @param {Timeline.body} body * @param {Object} options * @constructor LineGraph * @extends Component @@ -242,7 +242,7 @@ LineGraph.prototype.show = function () { /** * Set items - * @param {vis.DataSet | null} items + * @param {DataSet | null} items */ LineGraph.prototype.setItems = function (items) { var me = this, @@ -287,7 +287,7 @@ LineGraph.prototype.setItems = function (items) { /** * Set groups - * @param {vis.DataSet} groups + * @param {DataSet} groups */ LineGraph.prototype.setGroups = function (groups) { var me = this; @@ -362,7 +362,7 @@ LineGraph.prototype._onRemoveGroups = function (groupIds) { /** * this cleans the group out off the legends and the dataaxis - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup.id} groupId * @private */ LineGraph.prototype._removeGroup = function (groupId) { @@ -384,8 +384,8 @@ LineGraph.prototype._removeGroup = function (groupId) { /** * update a group object with the group dataset entree * - * @param {vis.GraphGroup} group - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup} group + * @param {GraphGroup.id} groupId * @private */ LineGraph.prototype._updateGroup = function (group, groupId) { @@ -856,8 +856,8 @@ LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, /** * - * @param {Array.} groupIds - * @param {vis.DataSet} groupsData + * @param {Array.} groupIds + * @param {DataSet} groupsData * @private */ LineGraph.prototype._applySampling = function (groupIds, groupsData) { @@ -893,8 +893,8 @@ LineGraph.prototype._applySampling = function (groupIds, groupsData) { /** * - * @param {Array.} groupIds - * @param {vis.DataSet} groupsData + * @param {Array.} groupIds + * @param {DataSet} groupsData * @param {object} groupRanges | this is being filled here * @private */ @@ -933,7 +933,7 @@ LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { /** * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. - * @param {Array.} groupIds + * @param {Array.} groupIds * @param {Object} groupRanges * @returns {boolean} resized * @private @@ -1033,7 +1033,7 @@ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function * * @param {boolean} axisUsed - * @param {vis.DataAxis} axis + * @param {DataAxis} axis * @returns {boolean} * @private */ @@ -1084,7 +1084,7 @@ LineGraph.prototype._convertXcoordinates = function (datapoints) { * the yAxis. * * @param {Array.} datapoints - * @param {vis.GraphGroup} group + * @param {GraphGroup} group * @private */ LineGraph.prototype._convertYcoordinates = function (datapoints, group) { diff --git a/lib/timeline/component/graph2d_types/bar.js b/lib/timeline/component/graph2d_types/bar.js index 13478737d..5d0f9b2a6 100644 --- a/lib/timeline/component/graph2d_types/bar.js +++ b/lib/timeline/component/graph2d_types/bar.js @@ -3,7 +3,7 @@ var Points = require('./points'); /** * - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup.id} groupId * @param {Object} options // TODO: Describe options * @constructor Bargraph */ @@ -45,9 +45,9 @@ Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { /** * draw a bar graph * - * @param {Array.} groupIds + * @param {Array.} groupIds * @param {Object} processedGroupData - * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework */ Bargraph.draw = function (groupIds, processedGroupData, framework) { var combinedData = []; @@ -200,7 +200,7 @@ Bargraph._getDataIntersections = function (intersections, combinedData) { * Get the width and offset for bargraphs based on the coredistance between datapoints * * @param {number} coreDistance - * @param {vis.Group} group + * @param {Group} group * @param {number} minWidth * @returns {{width: number, offset: number}} * @private diff --git a/lib/timeline/component/graph2d_types/line.js b/lib/timeline/component/graph2d_types/line.js index 5a661c73f..769159ac8 100644 --- a/lib/timeline/component/graph2d_types/line.js +++ b/lib/timeline/component/graph2d_types/line.js @@ -2,7 +2,7 @@ var DOMutil = require('../../../DOMutil'); /** * - * @param {vis.GraphGroup.id} groupId + * @param {GraphGroup.id} groupId * @param {Object} options // TODO: Describe options * @constructor Line */ @@ -118,8 +118,8 @@ Line.drawShading = function (pathArray, group, subPathArray, framework) { * draw a line graph * * @param {Array.} pathArray - * @param {vis.Group} group - * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + * @param {Group} group + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework */ Line.draw = function (pathArray, group, framework) { if (pathArray != null && pathArray != undefined) { @@ -212,7 +212,7 @@ Line._catmullRomUniform = function (data) { * * One optimization can be used to reuse distances since this is a sliding window approach. * @param {Array.} data - * @param {vis.GraphGroup} group + * @param {GraphGroup} group * @returns {string} * @private */ diff --git a/lib/timeline/component/graph2d_types/points.js b/lib/timeline/component/graph2d_types/points.js index a6c7f4214..908099a8b 100644 --- a/lib/timeline/component/graph2d_types/points.js +++ b/lib/timeline/component/graph2d_types/points.js @@ -1,9 +1,18 @@ var DOMutil = require('../../../DOMutil'); /** - * + * A template containing the necessary information to draw the datapoint + * @typedef {Object.} GroupTemplate + * @property {string} style + * @property {string|*} styles + * @property {number} size + * @property {string} className + */ + +/** * @param {number | string} groupId - * @param {Object} options // TODO: Describe options + * @param {Object} options + * @todo Describe options * * @constructor Points */ @@ -36,6 +45,13 @@ Points.draw = function (dataset, group, framework, offset) { } }; +/** + * + * @param {Group} group + * @param {any} callbackResult + * @returns {GroupTemplate} + */ + Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { var fillHeight = iconHeight * 0.5; @@ -49,13 +65,6 @@ Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { //Don't call callback on icon DOMutil.drawPoint(x + 0.5 * iconWidth, y, getGroupTemplate(group), framework.svgElements, framework.svg); }; - -/** - * - * @param {vis.Group} group - * @param {any} callbackResult - * @returns {{style: *, styles: (*|string), size: *, className: *}} - */ function getGroupTemplate(group, callbackResult) { callbackResult = (typeof callbackResult === 'undefined') ? {} : callbackResult; return { @@ -69,7 +78,7 @@ function getGroupTemplate(group, callbackResult) { /** * * @param {Object} framework | SVG DOM element - * @param {vis.Group} group + * @param {Group} group * @returns {function} */ function getCallback(framework, group) { diff --git a/lib/timeline/component/item/BackgroundItem.js b/lib/timeline/component/item/BackgroundItem.js index 9e1e3b19e..e60b2902a 100644 --- a/lib/timeline/component/item/BackgroundItem.js +++ b/lib/timeline/component/item/BackgroundItem.js @@ -3,15 +3,15 @@ var BackgroundGroup = require('../BackgroundGroup'); var RangeItem = require('./RangeItem'); /** - * @constructor BackgroundItem - * @extends Item * @param {Object} data Object containing parameters start, end * content, className. * @param {{toScreen: function, toTime: function}} conversion * Conversion functions from time to screen and vice versa * @param {Object} [options] Configuration options - * // TODO: describe options - * // TODO: implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation + * @todo describe options + * @todo implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation + * @type BackgroundItem + * @extends Item */ function BackgroundItem (data, conversion, options) { this.props = { @@ -41,7 +41,7 @@ BackgroundItem.prototype.stack = false; /** * Check whether this item is visible inside given range - * @param {vis.Range} range with a timestamp for start and end + * @param {Range} range with a timestamp for start and end * @returns {boolean} True if visible */ BackgroundItem.prototype.isVisible = function(range) { diff --git a/lib/timeline/component/item/Item.js b/lib/timeline/component/item/Item.js index 6c5d7d3aa..a1340db83 100644 --- a/lib/timeline/component/item/Item.js +++ b/lib/timeline/component/item/Item.js @@ -99,7 +99,7 @@ Item.prototype.setParent = function(parent) { /** * Check whether this item is visible inside given range - * @param {vis.Range} range with a timestamp for start and end + * @param {Range} range with a timestamp for start and end * @returns {boolean} True if visible */ Item.prototype.isVisible = function(range) { // eslint-disable-line no-unused-vars diff --git a/lib/timeline/component/item/RangeItem.js b/lib/timeline/component/item/RangeItem.js index e1dbef4f7..2c375c772 100644 --- a/lib/timeline/component/item/RangeItem.js +++ b/lib/timeline/component/item/RangeItem.js @@ -38,7 +38,7 @@ RangeItem.prototype.baseClassName = 'vis-item vis-range'; /** * Check whether this item is visible inside given range * - * @param {vis.Range} range with a timestamp for start and end + * @param {Range} range with a timestamp for start and end * @returns {boolean} True if visible */ RangeItem.prototype.isVisible = function(range) { diff --git a/lib/timeline/optionsGraph2d.js b/lib/timeline/optionsGraph2d.js index 0caaf2d2d..9188de6e6 100644 --- a/lib/timeline/optionsGraph2d.js +++ b/lib/timeline/optionsGraph2d.js @@ -4,6 +4,7 @@ * * __any__ means that the name of the property does not matter. * __type__ is a required field for all objects and contains the allowed types of all objects + * @ignore */ let string = 'string'; let bool = 'boolean'; diff --git a/lib/timeline/optionsTimeline.js b/lib/timeline/optionsTimeline.js index 147c044a6..b79bd9f0f 100644 --- a/lib/timeline/optionsTimeline.js +++ b/lib/timeline/optionsTimeline.js @@ -4,6 +4,7 @@ * * __any__ means that the name of the property does not matter. * __type__ is a required field for all objects and contains the allowed types of all objects + * @ignore */ let string = 'string'; let bool = 'boolean';