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

Support dynamically circle colors changes on LineChartRenderer #5231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

santosmgbh
Copy link

@santosmgbh santosmgbh commented Jan 3, 2022

PR Checklist:

  • I have tested this extensively and it does not break any existing behavior.
  • I have added/updated examples and tests for any new behavior.
  • If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]

PR Description

Improve cache from circle image on LineChartRenderer
Changed mImageCache from HashMap to WeakHashMap to avoid OOM
Moved DataSetImageCache.init to be inside of fill method. The main idea is check if the color have been changed and update circle if it is true.

Motivation:

I created this PR because I met one use case that I needed to use different colors from dots and changed it dinamically from a "hover" on graph. So I used the method setCircleColors, but when I call drawCircle it doesn’t works because the length of the circle array(drawCircles:777) have not been changed. So, in my use case the size keep the same only the color changed.

Selected:
Screen Shot 2022-01-03 at 18 26 36
Unselected:
Screen Shot 2022-01-03 at 18 26 22

agabriel added 2 commits January 3, 2022 16:27
Moved DataSetImageCache.init from a method to a constructor. The main idea is verify the content of the color in array instead of only the length.
I met one use case that I needed to use different colors from dots. So I used the method setCircleColors, but when I call drawCircle it doesnt works because the length of the circle array is not change, only the content is changed.
@santosmgbh santosmgbh changed the title Support different circle colors and updates on LineChartRenderer Support dynamically circle colors changes on LineChartRenderer Jan 3, 2022
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

Successfully merging this pull request may close these issues.

1 participant