API

A module representing the public graph API.

Source:

Methods

(static) alignFixedNodesToGrid(valueopt) → {boolean|Object}

If true, fixed nodes are aligned to the nearest grid position on the drag end event. You can pin nodes, when pinMode is set to true or by delivering nodes with the attribute “fixed” set to true and “x” and “y” attributes for the position. If you have already fixed nodes on your graph you can also set this attribute at runtime and resume the force. Needs a resume call to take into effect:

example.alignFixedNodesToGrid(true).resume();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) autoRefresh(valueopt) → {boolean|Object}

If true, the graph is refreshed automatically. This makes only sense when running as APEX plugin - here you have the SQL queries for loading new data with AJAX. If you run your code standalone, you have to provide new data as a parameter in the start or render method and therefore you have to use your own auto refresh logic. No render or resume call needed to take into effect:

example.autoRefresh(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) center(durationopt) → {Object}

Helper/Command method - center the graph. No render or resume call needed to take into effect:

example.center();
Source:
See:
Parameters:
Name Type Attributes Default Description
duration number <optional>
500

The transition duration in milliseconds.

Returns:
Type:
Object

The graph object for method chaining.

(static) centerPositionGraph() → {Array}

Helper/Command method - get the center position of the graph border box:

example.centerPositionGraph();
Source:
Returns:
Type:
Array

An array with the x and y positions: [x, y].

(static) centerPositionViewport() → {Array}

Helper/Command method - get the center position of the SVG viewport:

example.centerPositionViewport();
Source:
Returns:
Type:
Array

An array with the x and y positions: [x, y].

(static) charge(valueopt) → {number|Object}

Gets or sets the charge strength to the specified value. For more informations have a look at the D3 API Reference. Needs a render call to take into effect:

example.charge(-200).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
-350

The new charge value.

Returns:
Type:
number | Object

The current charge value if no parameter is given or the graph object for method chaining.

(static) chargeDistance(valueopt) → {number|Object}

Gets or sets the maximum distance over which charge forces are applied. For more informations have a look at the D3 API Reference. This option is not shown in the customize wizard. Needs a render call to take into effect:

example.chargeDistance(200).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
Infinity

The new charge distance value.

Returns:
Type:
number | Object

The current charge distance value if no parameter is given or the graph object for method chaining.

(static) colorScheme(valueopt) → {string|Object}

Color scheme can be color20, color20b, color20c, color10 or direct. The first four use the color functions provided by D3, which return up to 20 colors for the given keywords for your data attribute COLORVALUE - this can be a text like a department name or a postal zip code. With the last option you can provide direct css color values in your data like blue or #123456. No render or resume call needed to take into effect:

example.colorScheme('color10');
Source:
Parameters:
Name Type Attributes Default Description
value string <optional>
color20

The new config value.

Returns:
Type:
string | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) customize(valueopt) → {boolean|Object}

Gets or sets the customize mode. If true, the customizing wizard is opened, otherwise closed.

example.customize(true);
Source:
See:
Parameters:
Name Type Attributes Description
value boolean <optional>

The new mode.

Returns:
Type:
boolean | Object

The current mode if no parameter is given or the graph object for method chaining.

(static) data() → {Object}

Returns the current graph data as JSON object. This method expects no parameter and terminates the method chain. Example:

//JSON object
example.data();

//stringified JSON object
JSON.stringify(example.data());
Source:
See:
Returns:
Type:
Object

The current graph data.

(static) debug(valueopt) → {boolean|Object}

Gets or sets the debug mode. When debug is enabled, there is a link rendered in the SVG to start the customize wizard and debug messages are written to the console.

example.debug(true);
Source:
See:
Parameters:
Name Type Attributes Description
value boolean <optional>

The new mode.

Returns:
Type:
boolean | Object

The current mode if no parameter is given or the graph object for method chaining.

(static) domParentWidth() → {number}

Returns the current with of the graphs DOM parent. This method expects no parameter and terminates the method chain.

If the option useDomParentWidth is set to true, then this is the effective width of the graph - independent of the configured width.

example.domParentWidth();
Source:
Returns:
Type:
number

The current DOM parent width.

(static) dragMode(valueopt) → {boolean|Object}

If true, the nodes are draggable. No render or resume call needed to take into effect:

