Vertical line annotations are white when updating quickly (Android)


#1

Vertical annotations displayed without color - in high speed scenarios (where we frequently clear the chart and then add a bunch of data and annotations on top), we find that the vertical annotations we are adding are displayed in all white.  If we use the button on our app that clears them and re-adds them once the data streaming is stopped, they display properly again.  This seems like a bug.  Any suggestions?


#2

Hi.

Thanks for getting in touch.

Unlike our DataPoint and Series objects, which are drawn natively by the graphics hardware using OpenGL, our Annotations ultimately comprise of standard Android View objects. I am currently not aware of any existing issues with our libraries’ Annotation functionality, but my initial thought is that Android is being asked to measure, layout and draw too many UI objects (in this case View objects) too often. Are you using the SimpleDataAdapter class to populate your series or your own implementation? When a new DataPoint is added to a SimpleDataAdapter, an update handler fires which will trigger a redraw of the chart. This will include any UI objects on the chart, including Annotations. In some cases, adding new DataPoints will mean that in pixel terms, the positions of each Annotation changes, which means Android has more work to do to recalculate the new positions of the underlying View objects. If Android is doing too much work on the UI thread we can sometimes see unwieldy behaviour and sluggish performance. This will of course vary, depending upon factors such as the device specification and version of Android which runs on it. 

If you are dealing with a lot of data and frequent updates, you may need to consider alternative approaches such as only adding Annotation objects at certain intervals. One approach which may improve performance is to use a LineSeries object, instead of a vertical line Annotation, as Series objects are drawn using OpenGL and thus may render more quickly.

I hope this helps. Please feel free to post back more information such as how many DataPoints and Annotations you are adding, and how frequently. 

Thanks and kind regards,

Kai.


#3

Kai,

Thanks for the help and suggestions.  We ended up setting a default style for annotations and that worked.

Thanks,
Jamie


#4

Hi Jamie.

I’m glad you were able to resolve your issue. Please let us know if you have any more questions.

Kind regards.

Kai.