if(subtitleVisibility != null && subtitleVisibility.booleanValue())
{
String subtitleText = (String)evaluateExpression(getChart().getSubtitleExpression());
if (subtitleText != null)
{
TextTitle subtitle = new TextTitle(subtitleText);
Font themeSubtitleFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FONT), getChart().getSubtitleFont(), baseFontSize);
subtitle.setFont(themeSubtitleFont);
HorizontalAlignment defaultSubtitleHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_HORIZONTAL_ALIGNMENT);
if(defaultSubtitleHAlignment != null)
subtitle.setHorizontalAlignment(defaultSubtitleHAlignment);
VerticalAlignment defaultSubtitleVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VERTICAL_ALIGNMENT);
if(defaultSubtitleVAlignment != null)
subtitle.setVerticalAlignment(defaultSubtitleVAlignment);
RectangleInsets defaultSubtitlePadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_PADDING);
RectangleInsets subtitlePadding = subtitle.getPadding() != null ? subtitle.getPadding() : defaultSubtitlePadding;
if(subtitlePadding != null)
subtitle.setPadding(subtitlePadding);
Color subtitleForecolor = getChart().getOwnSubtitleColor() != null ?
getChart().getOwnSubtitleColor() :
(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) :
getChart().getSubtitleColor());
if(subtitleForecolor != null)
subtitle.setPaint(subtitleForecolor);
Color subtitleBackcolor = getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) :
null;
if(subtitleBackcolor != null)
subtitle.setBackgroundPaint(subtitleBackcolor);
RectangleEdge defaultSubtitlePosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_POSITION);
//Subtitle has not its own position set, and by default this will be set the same as title position
RectangleEdge subtitleEdge = null;
if(defaultSubtitlePosition == null)
{
subtitleEdge = jfreeChart.getTitle().getPosition();
}
else
{
subtitleEdge = defaultSubtitlePosition;
}
if(subtitleEdge != null)
subtitle.setPosition(subtitleEdge);
jfreeChart.addSubtitle(subtitle);
}
}
}