Mpandroidchart: X-axis label gets cut off to the right

Created on 15 Dec 2016  路  3Comments  路  Source: PhilJay/MPAndroidChart

I'm displaying a chart where the X-axis values represent time stamps, and showing the hh:mm:ss.

Sometimes the last label (rightmost one) gets cut off. It displays the label centered at the right edge, which makes up to half the label getting cut off at the view's rightmost edge.

This doesn't look really nice. It can be solved by setting an offset on the right, but that makes the whole chart have an offset - which also doesn't look good.

I think the appropriate behavior should be to either not show the X value at a position so far right that it gets cut off, or have the label dynamically move/shrink/similar instead of getting cut off.

Screenshot of what I mean:
cutofflabel

Thanks for a good library!

Most helpful comment

It did not work for me. I got my left xAxis label overlapped with nearest one and no effect on right label. I want to avoid clipping of right label. Do you know?

All 3 comments

chart.getXAxis().setAvoidFirstLastClipping(true); should do the trick

That seems to do the trick, thanks @GoneUp ! Somehow I didn't find that method - I think that behavior should be the default actually. :)

This is no longer an issue then, thanks.

It did not work for me. I got my left xAxis label overlapped with nearest one and no effect on right label. I want to avoid clipping of right label. Do you know?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

botondbutuza picture botondbutuza  路  3Comments

vishvendu picture vishvendu  路  3Comments

rohitkumarbhagat picture rohitkumarbhagat  路  3Comments

SutharRohit picture SutharRohit  路  3Comments

JungYongWook picture JungYongWook  路  3Comments