example.dragMode(false);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) forceTimeLimit(valueopt) → {number|Object}

Gets or sets the maximum runtime in milliseconds for the force. This could be helpful when the graph is running to long with many node background images or when you want to stop the force early because all nodes are fixed and the running force is useless and costs only battery runtime.

example.forceTimeLimit(100);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
Infinity

The new force time limit value.

Returns:
Type:
number | Object

The current force time limit value if no parameter is given or the graph object for method chaining.

(static) friction(valueopt) → {number|Object}

Gets or sets the friction coefficient to the specified value. For more informations have a look at the D3 API Reference. Needs a render call to take into effect:

example.friction(0.4).render();
Source:
Parameters:
Name Type Attributes Default Description
value number <optional>
0.9

The new friction value.

Returns:
Type:
number | Object

The current friction value if no parameter is given or the graph object for method chaining.

(static) gravity(valueopt) → {number|Object}

Gets or sets the gravitational strength to the specified numerical value. For more informations see the D3 API Reference. Needs a render call to take into effect:

example.gravity(0.3).render();
Source:
Parameters:
Name Type Attributes Default Description
value number <optional>
0.1

The new gravity value.

Returns:
Type:
number | Object

The current gravity value if no parameter is given or the graph object for method chaining.

(static) gridSize(valueopt) → {number|Object}

The grid size of the virtual grid for the option alignFixedNodesToGrid. Needs a resume call to take into effect:

example.gridSize(100).alignFixedNodesToGrid(true).resume();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
50

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) height(valueopt) → {number|Object}

The height of the chart:

example.height(300);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
400

The new chart height value.

Returns:
Type:
number | Object

The current chart height value if no parameter is given or the graph object for method chaining.

(static) inspect() → {Object}

Shows the current closure object, which holds all functions and data. This method expects no parameter and terminates the method chain:

example.inspect();
Source:
See:
Returns:
Type:
Object

The graph's internal object with all functions and data.

(static) keepAspectRatioOnResize(valueopt) → {boolean|Object}

When the graph is resized, the initial aspect ratio (width and height on first render cycle) is respected:

//change config and resize height (width will change implicit based on initial aspect ratio)
example.keepAspectRatioOnResize(true).height(400);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) labelDistance(valueopt) → {number|Object}

The distance of a label from the nodes outer border. Needs a render call to take into effect:

example.labelDistance(18).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
12

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) labelPlacementIterations(valueopt) → {number|Object}

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 Evan Wang. Needs a resume call to take into effect:

example.preventLabelOverlappingOnForceEnd(true).resume();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
250

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) labelsCircular(valueopt) → {boolean|Object}

If true, then the labels are rendered along a path around the nodes.

You can overwrite this attribute on node level by setting a attribute called LABELCIRCULAR on the node to true or false. As an example you can see this in the online demo on the node named KING.

ATTENTION: If you set the LABELCIRCULAR attribute on a specific or all nodes, then the global configuration parameter labelsCircular has no effect on these nodes.

Needs a render call to take into effect:

example.labelsCircular(true).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) labelSplitCharacter(valueopt) → {string|Object}

If set to a value other then none labels are splitted on this character. Needs wrapLabels to be true and a render call to take into effect. If both options labelSplitCharacter and wrappedLabelWidth are set, then wrappedLabelWidth is ignored.

example.wrapLabels(true).labelSplitCharacter("^").render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value string <optional>
"none"

The new config value.

Returns:
Type:
string | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) lassoMode(valueopt) → {boolean|Object}

If true, you can select miltiple nodes with a lasso - think of a graphical multiselect :-). No render or resume call needed to take into effect:

example.lassoMode(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) linkDistance(valueopt) → {number|Object}

The distance between nodes centers. Needs a render call to take into effect:

example.linkDistance(60).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
80

The new link distance value.

Returns:
Type:
number | Object

The current link distance value if no parameter is given or the graph object for method chaining.

Returns the current graph links as D3 array for direct modifications. This method expects no parameter and terminates the method chain. See also the D3 docs. Example:

example.links().filter(function (link) {
  return link.TOID === "7839";
}).style("stroke", "red");
Source:
See:
Returns:
Type:
Array

The current graph links.

(static) linkStrength(valueopt) → {number|Object}

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. Needs a render call to take into effect:

