public class DataLabels extends AbstractDataLabels
Options for the series data labels, appearing next to each data point.
In
styled mode, the data labels can be styled wtih the
.highcharts-data-label-box and
.highcharts-data-label class names (see example).
OVERFLOW_JUSTIFY, OVERFLOW_NONE| Constructor and Description |
|---|
DataLabels() |
DataLabels(Boolean enabled) |
| Modifier and Type | Method and Description |
|---|---|
HorizontalAlign |
getAlign() |
Boolean |
getAllowOverlap() |
String |
getClassName() |
Number |
getConnectorPadding() |
Boolean |
getCrop() |
Boolean |
getDefer() |
Number |
getDistance() |
Boolean |
getEnabled() |
String |
getFormat() |
String |
getFormatter() |
Boolean |
getInside() |
String |
getOverflow() |
Number |
getPadding() |
Number |
getRotation() |
Boolean |
getShadow() |
Shape |
getShape() |
Boolean |
getSoftConnector() |
Boolean |
getUseHTML() |
VerticalAlign |
getVerticalAlign() |
Number |
getX() |
Number |
getY() |
Number |
getZIndex() |
void |
setAlign(HorizontalAlign align)
The alignment of the data label compared to the point.
|
void |
setAllowOverlap(Boolean allowOverlap)
Whether to allow data labels to overlap.
|
void |
setClassName(String className)
A class name for the data label.
|
void |
setConnectorPadding(Number connectorPadding)
The distance from the data label to the connector.
|
void |
setCrop(Boolean crop)
Whether to hide data labels that are outside the plot area.
|
void |
setDefer(Boolean defer)
Whether to defer displaying the data labels until the initial series
animation has finished.
|
void |
setDistance(Number distance)
The distance of the data label from the pie's edge.
|
void |
setEnabled(Boolean enabled)
Enable or disable the data labels.
|
void |
setFormat(String format)
A format string for the data label.
|
void |
setFormatter(String _fn_formatter)
Callback JavaScript function to format the data label.
|
void |
setInside(Boolean inside)
For points with an extent, like columns, whether to align the data label
inside the box or to the actual value point.
|
void |
setOverflow(String overflow)
How to handle data labels that flow outside the plot area.
|
void |
setPadding(Number padding)
When either the
borderWidth or the
backgroundColor is set, this is the padding within the box. |
void |
setRotation(Number rotation)
Text rotation in degrees.
|
void |
setShadow(Boolean shadow)
The shadow of the box.
|
void |
setShape(Shape shape)
The name of a symbol to use for the border around the label.
|
void |
setSoftConnector(Boolean softConnector)
Whether to render the connector as a soft arc or a line with sharp break.
|
void |
setUseHTML(Boolean useHTML)
Whether to use HTML to render the labels.
|
void |
setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of a data label.
|
void |
setX(Number x)
The x position offset of the label relative to the point.
|
void |
setY(Number y)
The y position offset of the label relative to the point.
|
void |
setZIndex(Number zIndex)
The Z index of the data labels.
|
public DataLabels()
public DataLabels(Boolean enabled)
public HorizontalAlign getAlign()
setAlign(HorizontalAlign)public void setAlign(HorizontalAlign align)
right, the right side of the label should be touching the
point. For points with an extent, like columns, the alignments also
dictates how to align it inside the box, as given with the
inside option. Can be
one of "left", "center" or "right".
Defaults to: center
public Boolean getAllowOverlap()
setAllowOverlap(Boolean)public void setAllowOverlap(Boolean allowOverlap)
Defaults to: false
public String getClassName()
getClassName in class AbstractDataLabelssetClassName(String)public void setClassName(String className)
setClassName in class AbstractDataLabelspublic Boolean getCrop()
getCrop in class AbstractDataLabelssetCrop(Boolean)public void setCrop(Boolean crop)
Defaults to: true
setCrop in class AbstractDataLabelspublic Boolean getDefer()
getDefer in class AbstractDataLabelssetDefer(Boolean)public void setDefer(Boolean defer)
Defaults to: true
setDefer in class AbstractDataLabelspublic Boolean getEnabled()
getEnabled in class AbstractDataLabelssetEnabled(Boolean)public void setEnabled(Boolean enabled)
Defaults to: false
setEnabled in class AbstractDataLabelspublic String getFormat()
getFormat in class AbstractDataLabelssetFormat(String)public void setFormat(String format)
formatter.
Defaults to: {y}
setFormat in class AbstractDataLabelspublic String getFormatter()
getFormatter in class AbstractDataLabelsAbstractDataLabels.setFormatter(String)public void setFormatter(String _fn_formatter)
AbstractDataLabelsformat is defined, the format takes precedence and the
formatter is ignored.setFormatter in class AbstractDataLabelspublic Boolean getInside()
getInside in class AbstractDataLabelssetInside(Boolean)public void setInside(Boolean inside)
false in most cases, true in stacked columns.setInside in class AbstractDataLabelspublic String getOverflow()
getOverflow in class AbstractDataLabelssetOverflow(String)public void setOverflow(String overflow)
justify, which aligns them inside the plot area. For columns
and bars, this means it will be moved inside the bar. To display data
labels outside the plot area, set crop to false
and overflow to "none".
Defaults to: justify
setOverflow in class AbstractDataLabelspublic Number getPadding()
getPadding in class AbstractDataLabelssetPadding(Number)public void setPadding(Number padding)
borderWidth or the
backgroundColor is set, this is the padding within the box.
Defaults to: 5
setPadding in class AbstractDataLabelspublic Number getRotation()
getRotation in class AbstractDataLabelssetRotation(Number)public void setRotation(Number rotation)
Defaults to: 0
setRotation in class AbstractDataLabelspublic Boolean getShadow()
getShadow in class AbstractDataLabelssetShadow(Boolean)public void setShadow(Boolean shadow)
borderWidth or
backgroundColor. Since 2.3 the shadow can be an object
configuration containing color, offsetX,
offsetY, opacity and width.
Defaults to: false
setShadow in class AbstractDataLabelspublic Shape getShape()
getShape in class AbstractDataLabelssetShape(Shape)public void setShape(Shape shape)
Defaults to: square
setShape in class AbstractDataLabelspublic Boolean getUseHTML()
getUseHTML in class AbstractDataLabelssetUseHTML(Boolean)public void setUseHTML(Boolean useHTML)
Defaults to: false
setUseHTML in class AbstractDataLabelspublic VerticalAlign getVerticalAlign()
getVerticalAlign in class AbstractDataLabelssetVerticalAlign(VerticalAlign)public void setVerticalAlign(VerticalAlign verticalAlign)
top,
middle or bottom. The default value depends on
the data, for instance in a column chart, the label is above positive
values and below negative values.setVerticalAlign in class AbstractDataLabelspublic Number getX()
setX(Number)public void setX(Number x)
Defaults to: 0
public Number getY()
setY(Number)public void setY(Number y)
Defaults to: -6
public Number getZIndex()
getZIndex in class AbstractDataLabelssetZIndex(Number)public void setZIndex(Number zIndex)
Defaults to: 6
setZIndex in class AbstractDataLabelspublic Number getConnectorPadding()
setConnectorPadding(Number)public void setConnectorPadding(Number connectorPadding)
Defaults to: 5
public Number getDistance()
setDistance(Number)public void setDistance(Number distance)
Defaults to: 30
public Boolean getSoftConnector()
setSoftConnector(Boolean)public void setSoftConnector(Boolean softConnector)
Defaults to: true
Copyright © 2025. All rights reserved.