Graph Edge Class

Function that can change Cytoscape classes of edges. Useful for customizing the style of edges on the graph.

Tutorial

Web Plugin

Register a plugin file to register the extensions.

app.registerJavaScript("/org/visallo/examples/graph_edge_class/plugin.js", true);

Register Extension

Register the class extension that checks if any of the edges (they are by default bundled together by type) has a comment. If any of them do, add a class.

visallo.registry.registerExtension('org.visallo.graph.edge.class', function(edges, type, classes) {
    var hasComment = _.any(edges, function(edge) {
        return _.findWhere(edge.properties, { name: 'http://visallo.org/comment#entry' })
    });

    if (hasComment) {
        classes.push('hasComment')
    }
});

Register a style extension to test.

visallo.registry.registerExtension('org.visallo.graph.style', function(cytoscapeStylesheet) {
     cytoscapeStylesheet.selector('edge.hasComment')
         .style({
             color: '#ff0000',
             'line-color': '#ff0000',
             'target-arrow-color': '#ff0000',
             width: 5
         })
});

results matching ""

    No results matching ""