Class DataLabels
- java.lang.Object
-
- com.vaadin.flow.component.charts.model.AbstractConfigurationObject
-
- com.vaadin.flow.component.charts.model.AbstractDataLabels
-
- com.vaadin.flow.component.charts.model.DataLabels
-
- All Implemented Interfaces:
Serializable
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-boxand.highcharts-data-labelclass names (see example).- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.vaadin.flow.component.charts.model.AbstractDataLabels
OVERFLOW_JUSTIFY, OVERFLOW_NONE
-
-
Constructor Summary
Constructors Constructor Description DataLabels()DataLabels(Boolean enabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HorizontalAligngetAlign()BooleangetAllowOverlap()ColorgetBackgroundColor()ColorgetBorderColor()NumbergetBorderRadius()NumbergetBorderWidth()StringgetClassName()ColorgetColor()ColorgetConnectorColor()NumbergetConnectorPadding()NumbergetConnectorWidth()BooleangetCrop()BooleangetDefer()NumbergetDistance()BooleangetEnabled()StringgetFormat()StringgetFormatter()BooleangetInside()StringgetOverflow()NumbergetPadding()NumbergetRotation()BooleangetShadow()ShapegetShape()BooleangetSoftConnector()StylegetStyle()BooleangetUseHTML()VerticalAligngetVerticalAlign()NumbergetX()NumbergetY()NumbergetZIndex()voidsetAlign(HorizontalAlign align)The alignment of the data label compared to the point.voidsetAllowOverlap(Boolean allowOverlap)Whether to allow data labels to overlap.voidsetBackgroundColor(Color backgroundColor)The background color or gradient for the data label.voidsetBorderColor(Color borderColor)The border color for the data label.voidsetBorderRadius(Number borderRadius)The border radius in pixels for the data label.voidsetBorderWidth(Number borderWidth)The border width in pixels for the data label.voidsetClassName(String className)A class name for the data label.voidsetColor(Color color)The text color for the data labels.voidsetConnectorColor(Color connectorColor)The color of the line connecting the data label to the pie slice.voidsetConnectorPadding(Number connectorPadding)The distance from the data label to the connector.voidsetConnectorWidth(Number connectorWidth)The width of the line connecting the data label to the pie slice.voidsetCrop(Boolean crop)Whether to hide data labels that are outside the plot area.voidsetDefer(Boolean defer)Whether to defer displaying the data labels until the initial series animation has finished.voidsetDistance(Number distance)The distance of the data label from the pie's edge.voidsetEnabled(Boolean enabled)Enable or disable the data labels.voidsetFormat(String format)A format string for the data label.voidsetFormatter(String _fn_formatter)Callback JavaScript function to format the data label.voidsetInside(Boolean inside)For points with an extent, like columns, whether to align the data label inside the box or to the actual value point.voidsetOverflow(String overflow)How to handle data labels that flow outside the plot area.voidsetPadding(Number padding)When either theborderWidthor thebackgroundColoris set, this is the padding within the box.voidsetRotation(Number rotation)Text rotation in degrees.voidsetShadow(Boolean shadow)The shadow of the box.voidsetShape(Shape shape)The name of a symbol to use for the border around the label.voidsetSoftConnector(Boolean softConnector)Whether to render the connector as a soft arc or a line with sharp break.voidsetStyle(Style style)Styles for the label.voidsetUseHTML(Boolean useHTML)Whether to use HTML to render the labels.voidsetVerticalAlign(VerticalAlign verticalAlign)The vertical alignment of a data label.voidsetX(Number x)The x position offset of the label relative to the point.voidsetY(Number y)The y position offset of the label relative to the point.voidsetZIndex(Number zIndex)The Z index of the data labels.
-
-
-
Constructor Detail
-
DataLabels
public DataLabels()
-
DataLabels
public DataLabels(Boolean enabled)
-
-
Method Detail
-
getAlign
public HorizontalAlign getAlign()
- See Also:
setAlign(HorizontalAlign)
-
setAlign
public void setAlign(HorizontalAlign align)
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
public Boolean getAllowOverlap()
- See Also:
setAllowOverlap(Boolean)
-
setAllowOverlap
public void setAllowOverlap(Boolean allowOverlap)
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
public Color getBackgroundColor()
- Specified by:
getBackgroundColorin classAbstractDataLabels- See Also:
setBackgroundColor(Color)
-
setBackgroundColor
public void setBackgroundColor(Color backgroundColor)
The background color or gradient for the data label. Defaults toundefined.- Specified by:
setBackgroundColorin classAbstractDataLabels
-
getBorderColor
public Color getBorderColor()
- Specified by:
getBorderColorin classAbstractDataLabels- See Also:
setBorderColor(Color)
-
setBorderColor
public void setBorderColor(Color borderColor)
The border color for the data label. Defaults toundefined.- Specified by:
setBorderColorin classAbstractDataLabels
-
getBorderRadius
public Number getBorderRadius()
- Specified by:
getBorderRadiusin classAbstractDataLabels- See Also:
setBorderRadius(Number)
-
setBorderRadius
public void setBorderRadius(Number borderRadius)
The border radius in pixels for the data label.Defaults to: 0
- Specified by:
setBorderRadiusin classAbstractDataLabels
-
getBorderWidth
public Number getBorderWidth()
- Specified by:
getBorderWidthin classAbstractDataLabels- See Also:
setBorderWidth(Number)
-
setBorderWidth
public void setBorderWidth(Number borderWidth)
The border width in pixels for the data label.Defaults to: 0
- Specified by:
setBorderWidthin classAbstractDataLabels
-
getClassName
public String getClassName()
- Specified by:
getClassNamein classAbstractDataLabels- See Also:
setClassName(String)
-
setClassName
public void setClassName(String className)
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:
setClassNamein classAbstractDataLabels
-
getColor
public Color getColor()
- Specified by:
getColorin classAbstractDataLabels- See Also:
setColor(Color)
-
setColor
public void setColor(Color color)
The text color for the data labels. Defaults tonull.- Specified by:
setColorin classAbstractDataLabels
-
getCrop
public Boolean getCrop()
- Specified by:
getCropin classAbstractDataLabels- See Also:
setCrop(Boolean)
-
setCrop
public void setCrop(Boolean crop)
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:
setCropin classAbstractDataLabels
-
getDefer
public Boolean getDefer()
- Specified by:
getDeferin classAbstractDataLabels- See Also:
setDefer(Boolean)
-
setDefer
public void setDefer(Boolean defer)
Whether to defer displaying the data labels until the initial series animation has finished.Defaults to: true
- Specified by:
setDeferin classAbstractDataLabels
-
getEnabled
public Boolean getEnabled()
- Specified by:
getEnabledin classAbstractDataLabels- See Also:
setEnabled(Boolean)
-
setEnabled
public void setEnabled(Boolean enabled)
Enable or disable the data labels.Defaults to: false
- Specified by:
setEnabledin classAbstractDataLabels
-
getFormat
public String getFormat()
- Specified by:
getFormatin classAbstractDataLabels- See Also:
setFormat(String)
-
setFormat
public void setFormat(String format)
A format string for the data label. Available variables are the same as forformatter.Defaults to: {y}
- Specified by:
setFormatin classAbstractDataLabels
-
getFormatter
public String getFormatter()
- Specified by:
getFormatterin classAbstractDataLabels- See Also:
AbstractDataLabels.setFormatter(String)
-
setFormatter
public void setFormatter(String _fn_formatter)
Description copied from class:AbstractDataLabelsCallback JavaScript function to format the data label. Note that if aformatis defined, the format takes precedence and the formatter is ignored.- Specified by:
setFormatterin classAbstractDataLabels
-
getInside
public Boolean getInside()
- Specified by:
getInsidein classAbstractDataLabels- See Also:
setInside(Boolean)
-
setInside
public 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. Defaults tofalsein most cases,truein stacked columns.- Specified by:
setInsidein classAbstractDataLabels
-
getOverflow
public String getOverflow()
- Specified by:
getOverflowin classAbstractDataLabels- See Also:
setOverflow(String)
-
setOverflow
public void setOverflow(String overflow)
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, setcroptofalseandoverflowto"none".Defaults to: justify
- Specified by:
setOverflowin classAbstractDataLabels
-
getPadding
public Number getPadding()
- Specified by:
getPaddingin classAbstractDataLabels- See Also:
setPadding(Number)
-
setPadding
public void setPadding(Number padding)
When either theborderWidthor thebackgroundColoris set, this is the padding within the box.Defaults to: 5
- Specified by:
setPaddingin classAbstractDataLabels
-
getRotation
public Number getRotation()
- Specified by:
getRotationin classAbstractDataLabels- See Also:
setRotation(Number)
-
setRotation
public void setRotation(Number rotation)
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:
setRotationin classAbstractDataLabels
-
getShadow
public Boolean getShadow()
- Specified by:
getShadowin classAbstractDataLabels- See Also:
setShadow(Boolean)
-
setShadow
public void setShadow(Boolean shadow)
The shadow of the box. Works best withborderWidthorbackgroundColor. Since 2.3 the shadow can be an object configuration containingcolor,offsetX,offsetY,opacityandwidth.Defaults to: false
- Specified by:
setShadowin classAbstractDataLabels
-
getShape
public Shape getShape()
- Specified by:
getShapein classAbstractDataLabels- See Also:
setShape(Shape)
-
setShape
public void setShape(Shape shape)
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:
setShapein classAbstractDataLabels
-
getStyle
public Style getStyle()
- Specified by:
getStylein classAbstractDataLabels- See Also:
setStyle(Style)
-
setStyle
public void setStyle(Style style)
Styles for the label. The defaultcolorsetting 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. ThetextOutlineis 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:
setStylein classAbstractDataLabels
-
getUseHTML
public Boolean getUseHTML()
- Specified by:
getUseHTMLin classAbstractDataLabels- See Also:
setUseHTML(Boolean)
-
setUseHTML
public void setUseHTML(Boolean useHTML)
Whether to use HTML to render the labels.Defaults to: false
- Specified by:
setUseHTMLin classAbstractDataLabels
-
getVerticalAlign
public VerticalAlign getVerticalAlign()
- Specified by:
getVerticalAlignin classAbstractDataLabels- See Also:
setVerticalAlign(VerticalAlign)
-
setVerticalAlign
public void setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of a data label. Can be one oftop,middleorbottom. 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:
setVerticalAlignin classAbstractDataLabels
-
getX
public Number getX()
- See Also:
setX(Number)
-
setX
public void setX(Number x)
The x position offset of the label relative to the point.Defaults to: 0
-
getY
public Number getY()
- See Also:
setY(Number)
-
setY
public void setY(Number y)
The y position offset of the label relative to the point.Defaults to: -6
-
getZIndex
public Number getZIndex()
- Specified by:
getZIndexin classAbstractDataLabels- See Also:
setZIndex(Number)
-
setZIndex
public void setZIndex(Number zIndex)
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:
setZIndexin classAbstractDataLabels
-
getConnectorColor
public Color getConnectorColor()
- See Also:
setConnectorColor(Color)
-
setConnectorColor
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-connectorclass.Defaults to: {point.color}
-
getConnectorPadding
public Number getConnectorPadding()
- See Also:
setConnectorPadding(Number)
-
setConnectorPadding
public void setConnectorPadding(Number connectorPadding)
The distance from the data label to the connector.Defaults to: 5
-
getConnectorWidth
public Number getConnectorWidth()
- See Also:
setConnectorWidth(Number)
-
setConnectorWidth
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-connectorclass.Defaults to: 1
-
getDistance
public Number getDistance()
- See Also:
setDistance(Number)
-
setDistance
public void setDistance(Number distance)
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
public Boolean getSoftConnector()
- See Also:
setSoftConnector(Boolean)
-
setSoftConnector
public void setSoftConnector(Boolean softConnector)
Whether to render the connector as a soft arc or a line with sharp break.Defaults to: true
-
-