Skip to content

Commit

Permalink
Fixed the avoidFirstLastClipping feature
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Oct 23, 2015
1 parent 8065d17 commit 0298122
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 0298122

Please sign in to comment.