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() |
Color |
getBackgroundColor() |
Color |
getBorderColor() |
Number |
getBorderRadius() |
Number |
getBorderWidth() |
String |
getClassName() |
Color |
getColor() |
Color |
getConnectorColor() |
Number |
getConnectorPadding() |
Number |
getConnectorWidth() |
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() |
Style |
getStyle() |
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 |
setBackgroundColor(Color backgroundColor)
The background color or gradient for the data label.
|
void |
setBorderColor(Color borderColor)
The border color for the data label.
|
void |
setBorderRadius(Number borderRadius)
The border radius in pixels for the data label.
|
void |
setBorderWidth(Number borderWidth)
The border width in pixels for the data label.
|
void |
setClassName(String className)
A class name for the data label.
|
void |
setColor(Color color)
The text color for the data labels.
|
void |
setConnectorColor(Color connectorColor)
The color of the line connecting the data label to the pie slice.
|
void |
setConnectorPadding(Number connectorPadding)
The distance from the data label to the connector.
|
void |
setConnectorWidth(Number connectorWidth)
The width of the line connecting the data label to the pie slice.
|
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 |
setStyle(Style style)
Styles for the label.
|
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 Color getBackgroundColor()
getBackgroundColor in class AbstractDataLabelssetBackgroundColor(Color)public void setBackgroundColor(Color backgroundColor)
undefined.setBackgroundColor in class AbstractDataLabelspublic Color getBorderColor()
getBorderColor in class AbstractDataLabelssetBorderColor(Color)public void setBorderColor(Color borderColor)
undefined.setBorderColor in class AbstractDataLabelspublic Number getBorderRadius()
getBorderRadius in class AbstractDataLabelssetBorderRadius(Number)public void setBorderRadius(Number borderRadius)
Defaults to: 0
setBorderRadius in class AbstractDataLabelspublic Number getBorderWidth()
getBorderWidth in class AbstractDataLabelssetBorderWidth(Number)public void setBorderWidth(Number borderWidth)
Defaults to: 0
setBorderWidth in class AbstractDataLabelspublic String getClassName()
getClassName in class AbstractDataLabelssetClassName(String)public void setClassName(String className)
setClassName in class AbstractDataLabelspublic Color getColor()
getColor in class AbstractDataLabelssetColor(Color)public void setColor(Color color)
null.setColor 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 Style getStyle()
getStyle in class AbstractDataLabelssetStyle(Style)public void setStyle(Style style)
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".
Defaults to: {"color": "contrast", "fontSize": "11px", "fontWeight": "bold", "textOutline": "1px contrast" }
setStyle 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 Color getConnectorColor()
setConnectorColor(Color)public void setConnectorColor(Color connectorColor)
The color of the line connecting the data label to the pie slice. The default color is the same as the point's color.
In styled mode, the connector stroke is given in the
.highcharts-data-label-connector class.
Defaults to: {point.color}
public Number getConnectorPadding()
setConnectorPadding(Number)public void setConnectorPadding(Number connectorPadding)
Defaults to: 5
public Number getConnectorWidth()
setConnectorWidth(Number)public void setConnectorWidth(Number connectorWidth)
The width of the line connecting the data label to the pie slice.
In styled mode, the connector stroke width is given in the
.highcharts-data-label-connector class.
Defaults to: 1
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 © 2021. All rights reserved.