Class DataLabels
- All Implemented Interfaces:
Serializable
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).
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.component.charts.model.AbstractDataLabels
OVERFLOW_JUSTIFY, OVERFLOW_NONE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAlign()
getColor()
getCrop()
getDefer()
getShape()
getStyle()
getX()
getY()
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
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
Whether to hide data labels that are outside the plot area.void
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
A format string for the data label.void
setFormatter
(String _fn_formatter) Callback JavaScript function to format the data label.void
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 theborderWidth
or thebackgroundColor
is set, this is the padding within the box.void
setRotation
(Number rotation) Text rotation in degrees.void
The shadow of the box.void
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
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
The x position offset of the label relative to the point.void
The y position offset of the label relative to the point.void
The Z index of the data labels.
-
Constructor Details
-
DataLabels
public DataLabels() -
DataLabels
-
-
Method Details
-
getAlign
- See Also:
-
setAlign
The alignment of the data label compared to the point. Ifright
, 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
-
getAllowOverlap
- See Also:
-
setAllowOverlap
Whether to allow data labels to overlap. To make the labels less sensitive for overlapping, the dataLabels.padding can be set to 0.Defaults to: false
-
getBackgroundColor
- Specified by:
getBackgroundColor
in classAbstractDataLabels
- See Also:
-
setBackgroundColor
The background color or gradient for the data label. Defaults toundefined
.- Specified by:
setBackgroundColor
in classAbstractDataLabels
-
getBorderColor
- Specified by:
getBorderColor
in classAbstractDataLabels
- See Also:
-
setBorderColor
The border color for the data label. Defaults toundefined
.- Specified by:
setBorderColor
in classAbstractDataLabels
-
getBorderRadius
- Specified by:
getBorderRadius
in classAbstractDataLabels
- See Also:
-
setBorderRadius
The border radius in pixels for the data label.Defaults to: 0
- Specified by:
setBorderRadius
in classAbstractDataLabels
-
getBorderWidth
- Specified by:
getBorderWidth
in classAbstractDataLabels
- See Also:
-
setBorderWidth
The border width in pixels for the data label.Defaults to: 0
- Specified by:
setBorderWidth
in classAbstractDataLabels
-
getClassName
- Specified by:
getClassName
in classAbstractDataLabels
- See Also:
-
setClassName
A class name for the data label. Particularly in styled mode, this can be used to give each series' or point's data label unique styling. In addition to this option, a default color class name is added so that we can give the labels a contrast text shadow.- Specified by:
setClassName
in classAbstractDataLabels
-
getColor
- Specified by:
getColor
in classAbstractDataLabels
- See Also:
-
setColor
The text color for the data labels. Defaults tonull
.- Specified by:
setColor
in classAbstractDataLabels
-
getCrop
- Specified by:
getCrop
in classAbstractDataLabels
- See Also:
-
setCrop
Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot area according to the overflow option.Defaults to: true
- Specified by:
setCrop
in classAbstractDataLabels
-
getDefer
- Specified by:
getDefer
in classAbstractDataLabels
- See Also:
-
setDefer
Whether to defer displaying the data labels until the initial series animation has finished.Defaults to: true
- Specified by:
setDefer
in classAbstractDataLabels
-
getEnabled
- Specified by:
getEnabled
in classAbstractDataLabels
- See Also:
-
setEnabled
Enable or disable the data labels.Defaults to: false
- Specified by:
setEnabled
in classAbstractDataLabels
-
getFormat
- Specified by:
getFormat
in classAbstractDataLabels
- See Also:
-
setFormat
A format string for the data label. Available variables are the same as forformatter
.Defaults to: {y}
- Specified by:
setFormat
in classAbstractDataLabels
-
getFormatter
- Specified by:
getFormatter
in classAbstractDataLabels
- See Also:
-
setFormatter
Description copied from class:AbstractDataLabels
Callback JavaScript function to format the data label. Note that if aformat
is defined, the format takes precedence and the formatter is ignored.- Specified by:
setFormatter
in classAbstractDataLabels
-
getInside
- Specified by:
getInside
in classAbstractDataLabels
- See Also:
-
setInside
For points with an extent, like columns, whether to align the data label inside the box or to the actual value point. Defaults tofalse
in most cases,true
in stacked columns.- Specified by:
setInside
in classAbstractDataLabels
-
getOverflow
- Specified by:
getOverflow
in classAbstractDataLabels
- See Also:
-
setOverflow
How to handle data labels that flow outside the plot area. The default isjustify
, 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, setcrop
tofalse
andoverflow
to"none"
.Defaults to: justify
- Specified by:
setOverflow
in classAbstractDataLabels
-
getPadding
- Specified by:
getPadding
in classAbstractDataLabels
- See Also:
-
setPadding
When either theborderWidth
or thebackgroundColor
is set, this is the padding within the box.Defaults to: 5
- Specified by:
setPadding
in classAbstractDataLabels
-
getRotation
- Specified by:
getRotation
in classAbstractDataLabels
- See Also:
-
setRotation
Text rotation in degrees. Note that due to a more complex structure, backgrounds, borders and padding will be lost on a rotated data label.Defaults to: 0
- Specified by:
setRotation
in classAbstractDataLabels
-
getShadow
- Specified by:
getShadow
in classAbstractDataLabels
- See Also:
-
setShadow
The shadow of the box. Works best withborderWidth
orbackgroundColor
. Since 2.3 the shadow can be an object configuration containingcolor
,offsetX
,offsetY
,opacity
andwidth
.Defaults to: false
- Specified by:
setShadow
in classAbstractDataLabels
-
getShape
- Specified by:
getShape
in classAbstractDataLabels
- See Also:
-
setShape
The name of a symbol to use for the border around the label. Symbols are predefined functions on the Renderer object.Defaults to: square
- Specified by:
setShape
in classAbstractDataLabels
-
getStyle
- Specified by:
getStyle
in classAbstractDataLabels
- See Also:
-
setStyle
Styles for the label. The defaultcolor
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. ThetextOutline
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" }
- Specified by:
setStyle
in classAbstractDataLabels
-
getUseHTML
- Specified by:
getUseHTML
in classAbstractDataLabels
- See Also:
-
setUseHTML
Whether to use HTML to render the labels.Defaults to: false
- Specified by:
setUseHTML
in classAbstractDataLabels
-
getVerticalAlign
- Specified by:
getVerticalAlign
in classAbstractDataLabels
- See Also:
-
setVerticalAlign
The vertical alignment of a data label. Can be one oftop
,middle
orbottom
. The default value depends on the data, for instance in a column chart, the label is above positive values and below negative values.- Specified by:
setVerticalAlign
in classAbstractDataLabels
-
getX
- See Also:
-
setX
The x position offset of the label relative to the point.Defaults to: 0
-
getY
- See Also:
-
setY
The y position offset of the label relative to the point.Defaults to: -6
-
getZIndex
- Specified by:
getZIndex
in classAbstractDataLabels
- See Also:
-
setZIndex
The Z index of the data labels. The default Z index puts it above the series. Use a Z index of 2 to display it behind the series.Defaults to: 6
- Specified by:
setZIndex
in classAbstractDataLabels
-
getConnectorColor
- See Also:
-
setConnectorColor
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}
-
getConnectorPadding
- See Also:
-
setConnectorPadding
The distance from the data label to the connector.Defaults to: 5
-
getConnectorWidth
- See Also:
-
setConnectorWidth
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
-
getDistance
- See Also:
-
setDistance
The distance of the data label from the pie's edge. Negative numbers put the data label on top of the pie slices. Connectors are only shown for data labels outside the pie.Defaults to: 30
-
getSoftConnector
- See Also:
-
setSoftConnector
Whether to render the connector as a soft arc or a line with sharp break.Defaults to: true
-