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.ID
plugin.
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 boolean
DEFAULT_ENABLED
Default enabled options, true.static IsColor
DEFAULT_LINE_COLOR
Default line color,HtmlColor.LIGHT_GRAY
.static String
DEFAULT_LINE_COLOR_AS_STRING
Default line color as string,HtmlColor.LIGHT_GRAY
.static List<Integer>
DEFAULT_LINE_DASH
Default line dash, [2, 2].static double
DEFAULT_LINE_DASH_OFFSET
Default line dash offset, 0.0.static int
DEFAULT_LINE_WIDTH
Default line width, 1.static InteractionAxis
DEFAULT_MODE
Default 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 CrosshairLabels
getLabels()
Returns the labels utility to set the same value to all labels.IsColor
getLineColor()
Returns the color of the line.String
getLineColorAsString()
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.double
getLineDashOffset()
Returns the line dash pattern offset.int
getLineWidth()
Sets the width of the line.InteractionAxis
getMode()
Returns the interaction axis mode.ModifierKey
getModifierKey()
Returns the modifier key to activate the crosshair.CrosshairLabel
getXLabel()
ScaleId
getXScaleID()
Returns the ID of the X scale to bind onto.CrosshairLabel
getYLabel()
ScaleId
getYScaleID()
Returns the ID of the Y scale to bind onto.boolean
isEnabled()
Returnstrue
if plugin is enabled.void
setEnabled(boolean enabled)
Setstrue
if plugin is enabled.void
setEvents(Set<IsEvent> events)
Sets the browser events that the legend should listen to.void
setEvents(IsEvent... events)
Sets the browser events that the chart should listen to.void
setLineColor(String color)
Sets the color of the line.void
setLineColor(IsColor color)
Sets the color of the line.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.void
setLineDashOffset(double lineDashOffset)
Sets the line dash pattern offset.void
setLineWidth(int lineWidth)
Sets the width of the line.void
setMode(InteractionAxis mode)
Sets the interaction axis mode.void
setModifierKey(ModifierKey modifierKey)
Sets the modifier key to activate the crosshair.void
setXScaleID(String scaleId)
Sets the ID of the X scale to bind onto.void
setXScaleID(ScaleId scaleId)
Sets the ID of the X scale to bind onto.void
setYScaleID(String scaleId)
Sets the ID of the Y scale to bind onto.void
setYScaleID(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, 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, 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:HasEvents
Sets the browser events that the chart should listen to.
-
setEvents
public void setEvents(Set<IsEvent> events)
Description copied from interface:HasEvents
Sets 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)
Setstrue
if plugin is enabled.- Parameters:
enabled
-true
if plugin is enabled.
-
isEnabled
public boolean isEnabled()
Returnstrue
if plugin is enabled.- Returns:
true
if 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
-
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
-
-