Class Subtitle
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Subtitle
-
- All Implemented Interfaces:
Serializable
,OptionDataListener
,org.zkoss.json.JSONAware
public class Subtitle extends Optionable
The chart's subtitleAll the options in this class support
DynamicalAttribute
.- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Subtitle.Attrs
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Subtitle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlign()
Returns the horizontal alignment of the subtitle.<K,V>
Map<K,V>getStyle()
Returns CSS styles for the title.String
getText()
Returns the subtitle of the chart.String
getVerticalAlign()
Returns the vertical alignment of the title.Number
getX()
Returns the x position of the subtitle relative to the alignment withinChart.setSpacingLeft(Number)
andChart.setSpacingRight(Number)
.Number
getY()
Returns the y position of the subtitle relative to the alignment withinChart.setSpacingTop(Number)
andChart.setSpacingBottom(Number)
.boolean
isFloating()
Returns when the subtitle is floating, the plot area will not move to make space for it.boolean
isUseHTML()
Returns whether to use HTML to render the text.void
setAlign(String align)
Sets the horizontal alignment of the subtitle.void
setFloating(boolean floating)
Sets when the subtitle is floating, the plot area will not move to make space for it.void
setStyle(String style)
Sets CSS styles for the title.<K,V>
voidsetStyle(Map<K,V> style)
Sets CSS styles for the title.void
setText(String text)
Sets the subtitle of the chart.void
setUseHTML(boolean useHTML)
Sets whether to use HTML to render the text.void
setVerticalAlign(String verticalAlign)
Sets the vertical alignment of the title.void
setX(Number x)
Sets the x position of the subtitle relative to the alignment withinChart.setSpacingLeft(Number)
andChart.setSpacingRight(Number)
.void
setY(Number y)
Sets the y position of the subtitle relative to the alignment withinChart.setSpacingTop(Number)
andChart.setSpacingBottom(Number)
.-
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 horizontal alignment of the subtitle. Can be one of "left", "center" and "right".Default: "center".
- Returns:
- align the horizontal alignment of the subtitle
-
setAlign
public void setAlign(String align)
Sets the horizontal alignment of the subtitle. Can be one of "left", "center" and "right".- Parameters:
align
- the horizontal alignment of the subtitle
-
isFloating
public boolean isFloating()
Returns when the subtitle is floating, the plot area will not move to make space for it.Default: false.
-
setFloating
public void setFloating(boolean floating)
Sets when the subtitle is floating, the plot area will not move to make space for it.
-
getStyle
public <K,V> Map<K,V> getStyle()
Returns CSS styles for the title. Exact positioning of the title can be achieved by changing the margin property, or by addingposition: "absolute"
and left and top properties.Defaults to:
color: #3E576F;
- 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 title. Exact positioning of the title can be achieved by changing the margin property, or by addingposition: "absolute"
and left and top properties.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 title. Exact positioning of the title can be achieved by changing the margin property, or by addingposition: "absolute"
and left and top properties.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
-
getText
public String getText()
Returns the subtitle of the chart.Default: null.
-
setText
public void setText(String text)
Sets the subtitle of the chart.- Parameters:
text
- the subtitle of the chart
-
isUseHTML
public boolean isUseHTML()
Returns whether to use HTML to render the text.Default: false.
-
setUseHTML
public void setUseHTML(boolean useHTML)
Sets whether to use HTML to render the text.
-
getVerticalAlign
public String getVerticalAlign()
Returns the vertical alignment of the title. Can be one of "top", "middle" and "bottom". When a value is given, the title behaves as floating.Default: top.
-
setVerticalAlign
public void setVerticalAlign(String verticalAlign)
Sets the vertical alignment of the title. Can be one of "top", "middle" and "bottom". When a value is given, the title behaves as floating.
-
getX
public Number getX()
Returns the x position of the subtitle relative to the alignment withinChart.setSpacingLeft(Number)
andChart.setSpacingRight(Number)
.Default: 0.
-
setX
public void setX(Number x)
Sets the x position of the subtitle relative to the alignment withinChart.setSpacingLeft(Number)
andChart.setSpacingRight(Number)
.
-
getY
public Number getY()
Returns the y position of the subtitle relative to the alignment withinChart.setSpacingTop(Number)
andChart.setSpacingBottom(Number)
. By default the subtitle is laid out below the title unless the title is floating.Default: null.
-
setY
public void setY(Number y)
Sets the y position of the subtitle relative to the alignment withinChart.setSpacingTop(Number)
andChart.setSpacingBottom(Number)
. By default the subtitle is laid out below the title unless the title is floating.
-
-