protected void configureChart(final JFreeChart chart)
{
super.configureChart(chart);
final XYPlot plot = chart.getXYPlot();
final XYItemRenderer renderer = plot.getRenderer();
if (StringUtils.isEmpty(getTooltipFormula()) == false)
{
renderer.setBaseToolTipGenerator(new FormulaXYZTooltipGenerator(getRuntime(), getTooltipFormula()));
}
if (StringUtils.isEmpty(getUrlFormula()) == false)
{
renderer.setURLGenerator(new FormulaXYZURLGenerator(getRuntime(), getUrlFormula()));
}
renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
if (getItemLabelFont() != null)
{
renderer.setBaseItemLabelFont(getItemLabelFont());
}
plot.setOrientation(computePlotOrientation());
// May be an axis that supports dates
final ValueAxis domainAxis = plot.getDomainAxis();
if (domainAxis instanceof NumberAxis)
{
final NumberAxis numberAxis = (NumberAxis) domainAxis;
numberAxis.setAutoRangeIncludesZero(isDomainIncludesZero());
numberAxis.setAutoRangeStickyZero(isDomainStickyZero());
if (getDomainPeriodCount() > 0)
{
if (getDomainTickFormat() != null)
{
numberAxis.setTickUnit(new NumberTickUnit(getDomainPeriodCount(), getDomainTickFormat()));
}
else if (getDomainTickFormatString() != null)
{
final FastDecimalFormat formatter = new FastDecimalFormat
(getDomainTickFormatString(), getResourceBundleFactory().getLocale());
numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount(), formatter));
}
else
{
numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount()));
}
}
else
{
if (getDomainTickFormat() != null)
{
numberAxis.setNumberFormatOverride(getDomainTickFormat());
}
else if (getDomainTickFormatString() != null)
{
final DecimalFormat formatter = new DecimalFormat
(getDomainTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
numberAxis.setNumberFormatOverride(formatter);
}
}
}
else if (domainAxis instanceof DateAxis)
{
final DateAxis numberAxis = (DateAxis) domainAxis;
if (getDomainPeriodCount() > 0 && getDomainTimePeriod() != null)
{
if (getDomainTickFormatString() != null)
{
final SimpleDateFormat formatter = new SimpleDateFormat
(getDomainTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
numberAxis.setTickUnit
(new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount(), formatter));
}
else
{
numberAxis.setTickUnit
(new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount()));
}
}
}
if (domainAxis != null)
{
domainAxis.setLabel(getDomainTitle());
if (getDomainTitleFont() != null)
{
domainAxis.setLabelFont(getDomainTitleFont());
}
domainAxis.setVerticalTickLabels(isDomainVerticalTickLabels());
if (getDomainTickFont() != null)
{
domainAxis.setTickLabelFont(getDomainTickFont());
}
final int level = getRuntime().getProcessingContext().getCompatibilityLevel();
if (ClassicEngineBoot.isEnforceCompatibilityFor(level, 3, 8))
{
if (getDomainMinimum() != 0)
{
domainAxis.setLowerBound(getDomainMinimum());
}
if (getDomainMaximum() != 1)
{
domainAxis.setUpperBound(getDomainMaximum());
}
if (getDomainMinimum() == 0 && getDomainMaximum() == 0)
{
domainAxis.setLowerBound(0);
domainAxis.setUpperBound(1);
domainAxis.setAutoRange(true);
}
}
else
{
domainAxis.setLowerBound(getDomainMinimum());
domainAxis.setUpperBound(getDomainMaximum());
domainAxis.setAutoRange(isDomainAxisAutoRange());
}
}
final ValueAxis rangeAxis = plot.getRangeAxis();
if (rangeAxis instanceof NumberAxis)
{
final NumberAxis numberAxis = (NumberAxis) rangeAxis;
numberAxis.setAutoRangeIncludesZero(isRangeIncludesZero());
numberAxis.setAutoRangeStickyZero(isRangeStickyZero());