Styling > Using Cascading Style Sheets > Customizing Link Label Layout

This use case shows how to customize the link label layout in a network and in an equipment component.

Please refer to Label Layout in the Graphic Components documentation for details about the label layout.

The customization of link label layout is based on the following CSS properties. They are valid for IltLink, IltLinkBundle and IltLinearGroup:

Table 2.16 CSS Properties for Link Label Layout 
Property Name 
Type 
Default Value 
Description 
linkLabelMinPercentageFromStart 
float 
0 
Defines the start point of the area of the polyline that should be used for the label when a label layout is performed. This start point is expressed as a percentage of the length of the polyline. 
linkLabelMaxPercentageFromStart 
float 
100 
Defines the end point of the area of the polyline that should be used for the label when a label layout is performed. This end point is expressed as a percentage of the length of the polyline. 
linkLabelMaxDistFromPath 
float 
10 
Defines the maximum distance allowed between the label and the path when a label layout is performed. 
linkLabelPreferredDistFromPath 
float 
0 
Defines the preferred distance between the label and the path when a label layout is performed. 
linkLabelPreferredSide 
IlvDirection 
Bottom 
Defines the preferred side where the label should be placed when a label layout is performed. The meaning of this property depends on property linkLabelSideAssociation.  
If the side association is IlvAnnealingPolylineLabelDescriptor.LOCAL, the following options can be used to specify the allowed and preferred sides: 
If the side association is IlvAnnealingPolylineLabelDescriptor.GLOBAL, the following options can be used to specify the allowed and preferred sides: 
linkLabelAllowedSide 
integer 
0 
Defines the sides that are allowed for the label placement when a label layout is performed. The value can be 0, if all sides are allowed. The meaning of this property depends on the property linkLabelSideAssociation
If the side association is IlvAnnealingPolylineLabelDescriptor.LOCAL, the following options can be used to specify the allowed and preferred sides: 
If the side association is IlvAnnealingPolylineLabelDescriptor.GLOBAL, the following options can be used to specify the allowed and preferred sides: 
linkLabelSideAssociation 
IlvAnnealingPolylineLabelDescriptor 
GLOBAL 
Defines an association between the preferred and the allowed side for the label when a label layout is performed. 
Valid options for the side association are: 
linkLabelTopOverlap 
float 
0 
Defines the number of pixels the top side of the label can overlap the related obstacle when a label layout is performed. 
linkLabelBottomOverlap 
float 
0 
Defines the number of pixels the bottom side of the label can overlap the related obstacle when a label layout is performed. 
linkLabelLeftOverlap 
float 
0 
Defines the number of pixels the left side of the label can overlap the related obstacle when a label layout is performed. 
linkLabelRightOverlap 
float 
0 
Defines the number of pixels the right side of the label can overlap the related obstacle when a label layout is performed. 

How to Customize the Link Label Layout

The following CSS extract illustrates how you can configure your link objects to customize the behavior of the label layout associated with a network or equipment component. It is based on the sample located in

<installdir>/samples/network/labelLayout/data/network.css

where <installdir> is the directory where you have installed JViews TGO.

object {
  linkLabelMinPercentageFromStart: 40;
  linkLabelMaxPercentageFromStart: 60;
  linkLabelMaxDistFromPath: 5;
  linkLabelPreferredDistFromPath: 5;
  linkLabelSideAssociation : 1;
  linkLabelPreferredSide: Bottom;
  linkLabelAllowedSide: Bottom;
  linkLabelTopOverlap: 0;
  linkLabelBottomOverlap: 0;
  linkLabelLeftOverlap: 0;
  linkLabelRightOverlap: 0;
}