Example usage for org.jfree.chart.plot CategoryMarker getLabelFont

List of usage examples for org.jfree.chart.plot CategoryMarker getLabelFont

Introduction

In this page you can find the example usage for org.jfree.chart.plot CategoryMarker getLabelFont.

Prototype

public Font getLabelFont() 

Source Link

Document

Returns the label font.

Usage

From source file:net.sf.jasperreports.customizers.marker.CategoryMarkerCustomizer.java

protected CategoryMarker createMarker(JRChart jrc) {
    Comparable<?> value = getProperty(PROPERTY_CATEGORY);

    if (value == null) {
        return null;
    }//from w ww .j a  v a  2  s . com

    CategoryMarker marker = new CategoryMarker(value);

    configureMarker(marker);

    configureStroke(marker);

    Boolean drawAsLine = getBooleanProperty(PROPERTY_DRAW_AS_LINE);
    if (drawAsLine != null) {
        marker.setDrawAsLine(drawAsLine);
    }

    //Setup the font
    Font font = marker.getLabelFont();

    String fontName = getProperty(PROPERTY_FONT_NAME);
    if (fontName == null) {
        fontName = font.getName();
    }

    Float fontSize = getFloatProperty(PROPERTY_FONT_SIZE);
    if (fontSize == null) {
        fontSize = Float.valueOf(font.getSize());
    }

    int fontStyle = Font.PLAIN;
    Boolean isBold = getBooleanProperty(PROPERTY_FONT_BOLD);
    if (isBold != null) {
        fontStyle = fontStyle | Font.BOLD;
    }
    Boolean isItalic = getBooleanProperty(PROPERTY_FONT_ITALIC);
    if (isItalic != null) {
        fontStyle = fontStyle | Font.ITALIC;
    }

    marker.setLabelFont(FontUtil.getInstance(filler.getJasperReportsContext()).getAwtFontFromBundles(fontName,
            fontStyle, fontSize, filler.getFillContext().getMasterLocale(), true));

    return marker;
}