org.visallo.graph.layout

Add new cytoscape layouts to graph menu

Extension to add new graph layouts that are accesible from the layout context menu.

the identifier is used for the menu option text and should be in the plugins message bundle:

 graph.layout.myLayout.displayName=My Layout

Example

MyLayout.identifier = 'myLayout';
function MyLayout(options) {
    this.options = options;
}

MyLayout.prototype.run = function() {
    var cy = this.options.cy;

    // Layout nodes
    // Note: Use util/retina to convert from points to pixels (Hi-DPI displays)
    cy.nodes()[0].renderedPosition({x:100,y:100})

    // Must call ready and stop callbacks
    cy.one("layoutready", options.ready);
    cy.emit("layoutready");

    cy.one("layoutstop", options.stop);
    cy.emit("layoutstop");

    return this;
};
registry.registerExtension('org.visallo.graph.layout', MyLayout);

Registration

registry.registerExtension("org.visallo.graph.layout", config)

Source:
Tutorials:
See:
Configuration Properties:
Name Type Description
config function

A cytoscape layout object constructor.

Properties
Name Type Description
identifier string

The layout identifier

run function

Instance method to run the layout.

Validation Function

Extensions registered must pass this validation check to be used.

function extensionValidator(e) {
    return 'identifier' in e;
}