Style mappers
Permission: Settings management
Style mappers setting is a collection of style mapper objects.
Style mapper object is a simple configuration object which defines mappings of node or relationship DB property values to style values, e.g. color, width or shape. These style values are used for visualization styling/rendering. You can create multiple mappers based on the same DB property but with different styling conditions and different GUI title. Defined style mapper objects are listed in "Style" tab in visualization where user can choose and apply them to style the visualization.
Configuration
-
Left menu - settings
-
In panel "Settings list" use icon "Update" for setting "STYLE_MAPPERS".
-
Enter JSON configuration and confirm by pressing "Save" button.
Default configuration
Default configuration contains no mappers.
-
Left menu - settings
-
In panel "Settings list" use icon "Update" for setting "STYLE_MAPPERS".
-
Press button "Default" and store by pressing button "Save".
Automatic configuration
Automatic configuration contains no mappers. You have to create appropriate mappers manually.
-
Left menu - settings
-
In panel "Settings list" use icon "Update" for setting "STYLE_MAPPERS".
-
Press button "Automatic", wait for generator to generate JSON and store by pressing button "Save".
Description of configuration
Configuration is entered as JSON. Example of JSON:
[
{
"id" : "1",
"dataAttr" : "TYPE",
"label" : "Color by type",
"group" : "nodes",
"styleGroup" : "nodeColor",
"mapperType" : "discrete",
"style" : {
"background_color" : {
"TYPE_1" : "rgb(200,100,100)",
"TYPE_2" : {"dataAttr" : "another_property"},
"_notMapped_" : "rgb(100,100,100)",
"_undefined_" : "rgb(0,0,0)"
},
"border_width" : 0
}
},
{
"id" : "2",
"dataAttr" : "NUM_OF_INCIDDENTS",
"label" : "Num of Incidents",
"group" : "nodes",
"styleGroup" : "nodeColor",
"mapperType" : "linear",
"style" : {
"background_color" : {
"minData" : 0,
"minValue" : "#ccc",
"maxData" : 100,
"maxValue" : "#f00",
"_undefined_" : "#000"
},
"border_width" : 0,
"shape" : "roundrectangle"
}
}
]
Explanation of JSON properties:
Property |
Values |
Default |
Description |
Usage |
id MANDATORY |
String |
|
Mapper identification. Id can't start with space " " or exclamation mark "!". It's used for referencing purposes, e.g. in Style views setting. |
Visualization |
dataAttr MANDATORY |
String |
|
Name of the DB property used in mapping. Values of this DB property will be used for determining the styling/rendering values in visualization when this mapper is used. Set dataAttr to "_dbLabels" if you want to style nodes by DB labels. Set dataAttr to "_dbRelType" if you want to style relationships by DB types. |
Visualization |
label MANDATORY |
String |
|
Mapper name used in GUI. |
Visualization |
group MANDATORY |
"nodes", "edges" |
|
Determines if this mapper is used to style nodes or relationships. |
Visualization |
styleGroup MANDATORY |
"nodeIcon", "nodeColor", "nodeShape", "nodeSize" "edgeColor", "edgeType", "edgeWidth" |
|
Determines the styling group in GUI where this mapper will be listed for use. All styling groups with mappers are on tab Style in visualization. When group is set to "nodes" you can use styleGroup values starting with "node" and when group is set to "edges" you can use styleGroup values starting with "edge". |
Visualization |
mapperType MANDATORY |
"discrete", "linear" |
|
Discrete mapper is best used with properties which have a finite number of distinct values and these can be directly mapped to style values (types, categories, ...). When you choose "discrete" mapper you have to define mappings as single value or multiple values (see description od style for more information). Linear mapper is best used with continuous numeric values (number of incidents, weight, performance indicators, ...). When you choose "linear" mapper you have to define mappings as single value or range of values (see description od style for more information). |
Visualization |
style MANDATORY |
Object |
|
Mapping from dataAttr values to style values. Mapping is defined as a set of style properties (e.g. background_color, width, height, ...) which can be mapped to DB properties values in a few ways:
Supported styling properties are based on Cytoscape.js style properties. You can read more about every style property in Cytoscape.js documentation on Style but be aware that not all style properties are supported and you have to change dash ("-") to underscore ("_") in the name of every used style property due to some issues with data storing mechanism of Cytoscape.js. Full list of supported style properties and their values is as follows:
|
Visualization |
Default styles
There are default styling values which are used as starting settings. Defaults are as follows:
-
Nodes
-
background_color : "rgb(130, 130, 130)"
-
background_image : "none"
-
border_color : "rgb(200, 200, 200)"
-
border_width : 3
-
shape : "ellipse"
-
height : 30
-
width : 30
-
font_size : 14
-
-
Relationships
-
line_color : "rgb(200, 200, 200)"
-
line_style : "solid"
-
width : 1
-
font_size : 14
-
-
Merged relationships
-
line_color : "rgb(150, 150, 150)"
-
line_style : "solid"
-
width : 5
-
font_size : 14
-