Remove mLabelRotatedHeight counted twice, when calculating legend offsets. (Fix for #2369).
Removed statements where completely not needed as calculating offsets is alredy done in BarLineCharBase#calculateOffsets(...)
diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java
index bf4c42e..1cca83d 100644
--- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java
+++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java
@@ -427,18 +427,12 @@
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:
@@ -478,21 +472,21 @@
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;
}
}
@@ -1224,7 +1218,7 @@
/**
* 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
*/
@@ -1234,7 +1228,7 @@
/**
* 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
*/