| Developing with the SDK > Using and Adding Renderers > Predefined Renderers > The Coloring Renderer |
The Coloring Renderer |
INDEX
PREVIOUS
NEXT
|
The 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.
With the first way, you use the custom function called coloring of the Coloring renderer which returns the color mapped to the model property value. Code Sample 4.7 shows a style rule that sets the foreground color according to the level of the node.
node[level] { foreground : @|coloring(level); } |
This rule states that all nodes that define the 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.
With the second way, you use the two properties colorProperty and indexProperty of the Coloring renderer. These properties can be set to achieve a similar, although more global, behavior, as shown in Code Sample 4.8.
Coloring { colorProperty : foreground; indexProperty : level; } |
This rule sets the foreground property for all nodes that have the level property.
The first way is preferred since the object selectors can be more specific than the coloring renderer global setting.
The following table lists the properties of the Coloring renderer:
The Coloring renderer does not have any per-object rendering properties.
See the class ilog.views.sdm.renderer.IlvColoringRenderer for more details.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |