/**
*
*/
protected JFreeChart createThermometerChart() throws JRException
{
JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();
// Create the plot that will hold the thermometer.
ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());
// Build a chart around this plot
JFreeChart jfreeChart = new JFreeChart(chartPlot);
// Set the generic options
configureChart(jfreeChart, getPlot());
jfreeChart.setBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
jfreeChart.setBorderVisible(false);
Range range = convertRange(jrPlot.getDataRange());
if(range != null)
{
// Set the boundary of the thermomoter
chartPlot.setLowerBound(range.getLowerBound());
chartPlot.setUpperBound(range.getUpperBound());
}
chartPlot.setGap(0);
// Units can only be Fahrenheit, Celsius or none, so turn off for now.
chartPlot.setUnits(ThermometerPlot.UNITS_NONE);
// Set the color of the mercury. Only used when the value is outside of
// any defined ranges.
List seriesPaints = (List)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
Paint paint = jrPlot.getMercuryColor();
if(paint != null)
{
chartPlot.setUseSubrangePaint(false);
}
else
{
//it has no effect, but is kept for backward compatibility reasons
paint = (Paint)seriesPaints.get(0);
}
chartPlot.setMercuryPaint(paint);
chartPlot.setThermometerPaint(THERMOMETER_COLOR);
chartPlot.setThermometerStroke(new BasicStroke(2f));
chartPlot.setOutlineVisible(false);
chartPlot.setValueFont(chartPlot.getValueFont().deriveFont(Font.BOLD));
// Set the formatting of the value display
JRValueDisplay display = jrPlot.getValueDisplay();
if (display != null)
{
if (display.getColor() != null)
{
chartPlot.setValuePaint(display.getColor());
}
if (display.getMask() != null)
{
chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
}
if (display.getFont() != null)
{
// chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont()).deriveFont(Font.BOLD));
}
}
// Set the location of where the value is displayed
// Set the location of where the value is displayed
ValueLocationEnum valueLocation = jrPlot.getValueLocationValue();
switch (valueLocation)
{
case NONE:
chartPlot.setValueLocation(ThermometerPlot.NONE);
break;
case LEFT:
chartPlot.setValueLocation(ThermometerPlot.LEFT);
break;
case RIGHT:
chartPlot.setValueLocation(ThermometerPlot.RIGHT);
break;
case BULB:
default:
chartPlot.setValueLocation(ThermometerPlot.BULB);
break;
}
// Define the three ranges
range = convertRange(jrPlot.getLowRange());
if (range != null)
{
chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
}
range = convertRange(jrPlot.getMediumRange());
if (range != null)
{
chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
}
range = convertRange(jrPlot.getHighRange());
if (range != null)
{
chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
}