Class PointClickEvent
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<Chart>
com.vaadin.flow.component.charts.events.PointClickEvent
- All Implemented Interfaces:
ClickEvent
,HasItem
,HasSeries
,Serializable
@DomEvent("point-click")
public class PointClickEvent
extends ComponentEvent<Chart>
implements ClickEvent, HasItem
The PointClickEvent class stores data for click events on the points of the
chart.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionPointClickEvent
(Chart source, boolean fromClient, int pageX, int pageY, boolean altKey, boolean ctrlKey, boolean metaKey, boolean shiftKey, int button, double x, double y, int seriesIndex, String category, int pointIndex, String pointId) Constructs a PointClickEvent -
Method Summary
Modifier and TypeMethodDescriptionThe ID of the series item that is associated with the event.int
Returns the index of the series item, that is associated with this event, inHasSeries.getSeries()
.Gets the mouse click detailsint
Returns the index of the seriesMethods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListener
Methods inherited from class java.util.EventObject
toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.charts.events.ClickEvent
getAbsoluteX, getAbsoluteY, getButton, getxAxisValue, getyAxisValue, isAltKey, isCtrlKey, isMetaKey, isShiftKey
-
Constructor Details
-
PointClickEvent
public PointClickEvent(Chart source, boolean fromClient, @EventData("event.detail.originalEvent.pageX") int pageX, @EventData("event.detail.originalEvent.pageY") int pageY, @EventData("event.detail.originalEvent.altKey") boolean altKey, @EventData("event.detail.originalEvent.ctrlKey") boolean ctrlKey, @EventData("event.detail.originalEvent.metaKey") boolean metaKey, @EventData("event.detail.originalEvent.shiftKey") boolean shiftKey, @EventData("event.detail.originalEvent.button") int button, @EventData("event.detail.originalEvent.point.x") double x, @EventData("event.detail.originalEvent.point.y") double y, @EventData("event.detail.originalEvent.point.series.index") int seriesIndex, @EventData("event.detail.originalEvent.point.category") String category, @EventData("event.detail.originalEvent.point.index") int pointIndex, @EventData("event.detail.originalEvent.point.id") String pointId) Constructs a PointClickEvent- Parameters:
source
-fromClient
-pageX
-pageY
-altKey
-ctrlKey
-metaKey
-shiftKey
-button
-seriesIndex
-category
-pointIndex
-pointId
-
-
-
Method Details
-
getMouseDetails
Description copied from interface:ClickEvent
Gets the mouse click details- Specified by:
getMouseDetails
in interfaceClickEvent
- Returns:
-
getSeriesItemIndex
public int getSeriesItemIndex()Description copied from interface:HasSeries
Returns the index of the series- Specified by:
getSeriesItemIndex
in interfaceHasSeries
- Returns:
-
getCategory
- Specified by:
getCategory
in interfaceHasItem
-
getItemIndex
public int getItemIndex()Description copied from interface:HasItem
Returns the index of the series item, that is associated with this event, inHasSeries.getSeries()
. Can be used to identify the item within the series.Example for
ListSeries
:int itemIndex = event.getItemIndex(); ListSeries series = (ListSeries) event.getSeries(); Number datum = series.getData()[itemIndex];
- Specified by:
getItemIndex
in interfaceHasItem
- Returns:
- the index of the item in the series
- See Also:
-
getItemId
Description copied from interface:HasItem
The ID of the series item that is associated with the event. Can be used to identify the item within the series.Example for
NodeSeries
:String id = this.getItemId(); NodeSeries series = (NodeSeries) this.getSeries(); Optional<Node> nodeForId = series.getNodes().stream() .filter(node -> node.getId().equals(id)).findFirst();
Only
AbstractSeriesItem
andNode
support setting an ID. For other types of series items this property will always return null. ForAbstractSeriesItem
the ID is optional. Unless the developer has explicitly set an ID for the item associated with the event, this property will be null. SeeHasItem.getItem()
orHasItem.getItemIndex()
for alternatives.
-