Z-ordering of annotations on Android


#1

Is there any way to specify z-ordering of annotations? I have a chart header annotation that I add in the beginning that I need to always be on top of all other annotations. 

This header annotation is kinda heavy so don’t want to remove and add again every time I’m showing anoher annotation on the screen - especially considering the hacks around it to make it stretcha and display properly.

Thanks,
Radu


#2

Hello Radu.

Thanks for getting in touch. ShinobiCharts for Android currently does not offer specific z-ordering options for Annotations. As I am sure you are aware we do offer the option to place the annotations in front, or behind the data, but I appreciate that this is not what you need. I am going to develop a very quick application to see if I can achieve what you are trying to do. I will respond soon with the results from this.

Thanks,
Kai.


#3

Hello Radu,

I have created a small app today which places several overlapping annotations on to the chart. Initially they were drawn in the order in which they were applied, so the last annotation applied was shown at the ‘front’.

I then obtain the View from the annotation (which is to be the header annotation) and call it’s own bringToFront() command using something like: 

testAnnotation.getView().bringToFront();
chart.redrawChart();

I have tried adding additional annotations after this, then calling the bring to front code again (not forgetting to call redrawChart), to simulate your app adding further views. This method seems to work and I think this would be a good starting point for you. 

If you need any further help, please ask.

Thanks,

Kai.