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

Old graphics not removed when adding new data #745

Closed
rohiver opened this issue Feb 9, 2016 · 3 comments
Closed

Old graphics not removed when adding new data #745

rohiver opened this issue Feb 9, 2016 · 3 comments

Comments

@rohiver
Copy link

rohiver commented Feb 9, 2016

Hi,

I am trying to run dynamic updates on a LineChartView, removing old data with removeEntry, and calling notifyDataSetChanged() on the view. However, when updating the chart, it appears as if the old graphics (points, grid lines, axes) are not removed and new graphics are drawn on top. The same happens when using BarCharView.

This is a real time app, with new data pushing out the oldest data. The X labels stay constant while the Y values propagate from the newest to the oldest (right to left) as new data arrives.

When rotating the device, the view clears up and renders correctly as soon as animation is completed, but then starts getting "corrupted" again as new data arrives. See image below for an idea:
screen shot 2016-02-08 at 9 26 16 pm

I have also tried to modify each data point separately, and as a last resort, clearing the data completely and rebuilding the dataset at the arrival of each new datapoint, with the same result.

I must be doing something wrong, any pointers highly appreciated. Using IOS 9.2 with Charts 2.2.1

Thanks

rohiver

@rohiver
Copy link
Author

rohiver commented Feb 10, 2016

Troubleshooting some more...

Recreating the storyboard and and rewriting the same code fixed the issue, for some strange reason!

@rohiver rohiver closed this as completed Feb 10, 2016
@danielgindi
Copy link
Collaborator

That's because your view was marked as opaque but with a transparent backgroundColor.
If you want it to be transparent, it must be opaque = NO so that CG knows to clear the background.

@rohiver
Copy link
Author

rohiver commented Feb 10, 2016

Thanks for the explanation!

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

2 participants