Package org.pepstock.charba.client.enums
Enum DefaultInteractionMode
- java.lang.Object
-
- java.lang.Enum<DefaultInteractionMode>
-
- org.pepstock.charba.client.enums.DefaultInteractionMode
-
- All Implemented Interfaces:
Serializable
,Comparable<DefaultInteractionMode>
,Key
,IsInteractionMode
,Interactioner
public enum DefaultInteractionMode extends Enum<DefaultInteractionMode> implements IsInteractionMode, Interactioner
When configuring interaction with the graph via hover or tooltips, a number of different modes are available to set which elements appear via tooltip or hover.- Author:
- Andrea "Stock" Stocchero
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DATASET
Finds all items in the same dataset.INDEX
Finds all items at the same index.NEAREST
Gets the item that is nearest to the point.
The nearest item is determined based on the distance to the center of the chart item (point, bar).
If 2 or more items are at the same distance, the one with the smallest area is used.POINT
Finds all of the items that intersect the point.X
Returns all items that would intersect based on the X coordinate of the position only.
Note that this only applies to cartesian chartsY
Returns all items that would intersect based on the Y coordinate of the position.
Note that this only applies to cartesian charts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IsInteractionMode
getMode()
Returns the name of interaction mode which must be used in chart options.List<InteractionItem>
invoke(IsChart chart, ChartEventContext event, InteractionOptions options, boolean useFinalPosition)
Returns items which must be managed by CHART.JS event or hovering handler and by tooltips.String
value()
Returns the name value of propertystatic DefaultInteractionMode
valueOf(String name)
Returns the enum constant of this type with the specified name.static DefaultInteractionMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
POINT
public static final DefaultInteractionMode POINT
Finds all of the items that intersect the point.
-
NEAREST
public static final DefaultInteractionMode NEAREST
Gets the item that is nearest to the point.
The nearest item is determined based on the distance to the center of the chart item (point, bar).
If 2 or more items are at the same distance, the one with the smallest area is used.
-
INDEX
public static final DefaultInteractionMode INDEX
Finds all items at the same index. If the intersect setting is true, the first intersecting item is used to determine the index in the data.
If intersect false the nearest item, in the x direction, is used to determine the index.
-
DATASET
public static final DefaultInteractionMode DATASET
Finds all items in the same dataset. If the intersect setting is true, the first intersecting item is used to determine the index in the data.
If intersect false the nearest item is used to determine the index.
-
X
public static final DefaultInteractionMode X
Returns all items that would intersect based on the X coordinate of the position only.
Note that this only applies to cartesian charts
-
Y
public static final DefaultInteractionMode Y
Returns all items that would intersect based on the Y coordinate of the position.
Note that this only applies to cartesian charts.
-
-
Method Detail
-
values
public static DefaultInteractionMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DefaultInteractionMode c : DefaultInteractionMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DefaultInteractionMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
value
public String value()
Description copied from interface:Key
Returns the name value of property
-
getMode
public IsInteractionMode getMode()
Description copied from interface:Interactioner
Returns the name of interaction mode which must be used in chart options.- Specified by:
getMode
in interfaceInteractioner
- Returns:
- the name of interaction mode
-
invoke
public List<InteractionItem> invoke(IsChart chart, ChartEventContext event, InteractionOptions options, boolean useFinalPosition)
Description copied from interface:Interactioner
Returns items which must be managed by CHART.JS event or hovering handler and by tooltips.- Specified by:
invoke
in interfaceInteractioner
- Parameters:
chart
- the chart we are returning items fromevent
- the event we are find things atoptions
- options to useuseFinalPosition
- use final element position (animation target)- Returns:
- items that are found
-
-