Graph Edge Transformer

Register a function that can modify the Cytoscape edge data.

Tutorial

Web Plugin

Create a web plugin and register the plugin.

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

Register Extension

Register the transformer that counts all the properties of the collapsed edges and sets a new data parameter called numProperties.

visallo.registry.registerExtension('org.visallo.graph.edge.transformer', function(data) {
    data.numProperties = data.edges.reduce(function(sum, edge) {
        return sum + edge.properties.length;
    }, 0)
});

Create a style extension to test. We use mapData to interpolate the number into a color.

visallo.registry.registerExtension('org.visallo.graph.style', function(cytoscapeStylesheet) {
     cytoscapeStylesheet.selector('edge[numProperties]')
         .style({
             'line-color': 'mapData(numProperties, 4, 10, blue, red)',
             'target-arrow-color': 'mapData(numProperties, 4, 10, blue, red)'
         })
});

results matching ""

    No results matching ""