Reputation: 2896
I have a problem with the MPAndroidChart library I use for my Android project. It seems that the first entry of my charts gets cut off since the value is too large (see screen shot). The value of the first entry point is 106.6 however only the 06.6 is visible. Is there any option to avoid this?
I already found the setAvoidFirstLastClipping(boolean)
of the xAxis but this doesn't solve my problem.
Upvotes: 1
Views: 4555
Reputation: 2896
Thanks to Philipp Jahoda's comment I solved the problem. I just had to add an extra offset to the left and the right of the chart.
mChart.setExtraLeftOffset(15);
mChart.setExtraRightOffset(15);
Upvotes: 13
Reputation: 2917
I don't have much experience with MPAndroidChart, but here's what you can try. If you have padding in your chart, you can set android:clipToPadding="false"
, so that the chart can draw over padding area. Additionally you can set android:clipChildren="false"
on chart's parent view so that it can draw beyond its view borders without clipping.
However, first of all this won't add any insets to the chart, meaning that you'll lose symmetry, and very long values will still clip by your screen. Also, if MPAndroidChart doesn't draw directly to Canvas but to the temporary bitmap (which was the case IIRC), these attributes won't help.
Upvotes: 2