com.vaadin.flow.component.charts.model.
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:
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).See Also:
-
-
Field Summary
-
Fields inherited from class com.vaadin.flow.component.charts.model.AbstractDataLabels
OVERFLOW_JUSTIFY, OVERFLOW_NONE
-
-
Constructor Summary
Constructors Constructor and Description DataLabels()
DataLabels(Boolean enabled)
-
Method Summary
All Methods 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 thebackgroundColor
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.
-
-
-
Constructor Detail
-
DataLabels
public DataLabels()
-
DataLabels
public DataLabels(Boolean enabled)
-
-
Method Detail
-
getAlign
public HorizontalAlign getAlign()
See Also:
-
setAlign
public void setAlign(HorizontalAlign align)
The alignment of the data label compared to the point. If
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
-
getAllowOverlap
public Boolean getAllowOverlap()
See Also:
-
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:
getBackgroundColor
in classAbstractDataLabels
See Also:
-
setBackgroundColor
public void setBackgroundColor(Color backgroundColor)
The background color or gradient for the data label. Defaults to
undefined
.Specified by:
setBackgroundColor
in classAbstractDataLabels
-
getBorderColor
public Color getBorderColor()
Specified by:
getBorderColor
in classAbstractDataLabels
See Also:
-
setBorderColor
public void setBorderColor(Color borderColor)
The border color for the data label. Defaults to
undefined
.Specified by:
setBorderColor
in classAbstractDataLabels
-
getBorderRadius
public Number getBorderRadius()
Specified by:
getBorderRadius
in classAbstractDataLabels
See Also:
-
setBorderRadius
public void setBorderRadius(Number borderRadius)
The border radius in pixels for the data label.
Defaults to: 0
Specified by:
setBorderRadius
in classAbstractDataLabels
-
getBorderWidth
public Number getBorderWidth()
Specified by:
getBorderWidth
in classAbstractDataLabels
See Also:
-
setBorderWidth
public void setBorderWidth(Number borderWidth)
The border width in pixels for the data label.
Defaults to: 0
Specified by:
setBorderWidth
in classAbstractDataLabels
-
getClassName
public String getClassName()
Specified by:
getClassName
in classAbstractDataLabels
See Also:
-
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:
setClassName
in classAbstractDataLabels
-
getColor
public Color getColor()
Specified by:
getColor
in classAbstractDataLabels
See Also:
-
setColor
public void setColor(Color color)
The text color for the data labels. Defaults to
null
.Specified by:
setColor
in classAbstractDataLabels
-
getCrop
public Boolean getCrop()
Specified by:
getCrop
in classAbstractDataLabels
See Also:
-
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:
setCrop
in classAbstractDataLabels
-
getDefer
public Boolean getDefer()
Specified by:
getDefer
in classAbstractDataLabels
See Also:
-
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:
setDefer
in classAbstractDataLabels
-
getEnabled
public Boolean getEnabled()
Specified by:
getEnabled
in classAbstractDataLabels
See Also:
-
setEnabled
public void setEnabled(Boolean enabled)
Enable or disable the data labels.
Defaults to: false
Specified by:
setEnabled
in classAbstractDataLabels
-
getFormat
public String getFormat()
Specified by:
getFormat
in classAbstractDataLabels
See Also:
-
setFormat
public void setFormat(String format)
A format string for the data label. Available variables are the same as for
formatter
.Defaults to: {y}
Specified by:
setFormat
in classAbstractDataLabels
-
getFormatter
public String getFormatter()
Specified by:
getFormatter
in classAbstractDataLabels
See Also:
-
setFormatter
public void setFormatter(String _fn_formatter)
Description copied from class:
AbstractDataLabels
Callback JavaScript function to format the data label. Note that if a
format
is defined, the format takes precedence and the formatter is ignored.Specified by:
setFormatter
in classAbstractDataLabels
-
getInside
public Boolean getInside()
Specified by:
getInside
in classAbstractDataLabels
See Also:
-
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 to
false
in most cases,true
in stacked columns.Specified by:
setInside
in classAbstractDataLabels
-
getOverflow
public String getOverflow()
Specified by:
getOverflow
in classAbstractDataLabels
See Also:
-
setOverflow
public void setOverflow(String overflow)
How to handle data labels that flow outside the plot area. The default is
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, setcrop
tofalse
andoverflow
to"none"
.Defaults to: justify
Specified by:
setOverflow
in classAbstractDataLabels
-
getPadding
public Number getPadding()
Specified by:
getPadding
in classAbstractDataLabels
See Also:
-
setPadding
public void setPadding(Number padding)
When either the
borderWidth
or thebackgroundColor
is set, this is the padding within the box.Defaults to: 5
Specified by:
setPadding
in classAbstractDataLabels
-
getRotation
public Number getRotation()
Specified by:
getRotation
in classAbstractDataLabels
See Also:
-
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:
setRotation
in classAbstractDataLabels
-
getShadow
public Boolean getShadow()
Specified by:
getShadow
in classAbstractDataLabels
See Also:
-
setShadow
public void setShadow(Boolean shadow)
The shadow of the box. Works best with
borderWidth
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
public Shape getShape()
Specified by:
getShape
in classAbstractDataLabels
See Also:
-
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:
setShape
in classAbstractDataLabels
-
getStyle
public Style getStyle()
Specified by:
getStyle
in classAbstractDataLabels
See Also:
-
setStyle
public void setStyle(Style 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. 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
public Boolean getUseHTML()
Specified by:
getUseHTML
in classAbstractDataLabels
See Also:
-
setUseHTML
public void setUseHTML(Boolean useHTML)
Whether to use HTML to render the labels.
Defaults to: false
Specified by:
setUseHTML
in classAbstractDataLabels
-
getVerticalAlign
public VerticalAlign getVerticalAlign()
Specified by:
getVerticalAlign
in classAbstractDataLabels
See Also:
-
setVerticalAlign
public void setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of a data label. Can be one of
top
,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
public Number getX()
See Also:
-
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
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:
getZIndex
in classAbstractDataLabels
See Also:
-
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:
setZIndex
in classAbstractDataLabels
-
getConnectorColor
public Color getConnectorColor()
See Also:
-
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-connector
class.Defaults to: {point.color}
-
getConnectorPadding
public Number getConnectorPadding()
See Also:
-
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
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
-
getDistance
public Number getDistance()
See Also:
-
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
public void setSoftConnector(Boolean softConnector)
Whether to render the connector as a soft arc or a line with sharp break.
Defaults to: true
-
-