Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataSeries forwards DataListener events without mapping columns #178

Open
rfauth opened this issue Jul 17, 2019 · 0 comments
Open

DataSeries forwards DataListener events without mapping columns #178

rfauth opened this issue Jul 17, 2019 · 0 comments

Comments

@rfauth
Copy link

rfauth commented Jul 17, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant