Package net.sf.jasperreports.engine.fill
Class DefaultChartTheme
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.DefaultChartTheme
-
- All Implemented Interfaces:
ChartTheme
public class DefaultChartTheme extends Object implements ChartTheme
- Author:
- Teodor Danciu (teodord@users.sourceforge.net), Some enhancements by Barry Klawans (bklawans@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static ChartThemeBundleBUNDLEstatic StringEXCEPTION_MESSAGE_KEY_UNSUPPORTED_CHART_TYPEstatic StringPROPERTY_DIAL_LABELstatic StringPROPERTY_DIAL_VALUE_DISPLAY_VISIBLEstatic StringPROPERTY_DOMAIN_AXIS_INTEGER_UNITstatic StringPROPERTY_DOMAIN_AXIS_TICK_COUNTstatic StringPROPERTY_DOMAIN_AXIS_TICK_INTERVALstatic StringPROPERTY_RANGE_AXIS_INTEGER_UNITstatic StringPROPERTY_RANGE_AXIS_TICK_COUNTstatic StringPROPERTY_RANGE_AXIS_TICK_INTERVALprotected static ColorTRANSPARENT_PAINT
-
Constructor Summary
Constructors Constructor Description DefaultChartTheme()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateTickUnits(org.jfree.chart.axis.Axis axis, boolean isRangeAxis)For a given axis, adjust the tick unit size, in order to have a customizable number of ticks on that axisprotected voidconfigureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Color lineColor, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)Sets all the axis formatting options.protected voidconfigureChart(org.jfree.chart.JFreeChart jfreeChart)protected voidconfigurePlot(org.jfree.chart.plot.Plot plot)protected org.jfree.chart.plot.MeterIntervalconvertInterval(JRMeterInterval interval)Converts a JasperReports meter interval to one that JFreeChart understands.protected org.jfree.data.RangeconvertRange(JRDataRange dataRange)Converts a JasperReport data range into one understood by JFreeChart.protected org.jfree.chart.JFreeChartcreateAreaChart()protected org.jfree.chart.JFreeChartcreateBar3DChart()protected org.jfree.chart.JFreeChartcreateBarChart()protected org.jfree.chart.JFreeChartcreateBubbleChart()protected org.jfree.chart.JFreeChartcreateCandlestickChart()org.jfree.chart.JFreeChartcreateChart(ChartContext chartContext)protected org.jfree.chart.JFreeChartcreateDialChart()protected org.jfree.chart.JFreeChartcreateGanttChart()protected org.jfree.chart.JFreeChartcreateHighLowChart()protected org.jfree.chart.JFreeChartcreateLineChart()protected org.jfree.chart.JFreeChartcreateMeterChart()protected org.jfree.chart.JFreeChartcreatePie3DChart()protected org.jfree.chart.JFreeChartcreatePieChart()protected org.jfree.chart.JFreeChartcreateScatterChart()protected org.jfree.chart.JFreeChartcreateStackedAreaChart()protected org.jfree.chart.JFreeChartcreateStackedBar3DChart()protected org.jfree.chart.JFreeChartcreateStackedBarChart()protected org.jfree.chart.JFreeChartcreateThermometerChart()Build and run a thermometer chart.protected org.jfree.chart.JFreeChartcreateTimeSeriesChart()protected org.jfree.chart.JFreeChartcreateXyAreaChart()protected org.jfree.chart.JFreeChartcreateXYBarChart()protected org.jfree.chart.JFreeChartcreateXyLineChart()protected ObjectevaluateExpression(JRExpression expression)protected StringevaluateTextExpression(JRExpression expression)protected JRChartgetChart()protected org.jfree.chart.axis.AxisLocationgetChartAxisLocation(JRChartAxis chartAxis)Specifies the axis location.protected org.jfree.data.general.DatasetgetDataset()protected JRFontgetFont(JRFont font)protected ObjectgetLabelGenerator()protected LocalegetLocale()protected JRChartPlotgetPlot()protected booleanisShowLegend()Specifies whether a chart legend should be visible or no by default.protected voidsetAxisBounds(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_UNSUPPORTED_CHART_TYPE
public static final String EXCEPTION_MESSAGE_KEY_UNSUPPORTED_CHART_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_DIAL_VALUE_DISPLAY_VISIBLE
public static final String PROPERTY_DIAL_VALUE_DISPLAY_VISIBLE
- See Also:
- Constant Field Values
-
PROPERTY_DIAL_LABEL
public static final String PROPERTY_DIAL_LABEL
- See Also:
- Constant Field Values
-
PROPERTY_RANGE_AXIS_TICK_COUNT
public static final String PROPERTY_RANGE_AXIS_TICK_COUNT
- See Also:
- Constant Field Values
-
PROPERTY_RANGE_AXIS_TICK_INTERVAL
public static final String PROPERTY_RANGE_AXIS_TICK_INTERVAL
- See Also:
- Constant Field Values
-
PROPERTY_RANGE_AXIS_INTEGER_UNIT
public static final String PROPERTY_RANGE_AXIS_INTEGER_UNIT
- See Also:
- Constant Field Values
-
PROPERTY_DOMAIN_AXIS_TICK_COUNT
public static final String PROPERTY_DOMAIN_AXIS_TICK_COUNT
- See Also:
- Constant Field Values
-
PROPERTY_DOMAIN_AXIS_TICK_INTERVAL
public static final String PROPERTY_DOMAIN_AXIS_TICK_INTERVAL
- See Also:
- Constant Field Values
-
PROPERTY_DOMAIN_AXIS_INTEGER_UNIT
public static final String PROPERTY_DOMAIN_AXIS_INTEGER_UNIT
- See Also:
- Constant Field Values
-
TRANSPARENT_PAINT
protected static final Color TRANSPARENT_PAINT
-
BUNDLE
public static final ChartThemeBundle BUNDLE
-
-
Method Detail
-
getChart
protected JRChart getChart()
-
getPlot
protected JRChartPlot getPlot()
-
getDataset
protected org.jfree.data.general.Dataset getDataset()
-
getLabelGenerator
protected Object getLabelGenerator()
-
getLocale
protected Locale getLocale()
-
evaluateTextExpression
protected final String evaluateTextExpression(JRExpression expression) throws JRException
- Throws:
JRException
-
evaluateExpression
protected final Object evaluateExpression(JRExpression expression) throws JRException
- Throws:
JRException
-
createChart
public org.jfree.chart.JFreeChart createChart(ChartContext chartContext) throws JRException
- Specified by:
createChartin interfaceChartTheme- Returns:
- an
org.jfree.chart.JFreeChartobject representing the chart - Throws:
JRException
-
configureChart
protected void configureChart(org.jfree.chart.JFreeChart jfreeChart) throws JRException- Throws:
JRException
-
configurePlot
protected void configurePlot(org.jfree.chart.plot.Plot plot)
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Color lineColor, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)Sets all the axis formatting options. This includes the colors and fonts to use on the axis as well as the color to use when drawing the axis line.- Parameters:
axis- the axis to formatlabelFont- the font to use for the axis labellabelColor- the color of the axis labeltickLabelFont- the font to use for each tick mark value labeltickLabelColor- the color of each tick mark value labeltickLabelMask- formatting mask for the label. If the axis is a NumberAxis then the mask should bejava.text.DecimalFormatmask, and if it is a DateAxis then the mask should be ajava.text.SimpleDateFormatmask.verticalTickLabels- flag to draw tick labels at 90 degreeslineColor- color to use when drawing the axis line and any tick marks
-
createAreaChart
protected org.jfree.chart.JFreeChart createAreaChart() throws JRException- Throws:
JRException
-
createBar3DChart
protected org.jfree.chart.JFreeChart createBar3DChart() throws JRException- Throws:
JRException
-
createBarChart
protected org.jfree.chart.JFreeChart createBarChart() throws JRException- Throws:
JRException
-
createBubbleChart
protected org.jfree.chart.JFreeChart createBubbleChart() throws JRException- Throws:
JRException
-
createCandlestickChart
protected org.jfree.chart.JFreeChart createCandlestickChart() throws JRException- Throws:
JRException
-
createHighLowChart
protected org.jfree.chart.JFreeChart createHighLowChart() throws JRException- Throws:
JRException
-
createLineChart
protected org.jfree.chart.JFreeChart createLineChart() throws JRException- Throws:
JRException
-
createPie3DChart
protected org.jfree.chart.JFreeChart createPie3DChart() throws JRException- Throws:
JRException
-
createPieChart
protected org.jfree.chart.JFreeChart createPieChart() throws JRException- Throws:
JRException
-
createScatterChart
protected org.jfree.chart.JFreeChart createScatterChart() throws JRException- Throws:
JRException
-
createStackedBar3DChart
protected org.jfree.chart.JFreeChart createStackedBar3DChart() throws JRException- Throws:
JRException
-
createStackedBarChart
protected org.jfree.chart.JFreeChart createStackedBarChart() throws JRException- Throws:
JRException
-
createStackedAreaChart
protected org.jfree.chart.JFreeChart createStackedAreaChart() throws JRException- Throws:
JRException
-
createXyAreaChart
protected org.jfree.chart.JFreeChart createXyAreaChart() throws JRException- Throws:
JRException
-
createXYBarChart
protected org.jfree.chart.JFreeChart createXYBarChart() throws JRException- Throws:
JRException
-
createXyLineChart
protected org.jfree.chart.JFreeChart createXyLineChart() throws JRException- Throws:
JRException
-
createTimeSeriesChart
protected org.jfree.chart.JFreeChart createTimeSeriesChart() throws JRException- Throws:
JRException
-
createGanttChart
protected org.jfree.chart.JFreeChart createGanttChart() throws JRException- Throws:
JRException
-
convertRange
protected org.jfree.data.Range convertRange(JRDataRange dataRange) throws JRException
Converts a JasperReport data range into one understood by JFreeChart.- Parameters:
dataRange- the JasperReport version of the range- Returns:
- the JFreeChart version of the range
- Throws:
JRException- thrown when the low value of the range is greater than the high value
-
convertInterval
protected org.jfree.chart.plot.MeterInterval convertInterval(JRMeterInterval interval) throws JRException
Converts a JasperReports meter interval to one that JFreeChart understands.- Parameters:
interval- the JasperReports definition of an interval- Returns:
- the JFreeChart version of the same interval
- Throws:
JRException- thrown when the interval contains an invalid range
-
createMeterChart
protected org.jfree.chart.JFreeChart createMeterChart() throws JRException- Throws:
JRException
-
createThermometerChart
protected org.jfree.chart.JFreeChart createThermometerChart() throws JRExceptionBuild and run a thermometer chart. JFreeChart thermometer charts have some limitations. They always have a maximum of three ranges, and the colors of those ranges seems to be fixed.- Throws:
JRException
-
createDialChart
protected org.jfree.chart.JFreeChart createDialChart() throws JRException- Throws:
JRException
-
getChartAxisLocation
protected org.jfree.chart.axis.AxisLocation getChartAxisLocation(JRChartAxis chartAxis)
Specifies the axis location. It has to be overridden for child themes with another default axis location
-
setAxisBounds
protected void setAxisBounds(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)
-
calculateTickUnits
protected void calculateTickUnits(org.jfree.chart.axis.Axis axis, boolean isRangeAxis)For a given axis, adjust the tick unit size, in order to have a customizable number of ticks on that axis
-
isShowLegend
protected boolean isShowLegend()
Specifies whether a chart legend should be visible or no by default. It has to be overridden for child themes which don't show chart legends
-
-