Skip to main content
Version: 6.0

Point Labels

The point labels options are used to configure the point labels that are shown on the perimeter of the scale. They can be found in the pointLabels sub options object. Note

caution

The point labels can be ONLY applied to radial axes.
These options only apply if display is true.

The RadialPointLabels provides all set and get methods to manage the configuration, as following:

// creates a radial axis 
RadialAxis axis = new RadialAxis(chart);
// enables point labels
axis.getPointLabels().setDisplay(true);
// sets and gets the color value
axis.getPointLabels().setColor(HtmlColor.RED);

IsColor color = axis.getPointLabels().getColor();

Table with options:

NameTypeScriptableDescription
backdropColorString - IsColorYesBackground color of the point label.
backdropPaddingPadding-The padding of label backdrop.
See padding documentation for more details.
borderRadiusint - BarBorderRadiusYesThe border radius of the point label (in pixels).
centerPointLabelsboolean-If true, point labels are centered.
displayboolean-If true, point labels are shown.
colorString - IsColorYesColor of point labels.
fontIsFontYesFont of point labels.
paddingintYesPadding between chart and point labels, in pixel.

The further customization of point labels, a callback is provided.

Scriptable

Scriptable options at grid level accept a callback which is called for each of the underlying data values. See more details in Configuring charts section.

All scriptable options callbacks will get a ScaleContext instance.

// creates a radial axis 
RadialAxis axis = new RadialAxis(chart);
// enables point labels
axis.getPointLabels().setDisplay(true);
// sets the option by a callback
axis.getPointLabels().setColor(new ColorCallback<ScaleContext>(){

@Override
public IsColor invoke(ScaleContext context){
// logic
return color;
}
});

The following options can be set by a callback:

NameCallbackReturned types
backdropColorColorCallback<ScaleContext>String - IsColor
borderRadiusBorderRadiusCallback<ScaleContext>int - BarBorderRadius
colorColorCallback<ScaleContext>String - IsColor
fontFontCallback<ScaleContext>FontItem
paddingSimplePaddingCallbackint

Callback

Callback implementation can transform data labels to point labels. The default implementation simply returns the current string.

To apply an own callback, you can set a PointLabelCallback instance to the axis options, as following:

// creates a radial axis 
RadialAxis axis = new RadialAxis(chart);
// enables point labels
axis.getPointLabels().setDisplay(true);
// sets callback
axis.getPointLabels().setCallBack(new PointLabelCallback(){

/**
* Callback function to transform data labels to point labels. The default implementation simply returns the current string.
*
* @param axis axis instance where this callback as been defined
* @param item label of current label
* @param index index of the label
* @return new label to apply to point label
*/
@Override
public String onCallback(Axis axis, String item, int index){
// logic
return item;
}

});

The callback can return a string (for single line) or a list of strings (for multiple lines).