// Set the spacing between ticks. I hate the name "tickSize" since to me it
// implies I am changing the size of the tick, not the spacing between them.
double tickInterval = jrPlot.getTickIntervalDouble() == null ? 10.0 : jrPlot.getTickIntervalDouble().doubleValue();
chartPlot.setTickSize(tickInterval);
JRFont tickLabelFont = jrPlot.getTickLabelFont();
Integer defaultBaseFontSize = (Integer)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE);
Font themeTickLabelFont = getFont((JRFont)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_TICK_LABEL_FONT), tickLabelFont, defaultBaseFontSize);
chartPlot.setTickLabelFont(themeTickLabelFont);
Color tickColor = jrPlot.getTickColor() == null ? Color.BLACK : jrPlot.getTickColor();
chartPlot.setTickPaint(tickColor);
int dialUnitScale = 1;
Range range = convertRange(jrPlot.getDataRange());
// Set the meter's range
if(range != null)
{
chartPlot.setRange(range);
double bound = Math.max(Math.abs(range.getUpperBound()), Math.abs(range.getLowerBound()));
dialUnitScale = ChartThemesUtilities.getScale(bound);
if((range.getLowerBound() == (int)range.getLowerBound() &&
range.getUpperBound() == (int)range.getUpperBound() &&
tickInterval == (int)tickInterval) ||
dialUnitScale > 1
)
{
chartPlot.setTickLabelFormat(new DecimalFormat("#,##0"));
}
else if(dialUnitScale == 1)
{
chartPlot.setTickLabelFormat(new DecimalFormat("#,##0.0"));
}
else if(dialUnitScale <= 0)
{
chartPlot.setTickLabelFormat(new DecimalFormat("#,##0.00"));
}
}
chartPlot.setTickLabelsVisible(true);
// Set all the colors we support
Paint backgroundPaint = jrPlot.getOwnBackcolor() == null ? ChartThemesConstants.TRANSPARENT_PAINT : jrPlot.getOwnBackcolor();
chartPlot.setBackgroundPaint(backgroundPaint);
GradientPaint gp =
new GradientPaint(
new Point(), Color.LIGHT_GRAY,
new Point(), Color.BLACK,
false
);
if(jrPlot.getMeterBackgroundColor() != null)
{
chartPlot.setDialBackgroundPaint(jrPlot.getMeterBackgroundColor());
}
else
{
chartPlot.setDialBackgroundPaint(gp);
}
//chartPlot.setForegroundAlpha(1f);
Paint needlePaint = jrPlot.getNeedleColor() == null ? new Color(191, 48, 0) : jrPlot.getNeedleColor();
chartPlot.setNeedlePaint(needlePaint);
JRValueDisplay display = jrPlot.getValueDisplay();
if(display != null)
{
Color valueColor = display.getColor() == null ? Color.BLACK : display.getColor();
chartPlot.setValuePaint(valueColor);
String pattern = display.getMask() != null ? display.getMask() : "#,##0.####";
if(pattern != null)
chartPlot.setTickLabelFormat( new DecimalFormat(pattern));
JRFont displayFont = display.getFont();
Font themeDisplayFont = getFont((JRFont)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT), displayFont, defaultBaseFontSize);
if (themeDisplayFont != null)
{
chartPlot.setValueFont(themeDisplayFont);