Skip to content

Commit

Permalink
Remove mLabelRotatedHeight counted twice, when calculating legend off…
Browse files Browse the repository at this point in the history
…sets. (Fix for PhilJay#2369).

Removed statements where completely not needed as calculating offsets is alredy done in BarLineCharBase#calculateOffsets(...)
  • Loading branch information
RobertZagorski authored and Robert Zagorski committed May 9, 2018
1 parent 7380b31 commit c4c4d40
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,18 +427,12 @@ protected void calculateLegendOffsets(RectF offsets) {
offsets.top += Math.min(mLegend.mNeededHeight,
mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent())
+ mLegend.getYOffset();

if (getXAxis().isEnabled() && getXAxis().isDrawLabelsEnabled())
offsets.top += getXAxis().mLabelRotatedHeight;
break;

case BOTTOM:
offsets.bottom += Math.min(mLegend.mNeededHeight,
mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent())
+ mLegend.getYOffset();

if (getXAxis().isEnabled() && getXAxis().isDrawLabelsEnabled())
offsets.bottom += getXAxis().mLabelRotatedHeight;
break;

default:
Expand Down Expand Up @@ -478,21 +472,21 @@ public void calculateOffsets() {

if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {

float xlabelheight = mXAxis.mLabelRotatedHeight + mXAxis.getYOffset();
float xLabelHeight = mXAxis.mLabelRotatedHeight + mXAxis.getYOffset();

// offsets for x-labels
if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

offsetBottom += xlabelheight;
offsetBottom += xLabelHeight;

} else if (mXAxis.getPosition() == XAxisPosition.TOP) {

offsetTop += xlabelheight;
offsetTop += xLabelHeight;

} else if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {

offsetBottom += xlabelheight;
offsetTop += xlabelheight;
offsetBottom += xLabelHeight;
offsetTop += xLabelHeight;
}
}

Expand Down Expand Up @@ -1224,7 +1218,7 @@ public boolean isDrawBordersEnabled() {

/**
* When enabled, the values will be clipped to contentRect,
* otherwise they can bleed outside the content rect.
* otherwise they can bleed outside the content rect.
*
* @param enabled
*/
Expand All @@ -1234,7 +1228,7 @@ public void setClipValuesToContent(boolean enabled) {

/**
* When enabled, the values will be clipped to contentRect,
* otherwise they can bleed outside the content rect.
* otherwise they can bleed outside the content rect.
*
* @return
*/
Expand Down

0 comments on commit c4c4d40

Please sign in to comment.