Skip to content

Commit 5424d79

Browse files
committed
Merge pull request PhilJay#1684 from thadeubatista/master
[Resolved] X Axis Labels being cut off horizontally PhilJay#1657
2 parents 358770c + 3f483b9 commit 5424d79

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • MPChartLib/src/com/github/mikephil/charting/utils

MPChartLib/src/com/github/mikephil/charting/utils/Utils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ public static float getNormalizedAngle(float angle) {
532532

533533
private static Rect mDrawTextRectBuffer = new Rect();
534534
private static Paint.FontMetrics mFontMetricsBuffer = new Paint.FontMetrics();
535+
private static float mLineHeight = 9999.0f;
535536

536537
public static void drawText(Canvas c, String text, float x, float y,
537538
Paint paint,
@@ -542,7 +543,10 @@ public static void drawText(Canvas c, String text, float x, float y,
542543

543544
paint.getTextBounds(text, 0, text.length(), mDrawTextRectBuffer);
544545

545-
final float lineHeight = mDrawTextRectBuffer.height();
546+
if(mDrawTextRectBuffer.height() < mLineHeight){
547+
mLineHeight = mDrawTextRectBuffer.height();
548+
}
549+
final float lineHeight = mLineHeight;
546550

547551
// Android sometimes has pre-padding
548552
drawOffsetX -= mDrawTextRectBuffer.left;

0 commit comments

Comments
 (0)