Class BubbleLegend.Labels
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.BubbleLegend.Labels
-
- All Implemented Interfaces:
Serializable
,OptionDataListener
,org.zkoss.json.JSONAware
- Enclosing class:
- BubbleLegend
public static class BubbleLegend.Labels extends Optionable
Options for the bubble legend labels.- Since:
- 7.2.1.0
- Author:
- rudyhuang
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Labels()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlign()
Returns the alignment of the labels compared to the bubble legend.String
getClassName()
Returns an additional class name to apply to the bubble legend label graphical elements.String
getFormat()
Returns a format string for the bubble legend labels.org.zkoss.json.JavaScriptValue
getFormatter()
Returns the callback JavaScript function to format the bubble legend labels.<K,V>
Map<K,V>getStyle()
Returns CSS styles for the labels.Number
getX()
Returns the x position offset of the label relative to the connector.Number
getY()
Returns the y position offset of the label relative to the connector.boolean
isAllowOverlap()
Returns whether to allow data labels to overlap.void
setAlign(String align)
Sets the alignment of the labels compared to the bubble legend.void
setAllowOverlap(Boolean allowOverlap)
Sets whether to allow data labels to overlap.void
setClassName(String className)
Sets an additional class name to apply to the bubble legend label graphical elements.void
setFormat(String format)
Sets a format string for the bubble legend labels.void
setFormatter(org.zkoss.json.JavaScriptValue formatter)
Sets the callback JavaScript function to format the bubble legend labels.void
setStyle(String style)
Sets CSS styles for the labels.<K,V>
voidsetStyle(Map<K,V> style)
Sets CSS styles for the labels.void
setX(Number x)
Sets the x position offset of the label relative to the connector.void
setY(Number y)
Sets the y position offset of the label relative to the connector.-
Methods inherited from class org.zkoss.chart.Optionable
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, onChange, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, setAttr, toJSONString, toString
-
-
-
-
Method Detail
-
getAlign
public String getAlign()
Returns the alignment of the labels compared to the bubble legend. Can be one of left, center or right.Default: "right"
-
setAlign
public void setAlign(String align)
Sets the alignment of the labels compared to the bubble legend. Can be one of left, center or right.
-
isAllowOverlap
public boolean isAllowOverlap()
Returns whether to allow data labels to overlap.Default: false.
-
setAllowOverlap
public void setAllowOverlap(Boolean allowOverlap)
Sets whether to allow data labels to overlap.
-
getClassName
public String getClassName()
Returns an additional class name to apply to the bubble legend label graphical elements. This option does not replace default class names of the graphical element.Default: ""
-
setClassName
public void setClassName(String className)
Sets an additional class name to apply to the bubble legend label graphical elements. This option does not replace default class names of the graphical element.
-
getFormat
public String getFormat()
Returns a format string for the bubble legend labels. Available variables are the same as for formatter.Default: ""
-
setFormat
public void setFormat(String format)
Sets a format string for the bubble legend labels. Available variables are the same as for formatter.
-
getFormatter
public org.zkoss.json.JavaScriptValue getFormatter()
Returns the callback JavaScript function to format the bubble legend labels. Availablethis
properties are:this.value
: The bubble value.this.radius
: The radius of the bubble range.this.center
: The center y position of the range.
Default: null
-
setFormatter
public void setFormatter(org.zkoss.json.JavaScriptValue formatter)
Sets the callback JavaScript function to format the bubble legend labels. Availablethis
properties are:this.value
: The bubble value.this.radius
: The radius of the bubble range.this.center
: The center y position of the range.
-
getStyle
public <K,V> Map<K,V> getStyle()
Returns CSS styles for the labels.Default: empty
- Type Parameters:
K
- type for the keyif style was set using
setStyle(String)
, type will be Stringif style was set using
setStyle(Map)
, type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
V
- type for the valueif style was set using
setStyle(String)
, type will be Stringif style was set using
setStyle(Map)
, type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
-
setStyle
public void setStyle(String style)
Sets CSS styles for the labels.This method allows simple settings like
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)
- Parameters:
style
- one or many CSS key:value pairs in a single line string format
-
setStyle
public <K,V> void setStyle(Map<K,V> style)
Sets CSS styles for the labels.This method allows complex styling like:
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);
{ "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" } }
- Type Parameters:
K
- Type for the key, usually StringV
- Type for the value, usually String. For nested maps, use Object or any other type.- Parameters:
style
- the style object
-
getX
public Number getX()
Returns the x position offset of the label relative to the connector.Default: 0
-
setX
public void setX(Number x)
Sets the x position offset of the label relative to the connector.
-
getY
public Number getY()
Returns the y position offset of the label relative to the connector.Default: 0
-
setY
public void setY(Number y)
Sets the y position offset of the label relative to the connector.
-
-