public class DataLabels extends Optionable
Series
All the options in this class support DynamicalAttribute
.
NOT_NULL_VALUE, options
Constructor and Description |
---|
DataLabels() |
Modifier and Type | Method and Description |
---|---|
String |
getAlign()
Returns the alignment of the data label compared to the point.
|
boolean |
getAllowOverlap()
Whether to allow data labels to overlap.
|
Color |
getBackgroundColor()
Returns the background color for the data label.
|
Color |
getBorderColor()
Returns the border color for the data label.
|
Number |
getBorderRadius()
Returns the border radius in pixels for the data label.
|
Number |
getBorderWidth()
Returns the border width in pixels for the data label.
|
Color |
getColor()
Returns the text color for the data labels.
|
String |
getConnectorColor()
Returns the color of the line connecting the data label to the pie slice.
|
Number |
getConnectorWidth()
Returns the width of the line connecting the data label to the point.
|
boolean |
getDefer()
Return whether to defer displaying the data labels until the initial series
animation has finished.
|
Object |
getDistance()
Returns the distance of the data labels which is used for Pie chart only.
|
DataLabelsFilter |
getFilter()
Returns a declarative filter to control of which data labels to display, if any.
|
String |
getFormat()
Returns a format
string for the data label.
|
org.zkoss.json.JavaScriptValue |
getFormatter()
Returns a callback JavaScript function to format the data label.
|
String |
getLinkFormat()
Returns the format string specifying what to show for links in the networkgraph.
|
DataLabelsTextPath |
getLinkTextPath()
Returns the options for a link label text which should follow link connection,
if any.
|
String |
getOverflow()
Returns how to handle data labels that flow outside the plot area.
|
Number |
getPadding()
Returns when either the
getBorderWidth() or the
getBackgroundColor() is set, this is the padding within the box. |
Object |
getRotation()
Returns text rotation in degrees.
|
String |
getRotationMode()
Returns a rotationMode on all points which lies on the same level.
|
Shadow |
getShadow()
Returns whether to apply a drop shadow to the outer chart area.
|
String |
getShape()
Return the name of a symbol to use for the border around the label.
|
<K,V> Map<K,V> |
getStyle()
Returns styles for the label.
|
DataLabelsTextPath |
getTextPath()
Returns options for a label text which should follow marker's shape, if any.
|
String |
getVerticalAlign()
Returns the vertical alignment of a data label.
|
Number |
getX()
Returns the x position offset of the label relative to the point.
|
Number |
getY()
Returns the y position offset of the label relative to the point.
|
Number |
getZIndex()
Returns the Z index of the data labels.
|
boolean |
isAlternate()
Returns whether to position data labels alternately.
|
boolean |
isCrop()
Returns whether to hide data labels that are outside the plot area.
|
boolean |
isEnabled()
Returns enable or disable the data labels.
|
boolean |
isInside()
Returns for points with an extent, like columns, whether to align the
data label inside the box or to the actual value point.
|
boolean |
isShadow()
Returns whether to apply a drop shadow to the data label area.
|
boolean |
isSoftConnector()
Returns whether to enable soft connector.
|
boolean |
isUseHTML()
Return whether to use HTML to render the labels.
|
void |
setAlign(String align)
Sets the alignment of the data label compared to the point.
|
void |
setAllowOverlap(Boolean allowOverlap)
Whether to allow data labels to overlap.
|
void |
setAlternate(boolean alternate)
Sets whether to position data labels alternately.
|
void |
setBackgroundColor(Color color)
Sets the background color for the data label.
|
void |
setBackgroundColor(LinearGradient color)
Sets the background color for the data label.
|
void |
setBackgroundColor(RadialGradient color)
Sets the background color for the data label.
|
void |
setBackgroundColor(String color)
Sets the background color for the data label.
|
void |
setBorderColor(Color color)
Sets the border color for the data label.
|
void |
setBorderColor(LinearGradient color)
Sets the border color for the data label.
|
void |
setBorderColor(RadialGradient color)
Sets the border color for the data label.
|
void |
setBorderColor(String color)
Sets the border color for the data label.
|
void |
setBorderRadius(Number borderRadius)
Sets the border radius in pixels for the data label.
|
void |
setBorderWidth(Number borderWidth)
Sets the border width in pixels for the data label.
|
void |
setColor(Color color)
Sets the text color for the data labels.
|
void |
setColor(LinearGradient color)
Sets the text color for the data labels.
|
void |
setColor(RadialGradient color)
Sets the text color for the data labels.
|
void |
setColor(String color)
Sets the text color for the data labels.
|
void |
setConnectorColor(String connectorColor)
Sets the color of the line connecting the data label to the pie slice.
|
void |
setConnectorWidth(Number connectorWidth)
Sets the width of the line connecting the data label to the point.
|
void |
setCrop(boolean crop)
Sets whether to hide data labels that are outside the plot area.
|
void |
setDefer(Boolean defer)
Set whether to defer displaying the data labels until the initial series
animation has finished.
|
void |
setDistance(Number distance)
Sets the distance of the data labels which is used for Pie chart only.
|
void |
setDistance(String distance)
Sets the distance of the data labels which is used for Pie chart only.
|
void |
setEnabled(boolean enabled)
Sets enable or disable the data labels.
|
void |
setFilter(DataLabelsFilter filter)
Sets a declarative filter to control of which data labels to display.
|
void |
setFormat(String format)
Sets a format string
for the data label.
|
void |
setFormatter(org.zkoss.json.JavaScriptValue formatter)
Sets a callback JavaScript function to format the data label.
|
void |
setInside(boolean inside)
Sets for points with an extent, like columns, whether to align the data
label inside the box or to the actual value point.
|
void |
setLinkFormat(String linkFormat)
Sets the format string specifying what to show for links in the networkgraph.
|
void |
setLinkTextPath(DataLabelsTextPath linkTextPath)
Sets the options for a link label text which should follow link connection.
|
void |
setOverflow(String overflow)
Returns how to handle data labels that flow outside the plot area.
|
void |
setPadding(int padding)
Sets when either the
getBorderWidth() or the
getBackgroundColor() is set, this is the padding within the box. |
void |
setRotation(Number rotation)
Sets text rotation in degrees.
|
void |
setRotation(String rotation)
Sets text rotation in degrees.
|
void |
setRotationMode(String rotationMode)
Sets a rotationMode on all points which lies on the same level.
|
void |
setShadow(boolean shadow)
Sets whether to apply a drop shadow to the outer chart area.
|
void |
setShadow(Shadow shadow)
Sets whether to apply a drop shadow to the outer chart area.
|
void |
setShape(String shape)
Set the name of a symbol to use for the border around the label.
|
void |
setSoftConnector(boolean softConnector)
Sets to enable soft connector.
|
<K,V> void |
setStyle(Map<K,V> style)
Set styles for the label.
|
void |
setStyle(String style)
Set styles for the label.
|
void |
setTextPath(DataLabelsTextPath textPath)
Sets options for a label text which should follow marker's shape.
|
void |
setUseHTML(boolean useHTML)
Sets whether to use HTML to render the labels.
|
void |
setVerticalAlign(String verticalAlign)
Sets the vertical alignment of a data label.
|
void |
setX(Number x)
Sets the x position offset of the label relative to the point.
|
void |
setY(Number y)
Sets the y position offset of the label relative to the point.
|
void |
setZIndex(Number zIndex)
Sets the Z index of the data labels.
|
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, onChange, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, toJSONString, toString
public String getAlign()
Defaults to "center"
.
public void setAlign(String align)
"center"
. 'align
the alignment of the data label compared to the point. Can be one of
"left", "center" or "right".
Defaults to "center"
.
public boolean getAllowOverlap()
Defaults to false.
public void setAllowOverlap(Boolean allowOverlap)
Defaults to false.
public boolean isAlternate()
Default: true
public void setAlternate(boolean alternate)
public Color getBackgroundColor()
Defaults to null.
public void setBackgroundColor(Color color)
Defaults to null.
public void setBackgroundColor(String color)
Defaults to null.
public void setBackgroundColor(LinearGradient color)
Defaults to null.
public void setBackgroundColor(RadialGradient color)
Defaults to null.
public Color getBorderColor()
Default: null
public void setBorderColor(Color color)
Default: null
public void setBorderColor(String color)
Default: null
public void setBorderColor(LinearGradient color)
Default: null
public void setBorderColor(RadialGradient color)
Default: null
public Number getBorderRadius()
Default: 0
public void setBorderRadius(Number borderRadius)
public Number getBorderWidth()
Default: 0
public void setBorderWidth(Number borderWidth)
Default: 0
public Color getColor()
Default: null
public void setColor(Color color)
public void setColor(String color)
public void setColor(LinearGradient color)
public void setColor(RadialGradient color)
public String getConnectorColor()
Default: null
public void setConnectorColor(String connectorColor)
public Number getConnectorWidth()
Default: 1
public void setConnectorWidth(Number connectorWidth)
public boolean isCrop()
setOverflow(String)
option.
Default: true
public void setCrop(boolean crop)
setOverflow(String)
option.
Default: true
public boolean getDefer()
Defaults to true.
public void setDefer(Boolean defer)
Defaults to true.
public Object getDistance()
Default: 0
public void setDistance(Number distance)
public void setDistance(String distance)
public boolean isEnabled()
Default: false
public void setEnabled(boolean enabled)
Default: false
public DataLabelsFilter getFilter()
public void setFilter(DataLabelsFilter filter)
public String getFormat()
public void setFormat(String format)
public org.zkoss.json.JavaScriptValue getFormatter()
Default: null
public void setFormatter(org.zkoss.json.JavaScriptValue formatter)
public boolean isInside()
Defaults to false
in most cases, true
in
stacked columns.
public void setInside(boolean inside)
false
in most cases, true
in stacked columns.
'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 String getLinkFormat()
Default: null
public void setLinkFormat(String linkFormat)
public DataLabelsTextPath getLinkTextPath()
public void setLinkTextPath(DataLabelsTextPath linkTextPath)
public String getOverflow()
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"
.
public void setOverflow(String overflow)
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
setCrop(boolean)
to false
and
setOverflow(String)
to "none"
.
public Number getPadding()
getBorderWidth()
or the
getBackgroundColor()
is set, this is the padding within the box.
Default: 2
public void setPadding(int padding)
getBorderWidth()
or the
getBackgroundColor()
is set, this is the padding within the box.public Object getRotation()
Default: 0
public void setRotation(Number rotation)
public void setRotation(String rotation)
public String getRotationMode()
Default: null
public void setRotationMode(String rotationMode)
public boolean isShadow()
Default: false.
Shadow
public Shadow getShadow()
Default: Shadow.NONE
.
Shadow
public void setShadow(boolean shadow)
public void setShadow(Shadow shadow)
Shadow
public String getShape()
Defaults to square.
public void setShape(String shape)
Defaults to square.
public boolean isSoftConnector()
public void setSoftConnector(boolean softConnector)
public <K,V> Map<K,V> getStyle()
color: 'contrast'; fontSize: '11px'; fontWeight: 'bold'; textShadow: '0 0 6px contrast, 0 0 3px contrast'
K
- type for the key
if style was set using setStyle(String)
, type will be String
if style was set using setStyle(Map)
, type will be the same as the type from the key of the map
if style was not set, default style will be applied, and type will be String
V
- type for the value
if style was set using setStyle(String)
, type will be String
if style was set using setStyle(Map)
, type will be the same as the type from the key of the map
if style was not set, default style will be applied, and type will be String
public void setStyle(String style)
label.setStyle("fontWeight: 'bold'; color: 'white'; textShadow: '0px 1px 2px black'");
In the format of CSS key:value, and ";" separating multiple key:value pairs,
if you have more a complex CSS styling, we recommend using setStyle(Map)
style
- one or many CSS key:value pairs in a single line string formatpublic <K,V> void setStyle(Map<K,V> style)
Map<String, Object> styles = new HashMap<String, Object>();
styles.put("fill", "#E8E8EA");
styles.put("stroke", "#6E6E78");
styles.put("stroke-width", "1");
styles.put("r", "0");
Map<String, Object> states = new HashMap<String, Object>();
Map<String, String> hover = new HashMap<String, String>();
hover.put("fill", "#F4F4F6");
hover.put("stroke", "#6E6E78");
hover.put("stroke-width", "1");
hover.put("r", "0");
states.put("hover", hover);
styles.put("states", states);
Map<String, String> style = new HashMap<String, String>();
style.put("color", "#4D5663");
style.put("fontSize", "12px");
style.put("fontFamily", "'Arial'");
style.put("fontWeight", "normal");
style.put("padding", "10px");
styles.put("style", style);
which will generate the final results like:
{
"fill": "#E8E8EA",
"stroke": "#6E6E78",
"stroke-width": "1",
"r": "0",
"states":
{
"hover":
{
"fill": "#F4F4F6",
"stroke": "#6E6E78",
"stroke-width": "1",
"r": "0"
}
},
"style":
{
"color": "#4D5663",
"fontSize": "12px",
"fontFamily": "'Arial'",
"fontWeight": "normal",
"padding": "10px"
}
}
K
- Type for the key, usually StringV
- Type for the value, usually String. For nested maps, use Object or any other type.style
- the style objectpublic DataLabelsTextPath getTextPath()
useHTML
to true will disable this option.public void setTextPath(DataLabelsTextPath textPath)
useHTML
to true will disable this option.public boolean isUseHTML()
Defaults to false.
public void setUseHTML(boolean useHTML)
Defaults to false.
public String getVerticalAlign()
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(String verticalAlign)
top
, middle
, center
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 Number getX()
Default: 0
public void setX(Number x)
Default: 0
public Number getY()
Default: -6
public void setY(Number y)
Default: -6
public Number getZIndex()
The default Z index puts it above the series. Use a Z index of 2 to display it behind the series.
Default: 6
public void setZIndex(Number zIndex)
The default Z index puts it above the series. Use a Z index of 2 to display it behind the series.
Default: 6
Copyright © 2005-2020 Potix Corporation. All Rights Reserved.