shinobicharts for Android does not currently offer the option to have the grid lines drawn above the fill. One workaround is that you could use the AnnotationsManager (a premium feature) to draw a line annotation for each major tick mark that is drawn. To add a line annotation the appropriate methods would be:
The suitability of this approach would all depend upon your use case. Please be aware that an Annotation is essentially a View and as such will result in a certain overhead borne during the measure, layout and draw phases. If you have a lot of major tick marks, and / or supported pan and / or zoom gestures, performance may suffer as these ‘gridline’ Views are repositioned.
If you were to use this approach with gestures, you may find the following listener method useful to help you take action (such as add or remove an Annotation) as a new major tick mark is about to be drawn:
Another approach might be to instead, draw the lines yourself. In this case rather than add View objects, you could make calls to Android’s drawLine method on the Android Canvas. This approach should be more performant.
You would not be able to draw the lines directly to the chart, but we recommend you lay a suitable View over the top of the chart, using the same dimensions and layout parameters as the chart itself. You can then draw the grid lines onto this.
To help you position the lines, let’s consider the x axis. First, to obtain the x axis position, relative to the chart, you would obtain the tick mark data value from the suitable TickMark object given to you on the call to the onDrawTickMark() listener method.
When this method is called, you are also given the Axis object. In this case this would be the x axis. You could take the tick mark value and convert it to a pixel value, which is relative to the chart. The following method would help you do this:
To obtain the y axis pixel values, you need to know the top and bottom pixel values of the plot area, relative to the chart. This is because you don’t want the grid line to appear to draw on your axis. The following method may help you with this:
I hope that you find this information helpful. We do base our future development roadmap on customer demand and as such, I will make a note of your request for this feature. If you have any further questions, please do get back in touch.