Class SimpleChartTheme
- java.lang.Object
-
- net.sf.jasperreports.chartthemes.simple.SimpleChartTheme
-
- All Implemented Interfaces:
ChartTheme
- Direct Known Subclasses:
XmlChartTheme
public class SimpleChartTheme extends Object implements ChartTheme
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected ChartThemeSettings
chartThemeSettings
protected ThreadLocal<ChartContext>
threadLocalChartContext
protected ThreadLocal<FontUtil>
threadLocalFontUtil
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleChartTheme()
SimpleChartTheme(ChartThemeSettings chartThemeSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
calculateTickUnits(org.jfree.chart.axis.Axis axis, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriodUnitx)
For a given axis, adjust the tick unit size, in order to have a customizable number of ticks on that axisprotected void
configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)
Sets all the axis formatting options.protected void
configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriod, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)
Sets all the axis formatting options.protected void
configureChart(org.jfree.chart.JFreeChart jfreeChart, JRChartPlot jrPlot)
protected void
configurePlot(org.jfree.chart.plot.Plot plot, JRChartPlot jrPlot)
protected org.jfree.chart.plot.MeterInterval
convertInterval(JRMeterInterval interval)
Converts a JasperReports meter interval to one that JFreeChart understands.protected org.jfree.data.Range
convertRange(JRDataRange dataRange)
Converts a JasperReport data range into one understood by JFreeChart.protected org.jfree.chart.JFreeChart
createAreaChart()
protected org.jfree.chart.JFreeChart
createBar3DChart()
protected org.jfree.chart.JFreeChart
createBarChart()
protected org.jfree.chart.JFreeChart
createBubbleChart()
protected org.jfree.chart.JFreeChart
createCandlestickChart()
org.jfree.chart.JFreeChart
createChart(ChartContext chartContext)
protected org.jfree.chart.JFreeChart
createDialChart()
protected org.jfree.chart.JFreeChart
createGanttChart()
protected org.jfree.chart.JFreeChart
createHighLowChart()
protected org.jfree.chart.JFreeChart
createLineChart()
protected org.jfree.chart.JFreeChart
createMeterChart()
Build and configure a meter chart.protected org.jfree.chart.JFreeChart
createPie3DChart()
protected org.jfree.chart.JFreeChart
createPieChart()
protected org.jfree.chart.JFreeChart
createScatterChart()
protected org.jfree.chart.JFreeChart
createStackedAreaChart()
protected org.jfree.chart.JFreeChart
createStackedBar3DChart()
protected org.jfree.chart.JFreeChart
createStackedBarChart()
protected org.jfree.chart.JFreeChart
createThermometerChart()
Build and run a thermometer chart.protected org.jfree.chart.JFreeChart
createTimeSeriesChart()
protected org.jfree.chart.JFreeChart
createXyAreaChart()
protected org.jfree.chart.JFreeChart
createXYBarChart()
protected org.jfree.chart.JFreeChart
createXyLineChart()
protected Object
evaluateExpression(JRExpression expression)
protected String
evaluateTextExpression(JRExpression expression)
protected JRChart
getChart()
ChartSettings
getChartSettings()
ChartThemeSettings
getChartThemeSettings()
protected org.jfree.data.general.Dataset
getDataset()
AxisSettings
getDomainAxisSettings()
protected JRFont
getFont(JRFont font)
protected Object
getLabelGenerator()
LegendSettings
getLegendSettings()
protected Locale
getLocale()
protected Paint[]
getOutlinePaintSequence(PlotSettings plotSettings)
protected Stroke[]
getOutlineStrokeSequence(PlotSettings plotSettings)
protected Paint[]
getPaintSequence(PlotSettings plotSettings, JRChartPlot jrPlot)
protected JRChartPlot
getPlot()
PlotSettings
getPlotSettings()
AxisSettings
getRangeAxisSettings()
protected Stroke[]
getStrokeSequence(PlotSettings plotSettings)
TitleSettings
getSubtitleSettings()
TitleSettings
getTitleSettings()
protected void
handleCategoryPlotSettings(org.jfree.chart.plot.CategoryPlot p, JRChartPlot jrPlot)
protected void
handleTitleSettings(org.jfree.chart.title.TextTitle title, TitleSettings titleSettings, JRFont titleFont, Paint titleForegroundPaint, org.jfree.chart.ui.RectangleEdge titleEdge)
protected void
handleXYPlotSettings(org.jfree.chart.plot.XYPlot p, JRChartPlot jrPlot)
protected boolean
isShowLegend()
Specifies whether a chart legend should be visible or no by default.protected void
populateSeriesColors(Paint[] colors, Paint[] colorSequence)
protected void
setAxisBounds(org.jfree.chart.axis.Axis axis, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriodUnit, Comparable<?> minValue, Comparable<?> maxValue)
protected void
setAxisLabel(org.jfree.chart.axis.Axis axis, JRFont labelFont, Paint labelColor, AxisSettings axisSettings)
protected void
setAxisLine(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)
protected void
setAxisTickLabels(org.jfree.chart.axis.Axis axis, JRFont tickLabelFont, Paint tickLabelColor, String tickLabelMask, AxisSettings axisSettings)
protected void
setAxisTickMarks(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)
protected void
setChartBackground(org.jfree.chart.JFreeChart jfreeChart)
protected void
setChartBackgroundImage(org.jfree.chart.JFreeChart jfreeChart)
protected void
setChartBorder(org.jfree.chart.JFreeChart jfreeChart)
protected void
setChartLegend(org.jfree.chart.JFreeChart jfreeChart)
protected void
setChartSubtitles(org.jfree.chart.JFreeChart jfreeChart)
void
setChartThemeSettings(ChartThemeSettings chartThemeSettings)
protected void
setChartTitle(org.jfree.chart.JFreeChart jfreeChart)
protected void
setPlotBackground(org.jfree.chart.plot.Plot plot, JRChartPlot jrPlot)
protected void
setPlotDrawingDefaults(org.jfree.chart.plot.Plot p, JRChartPlot jrPlot)
-
-
-
Field Detail
-
chartThemeSettings
protected ChartThemeSettings chartThemeSettings
-
threadLocalChartContext
protected ThreadLocal<ChartContext> threadLocalChartContext
-
threadLocalFontUtil
protected ThreadLocal<FontUtil> threadLocalFontUtil
-
-
Constructor Detail
-
SimpleChartTheme
protected SimpleChartTheme()
-
SimpleChartTheme
public SimpleChartTheme(ChartThemeSettings chartThemeSettings)
-
-
Method Detail
-
getChartThemeSettings
public ChartThemeSettings getChartThemeSettings()
-
setChartThemeSettings
public void setChartThemeSettings(ChartThemeSettings chartThemeSettings)
-
getChartSettings
public ChartSettings getChartSettings()
-
getTitleSettings
public TitleSettings getTitleSettings()
-
getSubtitleSettings
public TitleSettings getSubtitleSettings()
-
getLegendSettings
public LegendSettings getLegendSettings()
-
getPlotSettings
public PlotSettings getPlotSettings()
-
getDomainAxisSettings
public AxisSettings getDomainAxisSettings()
-
getRangeAxisSettings
public AxisSettings getRangeAxisSettings()
-
getChart
protected JRChart getChart()
-
getPlot
protected JRChartPlot getPlot()
-
getDataset
protected org.jfree.data.general.Dataset getDataset()
-
getLabelGenerator
protected Object getLabelGenerator()
-
getLocale
protected Locale getLocale()
-
evaluateExpression
protected final Object evaluateExpression(JRExpression expression) throws JRException
- Throws:
JRException
-
evaluateTextExpression
protected final String evaluateTextExpression(JRExpression expression) throws JRException
- Throws:
JRException
-
createChart
public org.jfree.chart.JFreeChart createChart(ChartContext chartContext) throws JRException
- Specified by:
createChart
in interfaceChartTheme
- Returns:
- an
org.jfree.chart.JFreeChart
object representing the chart - Throws:
JRException
-
configureChart
protected void configureChart(org.jfree.chart.JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException
- Throws:
JRException
-
configurePlot
protected void configurePlot(org.jfree.chart.plot.Plot plot, JRChartPlot jrPlot)
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, 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.DecimalFormat
mask, and if it is a DateAxis then the mask should be ajava.text.SimpleDateFormat
mask.verticalTickLabels
- flag to draw tick labels at 90 degreeslineColor
- color to use when drawing the axis line and any tick marks- Throws:
JRException
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriod, 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.DecimalFormat
mask, and if it is a DateAxis then the mask should be ajava.text.SimpleDateFormat
mask.verticalTickLabels
- flag to draw tick labels at 90 degreeslineColor
- color to use when drawing the axis line and any tick marks- Throws:
JRException
-
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
Build and configure a meter chart.- Throws:
JRException
-
createThermometerChart
protected org.jfree.chart.JFreeChart createThermometerChart() throws JRException
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
protected org.jfree.chart.JFreeChart createDialChart() throws JRException
- Throws:
JRException
-
setChartBackground
protected void setChartBackground(org.jfree.chart.JFreeChart jfreeChart)
-
setChartBackgroundImage
protected void setChartBackgroundImage(org.jfree.chart.JFreeChart jfreeChart)
-
setChartTitle
protected void setChartTitle(org.jfree.chart.JFreeChart jfreeChart)
-
setChartSubtitles
protected void setChartSubtitles(org.jfree.chart.JFreeChart jfreeChart) throws JRException
- Throws:
JRException
-
setChartLegend
protected void setChartLegend(org.jfree.chart.JFreeChart jfreeChart)
-
setChartBorder
protected void setChartBorder(org.jfree.chart.JFreeChart jfreeChart)
-
setPlotBackground
protected void setPlotBackground(org.jfree.chart.plot.Plot plot, JRChartPlot jrPlot)
-
handleCategoryPlotSettings
protected void handleCategoryPlotSettings(org.jfree.chart.plot.CategoryPlot p, JRChartPlot jrPlot)
-
handleXYPlotSettings
protected void handleXYPlotSettings(org.jfree.chart.plot.XYPlot p, JRChartPlot jrPlot)
-
setPlotDrawingDefaults
protected void setPlotDrawingDefaults(org.jfree.chart.plot.Plot p, JRChartPlot jrPlot)
-
setAxisLine
protected void setAxisLine(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)
-
setAxisLabel
protected void setAxisLabel(org.jfree.chart.axis.Axis axis, JRFont labelFont, Paint labelColor, AxisSettings axisSettings)
-
setAxisTickLabels
protected void setAxisTickLabels(org.jfree.chart.axis.Axis axis, JRFont tickLabelFont, Paint tickLabelColor, String tickLabelMask, AxisSettings axisSettings)
-
setAxisTickMarks
protected void setAxisTickMarks(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)
-
setAxisBounds
protected void setAxisBounds(org.jfree.chart.axis.Axis axis, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriodUnit, Comparable<?> minValue, Comparable<?> maxValue) throws JRException
- Throws:
JRException
-
calculateTickUnits
protected void calculateTickUnits(org.jfree.chart.axis.Axis axis, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriodUnitx)
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.
-
getPaintSequence
protected Paint[] getPaintSequence(PlotSettings plotSettings, JRChartPlot jrPlot)
-
getOutlinePaintSequence
protected Paint[] getOutlinePaintSequence(PlotSettings plotSettings)
-
getStrokeSequence
protected Stroke[] getStrokeSequence(PlotSettings plotSettings)
-
getOutlineStrokeSequence
protected Stroke[] getOutlineStrokeSequence(PlotSettings plotSettings)
-
handleTitleSettings
protected void handleTitleSettings(org.jfree.chart.title.TextTitle title, TitleSettings titleSettings, JRFont titleFont, Paint titleForegroundPaint, org.jfree.chart.ui.RectangleEdge titleEdge)
-
-