8000 setTickLabelFont is not respected for LogAxis if setNumberFormatOverride is used · Issue #98 · jfree/jfreechart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 8000
setTickLabelFont is not respected for LogAxis if setNumberFormatOverride is used #98
Closed
@DuaneTiemann

Description

@DuaneTiemann

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);}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0