-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Open
Labels
bugconfirmed bugs or otherwise incorrect behaviorconfirmed bugs or otherwise incorrect behavior
Description
It looks like the legend adds this height to its own offset. This happens in every case, but it's most noticeable when the labels are long, since the space taken is bigger. You can clearly see it (blank space between chart and legend) when comparing these two screenshots
(This was tested with the latest commit, as of today)
Steps to reproduce
Edit LineChartActivity1.java
in the sample project, and add the following lines to the onCreate() method:
xAxis.setLabelRotationAngle(-90f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return "A long text for value" + (int)value;
}
@Override
public int getDecimalDigits() {
return -1;
}
});
I believe the bug is in BarLineChartBase.calculateLegendOffsets()
which adds getXAxis().mLabelRotatedHeight
to the top offset of the legend (or bottom, depending on its position):
if (getXAxis().isEnabled() && getXAxis().isDrawLabelsEnabled())
offsets.bottom += getXAxis().mLabelRotatedHeight;
I tried commenting out those lines and the problem goes away, but I'm not sure if there could be any other repercussions.
Metadata
Metadata
Assignees
Labels
bugconfirmed bugs or otherwise incorrect behaviorconfirmed bugs or otherwise incorrect behavior