Vaadin 14.1.17 - Get element selected in chart - Java

Hello i’m wondering how to retrieve the clicked element from a pie chart in Vaadin 14.1.17.

I’m using a classic pie with DataSeries and some values inside and i want to get the current selected item from a click listener

DataSeries initialization

DataSeries ds = new DataSeries();

for (AssetClassModel a : p.getAssetClasses()) {
    ds.add(new DataSeriesItem(a.getDesc(), a.getPerc()));

I’ve tried reading the selected field inside DataSeriesItem but it’s always false

Click Listener

        e -> {
            List<DataSeriesItem> items = ((DataSeries) e.getSeries()).getData();

            for (DataSeriesItem item : items) {
                System.out.println(item.getName() + " selected: " + item.isSelected());



value1 selected: false
value2 selected: false
value4 selected: false

I’ve already tried a workaround reading the Y position of the Item clicked and compare it to the Mouse click position but it doesn’t work since i’ve multiple items with the same Y value.

Do you have any idea on how to manage this?

Thanks Davide