Coloring
renderer allocates
colors automatically to nodes or links or both, depending on one of
their properties. This is useful when you want to represent objects
with different colors depending on a given property, but you do not
know in advance how many different values the property will take.
There are two ways to set colors.coloring
of
the Coloring
renderer which returns the
color mapped to the model property value. The following code example
shows a style rule that sets the foreground color according to the
level of the node.node[level] { foreground : @|coloring(level); }
level
property
will be visualized with the foreground
property
set to a color computed according to the level
value.
Objects with the same level
value will
have the same color.colorProperty
and indexProperty
of
the Coloring
renderer. These properties
can be set to achieve a similar, although more global, behavior, as
shown in the following code example.Coloring { colorProperty : foreground; indexProperty : level; }
foreground
property
for all nodes that have the level
property. Coloring
renderer: Property |
Type |
Default |
Description |
---|---|---|---|
alpha |
float |
1.0 |
The alpha value (that is, the transparency)
of the allocated colors. |
brightness |
float |
1.0 |
The brightness of the allocated colors. |
colorProperty |
String |
“foreground” |
The color property to set on the graphic
objects. |
hue |
float |
0.0 |
The hue with which the color allocation algorithm
will start. |
indexProperty |
String |
null |
The object property used as an index to allocate
colors. |
saturation |
float |
1.0 |
The saturation of the allocated colors. |
Coloring
renderer does
not have any per-object rendering properties.