Hi I would like to draw icons in xaxis of the bar chart instead of values. Like the chart below
I have found how to do it extremely easy:
Add another data set with values set to -1, and provide a drawable upon creating that entry: new Entry(i, value, icon)
Use setStartAtZero(false) to enable drawing of negative values.
Set data set color to transparent in order to make this dataSet invisible to user.
I admit, that this is pretty hacky solution, but it is easy and doesn't require copy pasting and rewriting code form the lib, so it is easier to maintain updated.
Based on sauvik's answer, I have written an updated version and in Kotlin, for MPAndroidChart v3.1.0. The implementation from sauvik doesn't seem to work with the current version.
The complete Renderer class can be found here.
And it is used like this (from inside a BarChart subclass):
init {
renderer = BarChartIconRenderer(this, animator, viewPortHandler,
mBarXAxisIcons, context)
}
... with mBarXAxisIcons being an ArrayList<Bitmap> that you add your bitmaps to.
Additionally, you need to add a dimension barchart_icon_size, or customize the getScaledBitmap function in the class linked above.
There is one problem with the renderer: the labels on top of the bars are drawn a bit higher than usual, I don't know why yet, but trying to find out and will update this answer accordingly.