String defaultRenderType,
String datasetType
)
{
SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent();
ChartSettings chartSettings = chartComponent.getChartSettings();
SpiderPlot plot = (SpiderPlot)chartComponent.getPlot();
DefaultCategoryDataset dataset = null;
StandardCategoryItemLabelGenerator labelGenerator = null;
if(FILL_DATASET.equals(datasetType))
{
dataset = ((FillSpiderDataset)spiderchartBean.getDataset()).getCustomDataset();
labelGenerator = ((FillSpiderDataset)spiderchartBean.getDataset()).getLabelGenerator();
}
else
{
dataset = getSampleDataset();
labelGenerator = new StandardCategoryItemLabelGenerator();
}
SpiderWebPlot spiderWebPlot = new SpiderWebPlot(dataset);
if(plot.getAxisLineColor() != null)
{
spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor());
}
if(plot.getAxisLineWidth() != null)
{
spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth()));
}
if(plot.getBackcolor() != null)
{
spiderWebPlot.setBackgroundPaint(plot.getBackcolor());
}
if(plot.getBackgroundAlpha() != null)
{
spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha());
}
if(plot.getForegroundAlpha() != null)
{
spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha());
}
if(plot.getHeadPercent() != null)
{
spiderWebPlot.setHeadPercent(plot.getHeadPercent());
}
if(plot.getInteriorGap() != null)
{
spiderWebPlot.setInteriorGap(plot.getInteriorGap());
}
if(plot.getLabelColor() != null)
{
spiderWebPlot.setLabelPaint(plot.getLabelColor());
}
if(plot.getLabelFont() != null)
{
spiderWebPlot.setLabelFont(JRFontUtil.getAwtFont(plot.getLabelFont(), Locale.getDefault()));
}
if(plot.getLabelGap() != null)
{
spiderWebPlot.setAxisLabelGap(plot.getLabelGap());
}
if(spiderchartBean.getMaxValue() != null)
{
spiderWebPlot.setMaxValue(spiderchartBean.getMaxValue());
}
if(plot.getRotation() != null)
{
spiderWebPlot.setDirection(plot.getRotation().getRotation());
}
if(plot.getStartAngle() != null)
{
spiderWebPlot.setStartAngle(plot.getStartAngle());
}
if(plot.getTableOrder() != null)
{
spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder());
}
if(plot.getWebFilled() != null)
{
spiderWebPlot.setWebFilled(plot.getWebFilled());
}
spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
spiderWebPlot.setLabelGenerator(labelGenerator);
Font titleFont = chartSettings.getTitleFont() != null
? JRFontUtil.getAwtFont(chartSettings.getTitleFont(), Locale.getDefault())
: TextTitle.DEFAULT_FONT;
String titleText = spiderchartBean.getTitleText();
JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true);
Color backcolor = chartSettings.getBackcolor() != null ? chartSettings.getBackcolor() : element.getBackcolor();
if(backcolor != null)
{
jfreechart.setBackgroundPaint(backcolor);
}
RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP);
if (titleText != null)
{
TextTitle title = jfreechart.getTitle();
title.setText(titleText);
if(chartSettings.getTitleColor() != null)
{
title.setPaint(chartSettings.getTitleColor());
}
title.setFont(titleFont);
title.setPosition(titleEdge);
jfreechart.setTitle(title);
}
String subtitleText = spiderchartBean.getSubtitleText();
if (subtitleText != null)
{
TextTitle subtitle = new TextTitle(subtitleText);
subtitle.setText(subtitleText);
if(chartSettings.getSubtitleColor() != null)
{
subtitle.setPaint(chartSettings.getSubtitleColor());
}
if(chartSettings.getSubtitleColor() != null)
{
Font subtitleFont = chartSettings.getSubtitleFont() != null
? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault())
: TextTitle.DEFAULT_FONT;
subtitle.setFont(subtitleFont);
}
subtitle.setPosition(titleEdge);
jfreechart.addSubtitle(subtitle);
}
// Apply all of the legend formatting options
LegendTitle legend = jfreechart.getLegend();
if (legend != null)
{
legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend()));
if (legend.isVisible())
{
if(chartSettings.getLegendColor() != null)
{
legend.setItemPaint(chartSettings.getLegendColor());
}
if (chartSettings.getLegendBackgroundColor() != null)
{
legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor());
}
if(chartSettings.getLegendFont() != null)
{
legend.setItemFont(JRFontUtil.getAwtFont(chartSettings.getLegendFont(), Locale.getDefault()));
}
legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM));
}
}
String renderType = chartSettings.getRenderType() == null ? defaultRenderType : chartSettings.getRenderType();
Rectangle2D rectangle = new Rectangle2D.Double(0,0,element.getWidth(),element.getHeight());
if (chartCustomizer != null)
{
chartCustomizer.customize(jfreechart, chartComponent);