It is necessary for my application to have a label on each bar of the bar chart. Is there a way to do this with MPAndroidChart? I could not find a way to do this on the project wiki/javadocs.
If there isn't a way to do this is there another software that will allow me to?
you can set the column label above by adding this line go code
Updated Answer (MPAndroidChart v3.0.1)
Being such a commonly used feature, v3.0.1 of the library added the
IndexAxisValueFormatter
class exactly for this purpose, so it's just one line of code now:The ProTip from the original answer below still applies.
Original Answer (MPAndroidChart v3.0.0)
With v3.0.0 of the library there is no direct way of setting labels for the bars, but there's a rather decent workaround that uses the
ValueFormatter
interface.Create a new formatter like this:
Then set this formatter to your x-axis (assuming you've already created a
String[]
containing the labels):ProTip: if you want to remove the extra labels appearing when zooming into the bar chart, you can use the granularity feature: