The BarChart x-axis value label position and the LineChart x-axis value label position mismatch slightly. What can I do to fix this?
![mismatched labels on the x-axis]](../../images/3829468327.webp)
The BarChart x-axis value label position and the LineChart x-axis value label position mismatch slightly. What can I do to fix this?
![mismatched labels on the x-axis]](../../images/3829468327.webp)
For what it's worth, I find that the mismatch is barely noticeable and if you hadn't have pointed it out I would not have seen it.
You can tweak the offset of the x-values using XAxis#setXOffset(float f):
mChart.getXAxis().setXOffset(10f);
Use a negative offset (e.g., -10f) if you want to move the labels in the opposite direction.
If you want to tweak the offset of the value on the LineChart it is a bit more complicated - you would have to subclass LineChartRenderer and override the method drawValues.
Please see How do MPAndroidChart renderers work and how do I write a custom renderer? if you wish to attempt that.