com.vaadin.flow.component.charts.events.
Interface HasItem
All Superinterfaces:
All Known Implementing Classes:
DrilldownEvent
, PointClickEvent
, PointDragEvent
, PointDragStartEvent
, PointDropEvent
, PointLegendItemClickEvent
, PointMouseOutEvent
, PointMouseOverEvent
, PointRemoveEvent
, PointSelectEvent
, PointUnselectEvent
, PointUpdateEvent
Indicates that an event has an associated item
-
Method Summary
Modifier and TypeMethodDescriptiondefault DataSeriesItem
getItem()
Returns the data series item that this event is associated with.
The 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, in
HasSeries.getSeries()
.Methods inherited from interface com.vaadin.flow.component.charts.events.HasSeries
getSeries, getSeriesItemIndex
-
Method Details
-
getSource
Chart getSource() -
getCategory
String getCategory() -
getItemIndex
int getItemIndex()Returns the index of the series item, that is associated with this event, in
HasSeries.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];
Returns:
the index of the item in the series
See Also:
-
getItemId
String getItemId()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. SeegetItem()
orgetItemIndex()
for alternatives.Returns:
the ID of the series item associated with the event, or null if the series item has no ID
See Also:
-
getItem
Returns the data series item that this event is associated with.
NOTE: This method only works with series of type
DataSeries
. For other series anUnsupportedOperationException
will be thrown. SeegetItemIndex()
orgetItemId()
for alternatives.Returns:
the
DataSeriesItem
that is associated with this eventThrows:
UnsupportedOperationException
- when using this method with a series that is not a DataSeriesSee Also:
-