Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix space between links #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions imports/cyto/layouts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,32 @@ export const layoutColaPreset = () => ({

// positioning options
randomize: false, // use random node positions at beginning of layout
avoidOverlap: false, // if true, prevents overlap of node bounding boxes
handleDisconnected: false, // if true, avoids disconnected components from overlapping
avoidOverlap: true, // if true, prevents overlap of node bounding boxes
handleDisconnected: true, // if true, avoids disconnected components from overlapping
convergenceThreshold: 0.01, // when the alpha value (system energy) falls below this value, the layout stops
// nodeSpacing: function( node ){ return 50; }, // extra spacing around nodes
nodeSpacing: function( node ){ return 10; }, // extra spacing around nodes
flow: undefined, // use DAG/tree flow layout if specified, e.g. { axis: 'y', minSeparation: 30 }
alignment: undefined, // relative alignment constraints on nodes, e.g. {vertical: [[{node: node1, offset: 0}, {node: node2, offset: 5}]], horizontal: [[{node: node3}, {node: node4}], [{node: node5}, {node: node6}]]}
gapInequalities: undefined, // list of inequality constraints for the gap between the nodes, e.g. [{"axis":"y", "left":node1, "right":node2, "gap":25}]
centerGraph: true, // adjusts the node positions initially to center the graph (pass false if you want to start the layout from the current position)

// different methods of specifying edge length
// each can be a constant numerical value or a function like `function( edge ){ return 2; }`
edgeLength: undefined, // sets edge length directly in simulation

edgeLength: function( edge ) {
const baseLength = 30; // base edge length
const extraLength = 10; // additional length of the edge to take into account the density of connections
const sourceNode = edge.source();
const targetNode = edge.target();

// Calculate the number of connected edges for source nodes and target nodes
const sourceConnectedEdges = sourceNode.connectedEdges().length;
const targetConnectedEdges = targetNode.connectedEdges().length;

// Increase edge length based on the number of connected edges
return baseLength + (sourceConnectedEdges + targetConnectedEdges) * extraLength;
},// sets edge length directly in simulation
//edgeLength: undefined, // sets edge length directly in simulation
edgeSymDiffLength: undefined, // symmetric diff edge length in simulation
edgeJaccardLength: undefined, // jaccard edge length in simulation

Expand All @@ -37,4 +51,4 @@ export const layoutColaPreset = () => ({
});
export const layouts = {
'cola': layoutColaPreset,
};
};