Chart data(Barchart) in FRAGMENT (support v4) not updated even after calling notifyDataSetChanged
Well I created a with android studio from scratch: (is attached)
- new project with NavigationView (side bar) (with wizard)
- copied BarChartFrag + MyMarkerView + all layouts need for this fragment from library example to this project
- created 2 method updateA and updateB in this fragment which basically simulate a postponed click/http call to get json response from server (you get the idea)
(use always either updateA or updateB to test different behaviour not both together) Problem:
- if I do not fill the chart with data before displaying fragment, after update event data will not be updated.
- if I fill data at start and the try to update it later, it will not be update until a click event on the chart happens (updateA() method)
- if I change data periodically (inspired by the example Realtime chart) the chart is not updated (updateB() method) chartbug.zip
Probalby this should be a another bug (but it could be associated with the invalidate problem) I attached a video, the probelm is during scaling the chart disappers. This is a similar structure also within fragment Google Nexus 4 - 5.1.0 - API 22 - 768x1280.zip
It's kind a blocker. Thx
You forgot to call chart.invalidate() in your update method.
Thanks for the quick response, I tried to update the code with invalidate in the app with the scaling problem and it did not solve it. Should I create a new bug?
I suggest you read this: https://github.com/PhilJay/MPAndroidChart/wiki/Dynamic-&-Realtime-Data