4.8 Captions
The legend panel displays caption over a legend item when the rule based style
of the legend item has label.text specified.
The following shows a sample rule based style to display a caption.
{
_id: 1683557130420,
component: 'vertex',
stylingEnabled: true,
target: 'vertex',
visibilityEnabled: true,
conditions:{
operator: 'and',
conditions: []
},
aggregation: [],
style: {
label: {
text: '${properties.name}',
color: 'brown'
}
},
legendTitle: 'Legend with caption'
}
As shown in the preceding code, the property name gets
extracted and is shown as caption if the label.text is specified as an
expression using dot notation (${properties.name}) or bracket notation (
${properties["name"]}. The following figure shows the caption displayed
over the legend item:
The default pin icon shown inside the caption can be changed
using the rule based style's overlayIndicator property as shown:
{
....
overlayIndicator: 'bookmark',
style: {
label: {
text: '${properties.name}',
color: 'brown'
}
},
legendTitle: 'Legend with caption'
}
Parent topic: Usage Examples
