Events / Selection

Each chart has a SelectionChangeEvent, which is triggered when a selection is made. The RowID is located in the Event object. With the help of the RowID, the correct row with its information can then be called up in the Model. So that the model can be accessed later from the event, it makes sense to declare and assign the model as a field within the class.

Get the RowID and ColumnID of the selected entry

private void barChart_onSelection(final SelectionEvent<AbstractChart> event)
{
    final Selection  selection = event.getSelection();
    final List<Item> items     = selection.items();

    for(final Item item : items)
    {
        final Integer row = item.row();
        final Integer column = item.column();
    }
}

Find the entry in the model using the RowID and ColumnID

final Integer row = item.row();
final Integer column = item.comlumn();

final Cell value = this.model.getValue(row, column);
Object rowValue = value.value();

Get all entries by RowID from the model

final Integer row = item.row();

for(int i = 0; i < this.model.columns().size(); i++)
{
    final Cell value = this.model.getValue(row, item.column());
    System.out.println(value.value());
}