{
final StandardCategoryItemLabelGenerator scilg;
if (categoricalLabelDecimalFormat != null)
{
scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
new DecimalFormat(categoricalLabelDecimalFormat));
}
else if (categoricalLabelDateFormat != null)
{
scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
new SimpleDateFormat(categoricalLabelDateFormat));
}
else
{
scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, new DecimalFormat());
}
renderer.setBaseItemLabelGenerator(scilg);
}
renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
if (getItemLabelFont() != null)
{
renderer.setBaseItemLabelFont(getItemLabelFont());
}
if (categoricalItemLabelRotation != null)
{
final ItemLabelPosition orgPosItemLabelPos = renderer.getBasePositiveItemLabelPosition();
if (orgPosItemLabelPos == null)
{
final ItemLabelPosition pos2 = new ItemLabelPosition
(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
renderer.setBasePositiveItemLabelPosition(pos2);
}
else
{
final ItemLabelPosition pos2 = new ItemLabelPosition
(orgPosItemLabelPos.getItemLabelAnchor(), orgPosItemLabelPos.getTextAnchor(),
orgPosItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
renderer.setBasePositiveItemLabelPosition(pos2);
}
final ItemLabelPosition orgNegItemLabelPos = renderer.getBaseNegativeItemLabelPosition();
if (orgNegItemLabelPos == null)
{
final ItemLabelPosition pos2 = new ItemLabelPosition
(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
renderer.setBaseNegativeItemLabelPosition(pos2);
}
else
{
final ItemLabelPosition neg2 = new ItemLabelPosition
(orgNegItemLabelPos.getItemLabelAnchor(), orgNegItemLabelPos.getTextAnchor(),
orgNegItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
renderer.setBaseNegativeItemLabelPosition(neg2);
}
}
final Font labelFont = Font.decode(getLabelFont());
final CategoryAxis categoryAxis = cpl.getDomainAxis();
categoryAxis.setLabelFont(labelFont);
categoryAxis.setTickLabelFont(labelFont);
if (getCategoryTitleFont() != null)
{
categoryAxis.setLabelFont(getCategoryTitleFont());
}
if (getCategoryTickFont() != null)
{
categoryAxis.setTickLabelFont(getCategoryTickFont());
}
if (maxCategoryLabelWidthRatio != null)
{
categoryAxis.setMaximumCategoryLabelWidthRatio(maxCategoryLabelWidthRatio.floatValue());
}
cpl.setDomainGridlinesVisible(showGridlines);
if (labelRotation != null)
{
categoryAxis.setCategoryLabelPositions
(CategoryLabelPositions.createUpRotationLabelPositions(labelRotation.doubleValue()));
}
final String[] colors = getSeriesColor();
for (int i = 0; i < colors.length; i++)
{
renderer.setSeriesPaint(i, parseColorFromString(colors[i]));
}
if (lowerMargin != null)
{
categoryAxis.setLowerMargin(lowerMargin.doubleValue());
}
if (upperMargin != null)
{
categoryAxis.setUpperMargin(upperMargin.doubleValue());
}
if (categoryMargin != null)
{
categoryAxis.setCategoryMargin(categoryMargin.doubleValue());
}
final ValueAxis rangeAxis = cpl.getRangeAxis();
if (rangeAxis instanceof NumberAxis)
{
final NumberAxis numberAxis = (NumberAxis) rangeAxis;
if (getRangePeriodCount() > 0)
{
if (getRangeTickFormat() != null)
{
numberAxis.setTickUnit(new NumberTickUnit(getRangePeriodCount(), getRangeTickFormat()));
}
else if (getRangeTickFormatString() != null)
{
final FastDecimalFormat formatter = new FastDecimalFormat
(getRangeTickFormatString(), getResourceBundleFactory().getLocale());
numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount(), formatter));
}
else
{
numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount()));
}
}
else
{
if (getRangeTickFormat() != null)
{
numberAxis.setNumberFormatOverride(getRangeTickFormat());
}
else if (getRangeTickFormatString() != null)
{
final DecimalFormat formatter = new DecimalFormat
(getRangeTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
numberAxis.setNumberFormatOverride(formatter);
}
}
}