2

For some reason (that I can develop if you want/need) I have to redraw all the chart periodically. So, I use removeAllSeries then addSeries, plus removeAllViews then addView. It works but the problem is that addView adds the view not by simply refreshing all pixels of the tablet but with a sort of "animation" that puts firstly the View a little bit (2 or 3 pixels) shifted to the right and then it takes the right place. The consequence is that, everytime I redraw my graph, it looks as if there is a "vibration" (it's not fluid).

Do anyone have some issue? Could this undesired "animation" be related to how the addView method is done?

JabberwockyDecompiler
  • 3,318
  • 2
  • 42
  • 54
rBenks93
  • 53
  • 1
  • 8
  • P.S. : Is there a simple way to redraw only the rectangles (bars) of the graph ? What I want to do is to change dynamically the color (style) of the graph and redraw it. What I do now is redrawing all the graph. But I think it could be better to redraw only the bars. I tried to modify the source code of GraphView library but not successfully for now. – rBenks93 Aug 04 '14 at 15:23

2 Answers2

0

there are three ways:

  1. redrawAll() method. Maybe it is protected, but you can overwrite and make it public
  2. change the data in series (appendData or resetData). The Graph will automatically rerender.
  3. removeAllSeries + add new series. No need to call removeAllViews/addView. Take a look at the GraphViews-Demos project, there is an example about that.

Cheers

appsthatmatter
  • 6,347
  • 3
  • 36
  • 40
0

Thank you for your answer ! I actually just simply overrided the ValueDependentColor() method directly in my main activity. The color depends on a timer. So, when I reset data after x seconds the graph rerenders as you said in your "2."

rBenks93
  • 53
  • 1
  • 8