new NetworkGraph(target, config) → {NetworkGraph}
Construct a new NetworkGraph class
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | The element to render the graph to |
config |
NetworkGraph~Config | The NetworkGraph config |
Returns:
NetworkGraphExample
var nodes = [{
term: 'foo', value: 15
},{
term: 'bar', value: 3
},{
term: 'baz', value: 4
}]
var links = [{
source: 'foo', target: 'bar'
},{
source: 'foo', target: 'baz'
}]
Spyral.Chart.networkgraph({
nodes: nodes, nodeIdField: 'term',
links: links
})
Type Definitions
-
Config
-
The NetworkGraph config
Properties:
Name Type Attributes Description config.nodes
Array An array of node objects
config.links
Array An array of link objects
config.nodeIdField
String | function <optional>
The name of the ID field in the node object, or a function for accessing that field. Default is "id".
config.nodeLabelField
String | function <optional>
The name of the label field in the node object, or a function for accessing that field. If not specified, nodeIdField will be used.
config.nodeValueField
String | function <optional>
The name of the value field in the node object, or a function for accessing that field. Default is "value".
config.nodeCategoryField
String | function <optional>
The name of the category field in the node object, or a function for accessing that field. Default is "category". This applies a category attribute to the node in the graph which can then be used for targeting or styling purposes.
config.linkSourceField
String | function <optional>
The name of the source field in the link object, or a function for accessing that field. Default is "source".
config.linkTargetField
String | function <optional>
The name of the target field in the link object, or a function for accessing that field. Default is "target".
config.linkValueField
String | function <optional>
The name of the value field in the link object, or a function for accessing that field. Default is "value".