example.linkStrength(0.1).render();
Source:
Parameters:
Name Type Attributes Default Description
value number <optional>
1

The new link strength value.

Returns:
Type:
number | Object

The current link strength value if no parameter is given or the graph object for method chaining.

(static) maxNodeRadius(valueopt) → {number|Object}

The maximum node radius. Each node radius is calculated by its SIZEVALUE attribute in a range between the minimum and the maximum node radius. Needs a render call to take into effect:

example.maxNodeRadius(24).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
18

The new max node radius value.

Returns:
Type:
number | Object

The current max node radius value if no parameter is given or the graph object for method chaining.

(static) maxZoomFactor(valueopt) → {number|Object}

No render or resume call needed to take into effect::

example.maxZoomFactor(10);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
5

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) minNodeRadius(valueopt) → {number|Object}

The minimum node radius. Each node radius is calculated by its SIZEVALUE attribute in a range between the minimum and the maximum node radius. Needs a render call to take into effect:

example.minNodeRadius(2).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
6

The new min node radius value.

Returns:
Type:
number | Object

The current min node radius value if no parameter is given or the graph object for method chaining.

(static) minZoomFactor(valueopt) → {number|Object}

No render or resume call needed to take into effect::

example.minZoomFactor(0.1);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
0.2

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) moveFixedNodes(xopt, yopt) → {Object}

Command method (has no get or set function). Moves all fixed nodes in the provided direction. Needs a resume call to take into effect:

example.moveFixedNodes(10,-5).resume();

The example adds 10 to x position and -5 to y position to all fixed nodes. ATTENTION: If alignFixedNodesToGrid is set to true this can have unexpected behavior - you must then provide values greater then gridSize halved to see any changes on your graph, otherwise the positions are falling back to the nearest (current) grid position.

Source:
See:
Parameters:
Name Type Attributes Default Description
x number <optional>
0

x value - positive or negative

y number <optional>
0

y value - positive or negative

Returns:
Type:
Object

The graph object for method chaining.

(static) nodeDataById(id) → {Object}

Returns the data from a specific node as JSON object. This method expects a node ID as parameter and terminates the method chain. Example:

//get the data from the node with the ID 8888
example.nodeDataById('8888');

//get the data from the node with the ID 'myAlphanumericID'
example.nodeDataById('myAlphanumericID');
Source:
See:
Parameters:
Name Type Description
id string

The node id.

Returns:
Type:
Object

The node data.

Can be “none”, “click”, “dblclick” or “contextmenu”. Works only for nodes with a non empty LINK attribute. No render or resume call needed to take into effect:

example.nodeEventToOpenLink("click");
Source:
Parameters:
Name Type Attributes Default Description
value string <optional>
"dblclick"

The new config value.

Returns:
Type:
string | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) nodeEventToStopPinMode(valueopt) → {boolean|Object}

Can be “none”, “click”, “dblclick” and “contextmenu” and defines, which event will release a node. This releasing of a node is sometimes a bit unstable (not on the code side, but on the visualizing side) and depends on the next tick event. You have to play around with this. If you want only release all nodes you can simply call the releaseFixedNodes method and resume the graph. No render or resume call needed to take into effect:

example.nodeEventToStopPinMode("contextmenu");
Source:
See:
Parameters:
Name Type Attributes Default Description
value string <optional>
"contextmenu"

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) nodeLinkTarget(valueopt) → {string|Object}

This text is used as the link target, when a node has a LINK attribute.

There are three special keywords: “none”, “nodeID” and “domContainerID”. If you use “none”, the link is opened in the same window/tab where your graph is currently shown. If you use “nodeID”, the ID of the currently clicked node is used as the target attribute, this means - you get one window/tab for each node in your graph - when you click a second time on the same node, the window/tab is reused. The same with the keyword “domContainerID” - you get one window/tab for each graph on your page - when you click a second time on the same node, the window/tab is reused.

Anything else is not interpreted - your given text is simply used as the target attribute of the link. This is also the case for the second option in the customize wizard called “_blank”. If you use this, then each click on a node opens in a new window/tab. You are not restricted to use only the predefined select options. It is up to you to overwrite the value in your configuration object. As an example: If you want to have always the same window/tab for each click on a node, then simply provide a text here, that fit your needs e.g. “myOwnWindowName”.

