Class AnnotationOptions
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.plugins.AbstractPluginOptions
-
- org.pepstock.charba.client.annotation.AnnotationOptions
-
public final class AnnotationOptions extends AbstractPluginOptions
This is theAnnotationPlugin.ID
plugin options where to set all configuration items needed to the plugin.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_DOUBLE_CLICK_SPEED
Default double click speed in milliseconds, 350.static DrawTime
DEFAULT_DRAW_TIME
Default draw time,DrawTime.AFTER_DATASETS_DRAW
.
-
Constructor Summary
Constructors Constructor Description AnnotationOptions()
Creates newAnnotationPlugin.ID
plugin options.AnnotationOptions(IsChart chart)
Creates newAnnotationPlugin.ID
plugin options, relating to chart instance for default.
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description void
addAnnotations(AbstractAnnotation... annotations)
Adds an annotations for plugin.protected void
applyingDefaults()
This is invoked before storing the plugins options as default.AbstractAnnotation
getAnnotation(String id)
Returns the annotation with the id passed as argument ornull
if not exist.AbstractAnnotation
getAnnotation(AnnotationId id)
Returns the annotation with the id passed as argument ornull
if not exist.List<AbstractAnnotation>
getAnnotations()
Returns the collection of annotations.default ClickCallback
getClickCallback()
Returns the callback called when a "click" event is occurring.default DoubleClickCallback
getDoubleClickCallback()
Returns the callback called when a "dblclick" event is occurring.int
getDoubleClickSpeed()
Returns the double-click speed in milliseconds used to distinguish single-clicks from double-clicks whenever you need to capture both.DrawTime
getDrawTime()
Returns the draw time which defines when the annotations are drawn.default EnterCallback
getEnterCallback()
Returns the callback called when a "enter" event is occurring.org.pepstock.charba.client.annotation.EventsHandler
getEventsHandler()
default LeaveCallback
getLeaveCallback()
Returns the callback called when a "leave" event is occurring.boolean
hasAnnotation(String id)
Returnstrue
if the annotation with the id passed as argument exists.boolean
hasAnnotation(AnnotationId id)
Returnstrue
if the annotation with the id passed as argument exists.boolean
isClip()
Returns if clips relative to the chart area.void
removeAnnotation(String id)
Removes the annotation by the id passed as argument, if exists.void
removeAnnotation(AnnotationId id)
Removes the annotation by the id passed as argument, if exists.void
setAnnotations(AbstractAnnotation... annotations)
Sets a set of annotations for plugin.default void
setClickCallback(ClickCallback clickCallback)
Sets the callback called when a "click" event is occurring.void
setClip(boolean clip)
Sets how to clip relative to the chart area.
Iffalse
allows overflow, otherwisetrue
clips that many pixels inside the chart area.default void
setDoubleClickCallback(DoubleClickCallback dblclickCallback)
Sets the callback called when a "dblclick" event is occurring.void
setDoubleClickSpeed(int speed)
Sets the double-click speed in milliseconds used to distinguish single-clicks from double-clicks whenever you need to capture both.void
setDrawTime(DrawTime drawTime)
Sets the draw time which defines when the annotations are drawn.default void
setEnterCallback(EnterCallback enterCallback)
Sets the callback called when a "enter" event is occurring.default void
setLeaveCallback(LeaveCallback leaveCallback)
Sets the callback called when a "leave" event is occurring.-
Methods inherited from class org.pepstock.charba.client.plugins.AbstractPluginOptions
applyingDefaults, getEvents, getId, getPluginId, loadGlobalsPluginOptions, setEvents, setEvents, store, store, store, store
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Field Detail
-
DEFAULT_DOUBLE_CLICK_SPEED
public static final int DEFAULT_DOUBLE_CLICK_SPEED
Default double click speed in milliseconds, 350.- See Also:
- Constant Field Values
-
DEFAULT_DRAW_TIME
public static final DrawTime DEFAULT_DRAW_TIME
Default draw time,DrawTime.AFTER_DATASETS_DRAW
.
-
-
Constructor Detail
-
AnnotationOptions
public AnnotationOptions()
Creates newAnnotationPlugin.ID
plugin options.
-
AnnotationOptions
public AnnotationOptions(IsChart chart)
Creates newAnnotationPlugin.ID
plugin options, relating to chart instance for default.- Parameters:
chart
- chart instance related to the plugin options
-
-
Method Detail
-
applyingDefaults
protected void applyingDefaults()
Description copied from class:AbstractPluginOptions
This is invoked before storing the plugins options as default.- Overrides:
applyingDefaults
in classAbstractPluginOptions
-
getEventsHandler
public final org.pepstock.charba.client.annotation.EventsHandler getEventsHandler()
-
setClip
public void setClip(boolean clip)
Sets how to clip relative to the chart area.
Iffalse
allows overflow, otherwisetrue
clips that many pixels inside the chart area.- Parameters:
clip
- Iffalse
allows overflow, otherwisetrue
clips that many pixels inside the chart area.
-
isClip
public boolean isClip()
Returns if clips relative to the chart area.- Returns:
true
if clips relative to the chart area.
-
setDrawTime
public void setDrawTime(DrawTime drawTime)
Sets the draw time which defines when the annotations are drawn.- Parameters:
drawTime
- the draw time which defines when the annotations are drawn
-
getDrawTime
public DrawTime getDrawTime()
Returns the draw time which defines when the annotations are drawn.- Returns:
- the draw time which defines when the annotations are drawn
-
setDoubleClickSpeed
public void setDoubleClickSpeed(int speed)
Sets the double-click speed in milliseconds used to distinguish single-clicks from double-clicks whenever you need to capture both.- Parameters:
speed
- the double-click speed in milliseconds
-
getDoubleClickSpeed
public int getDoubleClickSpeed()
Returns the double-click speed in milliseconds used to distinguish single-clicks from double-clicks whenever you need to capture both.- Returns:
- the double-click speed in milliseconds
-
hasAnnotation
public boolean hasAnnotation(String id)
Returnstrue
if the annotation with the id passed as argument exists.- Parameters:
id
- annotation id to check- Returns:
true
if the annotation with the id passed as argument exists
-
hasAnnotation
public boolean hasAnnotation(AnnotationId id)
Returnstrue
if the annotation with the id passed as argument exists.- Parameters:
id
- annotation id to check- Returns:
true
if the annotation with the id passed as argument exists
-
removeAnnotation
public void removeAnnotation(String id)
Removes the annotation by the id passed as argument, if exists.- Parameters:
id
- annotation id to check
-
removeAnnotation
public void removeAnnotation(AnnotationId id)
Removes the annotation by the id passed as argument, if exists.- Parameters:
id
- annotation id to check
-
addAnnotations
public void addAnnotations(AbstractAnnotation... annotations)
Adds an annotations for plugin.- Parameters:
annotations
- set of annotations.
-
setAnnotations
public void setAnnotations(AbstractAnnotation... annotations)
Sets a set of annotations for plugin. If argument isnull
, removes all annotations.- Parameters:
annotations
- set of annotations. Ifnull
, removes all annotations
-
getAnnotations
public List<AbstractAnnotation> getAnnotations()
Returns the collection of annotations.- Returns:
- the collection of annotations
-
getAnnotation
public AbstractAnnotation getAnnotation(String id)
Returns the annotation with the id passed as argument ornull
if not exist.- Parameters:
id
- annotation id to use to retrieve the annotation- Returns:
- the annotation or
null
if not exist
-
getAnnotation
public AbstractAnnotation getAnnotation(AnnotationId id)
Returns the annotation with the id passed as argument ornull
if not exist.- Parameters:
id
- annotation id to check- Returns:
- the annotation with the id passed as argument or
null
if not exist
-
getEnterCallback
public default EnterCallback getEnterCallback()
Returns the callback called when a "enter" event is occurring.- Returns:
- the callback called when a "enter" event is occurring
-
setEnterCallback
public default void setEnterCallback(EnterCallback enterCallback)
Sets the callback called when a "enter" event is occurring.- Parameters:
enterCallback
- the callback called when a "enter" event is occurring
-
getLeaveCallback
public default LeaveCallback getLeaveCallback()
Returns the callback called when a "leave" event is occurring.- Returns:
- the callback called when a "leave" event is occurring
-
setLeaveCallback
public default void setLeaveCallback(LeaveCallback leaveCallback)
Sets the callback called when a "leave" event is occurring.- Parameters:
leaveCallback
- the callback called when a "leave" event is occurring
-
getClickCallback
public default ClickCallback getClickCallback()
Returns the callback called when a "click" event is occurring.- Returns:
- the callback called when a "click" event is occurring
-
setClickCallback
public default void setClickCallback(ClickCallback clickCallback)
Sets the callback called when a "click" event is occurring.- Parameters:
clickCallback
- the callback called when a "click" event is occurring
-
getDoubleClickCallback
public default DoubleClickCallback getDoubleClickCallback()
Returns the callback called when a "dblclick" event is occurring.- Returns:
- the callback called when a "dblclick" event is occurring
-
setDoubleClickCallback
public default void setDoubleClickCallback(DoubleClickCallback dblclickCallback)
Sets the callback called when a "dblclick" event is occurring.- Parameters:
dblclickCallback
- the callback called when a "dblclick" event is occurring
-
-