Skip to content

Commit

Permalink
Merge pull request PhilJay#1142 from danielgindi/first-last-clipping-fix
Browse files Browse the repository at this point in the history
Fixed the avoidFirstLastClipping feature
  • Loading branch information
PhilJay committed Oct 23, 2015
2 parents 66c3c6c + 5b16f6d commit 809b9b4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@ protected void drawLabels(Canvas c, float pos) {
if (i == mXAxis.getValues().size() - 1) {
float width = Utils.calcTextWidth(mAxisLabelPaint, label);

if (width > mViewPortHandler.offsetRight() * 2
&& position[0] + width > mViewPortHandler.getChartWidth())
position[0] -= width / 2;
if (position[0] + width / 2.f > mViewPortHandler.contentRight())
position[0] = mViewPortHandler.contentRight() - (width / 2.f);

// avoid clipping of the first
} else if (i == 0) {

float width = Utils.calcTextWidth(mAxisLabelPaint, label);
position[0] += width / 2;

if (position[0] - width / 2.f < mViewPortHandler.contentLeft())
position[0] = mViewPortHandler.contentLeft() + (width / 2.f);
}
}

Expand Down

0 comments on commit 809b9b4

Please sign in to comment.