Skip to content

DataSeries forwards DataListener events without mapping columns #178

@rfauth

Description

@rfauth

If you create a DataSeries from a DataTable and attach a DataListener to it, you will receive DataChangeEvents with indexes matching the DataTable, but not the DataSeries.

In my special case i have a DataTable with 6 columns and create a 2 column DataSeries dynamicallly based on user interaction, depending on which graph i want to display. I attach a DataListener for custom yAxis scaling. However the dataAdded/dataChanged/dataRemoved notifications i get contain columns 0 through 5.

As i understand it, DataSeries allows me to have a limited view on the DataTable, but here it is leaking information from the part you dont want to see. Also, you dont necessarily have the means to interpret the DataTable's column numbers at this point, since cols is a private List of int within the DataSeries.

The solution would be to change the dataAdded/dataUpdated/dataRemoved methods in the following way:

  • check all events if their column is in the list
  • if yes, clone the event and map its column to its index in the column list
  • finally notify your listeners with the column-mapped events

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions