Custom Image for Tick Mark Labels on Android Chart


Is there a way to customize the tick mark labels using a drawable resource (ImageView) instead of the text label in the Android version of ShinobiCharts?

I know that the iOS version had a handy delegate method called sChart(_ chart: ShinobiChart, alter tickMark: SChartTickMark, beforeAddingTo axis: SChartAxis) where I was able to replace the label with an image view and update the constraints to fit the new image for each tick mark.

I saw that there’s ShinobiChart.OnTickMarkDrawListener but when I try to override the onDrawTickMark method, it removes all the tick marks completely.

I currently have:

public class MainActivity extends AppCompatActivity implements ShinobiChart.OnTickMarkDrawListener {

    private ShinobiChart chart;

    protected void onCreate(Bundle savedInstanceState) {

        if (savedInstanceState == null) {

    private void setupChart() {
        ChartFragment chartFragment =
                (ChartFragment) getFragmentManager().findFragmentById(;

        chart = chartFragment.getShinobiChart();
        // chart setup goes here for axis, series, dataAdapter, and styling

    public void onDrawTickMark(Canvas canvas, TickMark tickMark, Rect rect, Rect rect1, Axis<?, ?> axis) {  

Any help is greatly appreciated. Thanks!



Hello Jess,
If you add an instance of an OnTickMarkDrawListener to your ShinobiChart you will be responsible for drawing the tick marks and labels for all axes. Adding this listener effectively disables the default drawing. If you are customising only 1 of your axes for example, you must replicate the default behaviour to any that remain. I recommend you take a look at the ChartUtils class which may help.
As for using a drawable resource as your tick mark you should be able to achieve this using the onDrawTickMark method on your own OnTickMarkDrawListener. This method provides you with a number of useful parameters, including the Canvas and the Rects of both the tick mark and label. You should be able to draw to the canvas using a standard Android approach, using the appropriate Rect to position your image.