Class SimpleChartTheme
- java.lang.Object
-
- net.sf.jasperreports.chartthemes.simple.SimpleChartTheme
-
- All Implemented Interfaces:
net.sf.jasperreports.charts.ChartTheme
- Direct Known Subclasses:
XmlChartTheme
public class SimpleChartTheme extends Object implements net.sf.jasperreports.charts.ChartTheme
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected ChartThemeSettingschartThemeSettingsprotected ThreadLocal<net.sf.jasperreports.charts.ChartContext>threadLocalChartContextprotected ThreadLocal<net.sf.jasperreports.engine.fonts.FontUtil>threadLocalFontUtil
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleChartTheme()SimpleChartTheme(ChartThemeSettings chartThemeSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateTickUnits(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 voidconfigureAxis(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont labelFont, Color labelColor, net.sf.jasperreports.engine.JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, Comparable<?> axisMinValue, Comparable<?> axisMaxValue)Sets all the axis formatting options.protected voidconfigureAxis(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont labelFont, Color labelColor, net.sf.jasperreports.engine.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 voidconfigureChart(org.jfree.chart.JFreeChart jfreeChart, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected voidconfigurePlot(org.jfree.chart.plot.Plot plot, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected org.jfree.chart.plot.MeterIntervalconvertInterval(net.sf.jasperreports.charts.util.JRMeterInterval interval)Converts a JasperReports meter interval to one that JFreeChart understands.protected org.jfree.data.RangeconvertRange(net.sf.jasperreports.charts.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(net.sf.jasperreports.charts.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()Build and configure a meter chart.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(net.sf.jasperreports.engine.JRExpression expression)protected StringevaluateTextExpression(net.sf.jasperreports.engine.JRExpression expression)protected net.sf.jasperreports.engine.JRChartgetChart()ChartSettingsgetChartSettings()ChartThemeSettingsgetChartThemeSettings()protected org.jfree.data.general.DatasetgetDataset()AxisSettingsgetDomainAxisSettings()protected net.sf.jasperreports.engine.JRFontgetFont(net.sf.jasperreports.engine.JRFont font)protected ObjectgetLabelGenerator()LegendSettingsgetLegendSettings()protected LocalegetLocale()protected Paint[]getOutlinePaintSequence(PlotSettings plotSettings)protected Stroke[]getOutlineStrokeSequence(PlotSettings plotSettings)protected Paint[]getPaintSequence(PlotSettings plotSettings, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected net.sf.jasperreports.engine.JRChartPlotgetPlot()PlotSettingsgetPlotSettings()AxisSettingsgetRangeAxisSettings()protected Stroke[]getStrokeSequence(PlotSettings plotSettings)TitleSettingsgetSubtitleSettings()TitleSettingsgetTitleSettings()protected voidhandleCategoryPlotSettings(org.jfree.chart.plot.CategoryPlot p, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected voidhandleTitleSettings(org.jfree.chart.title.TextTitle title, TitleSettings titleSettings, net.sf.jasperreports.engine.JRFont titleFont, Paint titleForegroundPaint, org.jfree.ui.RectangleEdge titleEdge)protected voidhandleXYPlotSettings(org.jfree.chart.plot.XYPlot p, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected booleanisShowLegend()Specifies 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, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriodUnit, Comparable<?> minValue, Comparable<?> maxValue)protected voidsetAxisLabel(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont labelFont, Paint labelColor, AxisSettings axisSettings)protected voidsetAxisLine(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)protected voidsetAxisTickLabels(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont tickLabelFont, Paint tickLabelColor, String tickLabelMask, AxisSettings axisSettings)protected voidsetAxisTickMarks(org.jfree.chart.axis.Axis axis, Paint lineColor, AxisSettings axisSettings)protected voidsetChartBackground(org.jfree.chart.JFreeChart jfreeChart)protected voidsetChartBackgroundImage(org.jfree.chart.JFreeChart jfreeChart)protected voidsetChartBorder(org.jfree.chart.JFreeChart jfreeChart)protected voidsetChartLegend(org.jfree.chart.JFreeChart jfreeChart)protected voidsetChartSubtitles(org.jfree.chart.JFreeChart jfreeChart)voidsetChartThemeSettings(ChartThemeSettings chartThemeSettings)protected voidsetChartTitle(org.jfree.chart.JFreeChart jfreeChart)protected voidsetPlotBackground(org.jfree.chart.plot.Plot plot, net.sf.jasperreports.engine.JRChartPlot jrPlot)protected voidsetPlotDrawingDefaults(org.jfree.chart.plot.Plot p, net.sf.jasperreports.engine.JRChartPlot jrPlot)
-
-
-
Field Detail
-
chartThemeSettings
protected ChartThemeSettings chartThemeSettings
-
threadLocalChartContext
protected ThreadLocal<net.sf.jasperreports.charts.ChartContext> threadLocalChartContext
-
threadLocalFontUtil
protected ThreadLocal<net.sf.jasperreports.engine.fonts.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 net.sf.jasperreports.engine.JRChart getChart()
-
getPlot
protected net.sf.jasperreports.engine.JRChartPlot getPlot()
-
getDataset
protected org.jfree.data.general.Dataset getDataset()
-
getLabelGenerator
protected Object getLabelGenerator()
-
getLocale
protected Locale getLocale()
-
evaluateExpression
protected final Object evaluateExpression(net.sf.jasperreports.engine.JRExpression expression) throws net.sf.jasperreports.engine.JRException
- Throws:
net.sf.jasperreports.engine.JRException
-
evaluateTextExpression
protected final String evaluateTextExpression(net.sf.jasperreports.engine.JRExpression expression) throws net.sf.jasperreports.engine.JRException
- Throws:
net.sf.jasperreports.engine.JRException
-
createChart
public org.jfree.chart.JFreeChart createChart(net.sf.jasperreports.charts.ChartContext chartContext) throws net.sf.jasperreports.engine.JRException- Specified by:
createChartin interfacenet.sf.jasperreports.charts.ChartTheme- Throws:
net.sf.jasperreports.engine.JRException
-
configureChart
protected void configureChart(org.jfree.chart.JFreeChart jfreeChart, net.sf.jasperreports.engine.JRChartPlot jrPlot) throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
configurePlot
protected void configurePlot(org.jfree.chart.plot.Plot plot, net.sf.jasperreports.engine.JRChartPlot jrPlot)
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont labelFont, Color labelColor, net.sf.jasperreports.engine.JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) throws net.sf.jasperreports.engine.JRExceptionSets 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- Throws:
net.sf.jasperreports.engine.JRException
-
configureAxis
protected void configureAxis(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.JRFont labelFont, Color labelColor, net.sf.jasperreports.engine.JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, org.jfree.chart.axis.DateTickUnitType timePeriod, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) throws net.sf.jasperreports.engine.JRExceptionSets 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- Throws:
net.sf.jasperreports.engine.JRException
-
createAreaChart
protected org.jfree.chart.JFreeChart createAreaChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createBar3DChart
protected org.jfree.chart.JFreeChart createBar3DChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createBarChart
protected org.jfree.chart.JFreeChart createBarChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createBubbleChart
protected org.jfree.chart.JFreeChart createBubbleChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createCandlestickChart
protected org.jfree.chart.JFreeChart createCandlestickChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createHighLowChart
protected org.jfree.chart.JFreeChart createHighLowChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createLineChart
protected org.jfree.chart.JFreeChart createLineChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createPie3DChart
protected org.jfree.chart.JFreeChart createPie3DChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createPieChart
protected org.jfree.chart.JFreeChart createPieChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createScatterChart
protected org.jfree.chart.JFreeChart createScatterChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createStackedBar3DChart
protected org.jfree.chart.JFreeChart createStackedBar3DChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createStackedBarChart
protected org.jfree.chart.JFreeChart createStackedBarChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createStackedAreaChart
protected org.jfree.chart.JFreeChart createStackedAreaChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createXyAreaChart
protected org.jfree.chart.JFreeChart createXyAreaChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createXYBarChart
protected org.jfree.chart.JFreeChart createXYBarChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createXyLineChart
protected org.jfree.chart.JFreeChart createXyLineChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createTimeSeriesChart
protected org.jfree.chart.JFreeChart createTimeSeriesChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
createGanttChart
protected org.jfree.chart.JFreeChart createGanttChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.JRException
-
convertRange
protected org.jfree.data.Range convertRange(net.sf.jasperreports.charts.JRDataRange dataRange) throws net.sf.jasperreports.engine.JRExceptionConverts 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:
net.sf.jasperreports.engine.JRException- thrown when the low value of the range is greater than the high value
-
convertInterval
protected org.jfree.chart.plot.MeterInterval convertInterval(net.sf.jasperreports.charts.util.JRMeterInterval interval) throws net.sf.jasperreports.engine.JRExceptionConverts 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:
net.sf.jasperreports.engine.JRException- thrown when the interval contains an invalid range
-
createMeterChart
protected org.jfree.chart.JFreeChart createMeterChart() throws net.sf.jasperreports.engine.JRExceptionBuild and configure a meter chart.- Throws:
net.sf.jasperreports.engine.JRException
-
createThermometerChart
protected org.jfree.chart.JFreeChart createThermometerChart() throws net.sf.jasperreports.engine.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:
net.sf.jasperreports.engine.JRException
-
createDialChart
protected org.jfree.chart.JFreeChart createDialChart() throws net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.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 net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.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, net.sf.jasperreports.engine.JRChartPlot jrPlot)
-
handleCategoryPlotSettings
protected void handleCategoryPlotSettings(org.jfree.chart.plot.CategoryPlot p, net.sf.jasperreports.engine.JRChartPlot jrPlot)
-
handleXYPlotSettings
protected void handleXYPlotSettings(org.jfree.chart.plot.XYPlot p, net.sf.jasperreports.engine.JRChartPlot jrPlot)
-
setPlotDrawingDefaults
protected void setPlotDrawingDefaults(org.jfree.chart.plot.Plot p, net.sf.jasperreports.engine.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, net.sf.jasperreports.engine.JRFont labelFont, Paint labelColor, AxisSettings axisSettings)
-
setAxisTickLabels
protected void setAxisTickLabels(org.jfree.chart.axis.Axis axis, net.sf.jasperreports.engine.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 net.sf.jasperreports.engine.JRException- Throws:
net.sf.jasperreports.engine.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, net.sf.jasperreports.engine.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, net.sf.jasperreports.engine.JRFont titleFont, Paint titleForegroundPaint, org.jfree.ui.RectangleEdge titleEdge)
-
getFont
protected net.sf.jasperreports.engine.JRFont getFont(net.sf.jasperreports.engine.JRFont font)
-
-