com.vaadin.flow.component.charts.model.DataLabelsRange Maven / Gradle / Ivy
/**
* Copyright 2000-2024 Vaadin Ltd.
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See {@literal } for the full
* license.
*/
package com.vaadin.flow.component.charts.model;
import com.vaadin.flow.component.charts.model.style.Color;
import com.vaadin.flow.component.charts.model.style.Style;
/**
* Extended data labels for range series types. Range series data labels have no
* x
and y
options. Instead, they have
* xLow
, xHigh
, yLow
and
* yHigh
options to allow the higher and lower data label sets
* individually.
*/
public class DataLabelsRange extends AbstractDataLabels {
private HorizontalAlign align;
private Boolean allowOverlap;
private Color backgroundColor;
private Color borderColor;
private Number borderRadius;
private Number borderWidth;
private String className;
private Color color;
private Boolean crop;
private Boolean defer;
private Boolean enabled;
private String format;
private String _fn_formatter;
private Boolean inside;
private String overflow;
private Number padding;
private Number rotation;
private Boolean shadow;
private Shape shape;
private Style style;
private Boolean useHTML;
private VerticalAlign verticalAlign;
private Number xHigh;
private Number xLow;
private Number yHigh;
private Number yLow;
private Number zIndex;
public DataLabelsRange() {
}
/**
* @see #setAlign(HorizontalAlign)
*/
public HorizontalAlign getAlign() {
return 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
*/
public void setAlign(HorizontalAlign align) {
this.align = align;
}
/**
* @see #setAllowOverlap(Boolean)
*/
public Boolean getAllowOverlap() {
return 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
*/
public void setAllowOverlap(Boolean allowOverlap) {
this.allowOverlap = allowOverlap;
}
/**
* @see #setBackgroundColor(Color)
*/
public Color getBackgroundColor() {
return backgroundColor;
}
/**
* The background color or gradient for the data label. Defaults to
* undefined
.
*/
public void setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
}
/**
* @see #setBorderColor(Color)
*/
public Color getBorderColor() {
return borderColor;
}
/**
* The border color for the data label. Defaults to undefined
.
*/
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
/**
* @see #setBorderRadius(Number)
*/
public Number getBorderRadius() {
return borderRadius;
}
/**
* The border radius in pixels for the data label.
*
* Defaults to: 0
*/
public void setBorderRadius(Number borderRadius) {
this.borderRadius = borderRadius;
}
/**
* @see #setBorderWidth(Number)
*/
public Number getBorderWidth() {
return borderWidth;
}
/**
* The border width in pixels for the data label.
*
* Defaults to: 0
*/
public void setBorderWidth(Number borderWidth) {
this.borderWidth = borderWidth;
}
/**
* @see #setClassName(String)
*/
public String getClassName() {
return 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.
*/
public void setClassName(String className) {
this.className = className;
}
/**
* @see #setColor(Color)
*/
public Color getColor() {
return color;
}
/**
* The text color for the data labels. Defaults to null
.
*/
public void setColor(Color color) {
this.color = color;
}
/**
* @see #setCrop(Boolean)
*/
public Boolean getCrop() {
return 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
*/
public void setCrop(Boolean crop) {
this.crop = crop;
}
/**
* @see #setDefer(Boolean)
*/
public Boolean getDefer() {
return defer;
}
/**
* Whether to defer displaying the data labels until the initial series
* animation has finished.
*
* Defaults to: true
*/
public void setDefer(Boolean defer) {
this.defer = defer;
}
public DataLabelsRange(Boolean enabled) {
this.enabled = enabled;
}
/**
* @see #setEnabled(Boolean)
*/
public Boolean getEnabled() {
return enabled;
}
/**
* Enable or disable the data labels.
*
* Defaults to: false
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
* @see #setFormat(String)
*/
public String getFormat() {
return format;
}
/**
* A format string for the data label. Available variables are the same
* as for formatter
.
*
* Defaults to: {y}
*/
public void setFormat(String format) {
this.format = format;
}
public String getFormatter() {
return _fn_formatter;
}
public void setFormatter(String _fn_formatter) {
this._fn_formatter = _fn_formatter;
}
/**
* @see #setInside(Boolean)
*/
public Boolean getInside() {
return 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.
*/
public void setInside(Boolean inside) {
this.inside = inside;
}
/**
* @see #setOverflow(String)
*/
public String getOverflow() {
return 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, set crop
to false
* and overflow
to "none"
.
*
* Defaults to: justify
*/
public void setOverflow(String overflow) {
this.overflow = overflow;
}
/**
* @see #setPadding(Number)
*/
public Number getPadding() {
return padding;
}
/**
* When either the borderWidth
or the
* backgroundColor
is set, this is the padding within the box.
*
* Defaults to: 5
*/
public void setPadding(Number padding) {
this.padding = padding;
}
/**
* @see #setRotation(Number)
*/
public Number getRotation() {
return 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
*/
public void setRotation(Number rotation) {
this.rotation = rotation;
}
/**
* @see #setShadow(Boolean)
*/
public Boolean getShadow() {
return shadow;
}
/**
* The shadow of the box. Works best with borderWidth
or
* backgroundColor
. Since 2.3 the shadow can be an object
* configuration containing color
, offsetX
,
* offsetY
, opacity
and width
.
*
* Defaults to: false
*/
public void setShadow(Boolean shadow) {
this.shadow = shadow;
}
/**
* @see #setShape(Shape)
*/
public Shape getShape() {
return 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
*/
public void setShape(Shape shape) {
this.shape = shape;
}
/**
* @see #setStyle(Style)
*/
public Style getStyle() {
if (style == null) {
style = new Style();
}
return 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"
.
*
* Defaults to: {"color": "contrast", "fontSize": "11px", "fontWeight":
* "bold", "textOutline": "1px contrast" }
*/
public void setStyle(Style style) {
this.style = style;
}
/**
* @see #setUseHTML(Boolean)
*/
public Boolean getUseHTML() {
return useHTML;
}
/**
* Whether to use HTML to render the labels.
*
* Defaults to: false
*/
public void setUseHTML(Boolean useHTML) {
this.useHTML = useHTML;
}
/**
* @see #setVerticalAlign(VerticalAlign)
*/
public VerticalAlign getVerticalAlign() {
return verticalAlign;
}
/**
* The vertical alignment of a data label. Can be one of 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.
*/
public void setVerticalAlign(VerticalAlign verticalAlign) {
this.verticalAlign = verticalAlign;
}
/**
* @see #setXHigh(Number)
*/
public Number getXHigh() {
return xHigh;
}
/**
* X offset of the higher data labels relative to the point value.
*
* Defaults to: 0
*/
public void setXHigh(Number xHigh) {
this.xHigh = xHigh;
}
/**
* @see #setXLow(Number)
*/
public Number getXLow() {
return xLow;
}
/**
* X offset of the lower data labels relative to the point value.
*
* Defaults to: 0
*/
public void setXLow(Number xLow) {
this.xLow = xLow;
}
/**
* @see #setYHigh(Number)
*/
public Number getYHigh() {
return yHigh;
}
/**
* Y offset of the higher data labels relative to the point value.
*
* Defaults to: -6
*/
public void setYHigh(Number yHigh) {
this.yHigh = yHigh;
}
/**
* @see #setYLow(Number)
*/
public Number getYLow() {
return yLow;
}
/**
* Y offset of the lower data labels relative to the point value.
*
* Defaults to: 16
*/
public void setYLow(Number yLow) {
this.yLow = yLow;
}
/**
* @see #setZIndex(Number)
*/
public Number getZIndex() {
return 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
*/
public void setZIndex(Number zIndex) {
this.zIndex = zIndex;
}
}