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

setTickLabelFont is not respected for LogAxis if setNumberFormatOverride is used #98

Closed
DuaneTiemann opened this issue Sep 30, 2018 · 1 comment

Comments

@DuaneTiemann
Copy link

JFreeChart version: 1.0.19.

The problem appears to be in LogAxis.createTickLabel:

protected AttributedString createTickLabel(double value) {
    if (this.numberFormatOverride != null) {
        return new AttributedString(
                this.numberFormatOverride.format(value));
    } else ...

which bypasses font processing.

Subclassing LogAxis and providing the font attributes in createTickLabel gets around the problem:

private static class MyLogAxis extends LogAxis
{
public static final long serialVersionUID = 1L;

protected AttributedString createTickLabel(double value)
{
AttributedString result = super.createTickLabel(value);
java.awt.Font font = getTickLabelFont();
for (Map.Entry<TextAttribute,?> entry : font.getAttributes().entrySet())
result.addAttribute(entry.getKey(),entry.getValue());
return result;
}

MyLogAxis( ){super( );}
MyLogAxis(String t){super(t);}
}

jfree added a commit that referenced this issue Apr 27, 2021
jfree added a commit that referenced this issue Apr 27, 2021
@jfree
Copy link
Owner

jfree commented Apr 27, 2021

Fixed for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants