Graph Node Class

Register a function that can add or remove classes from Cytoscape nodes for custom styling.

Tutorial

Web Plugin

Register the plugin script in a web plugin.

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

Register Extension

Register the class extension and apply a unknownName class when the vertex is a person with no name property.

visallo.registry.registerExtension('org.visallo.graph.node.class', function(vertex, classes) {
    var name = _.findWhere(vertex.properties, { name: 'http://example.org/test#fullName' })
    var concept = _.findWhere(vertex.properties, { name: 'http://visallo.org#conceptType' })
    if (concept && concept.value === 'http://example.org/test#person' && !name) {
        classes.push('unknownName')
    }
});

Register a style extension to test the behavior by adjusting the opacity.

visallo.registry.registerExtension('org.visallo.graph.style', function(cytoscapeStylesheet) {
     cytoscapeStylesheet.selector('node.unknownName')
         .style({
             'opacity': '0.75'
         })
});

results matching ""

    No results matching ""