Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render x-axis limit line label with a set font. #4822

Open
wants to merge 1 commit into
base: master
from

Conversation

@Shakenbeer
Copy link

@Shakenbeer Shakenbeer commented Feb 21, 2020

PR Checklist:

  • I have tested this extensively and it does not break any existing behavior.
  • I have added/updated examples and tests for any new behavior.

PR Description

The set font wasn't used for rendering the label of the limit line of the x-axis, only for the y-axis.
This PR fixes that issue.
Without this fix, one has to override XAxisRenderer:

public class TypefaceAwareXAxisRenderer extends XAxisRenderer {

    public TypefaceAwareXAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer trans) {
        super(viewPortHandler, xAxis, trans);
    }

    @Override
    public void renderLimitLineLabel(Canvas c, LimitLine limitLine, float[] position, float yOffset) {
        if (limitLine != null) {
            mLimitLinePaint.setTypeface(limitLine.getTypeface());
        }
        super.renderLimitLineLabel(c, limitLine, position, yOffset);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.