I am using a Scatter Chart (MPAndroidChart library) and it looks like below presently.
Everything works well so far except for the values on the first and last label (Su and S) wherein the circles are cut off. Is there a way to add padding so that Su has some padding on the left on the X Axis and renders the circle completely and S has some padding on the right so the circle values for S render completely. I have tried to manually set padding going through numerous examples but nothing has worked correctly so far. Is someone has any ideas and can point in the right direction it will be great.. Thanks!
I just realized my previous answer isn't the best solution, but I'm going to leave it intact in case it better addresses certain situations or similar needs.
A better way to handle this is to use the SpaceMax and SpaceMin properties, which do exactly what you need without doing potentially fragile things with indices:
xAxis.setSpaceMax(0.1f);
xAxis.setSpaceMin(0.1f);
That will add the specified spacing on the ends in a much more clear and concise way.
I would try setting offset on chart. This let me draw the full labels and dots on both sides, however the grid lines ends where the last dot is.
mLineChart.setExtraLeftOffset(36);
mLineChart.setExtraRightOffset(36);
Use: xAxis.setAvoidFirstLastClipping(true)
If set to true, the chart will avoid that the first and last label entry in the chart "clip" off the edge of the chart or the screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With