Query |
Response |
Nodes in diagram are not well organized. Some connections were drawn over the nodes. How to fix it ? |
Currently we don’t have automatic line routing support in our diagram control. We have already logged “Line routing support in the diagram control” as a feature and provided the feature link below.
|
What is the easiest way to add connection label from node in data source "connLabel" in connection line which connects parent to its child nodes. |
Please use layouts getConnectorSegments to customize the connectors. We have set the label for the connector using this method. Please refer to the code example and JSPlayground link.
Code example:
var layoutdetails = {
//define getConnectorSegments
getConnectorSegments:getConnectorSegments,
};
$("#diagram").ejDiagram(
{
layout: layoutdetails,
});
function getConnectorSegments(diagram, connector) {
var diagram = $("#diagram").ejDiagram("instance");
if (connector && connector.targetNode) {
//get the targetNode
var targetNode = diagram.getNode(connector.targetNode);
if (targetNode.connLabel) {
connector.labels[0].text = targetNode.connLabel;
}
}
} |
How to center root node in diagram when diagram is shown. |
In your JSPlayground link, you have checked incorrect condition in the nodeTemplate function. So only the offsetX and offsetY for the root node is not set. We have modified your JSplayground link and provided below.
Code example:
function nodeTemplate(diagram, node) {
. . . .
if (node.displayName === "Root") {
node.offsetX = 675;
node.offsetY = 300;
}
} |