App-Netdisco
view release on metacpan or search on metacpan
share/public/javascripts/d3-force-network-chart.js view on Meta::CPAN
*
* Needs a `render` call to take into effect:
*
* example.labelsCircular(true).render();
* @see {@link module:API.labelDistance}
* @see {@link module:API.wrapLabels}
* @param {boolean} [value=false] - The new config value.
* @returns {(boolean|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.labelsCircular = function(value) {
if (!arguments.length) {
return v.conf.labelsCircular;
}
v.conf.labelsCircular = value;
if (v.status.graphStarted) {
v.tools.createCustomizeWizardIfNotRendering();
}
return graph;
};
/**
* The distance of a label from the nodes outer border. Needs a `render` call to take into effect:
*
* example.labelDistance(18).render();
* @see {@link module:API.labelsCircular}
* @see {@link module:API.wrapLabels}
* @param {number} [value=12] - The new config value.
* @returns {(number|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.labelDistance = function(value) {
if (!arguments.length) {
return v.conf.labelDistance;
}
v.conf.labelDistance = value;
if (v.status.graphStarted) {
v.tools.createCustomizeWizardIfNotRendering();
}
return graph;
};
/**
* If set to true the labels are aligned with a simulated annealing function to prevent overlapping when the graph is cooled down (correctly on the force end event and only on labels, who are not circular). Needs a `resume` call to take into effe...
*
* example.preventLabelOverlappingOnForceEnd(true).render();
* @see {@link module:API.labelPlacementIterations}
* @param {boolean} [value=false] - The new config value.
* @returns {(boolean|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.preventLabelOverlappingOnForceEnd = function(value) {
if (!arguments.length) {
return v.conf.preventLabelOverlappingOnForceEnd;
}
v.conf.preventLabelOverlappingOnForceEnd = value;
if (v.status.graphStarted) {
v.tools.createCustomizeWizardIfNotRendering();
}
return graph;
};
/**
* The number of iterations for the preventLabelOverlappingOnForceEnd option - default is 250 - as higher the number, as higher the quality of the result. For details refer to the [description of the simulated annealing function of the author Eva...
*
* example.preventLabelOverlappingOnForceEnd(true).resume();
* @see {@link module:API.labelPlacementIterations}
* @param {number} [value=250] - The new config value.
* @returns {(number|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.labelPlacementIterations = function(value) {
if (!arguments.length) {
return v.conf.labelPlacementIterations;
}
v.conf.labelPlacementIterations = value;
if (v.status.graphStarted) {
v.tools.createCustomizeWizardIfNotRendering();
}
return graph;
};
/**
* If true, the nodes are draggable. No `render` or `resume` call needed to take into effect:
*
* example.dragMode(false);
* @see {@link module:API.pinMode}
* @param {boolean} [value=false] - The new config value.
* @returns {(boolean|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.dragMode = function(value) {
if (!arguments.length) {
return v.conf.dragMode;
}
v.conf.dragMode = value;
if (v.status.graphStarted) {
if (v.conf.dragMode) {
v.main.nodes.call(v.main.drag);
} else {
// http://stackoverflow.com/questions/13136355/d3-js-remove-force-drag-from-a-selection
v.main.nodes.on("mousedown.drag", null);
v.main.nodes.on("touchstart.drag", null);
}
v.tools.createCustomizeWizardIfNotRendering();
}
return graph;
};
/**
* If true, the nodes are fixed (pinned) at the end of a drag event. No `render` or `resume` call needed to take into effect:
*
* example.pinMode(true);
* @see {@link module:API.releaseFixedNodes}
* @see {@link module:API.dragMode}
* @param {boolean} [value=true] - The new config value.
* @returns {(boolean|Object)} The current config value if no parameter is given or the graph object for method chaining.
*/
graph.pinMode = function(value) {
if (!arguments.length) {
return v.conf.pinMode;
}
v.conf.pinMode = value;
if (v.status.graphStarted) {
if (v.conf.pinMode) {
v.main.drag.on("dragstart", function(n) {
( run in 2.662 seconds using v1.01-cache-2.11-cpan-96521ef73a4 )