The BarChart x-axis value label position and the LineChart x-axis value label position mismatch slightly. What can I do to fix this?
Asked
Active
Viewed 951 times
1 Answers
0
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.

David Rawson
- 20,912
- 7
- 88
- 124
-
I have not resolved it yet, so I ask you to contact me again .I've added some photos. – user7811428 Jun 06 '17 at 13:04
-
1I used this lineChart.getXAxis().setSpaceMin(0.5f); lineChart.getXAxis().setSpaceMax(0.5f); – user7811428 Jun 06 '17 at 13:05
-
Is that really possible? – user7811428 Jun 06 '17 at 13:06