Class GenericChartTheme
java.lang.Object
net.sf.jasperreports.chartthemes.spring.GenericChartTheme
- All Implemented Interfaces:
ChartTheme
- Direct Known Subclasses:
AegeanChartTheme,EyeCandySixtiesChartTheme
- Author:
- Sanda Zaharia (shertage@users.sourceforge.net)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ThreadLocal<ChartContext> protected ThreadLocal<FontUtil> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateTickUnits(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, String timePeriodUnit) 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, Paint lineColor, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) Sets all the axis formatting options.protected voidconfigureChart(org.jfree.chart.JFreeChart jfreeChart, JRChartPlot jrPlot) protected voidconfigurePlot(org.jfree.chart.plot.Plot p, JRChartPlot jrPlot) 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.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartorg.jfree.chart.JFreeChartcreateChart(ChartContext chartContext) protected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartBuild and configure a meter chart.protected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartBuild and run a thermometer chart.protected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected org.jfree.chart.JFreeChartprotected final ObjectevaluateExpression(JRExpression expression) protected final StringevaluateTextExpression(JRExpression expression) protected JRChartgetChart()protected org.jfree.chart.axis.AxisLocationgetChartAxisLocation(JRChartAxis chartAxis) Specifies the axis location.protected ChartContextprotected org.jfree.data.general.Datasetprotected ObjectgetDefaultValue(Map<String, ?> map, Object key) protected JRFontprotected Fontprotected Objectprotected Localeprotected JRChartPlotgetPlot()protected org.jfree.chart.axis.DateTickUnitTypegetTimePeriodUnit(String timePeriodUnit) Returns the specific org.jfree.chart.axis.DateTickUnit time unit constant related to the String value passed as argumentprotected voidhandleCategoryPlotSettings(org.jfree.chart.plot.CategoryPlot p, JRChartPlot jrPlot) protected booleanSpecifies whether a chart legend should be visible or no by default.protected voidpopulateSeriesColors(Paint[] colors, Paint[] colorSequence) protected voidsetAxisBounds(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, String timePeriodUnit, Comparable<?> minValue, Comparable<?> maxValue) protected voidsetAxisLabel(org.jfree.chart.axis.Axis axis, JRFont labelFont, Paint labelColor, Integer baseFontSize) protected voidsetAxisLine(org.jfree.chart.axis.Axis axis, Paint lineColor) protected voidsetAxisTickLabels(org.jfree.chart.axis.Axis axis, JRFont tickLabelFont, Paint tickLabelColor, String tickLabelMask, Integer baseFontSize) protected voidsetAxisTickMarks(org.jfree.chart.axis.Axis axis, Paint lineColor) protected voidsetChartBackground(org.jfree.chart.JFreeChart jfreeChart) protected voidsetChartBackgroundImage(org.jfree.chart.JFreeChart jfreeChart, Image defaultBackgroundImage, Integer defaultBackgroundImageAlignment, Float defaultBackgroundImageAlpha) protected voidsetChartBorder(org.jfree.chart.JFreeChart jfreeChart) protected voidsetChartLegend(org.jfree.chart.JFreeChart jfreeChart, Integer baseFontSize) protected voidsetChartSubtitles(org.jfree.chart.JFreeChart jfreeChart, Integer baseFontSize) protected voidsetChartTitle(org.jfree.chart.JFreeChart jfreeChart, Integer baseFontSize) voidsetDefaultAxisPropertiesMap(Map<String, ?> defaultAxisPropertiesMap) voidsetDefaultChartPropertiesMap(Map<String, ?> defaultChartPropertiesMap) voidsetDefaultChartTypePropertiesMap(Map<String, ?> defaultChartTypePropertiesMap) voidsetDefaultPlotPropertiesMap(Map<String, ?> defaultPlotPropertiesMap) protected voidsetPlotBackground(org.jfree.chart.plot.Plot p, JRChartPlot jrPlot) protected voidsetPlotDrawingDefaults(org.jfree.chart.plot.Plot p, JRChartPlot jrPlot)
-
Field Details
-
defaultChartPropertiesMap
-
defaultPlotPropertiesMap
-
defaultAxisPropertiesMap
-
defaultChartTypePropertiesMap
-
threadLocalChartContext
-
threadLocalFontUtil
-
-
Constructor Details
-
GenericChartTheme
protected GenericChartTheme()
-
-
Method Details
-
getChartContext
-
getChart
-
getPlot
-
getDataset
protected org.jfree.data.general.Dataset getDataset() -
getLabelGenerator
-
getLocale
-
evaluateExpression
- Throws:
JRException
-
evaluateTextExpression
- Throws:
JRException
-
createChart
- Specified by:
createChartin interfaceChartTheme- Returns:
- an
org.jfree.chart.JFreeChartobject representing the chart - Throws:
JRException
-
configureChart
protected void configureChart(org.jfree.chart.JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException - Throws:
JRException
-
configurePlot
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) throws JRException 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 marksisRangeAxis- used to distinguish between range and domain axis type- Throws:
JRException
-
createAreaChart
- Throws:
JRException
-
createBar3DChart
- Throws:
JRException
-
createBarChart
- Throws:
JRException
-
createBubbleChart
- Throws:
JRException
-
createCandlestickChart
- Throws:
JRException
-
createHighLowChart
- Throws:
JRException
-
createLineChart
- Throws:
JRException
-
createPie3DChart
- Throws:
JRException
-
createPieChart
- Throws:
JRException
-
createScatterChart
- Throws:
JRException
-
createStackedBar3DChart
- Throws:
JRException
-
createStackedBarChart
- Throws:
JRException
-
createStackedAreaChart
- Throws:
JRException
-
createXyAreaChart
- Throws:
JRException
-
createXYBarChart
- Throws:
JRException
-
createXyLineChart
- Throws:
JRException
-
createTimeSeriesChart
- Throws:
JRException
-
createGanttChart
- Throws:
JRException
-
convertRange
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
Build and configure a meter chart.- Throws:
JRException
-
createThermometerChart
Build 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
- Throws:
JRException
-
getChartAxisLocation
Specifies the axis location. It has to be overridden for child themes with another default axis location -
populateSeriesColors
-
setChartBackground
protected void setChartBackground(org.jfree.chart.JFreeChart jfreeChart) -
setChartBackgroundImage
-
setChartTitle
-
setChartSubtitles
protected void setChartSubtitles(org.jfree.chart.JFreeChart jfreeChart, Integer baseFontSize) throws JRException - Throws:
JRException
-
setChartLegend
-
setChartBorder
protected void setChartBorder(org.jfree.chart.JFreeChart jfreeChart) -
setPlotBackground
-
handleCategoryPlotSettings
-
setPlotDrawingDefaults
-
setAxisLine
-
setAxisLabel
-
setAxisTickLabels
-
setAxisTickMarks
-
setAxisBounds
protected void setAxisBounds(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, String timePeriodUnit, Comparable<?> minValue, Comparable<?> maxValue) throws JRException - Throws:
JRException
-
calculateTickUnits
protected void calculateTickUnits(org.jfree.chart.axis.Axis axis, boolean isRangeAxis, String timePeriodUnit) 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. -
getTimePeriodUnit
Returns the specific org.jfree.chart.axis.DateTickUnit time unit constant related to the String value passed as argument- Parameters:
timePeriodUnit- - a String represented by one of the following accepted values: ["Year", "Month", "Day", "Hour", "Minute", "Second", "Millisecond"]- Returns:
- the specific org.jfree.chart.axis.DateTickUnit time unit constant
-
getDefaultValue
-
getFont
-
getFont
-
getDefaultChartPropertiesMap
- Returns:
- the defaultChartPropertiesMap
-
setDefaultChartPropertiesMap
- Parameters:
defaultChartPropertiesMap- the defaultChartPropertiesMap to set
-
getDefaultPlotPropertiesMap
- Returns:
- the defaultPlotPropertiesMap
-
setDefaultPlotPropertiesMap
- Parameters:
defaultPlotPropertiesMap- the defaultPlotPropertiesMap to set
-
getDefaultAxisPropertiesMap
- Returns:
- the defaultAxisPropertiesMap
-
setDefaultAxisPropertiesMap
- Parameters:
defaultAxisPropertiesMap- the defaultAxisPropertiesMap to set
-
getDefaultChartTypePropertiesMap
- Returns:
- the defaultChartTypePropertiesMap
-
setDefaultChartTypePropertiesMap
- Parameters:
defaultChartTypePropertiesMap- the defaultChartTypePropertiesMap to set
-