public interface HasItem extends HasSeries
| Modifier and Type | Method and Description |
|---|---|
String |
getCategory() |
default DataSeriesItem |
getItem()
Returns the data series item that this event is associated with.
|
String |
getItemId()
The ID of the series item that is associated with the event.
|
int |
getItemIndex()
Returns the index of the series item, that is associated with this event,
in
HasSeries.getSeries(). |
Chart |
getSource() |
getSeries, getSeriesItemIndexString getCategory()
int getItemIndex()
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];
getItem(),
getItemId()String getItemId()
Example for TreeSeries:
String id = this.getItemId();
TreeSeries series = (TreeSeries) this.getSeries();
Optional<TreeSeriesItem> treeItem = series.getData().stream()
.filter(item -> item.getId().equals(id)).findFirst();
Only AbstractSeriesItem supports setting an ID. For other types
of series items this property will always return null. For
AbstractSeriesItem the ID is optional. Unless the developer has
explicitly set an ID for the item associated with the event, this
property will be null. See getItem() or getItemIndex()
for alternatives.
getItem(),
getItemIndex()default DataSeriesItem getItem()
NOTE: This method only works with series of type
DataSeries. For other series an
UnsupportedOperationException will be thrown. See
getItemIndex() or getItemId() for alternatives.
DataSeriesItem that is associated with this eventUnsupportedOperationException - when using this method with a series that is not a DataSeriesgetItemIndex(),
getItemId()Copyright © 2025. All rights reserved.