App-Netdisco

 view release on metacpan or  search on metacpan

share/public/javascripts/d3-force-network-chart.js  view on Meta::CPAN

    /**
     * Gets or sets the charge strength to the specified value. For more informations have a look at the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#charge). Needs a `render` call to take into effect:
     *
     *     example.charge(-200).render();
     * @see {@link module:API.chargeDistance}
     * @param {number} [value=-350] - The new charge value.
     * @returns {(number|Object)} The current charge value if no parameter is given or the graph object for method chaining.
     */
    graph.charge = function(value) {
        if (!arguments.length) {
            return v.conf.charge;
        }
        v.conf.charge = value;
        if (v.status.graphStarted) {
            v.main.force.charge(v.conf.charge);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the maximum distance over which charge forces are applied. For more informations have a look at the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#chargeDistance). This option is not show...
     *
     *     example.chargeDistance(200).render();
     * @see {@link module:API.charge}
     * @param {number} [value=Infinity] - The new charge distance value.
     * @returns {(number|Object)} The current charge distance value if no parameter is given or the graph object for method chaining.
     */
    graph.chargeDistance = function(value) {
        if (!arguments.length) {
            return v.conf.chargeDistance;
        }
        v.conf.chargeDistance = value;
        if (v.status.graphStarted) {
            v.main.force.chargeDistance(v.conf.chargeDistance);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the gravitational strength to the specified numerical value. For more informations see the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#gravity). Needs a `render` call to take into effe...
     *
     *     example.gravity(0.3).render();
     * @param {number} [value=0.1] - The new gravity value.
     * @returns {(number|Object)} The current gravity value if no parameter is given or the graph object for method chaining.
     */
    graph.gravity = function(value) {
        if (!arguments.length) {
            return v.conf.gravity;
        }
        v.conf.gravity = value;
        if (v.status.graphStarted) {
            v.main.force.gravity(v.conf.gravity);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the strength (rigidity) of links to the specified value in the range [0,1]. For more informations see the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#linkStrength). Needs a `render` ca...
     *
     *     example.linkStrength(0.1).render();
     * @param {number} [value=1] - The new link strength value.
     * @returns {(number|Object)} The current link strength value if no parameter is given or the graph object for method chaining.
     */
    graph.linkStrength = function(value) {
        if (!arguments.length) {
            return v.conf.linkStrength;
        }
        v.conf.linkStrength = value;
        if (v.status.graphStarted) {
            v.main.force.linkStrength(v.conf.linkStrength);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the friction coefficient to the specified value. For more informations have a look at the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#friction). Needs a `render` call to take into effe...
     *
     *     example.friction(0.4).render();
     * @param {number} [value=0.9] - The new friction value.
     * @returns {(number|Object)} The current friction value if no parameter is given or the graph object for method chaining.
     */
    graph.friction = function(value) {
        if (!arguments.length) {
            return v.conf.friction;
        }
        v.conf.friction = value;
        if (v.status.graphStarted) {
            v.main.force.friction(v.conf.friction);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the Barnes–Hut approximation criterion to the specified value. For more informations see the [D3 API Reference](https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#theta). On smaller graphs with not so many no...
     *
     *     example.theta(0.1).render();
     * @param {number} [value=0.8] - The new theta value.
     * @returns {(number|Object)} The current theta value if no parameter is given or the graph object for method chaining.
     */
    graph.theta = function(value) {
        if (!arguments.length) {
            return v.conf.theta;
        }
        v.conf.theta = value;
        if (v.status.graphStarted) {
            v.main.force.theta(v.conf.theta);
            v.tools.createCustomizeWizardIfNotRendering();
        }
        return graph;
    };

    /**
     * Gets or sets the current positions of all nodes. This lets you save and load a specific layout or modify the current positions (of fixed nodes - if you have no fixed nodes then the nodes will likely fall back to their previous positions becaus...
     *
     *     // get current positions: Array of objects like [{"ID":"7839","x":200,"y":100,"fixed":1},...])
     *     var pos = example.positions();



( run in 0.426 second using v1.01-cache-2.11-cpan-5735350b133 )