Skip to content

Commit aee6058

Browse files
zhanglongzhanglong
authored andcommitted
Avoid that the last label entry in the x-labels clip off the edge of the screen PhilJay#3819
1 parent 3e1eb14 commit aee6058

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected void drawLabels(Canvas c, float pos, MPPointF anchor) {
207207
if (mXAxis.isAvoidFirstLastClippingEnabled()) {
208208

209209
// avoid clipping of the last
210-
if (i == mXAxis.mEntryCount - 1 && mXAxis.mEntryCount > 1) {
210+
if (i / 2 == mXAxis.mEntryCount - 1 && mXAxis.mEntryCount > 1) {
211211
float width = Utils.calcTextWidth(mAxisLabelPaint, label);
212212

213213
if (width > mViewPortHandler.offsetRight() * 2

0 commit comments

Comments
 (0)