Skip to content

Commit

Permalink
Merge pull request #4013 from RobertZagorski/bugfix/#2369-legend-offs…
Browse files Browse the repository at this point in the history
…et-is-not-calculated-twice-for-line-chart

Remove mLabelRotatedHeight counted twice, when calculating legend offset
  • Loading branch information
almic authored May 9, 2018
2 parents 73054be + 8943622 commit 9ee3a74
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 9ee3a74

Please sign in to comment.