Package org.zkoss.chart
Class Annotation
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Annotation
-
- All Implemented Interfaces:
Serializable
,OptionDataListener
,org.zkoss.json.JSONAware
public class Annotation extends Optionable
A basic type of an annotation. It allows to add custom labels or shapes. The items can be tied to points, axis coordinates or chart pixel coordinates.- Since:
- 7.2.1.0
- Author:
- rudyhuang
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Annotation.Point
This object defines the point to which the label or shape will be connected.
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Annotation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDraggable()
Allow an annotation to be draggable by a user.Object
getId()
Returns an ID for an annotation.AnnotationLabelOptions
getLabelOptions()
Returns options for annotation's labels.List<AnnotationLabel>
getLabels()
Returns the list of labels for the annotation.AnnotationShapeOptions
getShapeOptions()
Returns options for annotation's shapes.List<AnnotationShape>
getShapes()
Returns the list of shapes for the annotation.Number
getZIndex()
Returns the Z index of the annotation.boolean
isCrop()
Returns whether to hide the part of the annotation that is outside the plot area.boolean
isVisible()
Returns whether the annotation is visible.void
setCrop(boolean crop)
Sets whether to hide the part of the annotation that is outside the plot area.void
setDraggable(String draggable)
Allow an annotation to be draggable by a user.void
setId(Number id)
Sets an ID for an annotation.void
setId(String id)
Sets an ID for an annotation.void
setLabelOptions(AnnotationLabelOptions labelOptions)
Sets options for annotation's labels.void
setLabels(List<AnnotationLabel> labels)
Sets a list of labels for the annotation.void
setLabels(AnnotationLabel... labels)
Sets an array of labels for the annotation.void
setShapeOptions(AnnotationShapeOptions shapeOptions)
Sets options for annotation's shapes.void
setShapes(List<AnnotationShape> shapes)
Sets a list of shapes for the annotation.void
setShapes(AnnotationShape... shapes)
Sets an array of shapes for the annotation.void
setVisible(boolean visible)
Sets whether the annotation is visible.void
setZIndex(Number zIndex)
Sets the Z index of the annotation.-
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
-
isCrop
public boolean isCrop()
Returns whether to hide the part of the annotation that is outside the plot area.Default:
true
- Since:
- 10.2.1.0
-
setCrop
public void setCrop(boolean crop)
Sets whether to hide the part of the annotation that is outside the plot area.Default:
true
- Since:
- 10.2.1.0
-
getDraggable
public String getDraggable()
Allow an annotation to be draggable by a user. Possible values are "x", "xy", "y" and "" (disabled).Default: xy
-
setDraggable
public void setDraggable(String draggable)
Allow an annotation to be draggable by a user. Possible values are "x", "xy", "y" and "" (disabled).
-
getId
public Object getId()
Returns an ID for an annotation. Can be user later when removing an annotation in removeAnnotation(id) method.Default: null
-
setId
public void setId(String id)
Sets an ID for an annotation.
-
setId
public void setId(Number id)
Sets an ID for an annotation.
-
getLabelOptions
public AnnotationLabelOptions getLabelOptions()
Returns options for annotation's labels. Each label inherits options from the labelOptions object. An option from the labelOptions can be overwritten by config for a specific label.
-
setLabelOptions
public void setLabelOptions(AnnotationLabelOptions labelOptions)
Sets options for annotation's labels. Each label inherits options from the labelOptions object. An option from the labelOptions can be overwritten by config for a specific label.
-
getLabels
public List<AnnotationLabel> getLabels()
Returns the list of labels for the annotation.
-
setLabels
public void setLabels(List<AnnotationLabel> labels)
Sets a list of labels for the annotation. For options that apply to multiple labels, they can be added to thesetLabelOptions(org.zkoss.chart.AnnotationLabelOptions)
.
-
setLabels
public void setLabels(AnnotationLabel... labels)
Sets an array of labels for the annotation.
-
getShapeOptions
public AnnotationShapeOptions getShapeOptions()
Returns options for annotation's shapes. Each shape inherits options from the shapeOptions object. An option from the shapeOptions can be overwritten by config for a specific shape.
-
setShapeOptions
public void setShapeOptions(AnnotationShapeOptions shapeOptions)
Sets options for annotation's shapes. Each shape inherits options from the shapeOptions object. An option from the shapeOptions can be overwritten by config for a specific shape.
-
getShapes
public List<AnnotationShape> getShapes()
Returns the list of shapes for the annotation.
-
setShapes
public void setShapes(List<AnnotationShape> shapes)
Sets a list of shapes for the annotation. For options that apply to multiple shapes, they can be added to thesetShapeOptions(org.zkoss.chart.AnnotationShapeOptions)
.
-
setShapes
public void setShapes(AnnotationShape... shapes)
Sets an array of shapes for the annotation.
-
isVisible
public boolean isVisible()
Returns whether the annotation is visible.Default: true
-
setVisible
public void setVisible(boolean visible)
Sets whether the annotation is visible.
-
getZIndex
public Number getZIndex()
Returns the Z index of the annotation.Default: 6
-
setZIndex
public void setZIndex(Number zIndex)
Sets the Z index of the annotation.
-
-