example.nodeLinkTarget("myOwnWindowName");
Source:
See:
Parameters:
Name Type Attributes Default Description
value string <optional>
"_blank"

The new config value.

Returns:
Type:
string | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) nodes() → {Array}

Returns the current graph nodes as D3 array for direct modifications. This method expects no parameter and terminates the method chain. See also the D3 docs. Example:

example.nodes().filter(function (node) {
  return node.ID === "7839";
}).style("fill", "blue");

example.nodes().filter(function (node) {
  return node.ID === "7839";
}).classed("myOwnClass", true);
Source:
See:
Returns:
Type:
Array

The current graph nodes.

(static) onForceEndFunction(eventFunctionopt) → {Object}

Gets or sets the function for the forceend event.

No data is provided because this is a very generic event:

example.onForceEndFunction(
    function(){
      // your logic here.
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Force End [D3 - Force Layout]” on your graph region.

Source:
See:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onForceStartFunction(eventFunctionopt) → {Object}

Gets or sets the function for the forcestart event.

No data is provided because this is a very generic event:

example.onForceStartFunction(
    function(){
      // your logic here.
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Force Start [D3 - Force Layout]” on your graph region.

Source:
See:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onLassoEndFunction(eventFunctionopt) → {Object}

Gets or sets the function for the lassoend event.

In the first two parameters you get the event and the d3 lasso data, inside your function you have access to the DOM node with the this keyword. In case of the lasso this is refering the svg container element, because the lasso itself is not interesting:

example.onLassoEndFunction(
    function(event, data){
      console.log("Lasso end - event:", event);
      console.log("Lasso end - data:", data);
      console.log("Lasso end - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Lasso End [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Lasso end - event:", this.browserEvent);
console.log("Lasso end - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onLassoStartFunction(eventFunctionopt) → {Object}

Gets or sets the function for the lassostart event.

In the first two parameters you get the event and the d3 lasso data, inside your function you have access to the DOM node with the this keyword. In case of the lasso this is refering the svg container element, because the lasso itself is not interesting:

example.onLassoStartFunction(
    function(event, data){
      console.log("Lasso start - event:", event);
      console.log("Lasso start - data:", data);
      console.log("Lasso start - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Lasso Start [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Lasso start - event:", this.browserEvent);
console.log("Lasso start - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onLinkClickFunction(eventFunctionopt) → {Object}

Gets or sets the function for the link click event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onLinkClickFunction(
    function(event, data){
      console.log("Link click - event:", event);
      console.log("Link click - data:", data);
      console.log("Link click - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Link Click [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Link click - event:", this.browserEvent);
console.log("Link click - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Attention: It is not so easy to click a link, because the links are so narrow - if this option is needed I recommend to switch on the zoom mode - with zoom and pan it feels more natural to click links.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onNodeClickFunction(eventFunctionopt) → {Object}

Gets or sets the function for the node click event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onNodeClickFunction(
    function(event, data){
      console.log("Node click - event:", event);
      console.log("Node click - data:", data);
      console.log("Node click - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Node Click [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Node click - event:", this.browserEvent);
console.log("Node click - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onNodeContextmenuFunction(eventFunctionopt) → {Object}

Gets or sets the function for the node contextmenu event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onNodeContextmenuFunction(
    function(event, data){
      console.log("Node contextmenu - event:", event);
      console.log("Node contextmenu - data:", data);
      console.log("Node contextmenu - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Node Contextmenu [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Node contextmenu - event:", this.browserEvent);
console.log("Node contextmenu - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onNodeContextmenuPreventDefault(valueopt) → {boolean|Object}

If true, the context menu default browser action on the nodes are prevented. This could be useful, if you want to implement an own context menu for the nodes. xxx:

example.onNodeContextmenuPreventDefault(true);
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) onNodeDblclickFunction(eventFunctionopt) → {Object}

Gets or sets the function for the node dblclick event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onNodeDblclickFunction(
    function(event, data){
      console.log("Node double click - event:", event);
      console.log("Node double click - data:", data);
      console.log("Node double click - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Node Double Click [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Node double click - event:", this.browserEvent);
console.log("Node double click - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onNodeMouseenterFunction(eventFunctionopt) → {Object}

Gets or sets the function for the node mouseenter event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onNodeMouseenterFunction(
    function(event, data){
      console.log("Node mouse enter - event:", event);
      console.log("Node mouse enter - data:", data);
      console.log("Node mouse enter - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Node Mouse Enter [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Node mouse enter - event:", this.browserEvent);
console.log("Node mouse enter - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onNodeMouseleaveFunction(eventFunctionopt) → {Object}

Gets or sets the function for the node mouseleave event.

In the first two parameters you get the event and the d3 node data, inside your function you have access to the DOM node with the this keyword:

example.onNodeMouseleaveFunction(
    function(event, data){
      console.log("Node mouse leave - event:", event);
      console.log("Node mouse leave - data:", data);
      console.log("Node mouse leave - this:", this);
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Node Mouse Leave [D3 - Force Layout]” on your graph region. If you do so, you can access the event and data by executing JavaScript code in this way:

console.log("Node mouse leave - event:", this.browserEvent);
console.log("Node mouse leave - data:", this.data);

Please refer also to the APEX dynamic action documentation and keep in mind, that the data is the same in both ways but the event differs, because APEX provide a jQuery event and the Plugin the D3 original event.

Source:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onRenderEndFunction(eventFunctionopt) → {Object}

Gets or sets the function for the renderend event.

No data is provided because this is a very generic event. You can use the nodes and links API methods for a D3 array to modify directly the nodes or links:

example.onRenderEndFunction(
    function(){
      example.nodes().filter(function (node) {
        return node.ID === "7839";
      }).style("fill", "blue");
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Render End [D3 - Force Layout]” on your graph region.

Source:
See:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onResizeFunction(eventFunctionopt) → {Object}

Gets or sets the function for the resize event.

No data is provided because this is a very generic event:

example.onResizeFunction(
    function(){
      // your logic here
    }
);

If used as APEX plugin you can also create an APEX dynamic action on the component event “Resize [D3 - Force Layout]” on your graph region.

Source:
See:
Parameters:
Name Type Attributes Description
eventFunction Object <optional>

The new function.

Returns:
Type:
Object

The current function if no parameter is given or the graph object for method chaining.

(static) onResizeFunctionTimeout(valueopt) → {number|Object}

The harmonized/delayed handling of the resize event to prevent performance issues - see also zoomToFitOnResize:

example.onResizeFunctionTimeout(100).height(400);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
300

The new chart width value.

Returns:
Type:
number | Object

The current chart width value if no parameter is given or the graph object for method chaining.

(static) options(optionsopt) → {Object}

Get or set the whole configuration with one call. Ouput includes all options, which are accessible via the API methods including the registered event functions:

//get the current configuration
example.options();
//set the new configuration
example.options( { pinMode: true, ... } );
Source:
See:
Parameters:
Name Type Attributes Description
options Object <optional>

Your new options.

Returns:
Type:
Object

Your current options or the graph object for method chaining.

(static) optionsCustomizationWizard(optionsopt) → {Object}

Get or set the whole configuration with one call. Output includes only the options, which are accessible via the customization wizard:

//get the current configuration
example.optionsCustomizationWizard();
//set the new configuration
example.optionsCustomizationWizard( { pinMode: true, ... } );
Source:
See:
Parameters:
Name Type Attributes Description
options Object <optional>

Your new options.

Returns:
Type:
Object

Your current options or the graph object for method chaining.

(static) pinMode(valueopt) → {boolean|Object}

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);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) positions(positionsArrayopt) → {Object}

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 because of the working forces). Works nice together with the pinMode. Needs a resume call to take into effect:

// get current positions: Array of objects like [{"ID":"7839","x":200,"y":100,"fixed":1},...])
var pos = example.positions();
// set positions
example.positions(pos.map(function(p){ p.x += 10; return p; })).resume();

// all in one ;-)
example.positions( example.positions().map(function(p){ p.x += 10; return p; }) ).resume();
Source:
See:
Parameters:
Name Type Attributes Description
positionsArray Object <optional>

The new positions array.

Returns:
Type:
Object

The current positions array if no parameter is given or the graph object for method chaining.

(static) preventLabelOverlappingOnForceEnd(valueopt) → {boolean|Object}

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 effect:

example.preventLabelOverlappingOnForceEnd(true).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) refreshInterval(valueopt) → {number|Object}

The refresh interval in milliseconds. No render or resume call needed to take into effect, but after changing the interval value you have to stop a current activated auto refresh and start it again to take the new value into effect:

// only set the value and start auto refresh
example.refreshInterval(4000).autoRefresh(true);

// restart running auto refresh
example.refreshInterval(2000).autoRefresh(false).autoRefresh(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
5000

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) releaseFixedNodes() → {Object}

Command method (has no get or set function and expects no parameter): Release all fixed (pinned) nodes. Needs a resume call to take into effect:

example.releaseFixedNodes().resume();
Source:
See:
Returns:
Type:
Object

The graph object for method chaining.

(static) render(dataopt) → {Object}

The render method does the same as the start method - the only difference is, that the render method does not try to load data, if you use the APEX plugin. You can use this method after changing options which need a render cycle to take the changes into effect:

example.minNodeRadius(4).maxNodeRadius(20).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
data string | Object <optional>
Sample data EMP table flavoured

Can be a XML string, JSON string or JavaScript object (JSON)

Returns:
Type:
Object

The graph object for method chaining.

(static) resume() → {Object}

The resume method restarts only the force on your graph without a render cycle. This saves CPU time and can be useful if you change only things in your graph which do not need rendering to taking into effect:

example.releaseFixedNodes().resume();
Source:
See:
Returns:
Type:
Object

The graph object for method chaining.

(static) sampleData(dataopt) → {Object}

Gets or sets the sample data. This makes only sense before the first start, because only on the first start without data available the sample data is used. After the first start you can provide new data with the start method. Example:

//first start
example.sampleData('<node>...').start();

//later
example.start('<node>...');
Source:
See:
Parameters:
Name Type Attributes Description
data string | Object <optional>

The new sample data as XML string, JSON string or JSON object.

Returns:
Type:
Object

The current sample data in JSON format if no parameter is given or the graph object for method chaining.

(static) selfLinkDistance(valueopt) → {number|Object}

The distance of the self link path around a node. Needs a render call to take into effect:

example.selfLinkDistance(25).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
20

The new self link distance value.

Returns:
Type:
number | Object

The current self link distance value if no parameter is given or the graph object for method chaining.

Returns the current graph selfLinks as D3 array for direct modifications. This method expects no parameter and terminates the method chain. See also the D3 docs. Example:

example.selfLinks().style("stroke", "green");
Source:
See:
Returns:
Type:
Array

The current graph links.

(static) setDomParentPaddingToZero(valueopt) → {boolean|Object}

If true, the parent DOM element of the graph gets the style { padding: 0px; }. If set to false, this style is removed from the DOM parent of the graph. No render or resume call needed to take into effect:

example.setDomParentPaddingToZero(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showBorder(valueopt) → {boolean|Object}

If true, a class named border is added to the SVG element, if false the class will be removed. The border itself is defined in the delivered CSS - you can overwrite it if the current style does not match your needs. No render or resume call needed to take into effect:

example.showBorder(false);
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showLabels(valueopt) → {boolean|Object}

If true and you provided in your node data an attribute LABEL, then a label is rendered on top of the node. Needs a render call to take into effect:

example.showLabels(false).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showLegend(valueopt) → {boolean|Object}

If true, a legend for all COLORVALUEs in the node data is rendered in the bottom left corner of the graph. No render or resume call needed to take into effect:

example.showLegend(false);
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showLinkDirection(valueopt) → {boolean|Object}

If true, you get an marker at the end of a link. Needs a render call to take into effect:

example.showLinkDirection(false).render();
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showLoadingIndicator(value) → {boolean|Object}

Helper method to directly show or hide a loading indicator. The APEX plugin do this implicitly on AJAX calls when the option showLoadingIndicatorOnAjaxCall is set to true. No render or resume call needed to take into effect:

// Show:
example.showLoadingIndicator(true);

// Hide:
example.showLoadingIndicator(false);
Source:
See:
Parameters:
Name Type Description
value boolean

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showLoadingIndicatorOnAjaxCall(valueopt) → {boolean|Object}

If true, a loading indicator is shown when used as a APEX plugin during the AJAX calls. If you want to show the loading indicator in a standalone implementation you can show and hide the loading indicator directly with the API method showLoadingIndicator:

example.showLoadingIndicatorOnAjaxCall(false);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

If true, then links with the same source and target are rendered along a path around the node bottom. Needs a render call to take into effect:

example.showSelfLinks(false).render();
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) showTooltips(valueopt) → {boolean|Object}

If true and you provided in your source data an attribute INFOSTRING, then a tooltip is shown by hovering a node. No render or resume call needed to take into effect:

example.showTooltips(false);
Source:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) start(dataopt) → {Object}

This method starts the graph. You can configure your graph with all the available methods, but without the start method your changes will NOT take into effect.

You can pass new data (see included-sample-data) to the start method. Data can be a XML string, JSON string or JavaScript object (JSON). If you use the APEX plugin, then the start method internally does the AJAX call to your Oracle database, but you can prevent this behavior by passing data to this method.

This also means, that you can use data from a textarea or a report for the APEX plugin, to overwrite the existing data and you do not need to configure any query to run this plugin. If you do so and you do not pass data to the start method on the very first call, then the plugin provides sample data - it is the same data with the APEX online demo of this plugin, there is no query configured and you get therefore the sampledata :-)

Source:
See:
Parameters:
Name Type Attributes Default Description
data string | Object <optional>
Sample data EMP table flavoured

Can be a XML string, JSON string or JavaScript object (JSON)

Returns:
Type:
Object

The graph object for method chaining.

(static) theta(valueopt) → {number|Object}

Gets or sets the Barnes–Hut approximation criterion to the specified value. For more informations see the D3 API Reference. On smaller graphs with not so many nodes you will likely see no difference when you change this value. Needs a render call to take into effect:

example.theta(0.1).render();
Source:
Parameters:
Name Type Attributes Default Description
value number <optional>
0.8

The new theta value.

Returns:
Type:
number | Object

The current theta value if no parameter is given or the graph object for method chaining.

(static) tooltipPosition(valueopt) → {string|Object}

The position where tooltips are shown in the graph - can be node, svgTopLeft or svgTopRight. No render or resume call needed to take into effect:

example.tooltipPosition('node');
Source:
Parameters:
Name Type Attributes Default Description
value string <optional>
svgTopRight
  • The new config value.
Returns:
Type:
string | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) transform(transformopt, durationopt) → {Object}

Behaves like a normal getter/setter (the zoom and zoomSmooth methods implements only setters) and can be used in the conf object to initialize the graph with different translate values/scale factors than [0,0]/1. The current transform value(an object) is rendered in the customization wizard conf object text area like all other options when the current value is different then the default value. No render or resume call needed to take into effect:

//example.zoomMode(true);
example.transform({"translate":[100,100],"scale":0.5});
Source:
See:
Parameters:
Name Type Attributes Default Description
transform Object <optional>
{“translate”:[0,0],“scale”:1}

The new config value.

duration number <optional>
500

The transition duration in milliseconds.

Returns:
Type:
Object

The current config value if no parameter is given or the graph object for method chaining.

(static) useDomParentWidth(valueopt) → {boolean|Object}

If true, the width of the chart(SVG element) is aligned to its DOM parent element. No render or resume call needed to take into effect:

example.useDomParentWidth(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) userAgent() → {string}

Returns the detected user agent. Expects no parameter and terminates the method chain:

example.userAgent();
Source:
See:
Returns:
Type:
string

The detected user agent.

(static) version() → {string}

Shows the current plugin version. This method expects no parameter and terminates the method chain:

example.version();
Source:
See:
Returns:
Type:
string

The plugin version.

(static) width(valueopt) → {number|Object}

The width of the chart:

example.width(800);
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
600

The new chart width value.

Returns:
Type:
number | Object

The current chart width value if no parameter is given or the graph object for method chaining.

(static) wrapLabels(valueopt) → {boolean|Object}

If true long labels are wrapped. Needs a render call to take into effect:

example.wrapLabels(true).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) wrappedLabelLineHeight(valueopt) → {number|Object}

The line height of labels in em, if option wrapLabels is set to true. Needs a render call to take into effect:

example.wrappedLabelLineHeight(1.5).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
1.2

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) wrappedLabelWidth(valueopt) → {number|Object}

The width of the labels, if option wrapLabels is set to true. Needs a render call to take into effect. This option is ignored when labelSplitCharacter is set to a value other then none.

example.wrappedLabelWidth(40).render();
Source:
See:
Parameters:
Name Type Attributes Default Description
value number <optional>
80

The new config value.

Returns:
Type:
number | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) zoom(centerXopt, centerYopt, viewportWidthopt, durationopt) → {Object}

The graph is centered to the given position and scaled to the calculated scale factor (effective graph with / viewportWidth).

The reason to have a viewportWidth instead of a scale factor is, that you can rely on given data like the coordinates and radius of a node without calculating the scale factor by yourself - you define your desired viewport width and the zoom method is calculating the neccesary scale factor for this viewport width. If the calculated scale factor is less or greater then the configured minimum and maximum scale factors, then these configured scale factors are used. The reason for this a good user experience, since the graph would be otherwise falling back on these scale factors when the user is scaling the graph by mouse or touch events.

No render or resume call needed to take into effect:

var node = example.nodeDataById('8888');
example.zoom(node.x, node.y, node.radius * 6); // default duration of 500ms

var node = example.nodeDataById('9999');
example.zoom(node.x, node.y, node.radius * 6, 1500); // duration of 1500ms
Source:
See:
Parameters:
Name Type Attributes Default Description
centerX number <optional>
graph width / 2

The horizontal center position.

centerY number <optional>
graph height / 2

The vertical center position.

viewportWidth number <optional>
graph width

The desired viewport width.

duration number <optional>
500

the duration of the transition

Returns:
Type:
Object

The graph object for method chaining.

(static) zoomMode(valueopt) → {boolean|Object}

If true, you can zoom and pan the graph.

ATTENTION: When zoomMode is set to true then the lassoMode is only working with the pressed alt or shift key.

KNOWN BUG: In iOS it is after the first zoom event no more possible to drag a node - instead the whole graph is moved - this is, because iOS Safari provide a wrong event.target.tagName. Also a problem: your are not able to press the alt or shift key - if you want to use lasso and zoom together on a touch device, you have to provide a workaround. One possible way is to provide a button, which turns zoom mode on and off with the API zoomMode method - then the user has the choice between these two modes - not comfortable, but working.

No render or resume call needed to take into effect:

example.zoomMode(true);
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) zoomSmooth(centerXopt, centerYopt, viewportWidthopt, durationopt) → {Object}

DEPRECATED: Please use zoom instead.

Source:
See:
Parameters:
Name Type Attributes Default Description
centerX number <optional>
graph width / 2

The horizontal center position.

centerY number <optional>
graph height / 2

The vertical center position.

viewportWidth number <optional>
graph width

The desired viewport width.

duration number <optional>
1500

the duration of the transition

Returns:
Type:
Object

The graph object for method chaining.

(static) zoomToFit(durationopt) → {Object}

Helper/Command method - automatically zoom, so that the whole graph is visible and optimal sized. No render or resume call needed to take into effect:

example.zoomToFit();
Source:
See:
Parameters:
Name Type Attributes Default Description
duration number <optional>
500

The transition duration in milliseconds.

Returns:
Type:
Object

The graph object for method chaining.

(static) zoomToFitOnForceEnd(valueopt) → {boolean|Object}

Automatically zoom at force end, so that the whole graph is visible and optimal sized. If enabled it fires at every force end event. If you only want to resize your graph once than have a look at the command/helper method zoomToFit:

//change config and resize once
example.zoomToFitOnForceEnd(true).zoomToFit();

//resize only once
example.zoomToFit();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.

(static) zoomToFitOnResize(valueopt) → {boolean|Object}

Automatically zoom at resize (API call of width, height or responsive change of parent container size with option useDomParentWidth set to true), so that the whole graph is visible and optimal sized.

The event is harmonized/delayed for performance reasons. It could fire very often when for example the browser window is resized by the user. If the graph force simulation is running and not cooled down it is executed on the force end event. Also see the corresponding option onResizeFunctionTimeout which has a default value of 300 (milliseconds).

If you only want to resize your graph once than have a look at the command/helper method zoomToFit:

//change config and resize once
example.zoomToFitOnResize(true).zoomToFit();

//resize only once
example.zoomToFit();
Source:
See:
Parameters:
Name Type Attributes Default Description
value boolean <optional>
false

The new config value.

Returns:
Type:
boolean | Object

The current config value if no parameter is given or the graph object for method chaining.