public class DataLabels extends BaseOption
Options for the series data labels, appearing next to each data point.
Since v6.2.0, multiple data labels can be applied to each single point by defining them as an array of configs.
In styled mode, the data labels can be styled with the .highcharts-data-label-box
and .highcharts-data-label
class names (see example).
Modifier and Type | Field and Description |
---|---|
static DataLabels |
NULL |
Constructor and Description |
---|
DataLabels() |
Modifier and Type | Method and Description |
---|---|
Boolean |
getEnabled()
Enable or disable the data labels.
|
String |
getFormat()
A format string for the data label.
|
CSSObject |
getStyle()
Styles for the label.
|
DataLabels |
setEnabled(Boolean enabled)
Enable or disable the data labels.
|
DataLabels |
setFormat(String format)
A format string for the data label.
|
DataLabels |
setStyle(CSSObject style)
Styles for the label.
|
set_hcNulledOption
public static final DataLabels NULL
public Boolean getEnabled()
Enable or disable the data labels.
public DataLabels setEnabled(Boolean enabled)
Enable or disable the data labels.
enabled
- the value for the enabled optionpublic String getFormat()
A format string for the data label. Available variables are the same as for formatter
.
public DataLabels setFormat(String format)
A format string for the data label. Available variables are the same as for formatter
.
format
- the value for the format optionpublic CSSObject getStyle()
Styles for the label. The default color
setting is "contrast"
, which is a pseudo color that Highcharts picks up and applies the maximum contrast to the underlying point item, for example the bar in a bar chart.
The textOutline
is a pseudo property that applies an outline of the given width with the given color, which by default is the maximum contrast to the text. So a bright text color will result in a black text outline for maximum readability on a mixed background. In some cases, especially with grayscale text, the text outline doesn't work well, in which cases it can be disabled by setting it to "none"
. When useHTML
is true, the textOutline
will not be picked up. In this, case, the same effect can be acheived through the text-shadow
CSS property.
For some series types, where each point has an extent, like for example tree maps, the data label may overflow the point. There are two strategies for handling overflow. By default, the text will wrap to multiple lines. The other strategy is to set style.textOverflow
to ellipsis
, which will keep the text on one line plus it will break inside long words.
public DataLabels setStyle(CSSObject style)
Styles for the label. The default color
setting is "contrast"
, which is a pseudo color that Highcharts picks up and applies the maximum contrast to the underlying point item, for example the bar in a bar chart.
The textOutline
is a pseudo property that applies an outline of the given width with the given color, which by default is the maximum contrast to the text. So a bright text color will result in a black text outline for maximum readability on a mixed background. In some cases, especially with grayscale text, the text outline doesn't work well, in which cases it can be disabled by setting it to "none"
. When useHTML
is true, the textOutline
will not be picked up. In this, case, the same effect can be acheived through the text-shadow
CSS property.
For some series types, where each point has an extent, like for example tree maps, the data label may overflow the point. There are two strategies for handling overflow. By default, the text will wrap to multiple lines. The other strategy is to set style.textOverflow
to ellipsis
, which will keep the text on one line plus it will break inside long words.
style
- the value for the style optionCopyright © 2022. All rights reserved.