Example usage for org.jfree.chart.title TextTitle TextTitle

List of usage examples for org.jfree.chart.title TextTitle TextTitle

Introduction

In this page you can find the example usage for org.jfree.chart.title TextTitle TextTitle.

Prototype

public TextTitle(String text) 

Source Link

Document

Creates a new title, using default attributes where necessary.

Usage

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected void setChartSubtitles(JFreeChart jfreeChart) throws JRException {
    TitleSettings subtitleSettings = getSubtitleSettings();

    Boolean subtitleVisibility = subtitleSettings.getShowTitle();

    if (subtitleVisibility == null || subtitleVisibility) {
        String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
        if (subtitleText != null) {
            TextTitle subtitle = new TextTitle(subtitleText);
            Paint subtitleForecolor = getChart().getOwnSubtitleColor() != null
                    ? getChart().getOwnSubtitleColor()
                    : subtitleSettings.getForegroundPaint() != null
                            ? subtitleSettings.getForegroundPaint().getPaint()
                            : getChart().getSubtitleColor();
            //Subtitle has not its own position set, and by default this will be set the same as title position
            RectangleEdge subtitleEdge = getEdge(subtitleSettings.getPositionValue(),
                    jfreeChart.getTitle() == null ? null : jfreeChart.getTitle().getPosition());
            handleTitleSettings(subtitle, subtitleSettings, getChart().getSubtitleFont(), subtitleForecolor,
                    subtitleEdge);/*w w w  . java2 s  .  c om*/

            jfreeChart.addSubtitle(subtitle);
        }
    }
}