Class CrosshairOptions
- 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.impl.plugins.CrosshairOptions
-
- All Implemented Interfaces:
IsDefaultEventHandler,HasEvents
public final class CrosshairOptions extends AbstractPluginOptions
Configuration options ofCrosshair.IDplugin.
It manages the drawing the horizontal and vertical crosshair on the chart.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ENABLEDDefault enabled options, true.static IsColorDEFAULT_LINE_COLORDefault line color,HtmlColor.LIGHT_GRAY.static StringDEFAULT_LINE_COLOR_AS_STRINGDefault line color as string,HtmlColor.LIGHT_GRAY.static List<Integer>DEFAULT_LINE_DASHDefault line dash, [2, 2].static doubleDEFAULT_LINE_DASH_OFFSETDefault line dash offset, 0.0.static intDEFAULT_LINE_WIDTHDefault line width, 1.static InteractionAxisDEFAULT_MODEDefault interaction axis mode,InteractionAxis.XY.
-
Constructor Summary
Constructors Constructor Description CrosshairOptions()Builds the object with new java script object setting the default value of plugin.
The global plugin options is used, if exists, as defaults values.CrosshairOptions(IsChart chart)Builds the object with a chart instance in order to get the right defaults.
If the plugin options have not been set by chart type, it will use the global.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetGroup()Returns the group name used to synchronized more chart instances.CrosshairLabelsgetLabels()Returns the labels utility to set the same value to all labels.IsColorgetLineColor()Returns the color of the line.StringgetLineColorAsString()Returns the color of the line.List<Integer>getLineDash()Returns the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.doublegetLineDashOffset()Returns the line dash pattern offset.intgetLineWidth()Sets the width of the line.InteractionAxisgetMode()Returns the interaction axis mode.ModifierKeygetModifierKey()Returns the modifier key to activate the crosshair.CrosshairLabelgetXLabel()ScaleIdgetXScaleID()Returns the ID of the X scale to bind onto.CrosshairLabelgetYLabel()ScaleIdgetYScaleID()Returns the ID of the Y scale to bind onto.booleanisEnabled()Returnstrueif plugin is enabled.voidsetEnabled(boolean enabled)Setstrueif plugin is enabled.voidsetEvents(Set<IsEvent> events)Sets the browser events that the legend should listen to.voidsetEvents(IsEvent... events)Sets the browser events that the chart should listen to.voidsetGroup(String group)Sets the group name used to synchronized more chart instances.voidsetLineColor(String color)Sets the color of the line.voidsetLineColor(IsColor color)Sets the color of the line.voidsetLineDash(int... lineDash)Sets the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.voidsetLineDashOffset(double lineDashOffset)Sets the line dash pattern offset.voidsetLineWidth(int lineWidth)Sets the width of the line.voidsetMode(InteractionAxis mode)Sets the interaction axis mode.voidsetModifierKey(ModifierKey modifierKey)Sets the modifier key to activate the crosshair.voidsetXScaleID(String scaleId)Sets the ID of the X scale to bind onto.voidsetXScaleID(ScaleId scaleId)Sets the ID of the X scale to bind onto.voidsetYScaleID(String scaleId)Sets the ID of the Y scale to bind onto.voidsetYScaleID(ScaleId scaleId)Sets the ID of the Y scale to bind onto.-
Methods inherited from class org.pepstock.charba.client.plugins.AbstractPluginOptions
applyingDefaults, applyingDefaults, getEventsOptionHandler, getId, getPluginId, loadGlobalsPluginOptions, store, store, store, store
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, setValueAndAddToParent, 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
checkAndGetColor, 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, 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, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Field Detail
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
Default enabled options, true.- See Also:
- Constant Field Values
-
DEFAULT_MODE
public static final InteractionAxis DEFAULT_MODE
Default interaction axis mode,InteractionAxis.XY.
-
DEFAULT_LINE_COLOR
public static final IsColor DEFAULT_LINE_COLOR
Default line color,HtmlColor.LIGHT_GRAY.
-
DEFAULT_LINE_COLOR_AS_STRING
public static final String DEFAULT_LINE_COLOR_AS_STRING
Default line color as string,HtmlColor.LIGHT_GRAY.
-
DEFAULT_LINE_WIDTH
public static final int DEFAULT_LINE_WIDTH
Default line width, 1.- See Also:
- Constant Field Values
-
DEFAULT_LINE_DASH_OFFSET
public static final double DEFAULT_LINE_DASH_OFFSET
Default line dash offset, 0.0.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CrosshairOptions
public CrosshairOptions()
Builds the object with new java script object setting the default value of plugin.
The global plugin options is used, if exists, as defaults values.
-
CrosshairOptions
public CrosshairOptions(IsChart chart)
Builds the object with a chart instance in order to get the right defaults.
If the plugin options have not been set by chart type, it will use the global.- Parameters:
chart- chart instance related to the plugin options
-
-
Method Detail
-
setEvents
public void setEvents(IsEvent... events)
Description copied from interface:HasEventsSets the browser events that the chart should listen to.
-
setEvents
public void setEvents(Set<IsEvent> events)
Description copied from interface:HasEventsSets the browser events that the legend should listen to.
-
getLabels
public CrosshairLabels getLabels()
Returns the labels utility to set the same value to all labels.- Returns:
- the labels utility to set the same value to all labels
-
getXLabel
public CrosshairLabel getXLabel()
-
getYLabel
public CrosshairLabel getYLabel()
-
setEnabled
public void setEnabled(boolean enabled)
Setstrueif plugin is enabled.- Parameters:
enabled-trueif plugin is enabled.
-
isEnabled
public boolean isEnabled()
Returnstrueif plugin is enabled.- Returns:
trueif plugin is enabled.
-
setMode
public void setMode(InteractionAxis mode)
Sets the interaction axis mode.- Parameters:
mode- the interaction axis mode
-
getMode
public InteractionAxis getMode()
Returns the interaction axis mode.- Returns:
- the interaction axis mode
-
setGroup
public void setGroup(String group)
Sets the group name used to synchronized more chart instances.- Parameters:
group- the group name used to synchronized more chart instances
-
getGroup
public String getGroup()
Returns the group name used to synchronized more chart instances.- Returns:
- the group name used to synchronized more chart instances
-
setLineColor
public void setLineColor(IsColor color)
Sets the color of the line.- Parameters:
color- the color of the line.
-
setLineColor
public void setLineColor(String color)
Sets the color of the line.- Parameters:
color- the color of the line.
-
getLineColorAsString
public String getLineColorAsString()
Returns the color of the line.- Returns:
- the color of the line.
-
getLineColor
public IsColor getLineColor()
Returns the color of the line.- Returns:
- the color of the line.
-
setLineWidth
public void setLineWidth(int lineWidth)
Sets the width of the line.- Parameters:
lineWidth- the width of the line
-
getLineWidth
public int getLineWidth()
Sets the width of the line.- Returns:
- the width of the line
-
setLineDash
public void setLineDash(int... lineDash)
Sets the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.- Parameters:
lineDash- the line dash pattern used when stroking lines
-
getLineDash
public List<Integer> getLineDash()
Returns the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.- Returns:
- the line dash pattern used when stroking lines
-
setLineDashOffset
public void setLineDashOffset(double lineDashOffset)
Sets the line dash pattern offset.- Parameters:
lineDashOffset- Offset for line dashes.
-
getLineDashOffset
public double getLineDashOffset()
Returns the line dash pattern offset.- Returns:
- Offset for line dashes.
-
setXScaleID
public final void setXScaleID(String scaleId)
Sets the ID of the X scale to bind onto.- Parameters:
scaleId- the ID of the X scale to bind onto
-
setXScaleID
public final void setXScaleID(ScaleId scaleId)
Sets the ID of the X scale to bind onto.- Parameters:
scaleId- the ID of the X scale to bind onto
-
getXScaleID
public final ScaleId getXScaleID()
Returns the ID of the X scale to bind onto.- Returns:
- the ID of the X scale to bind onto
-
setYScaleID
public final void setYScaleID(String scaleId)
Sets the ID of the Y scale to bind onto.- Parameters:
scaleId- the ID of the Y scale to bind onto
-
setYScaleID
public final void setYScaleID(ScaleId scaleId)
Sets the ID of the Y scale to bind onto.- Parameters:
scaleId- the ID of the Y scale to bind onto
-
getYScaleID
public final ScaleId getYScaleID()
Returns the ID of the Y scale to bind onto.- Returns:
- the ID of the Y scale to bind onto
-
setModifierKey
public void setModifierKey(ModifierKey modifierKey)
Sets the modifier key to activate the crosshair.- Parameters:
modifierKey- the modifier key to activate the crosshair
-
getModifierKey
public ModifierKey getModifierKey()
Returns the modifier key to activate the crosshair.- Returns:
- the modifier key to activate the crosshair
-
-