Source Code Cross Referenced for JRFillChart.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » fill » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » jasperreports 2.0.1 » net.sf.jasperreports.engine.fill 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * ============================================================================
0003:         * GNU Lesser General Public License
0004:         * ============================================================================
0005:         *
0006:         * JasperReports - Free Java report-generating library.
0007:         * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
0008:         *
0009:         * This library is free software; you can redistribute it and/or
0010:         * modify it under the terms of the GNU Lesser General Public
0011:         * License as published by the Free Software Foundation; either
0012:         * version 2.1 of the License, or (at your option) any later version.
0013:         *
0014:         * This library is distributed in the hope that it will be useful,
0015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017:         * Lesser General Public License for more details.
0018:         *
0019:         * You should have received a copy of the GNU Lesser General Public
0020:         * License along with this library; if not, write to the Free Software
0021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
0022:         *
0023:         * JasperSoft Corporation
0024:         * 303 Second Street, Suite 450 North
0025:         * San Francisco, CA 94107
0026:         * http://www.jaspersoft.com
0027:         */
0028:        package net.sf.jasperreports.engine.fill;
0029:
0030:        import java.awt.Color;
0031:        import java.awt.Font;
0032:        import java.awt.Paint;
0033:        import java.text.DateFormat;
0034:        import java.text.DecimalFormat;
0035:        import java.text.NumberFormat;
0036:        import java.text.SimpleDateFormat;
0037:        import java.util.Iterator;
0038:        import java.util.List;
0039:        import java.util.SortedSet;
0040:
0041:        import net.sf.jasperreports.charts.JRAreaPlot;
0042:        import net.sf.jasperreports.charts.JRBar3DPlot;
0043:        import net.sf.jasperreports.charts.JRBarPlot;
0044:        import net.sf.jasperreports.charts.JRBubblePlot;
0045:        import net.sf.jasperreports.charts.JRCandlestickPlot;
0046:        import net.sf.jasperreports.charts.JRCategoryDataset;
0047:        import net.sf.jasperreports.charts.JRChartAxis;
0048:        import net.sf.jasperreports.charts.JRDataRange;
0049:        import net.sf.jasperreports.charts.JRHighLowDataset;
0050:        import net.sf.jasperreports.charts.JRHighLowPlot;
0051:        import net.sf.jasperreports.charts.JRLinePlot;
0052:        import net.sf.jasperreports.charts.JRMeterPlot;
0053:        import net.sf.jasperreports.charts.JRMultiAxisPlot;
0054:        import net.sf.jasperreports.charts.JRPie3DPlot;
0055:        import net.sf.jasperreports.charts.JRPieDataset;
0056:        import net.sf.jasperreports.charts.JRPiePlot;
0057:        import net.sf.jasperreports.charts.JRScatterPlot;
0058:        import net.sf.jasperreports.charts.JRThermometerPlot;
0059:        import net.sf.jasperreports.charts.JRTimePeriodDataset;
0060:        import net.sf.jasperreports.charts.JRTimeSeriesDataset;
0061:        import net.sf.jasperreports.charts.JRTimeSeriesPlot;
0062:        import net.sf.jasperreports.charts.JRValueDataset;
0063:        import net.sf.jasperreports.charts.JRValueDisplay;
0064:        import net.sf.jasperreports.charts.JRXyDataset;
0065:        import net.sf.jasperreports.charts.JRXyzDataset;
0066:        import net.sf.jasperreports.charts.fill.JRFillAreaPlot;
0067:        import net.sf.jasperreports.charts.fill.JRFillBar3DPlot;
0068:        import net.sf.jasperreports.charts.fill.JRFillBarPlot;
0069:        import net.sf.jasperreports.charts.fill.JRFillCategoryDataset;
0070:        import net.sf.jasperreports.charts.fill.JRFillChartAxis;
0071:        import net.sf.jasperreports.charts.fill.JRFillHighLowDataset;
0072:        import net.sf.jasperreports.charts.fill.JRFillLinePlot;
0073:        import net.sf.jasperreports.charts.fill.JRFillMeterPlot;
0074:        import net.sf.jasperreports.charts.fill.JRFillMultiAxisPlot;
0075:        import net.sf.jasperreports.charts.fill.JRFillPie3DPlot;
0076:        import net.sf.jasperreports.charts.fill.JRFillPieDataset;
0077:        import net.sf.jasperreports.charts.fill.JRFillPiePlot;
0078:        import net.sf.jasperreports.charts.fill.JRFillThermometerPlot;
0079:        import net.sf.jasperreports.charts.fill.JRFillTimePeriodDataset;
0080:        import net.sf.jasperreports.charts.fill.JRFillTimeSeriesDataset;
0081:        import net.sf.jasperreports.charts.fill.JRFillXyDataset;
0082:        import net.sf.jasperreports.charts.fill.JRFillXyzDataset;
0083:        import net.sf.jasperreports.charts.util.JRMeterInterval;
0084:        import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
0085:        import net.sf.jasperreports.engine.JRAbstractObjectFactory;
0086:        import net.sf.jasperreports.engine.JRBox;
0087:        import net.sf.jasperreports.engine.JRChart;
0088:        import net.sf.jasperreports.engine.JRChartCustomizer;
0089:        import net.sf.jasperreports.engine.JRChartDataset;
0090:        import net.sf.jasperreports.engine.JRChartPlot;
0091:        import net.sf.jasperreports.engine.JRChild;
0092:        import net.sf.jasperreports.engine.JRElement;
0093:        import net.sf.jasperreports.engine.JRException;
0094:        import net.sf.jasperreports.engine.JRExpression;
0095:        import net.sf.jasperreports.engine.JRExpressionCollector;
0096:        import net.sf.jasperreports.engine.JRFont;
0097:        import net.sf.jasperreports.engine.JRGroup;
0098:        import net.sf.jasperreports.engine.JRHyperlinkParameter;
0099:        import net.sf.jasperreports.engine.JRPrintElement;
0100:        import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
0101:        import net.sf.jasperreports.engine.JRPrintImage;
0102:        import net.sf.jasperreports.engine.JRRenderable;
0103:        import net.sf.jasperreports.engine.JRRuntimeException;
0104:        import net.sf.jasperreports.engine.JRStyle;
0105:        import net.sf.jasperreports.engine.JRChartPlot.JRSeriesColor;
0106:        import net.sf.jasperreports.engine.base.JRBaseFont;
0107:        import net.sf.jasperreports.engine.util.JRClassLoader;
0108:        import net.sf.jasperreports.engine.util.JRFontUtil;
0109:        import net.sf.jasperreports.engine.util.JRStyleResolver;
0110:        import net.sf.jasperreports.engine.xml.JRXmlWriter;
0111:        import net.sf.jasperreports.renderers.JFreeChartRenderer;
0112:        import net.sf.jasperreports.renderers.JRCategoryChartImageMapRenderer;
0113:        import net.sf.jasperreports.renderers.JRHighLowChartImageMapRenderer;
0114:        import net.sf.jasperreports.renderers.JRPieChartImageMapRenderer;
0115:        import net.sf.jasperreports.renderers.JRTimePeriodChartImageMapRenderer;
0116:        import net.sf.jasperreports.renderers.JRTimeSeriesChartImageMapRenderer;
0117:        import net.sf.jasperreports.renderers.JRXYChartImageMapRenderer;
0118:
0119:        import org.jfree.chart.ChartFactory;
0120:        import org.jfree.chart.JFreeChart;
0121:        import org.jfree.chart.axis.Axis;
0122:        import org.jfree.chart.axis.AxisLocation;
0123:        import org.jfree.chart.axis.CategoryAxis;
0124:        import org.jfree.chart.axis.CategoryLabelPositions;
0125:        import org.jfree.chart.axis.DateAxis;
0126:        import org.jfree.chart.axis.NumberAxis;
0127:        import org.jfree.chart.labels.PieSectionLabelGenerator;
0128:        import org.jfree.chart.plot.CategoryPlot;
0129:        import org.jfree.chart.plot.DefaultDrawingSupplier;
0130:        import org.jfree.chart.plot.DialShape;
0131:        import org.jfree.chart.plot.MeterInterval;
0132:        import org.jfree.chart.plot.MeterPlot;
0133:        import org.jfree.chart.plot.PiePlot;
0134:        import org.jfree.chart.plot.PiePlot3D;
0135:        import org.jfree.chart.plot.Plot;
0136:        import org.jfree.chart.plot.ThermometerPlot;
0137:        import org.jfree.chart.plot.XYPlot;
0138:        import org.jfree.chart.renderer.category.BarRenderer3D;
0139:        import org.jfree.chart.renderer.category.CategoryItemRenderer;
0140:        import org.jfree.chart.renderer.category.LineAndShapeRenderer;
0141:        import org.jfree.chart.renderer.category.StackedBarRenderer3D;
0142:        import org.jfree.chart.renderer.xy.CandlestickRenderer;
0143:        import org.jfree.chart.renderer.xy.HighLowRenderer;
0144:        import org.jfree.chart.renderer.xy.XYBubbleRenderer;
0145:        import org.jfree.chart.renderer.xy.XYItemRenderer;
0146:        import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
0147:        import org.jfree.chart.title.LegendTitle;
0148:        import org.jfree.chart.title.TextTitle;
0149:        import org.jfree.data.Range;
0150:        import org.jfree.data.category.CategoryDataset;
0151:        import org.jfree.data.general.PieDataset;
0152:        import org.jfree.data.general.ValueDataset;
0153:        import org.jfree.data.time.TimeSeriesCollection;
0154:        import org.jfree.data.xy.DefaultHighLowDataset;
0155:        import org.jfree.data.xy.IntervalXYDataset;
0156:        import org.jfree.data.xy.XYDataset;
0157:        import org.jfree.data.xy.XYZDataset;
0158:
0159:        /**
0160:         * @author Teodor Danciu (teodord@users.sourceforge.net)
0161:         * @author Some enhancements by Barry Klawans (bklawans@users.sourceforge.net)
0162:         * @version $Id: JRFillChart.java 1797 2007-07-30 09:38:35Z teodord $
0163:         */
0164:        public class JRFillChart extends JRFillElement implements  JRChart {
0165:
0166:            /**
0167:             *
0168:             */
0169:            private static final Color TRANSPARENT_PAINT = new Color(0, 0, 0, 0);
0170:
0171:            /**
0172:             *
0173:             */
0174:            protected byte chartType = 0;
0175:
0176:            /**
0177:             *
0178:             */
0179:            protected JRFont titleFont = null;
0180:            protected JRFont subtitleFont = null;
0181:            protected JRFont legendFont = null;
0182:
0183:            /**
0184:             *
0185:             */
0186:            protected JRGroup evaluationGroup = null;
0187:
0188:            protected JRFillChartDataset dataset = null;
0189:            protected JRChartPlot plot = null;
0190:
0191:            protected JRRenderable renderer = null;
0192:            private String anchorName = null;
0193:            private String hyperlinkReference = null;
0194:            private String hyperlinkAnchor = null;
0195:            private Integer hyperlinkPage = null;
0196:            private String hyperlinkTooltip;
0197:            private JRPrintHyperlinkParameters hyperlinkParameters;
0198:
0199:            protected String customizerClass;
0200:            protected JRChartCustomizer chartCustomizer;
0201:
0202:            /**
0203:             *
0204:             */
0205:            protected JRFillChart(JRBaseFiller filler, JRChart chart,
0206:                    JRFillObjectFactory factory) {
0207:                super (filler, chart, factory);
0208:
0209:                /*   */
0210:                chartType = chart.getChartType();
0211:
0212:                switch (chartType) {
0213:                case CHART_TYPE_AREA:
0214:                    dataset = (JRFillChartDataset) factory
0215:                            .getCategoryDataset((JRCategoryDataset) chart
0216:                                    .getDataset());
0217:                    plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
0218:                    break;
0219:                case CHART_TYPE_BAR:
0220:                    dataset = (JRFillChartDataset) factory
0221:                            .getCategoryDataset((JRCategoryDataset) chart
0222:                                    .getDataset());
0223:                    plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
0224:                    break;
0225:                case CHART_TYPE_BAR3D:
0226:                    dataset = (JRFillChartDataset) factory
0227:                            .getCategoryDataset((JRCategoryDataset) chart
0228:                                    .getDataset());
0229:                    plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
0230:                    break;
0231:                case CHART_TYPE_BUBBLE:
0232:                    dataset = (JRFillChartDataset) factory
0233:                            .getXyzDataset((JRXyzDataset) chart.getDataset());
0234:                    plot = factory
0235:                            .getBubblePlot((JRBubblePlot) chart.getPlot());
0236:                    break;
0237:                case CHART_TYPE_CANDLESTICK:
0238:                    dataset = (JRFillChartDataset) factory
0239:                            .getHighLowDataset((JRHighLowDataset) chart
0240:                                    .getDataset());
0241:                    plot = factory.getCandlestickPlot((JRCandlestickPlot) chart
0242:                            .getPlot());
0243:                    break;
0244:                case CHART_TYPE_HIGHLOW:
0245:                    dataset = (JRFillChartDataset) factory
0246:                            .getHighLowDataset((JRHighLowDataset) chart
0247:                                    .getDataset());
0248:                    plot = factory.getHighLowPlot((JRHighLowPlot) chart
0249:                            .getPlot());
0250:                    break;
0251:                case CHART_TYPE_LINE:
0252:                    dataset = (JRFillChartDataset) factory
0253:                            .getCategoryDataset((JRCategoryDataset) chart
0254:                                    .getDataset());
0255:                    plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
0256:                    break;
0257:                case CHART_TYPE_METER:
0258:                    dataset = (JRFillChartDataset) factory
0259:                            .getValueDataset((JRValueDataset) chart
0260:                                    .getDataset());
0261:                    plot = factory.getMeterPlot((JRMeterPlot) chart.getPlot());
0262:                    break;
0263:                case CHART_TYPE_MULTI_AXIS:
0264:                    plot = factory.getMultiAxisPlot((JRMultiAxisPlot) chart
0265:                            .getPlot());
0266:                    dataset = ((JRFillMultiAxisPlot) plot).getMainDataset();
0267:                    break;
0268:                case CHART_TYPE_PIE:
0269:                    dataset = (JRFillChartDataset) factory
0270:                            .getPieDataset((JRPieDataset) chart.getDataset());
0271:                    plot = factory.getPiePlot((JRPiePlot) chart.getPlot());
0272:                    break;
0273:                case CHART_TYPE_PIE3D:
0274:                    dataset = (JRFillChartDataset) factory
0275:                            .getPieDataset((JRPieDataset) chart.getDataset());
0276:                    plot = factory.getPie3DPlot((JRPie3DPlot) chart.getPlot());
0277:                    break;
0278:                case CHART_TYPE_SCATTER:
0279:                    dataset = (JRFillChartDataset) factory
0280:                            .getXyDataset((JRXyDataset) chart.getDataset());
0281:                    plot = factory.getScatterPlot((JRScatterPlot) chart
0282:                            .getPlot());
0283:                    break;
0284:                case CHART_TYPE_STACKEDBAR:
0285:                    dataset = (JRFillChartDataset) factory
0286:                            .getCategoryDataset((JRCategoryDataset) chart
0287:                                    .getDataset());
0288:                    plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
0289:                    break;
0290:                case CHART_TYPE_STACKEDBAR3D:
0291:                    dataset = (JRFillChartDataset) factory
0292:                            .getCategoryDataset((JRCategoryDataset) chart
0293:                                    .getDataset());
0294:                    plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
0295:                    break;
0296:                case CHART_TYPE_THERMOMETER:
0297:                    dataset = (JRFillChartDataset) factory
0298:                            .getValueDataset((JRValueDataset) chart
0299:                                    .getDataset());
0300:                    plot = factory.getThermometerPlot((JRThermometerPlot) chart
0301:                            .getPlot());
0302:                    break;
0303:                case CHART_TYPE_TIMESERIES:
0304:                    dataset = (JRFillChartDataset) factory
0305:                            .getTimeSeriesDataset((JRTimeSeriesDataset) chart
0306:                                    .getDataset());
0307:                    plot = factory.getTimeSeriesPlot((JRTimeSeriesPlot) chart
0308:                            .getPlot());
0309:                    break;
0310:                case CHART_TYPE_XYAREA:
0311:                    dataset = (JRFillChartDataset) factory
0312:                            .getXyDataset((JRXyDataset) chart.getDataset());
0313:                    plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
0314:                    break;
0315:                case CHART_TYPE_XYBAR:
0316:                    switch (chart.getDataset().getDatasetType()) {
0317:                    case JRChartDataset.TIMESERIES_DATASET:
0318:                        dataset = (JRFillChartDataset) factory
0319:                                .getTimeSeriesDataset((JRTimeSeriesDataset) chart
0320:                                        .getDataset());
0321:                        break;
0322:                    case JRChartDataset.TIMEPERIOD_DATASET:
0323:                        dataset = (JRFillChartDataset) factory
0324:                                .getTimePeriodDataset((JRTimePeriodDataset) chart
0325:                                        .getDataset());
0326:                        break;
0327:                    case JRChartDataset.XY_DATASET:
0328:                        dataset = (JRFillChartDataset) factory
0329:                                .getXyDataset((JRXyDataset) chart.getDataset());
0330:                        break;
0331:                    }
0332:
0333:                    plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
0334:                    break;
0335:                case CHART_TYPE_XYLINE:
0336:                    dataset = (JRFillChartDataset) factory
0337:                            .getXyDataset((JRXyDataset) chart.getDataset());
0338:                    plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
0339:                    break;
0340:                case CHART_TYPE_STACKEDAREA:
0341:                    dataset = (JRFillChartDataset) factory
0342:                            .getCategoryDataset((JRCategoryDataset) chart
0343:                                    .getDataset());
0344:                    plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
0345:                    break;
0346:                default:
0347:                    throw new JRRuntimeException("Chart type not supported.");
0348:                }
0349:
0350:                titleFont = new JRBaseFont(null, null, chart, chart
0351:                        .getTitleFont());
0352:                subtitleFont = new JRBaseFont(null, null, chart, chart
0353:                        .getSubtitleFont());
0354:                legendFont = new JRBaseFont(null, null, chart, chart
0355:                        .getLegendFont());
0356:
0357:                evaluationGroup = factory.getGroup(chart.getEvaluationGroup());
0358:
0359:                customizerClass = chart.getCustomizerClass();
0360:                if (customizerClass != null && customizerClass.length() > 0) {
0361:                    try {
0362:                        Class myClass = JRClassLoader
0363:                                .loadClassForName(customizerClass);
0364:                        chartCustomizer = (JRChartCustomizer) myClass
0365:                                .newInstance();
0366:                    } catch (Exception e) {
0367:                        throw new JRRuntimeException(
0368:                                "Could not create chart customizer instance.",
0369:                                e);
0370:                    }
0371:
0372:                    if (chartCustomizer instanceof  JRAbstractChartCustomizer) {
0373:                        ((JRAbstractChartCustomizer) chartCustomizer).init(
0374:                                filler, this );
0375:                    }
0376:                }
0377:            }
0378:
0379:            /**
0380:             *
0381:             */
0382:            public byte getMode() {
0383:                return JRStyleResolver.getMode(this , MODE_TRANSPARENT);
0384:            }
0385:
0386:            /**
0387:             *
0388:             */
0389:            public boolean isShowLegend() {
0390:                return ((JRChart) parent).isShowLegend();
0391:            }
0392:
0393:            /**
0394:             *
0395:             */
0396:            public void setShowLegend(boolean isShowLegend) {
0397:            }
0398:
0399:            /**
0400:             *
0401:             */
0402:            public byte getEvaluationTime() {
0403:                return ((JRChart) parent).getEvaluationTime();
0404:            }
0405:
0406:            /**
0407:             *
0408:             */
0409:            public JRGroup getEvaluationGroup() {
0410:                return evaluationGroup;
0411:            }
0412:
0413:            /**
0414:             * @deprecated
0415:             */
0416:            public JRBox getBox() {
0417:                return (JRBox) parent;
0418:            }
0419:
0420:            /**
0421:             *
0422:             */
0423:            public JRFont getTitleFont() {
0424:                return titleFont;
0425:            }
0426:
0427:            /**
0428:             *
0429:             */
0430:            public byte getTitlePosition() {
0431:                return ((JRChart) parent).getTitlePosition();
0432:            }
0433:
0434:            /**
0435:             *
0436:             */
0437:            public void setTitlePosition(byte titlePosition) {
0438:            }
0439:
0440:            /**
0441:             *
0442:             */
0443:            public Color getTitleColor() {
0444:                return JRStyleResolver.getTitleColor(this );
0445:            }
0446:
0447:            /**
0448:             *
0449:             */
0450:            public Color getOwnTitleColor() {
0451:                return ((JRChart) parent).getOwnTitleColor();
0452:            }
0453:
0454:            /**
0455:             *
0456:             */
0457:            public void setTitleColor(Color titleColor) {
0458:            }
0459:
0460:            /**
0461:             *
0462:             */
0463:            public JRFont getSubtitleFont() {
0464:                return subtitleFont;
0465:            }
0466:
0467:            /**
0468:             *
0469:             */
0470:            public Color getOwnSubtitleColor() {
0471:                return ((JRChart) parent).getOwnSubtitleColor();
0472:            }
0473:
0474:            /**
0475:             *
0476:             */
0477:            public Color getSubtitleColor() {
0478:                return JRStyleResolver.getSubtitleColor(this );
0479:            }
0480:
0481:            /**
0482:             *
0483:             */
0484:            public void setSubtitleColor(Color subtitleColor) {
0485:            }
0486:
0487:            /**
0488:             * Returns the color to use for text in the legend.
0489:             *
0490:             * @return the color to use for text in the legend
0491:             */
0492:            public Color getOwnLegendColor() {
0493:                return ((JRChart) parent).getOwnLegendColor();
0494:            }
0495:
0496:            /**
0497:             * Returns the inherited color to use for text in the legend.
0498:             *
0499:             * @return the color to use for text in the legend
0500:             */
0501:            public Color getLegendColor() {
0502:                return JRStyleResolver.getLegendColor(this );
0503:            }
0504:
0505:            /**
0506:             * Sets the color to use for text in the legend.
0507:             *
0508:             * @param legendColor the color to use for text in the legend
0509:             */
0510:            public void setLegendColor(Color legendColor) {
0511:            }
0512:
0513:            /**
0514:             * Returns the color to use as the background of the legend.
0515:             *
0516:             * @return the color to use as the background of the legend
0517:             */
0518:            public Color getOwnLegendBackgroundColor() {
0519:                return ((JRChart) parent).getOwnLegendBackgroundColor();
0520:            }
0521:
0522:            /**
0523:             * Returns the color to use as the background of the legend.
0524:             *
0525:             * @return the color to use as the background of the legend
0526:             */
0527:            public Color getLegendBackgroundColor() {
0528:                return JRStyleResolver.getLegendBackgroundColor(this );
0529:            }
0530:
0531:            /**
0532:             * Sets the color to use for the background of the legend.
0533:             *
0534:             * @param legendBackgroundColor the color to use for the background of the legend
0535:             */
0536:            public void setLegendBackgroundColor(Color legendBackgroundColor) {
0537:            }
0538:
0539:            /**
0540:             * Returns the font to use in the legend.
0541:             *
0542:             * @return the font to use in the legend
0543:             */
0544:            public JRFont getLegendFont() {
0545:                return legendFont;
0546:            }
0547:
0548:            /**
0549:             *
0550:             */
0551:            public JRExpression getTitleExpression() {
0552:                return ((JRChart) parent).getTitleExpression();
0553:            }
0554:
0555:            /**
0556:             *
0557:             */
0558:            public JRExpression getSubtitleExpression() {
0559:                return ((JRChart) parent).getSubtitleExpression();
0560:            }
0561:
0562:            /**
0563:             *
0564:             */
0565:            public byte getHyperlinkType() {
0566:                return ((JRChart) parent).getHyperlinkType();
0567:            }
0568:
0569:            /**
0570:             *
0571:             */
0572:            public byte getHyperlinkTarget() {
0573:                return ((JRChart) parent).getHyperlinkTarget();
0574:            }
0575:
0576:            /**
0577:             *
0578:             */
0579:            public JRExpression getAnchorNameExpression() {
0580:                return ((JRChart) parent).getAnchorNameExpression();
0581:            }
0582:
0583:            /**
0584:             *
0585:             */
0586:            public JRExpression getHyperlinkReferenceExpression() {
0587:                return ((JRChart) parent).getHyperlinkReferenceExpression();
0588:            }
0589:
0590:            /**
0591:             *
0592:             */
0593:            public JRExpression getHyperlinkAnchorExpression() {
0594:                return ((JRChart) parent).getHyperlinkAnchorExpression();
0595:            }
0596:
0597:            /**
0598:             *
0599:             */
0600:            public JRExpression getHyperlinkPageExpression() {
0601:                return ((JRChart) parent).getHyperlinkPageExpression();
0602:            }
0603:
0604:            /**
0605:             *
0606:             */
0607:            public JRChartDataset getDataset() {
0608:                return dataset;
0609:            }
0610:
0611:            /**
0612:             *
0613:             */
0614:            public void setDataset(JRFillChartDataset dataset) {
0615:                this .dataset = dataset;
0616:            }
0617:
0618:            /**
0619:             *
0620:             */
0621:            public JRChartPlot getPlot() {
0622:                return plot;
0623:            }
0624:
0625:            /**
0626:             *
0627:             */
0628:            protected JRRenderable getRenderer() {
0629:                return renderer;
0630:            }
0631:
0632:            /**
0633:             *
0634:             */
0635:            protected String getAnchorName() {
0636:                return anchorName;
0637:            }
0638:
0639:            /**
0640:             *
0641:             */
0642:            protected String getHyperlinkReference() {
0643:                return hyperlinkReference;
0644:            }
0645:
0646:            /**
0647:             *
0648:             */
0649:            protected String getHyperlinkAnchor() {
0650:                return hyperlinkAnchor;
0651:            }
0652:
0653:            /**
0654:             *
0655:             */
0656:            protected Integer getHyperlinkPage() {
0657:                return hyperlinkPage;
0658:            }
0659:
0660:            protected String getHyperlinkTooltip() {
0661:                return hyperlinkTooltip;
0662:            }
0663:
0664:            /**
0665:             *
0666:             */
0667:            protected JRTemplateImage getJRTemplateImage() {
0668:                JRStyle style = getStyle();
0669:                JRTemplateImage template = (JRTemplateImage) getTemplate(style);
0670:                if (template == null) {
0671:                    template = new JRTemplateImage(filler.getJasperPrint()
0672:                            .getDefaultStyleProvider(), this );
0673:                    registerTemplate(style, template);
0674:                }
0675:                return template;
0676:            }
0677:
0678:            /**
0679:             *
0680:             */
0681:            protected void rewind() {
0682:            }
0683:
0684:            /**
0685:             *
0686:             */
0687:            protected void evaluate(byte evaluation) throws JRException {
0688:                reset();
0689:
0690:                evaluatePrintWhenExpression(evaluation);
0691:
0692:                if ((isPrintWhenExpressionNull() || (!isPrintWhenExpressionNull() && isPrintWhenTrue()))) {
0693:                    if (getEvaluationTime() == JRExpression.EVALUATION_TIME_NOW) {
0694:                        evaluateImage(evaluation);
0695:                    }
0696:                }
0697:            }
0698:
0699:            /**
0700:             *
0701:             */
0702:            protected JFreeChartRenderer evaluateImage(byte evaluation)
0703:                    throws JRException {
0704:                evaluateDatasetRun(evaluation);
0705:
0706:                JFreeChartRenderer chartRenderer;
0707:                switch (chartType) {
0708:                case CHART_TYPE_AREA:
0709:                    chartRenderer = evaluateAreaImage(evaluation);
0710:                    break;
0711:                case CHART_TYPE_BAR:
0712:                    chartRenderer = evaluateBarImage(evaluation);
0713:                    break;
0714:                case CHART_TYPE_BAR3D:
0715:                    chartRenderer = evaluateBar3DImage(evaluation);
0716:                    break;
0717:                case CHART_TYPE_BUBBLE:
0718:                    chartRenderer = evaluateBubbleImage(evaluation);
0719:                    break;
0720:                case CHART_TYPE_CANDLESTICK:
0721:                    chartRenderer = evaluateCandlestickImage(evaluation);
0722:                    break;
0723:                case CHART_TYPE_HIGHLOW:
0724:                    chartRenderer = evaluateHighLowImage(evaluation);
0725:                    break;
0726:                case CHART_TYPE_LINE:
0727:                    chartRenderer = evaluateLineImage(evaluation);
0728:                    break;
0729:                case CHART_TYPE_METER:
0730:                    chartRenderer = evaluateMeterImage(evaluation);
0731:                    break;
0732:                case CHART_TYPE_MULTI_AXIS:
0733:                    chartRenderer = evaluateMultiAxisImage(evaluation);
0734:                    break;
0735:                case CHART_TYPE_PIE:
0736:                    chartRenderer = evaluatePieImage(evaluation);
0737:                    break;
0738:                case CHART_TYPE_PIE3D:
0739:                    chartRenderer = evaluatePie3DImage(evaluation);
0740:                    break;
0741:                case CHART_TYPE_SCATTER:
0742:                    chartRenderer = evaluateScatterImage(evaluation);
0743:                    break;
0744:                case CHART_TYPE_STACKEDBAR:
0745:                    chartRenderer = evaluateStackedBarImage(evaluation);
0746:                    break;
0747:                case CHART_TYPE_STACKEDBAR3D:
0748:                    chartRenderer = evaluateStackedBar3DImage(evaluation);
0749:                    break;
0750:                case CHART_TYPE_THERMOMETER:
0751:                    chartRenderer = evaluateThermometerImage(evaluation);
0752:                    break;
0753:                case CHART_TYPE_TIMESERIES:
0754:                    chartRenderer = evaluateTimeSeriesImage(evaluation);
0755:                    break;
0756:                case CHART_TYPE_XYAREA:
0757:                    chartRenderer = evaluateXyAreaImage(evaluation);
0758:                    break;
0759:                case CHART_TYPE_XYBAR:
0760:                    chartRenderer = evaluateXYBarImage(evaluation);
0761:                    break;
0762:                case CHART_TYPE_XYLINE:
0763:                    chartRenderer = evaluateXyLineImage(evaluation);
0764:                    break;
0765:                case CHART_TYPE_STACKEDAREA:
0766:                    chartRenderer = evaluateStackedAreaImage(evaluation);
0767:                    break;
0768:                default:
0769:                    throw new JRRuntimeException("Chart type " + getChartType()
0770:                            + " not supported.");
0771:                }
0772:
0773:                if (chartCustomizer != null) {
0774:                    chartCustomizer.customize(chartRenderer.getChart(), this );
0775:                }
0776:
0777:                renderer = chartRenderer;
0778:
0779:                anchorName = (String) evaluateExpression(
0780:                        getAnchorNameExpression(), evaluation);
0781:                hyperlinkReference = (String) evaluateExpression(
0782:                        getHyperlinkReferenceExpression(), evaluation);
0783:                hyperlinkAnchor = (String) evaluateExpression(
0784:                        getHyperlinkAnchorExpression(), evaluation);
0785:                hyperlinkPage = (Integer) evaluateExpression(
0786:                        getHyperlinkPageExpression(), evaluation);
0787:                hyperlinkTooltip = (String) evaluateExpression(
0788:                        getHyperlinkTooltipExpression(), evaluation);
0789:                hyperlinkParameters = JRFillHyperlinkHelper
0790:                        .evaluateHyperlinkParameters(this , expressionEvaluator,
0791:                                evaluation);
0792:                return chartRenderer;
0793:            }
0794:
0795:            /**
0796:             *
0797:             */
0798:            protected boolean prepare(int availableStretchHeight,
0799:                    boolean isOverflow) {
0800:                boolean willOverflow = false;
0801:
0802:                if (isPrintWhenExpressionNull()
0803:                        || (!isPrintWhenExpressionNull() && isPrintWhenTrue())) {
0804:                    setToPrint(true);
0805:                } else {
0806:                    setToPrint(false);
0807:                }
0808:
0809:                if (!isToPrint()) {
0810:                    return willOverflow;
0811:                }
0812:
0813:                boolean isToPrint = true;
0814:                boolean isReprinted = false;
0815:
0816:                if (getEvaluationTime() == JRExpression.EVALUATION_TIME_NOW) {
0817:                    if (isOverflow && isAlreadyPrinted()
0818:                            && !isPrintWhenDetailOverflows()) {
0819:                        isToPrint = false;
0820:                    }
0821:
0822:                    if (isToPrint
0823:                            && availableStretchHeight < getRelativeY() - getY()
0824:                                    - getBandBottomY()) {
0825:                        isToPrint = false;
0826:                        willOverflow = true;
0827:                    }
0828:
0829:                    if (isToPrint
0830:                            && isOverflow
0831:                            &&
0832:                            //(this.isAlreadyPrinted() || !this.isPrintRepeatedValues())
0833:                            (isPrintWhenDetailOverflows() && (isAlreadyPrinted() || (!isAlreadyPrinted() && !isPrintRepeatedValues())))) {
0834:                        isReprinted = true;
0835:                    }
0836:
0837:                    if (isToPrint && isRemoveLineWhenBlank()
0838:                            && getRenderer() == null) {
0839:                        isToPrint = false;
0840:                    }
0841:                } else {
0842:                    if (isOverflow && isAlreadyPrinted()
0843:                            && !isPrintWhenDetailOverflows()) {
0844:                        isToPrint = false;
0845:                    }
0846:
0847:                    if (isToPrint
0848:                            && availableStretchHeight < getRelativeY() - getY()
0849:                                    - getBandBottomY()) {
0850:                        isToPrint = false;
0851:                        willOverflow = true;
0852:                    }
0853:
0854:                    if (isToPrint
0855:                            && isOverflow
0856:                            &&
0857:                            //(this.isAlreadyPrinted() || !this.isPrintRepeatedValues())
0858:                            (isPrintWhenDetailOverflows() && (isAlreadyPrinted() || (!isAlreadyPrinted() && !isPrintRepeatedValues())))) {
0859:                        isReprinted = true;
0860:                    }
0861:                }
0862:
0863:                setToPrint(isToPrint);
0864:                setReprinted(isReprinted);
0865:
0866:                return willOverflow;
0867:            }
0868:
0869:            /**
0870:             *
0871:             */
0872:            protected JRPrintElement fill() {
0873:                JRTemplatePrintImage printImage = new JRTemplatePrintImage(
0874:                        getJRTemplateImage());
0875:
0876:                printImage.setX(getX());
0877:                printImage.setY(getRelativeY());
0878:                printImage.setWidth(getWidth());
0879:                printImage.setHeight(getStretchHeight());
0880:
0881:                byte evaluationType = getEvaluationTime();
0882:                if (evaluationType == JRExpression.EVALUATION_TIME_NOW) {
0883:                    copy(printImage);
0884:                } else {
0885:                    filler.addBoundElement(this , printImage, evaluationType,
0886:                            getEvaluationGroup(), band);
0887:                }
0888:
0889:                return printImage;
0890:            }
0891:
0892:            /**
0893:             *
0894:             */
0895:            protected void copy(JRPrintImage printImage) {
0896:                printImage.setRenderer(getRenderer());
0897:                printImage.setAnchorName(getAnchorName());
0898:                printImage.setHyperlinkReference(getHyperlinkReference());
0899:                printImage.setHyperlinkAnchor(getHyperlinkAnchor());
0900:                printImage.setHyperlinkPage(getHyperlinkPage());
0901:                printImage.setHyperlinkTooltip(getHyperlinkTooltip());
0902:                printImage.setBookmarkLevel(getBookmarkLevel());
0903:                printImage.setHyperlinkParameters(hyperlinkParameters);
0904:            }
0905:
0906:            public byte getChartType() {
0907:                return chartType;
0908:            }
0909:
0910:            public JRChild getCopy(JRAbstractObjectFactory factory) {
0911:                return factory.getChart(this );
0912:            }
0913:
0914:            public void collectExpressions(JRExpressionCollector collector) {
0915:                collector.collect(this );
0916:            }
0917:
0918:            /**
0919:             * The method is never called for fill charts
0920:             * @param writer
0921:             */
0922:            public void writeXml(JRXmlWriter writer) {
0923:            }
0924:
0925:            /**
0926:             *
0927:             */
0928:            private void configureChart(JFreeChart chart, JRChartPlot jrPlot,
0929:                    byte evaluation) throws JRException {
0930:                if (getMode() == JRElement.MODE_OPAQUE) {
0931:                    chart.setBackgroundPaint(getBackcolor());
0932:                } else {
0933:                    chart.setBackgroundPaint(TRANSPARENT_PAINT);
0934:                }
0935:
0936:                if (chart.getTitle() != null) {
0937:                    TextTitle title = chart.getTitle();
0938:                    title.setPaint(getTitleColor());
0939:
0940:                    title.setFont(new Font(JRFontUtil
0941:                            .getAttributes(getTitleFont())));
0942:                }
0943:
0944:                String subtitleText = (String) evaluateExpression(
0945:                        getSubtitleExpression(), evaluation);
0946:                if (subtitleText != null) {
0947:                    TextTitle subtitle = new TextTitle(subtitleText);
0948:                    subtitle.setPaint(getSubtitleColor());
0949:
0950:                    subtitle.setFont(new Font(JRFontUtil
0951:                            .getAttributes(getSubtitleFont())));
0952:
0953:                    chart.addSubtitle(subtitle);
0954:                }
0955:
0956:                // Apply all of the legend formatting options
0957:                LegendTitle legend = chart.getLegend();
0958:                if (legend != null) {
0959:                    legend.setItemPaint(getLegendColor());
0960:
0961:                    if (getOwnLegendBackgroundColor() == null)// in a way, legend backcolor inheritence from chart is useless
0962:                    {
0963:                        legend.setBackgroundPaint(TRANSPARENT_PAINT);
0964:                    } else {
0965:                        legend.setBackgroundPaint(getLegendBackgroundColor());
0966:                    }
0967:
0968:                    chart.getLegend()
0969:                            .setItemFont(
0970:                                    new Font(JRFontUtil
0971:                                            .getAttributes(getLegendFont())));//FIXME put these in JRFontUtil
0972:                }
0973:
0974:                configurePlot(chart.getPlot(), jrPlot);
0975:            }
0976:
0977:            /**
0978:             *
0979:             */
0980:            private void configurePlot(Plot p, JRChartPlot jrPlot) {
0981:                p.setOutlinePaint(TRANSPARENT_PAINT);
0982:
0983:                if (getPlot().getOwnBackcolor() == null)// in a way, plot backcolor inheritence from chart is useless
0984:                {
0985:                    p.setBackgroundPaint(TRANSPARENT_PAINT);
0986:                } else {
0987:                    p.setBackgroundPaint(getPlot().getBackcolor());
0988:                }
0989:
0990:                p.setBackgroundAlpha(getPlot().getBackgroundAlpha());
0991:                p.setForegroundAlpha(getPlot().getForegroundAlpha());
0992:
0993:                SortedSet seriesColors = getPlot().getSeriesColors();
0994:                if (p instanceof  CategoryPlot) {
0995:                    // Handle rotation of the category labels.
0996:                    CategoryAxis axis = ((CategoryPlot) p).getDomainAxis();
0997:                    double labelRotation = getPlot().getLabelRotation();
0998:                    if (labelRotation == 90) {
0999:                        axis
1000:                                .setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
1001:                    } else if (labelRotation == -90) {
1002:                        axis
1003:                                .setCategoryLabelPositions(CategoryLabelPositions.UP_90);
1004:                    } else if (labelRotation < 0) {
1005:                        axis
1006:                                .setCategoryLabelPositions(CategoryLabelPositions
1007:                                        .createUpRotationLabelPositions((-labelRotation / 180.0)
1008:                                                * Math.PI));
1009:                    } else if (labelRotation > 0) {
1010:                        axis
1011:                                .setCategoryLabelPositions(CategoryLabelPositions
1012:                                        .createDownRotationLabelPositions((labelRotation / 180.0)
1013:                                                * Math.PI));
1014:                    }
1015:                }
1016:
1017:                // Set any color series
1018:                if (seriesColors != null) {
1019:                    if (seriesColors.size() == 1) {
1020:                        // Add the single color to the beginning of the color cycle, using all the default
1021:                        // colors.  To replace the defaults you have to specify at least two colors.
1022:                        Paint[] colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + 1];
1023:                        colors[0] = ((JRSeriesColor) seriesColors.first())
1024:                                .getColor();
1025:                        for (int i = 0; i < DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length; i++) {
1026:                            colors[i + 1] = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i];
1027:                        }
1028:
1029:                        p
1030:                                .setDrawingSupplier(new DefaultDrawingSupplier(
1031:                                        colors,
1032:                                        DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
1033:                                        DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
1034:                                        DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
1035:                                        DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
1036:                    } else if (seriesColors.size() > 1) {
1037:                        // Set up a custom drawing supplier that cycles through the user's colors
1038:                        // instead of the default colors.
1039:                        Color[] colors = new Color[seriesColors.size()];
1040:                        JRSeriesColor[] colorSequence = new JRSeriesColor[seriesColors
1041:                                .size()];
1042:                        seriesColors.toArray(colorSequence);
1043:                        for (int i = 0; i < colorSequence.length; i++) {
1044:                            colors[i] = colorSequence[i].getColor();
1045:                        }
1046:
1047:                        p
1048:                                .setDrawingSupplier(new DefaultDrawingSupplier(
1049:                                        colors,
1050:                                        DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
1051:                                        DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
1052:                                        DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
1053:                                        DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
1054:                    }
1055:                }
1056:            }
1057:
1058:            /**
1059:             * The series colors set in the main plot of a multiple axis chart are used for
1060:             * all the rendered charts in the plot.  This is a problem with multiple line
1061:             * charts, using different scales and thus different axis.  All the lines will
1062:             * be drawn using the first series color (since they are the first series for that
1063:             * rendered) and it will be impossible to tell them apart.
1064:             * <br><br>
1065:             * For this reason we interpret series colors for charts included in a multiple
1066:             * axis chart as specify absolute series colors for that renderer.
1067:             *
1068:             * @param renderer the renderer of the chart being created
1069:             * @param jrPlot the Jasper view of that plot
1070:             */
1071:            private void configureAxisSeriesColors(
1072:                    CategoryItemRenderer renderer, JRChartPlot jrPlot) {
1073:                SortedSet seriesColors = jrPlot.getSeriesColors();
1074:
1075:                if (seriesColors != null) {
1076:                    Iterator iter = seriesColors.iterator();
1077:                    while (iter.hasNext()) {
1078:                        JRSeriesColor seriesColor = (JRSeriesColor) iter.next();
1079:                        renderer.setSeriesPaint(seriesColor.getSeriesOrder(),
1080:                                seriesColor.getColor());
1081:                    }
1082:                }
1083:            }
1084:
1085:            /**
1086:             * The series colors set in the main plot of a multiple axis chart are used for
1087:             * all the rendered charts in the plot.  This is a problem with multiple line
1088:             * charts, using different scales and thus different axis.  All the lines will
1089:             * be drawn using the first series color (since they are the first series for that
1090:             * rendered) and it will be impossible to tell them apart.
1091:             * <br>
1092:             * For this reason we interpret series colors for charts included in a multiple
1093:             * axis chart as specify absolute series colors for that renderer.
1094:             *
1095:             * @param renderer the renderer of the chart being created
1096:             * @param jrPlot the Jasper view of that plot
1097:             */
1098:            private void configureAxisSeriesColors(XYItemRenderer renderer,
1099:                    JRChartPlot jrPlot) {
1100:                SortedSet seriesColors = jrPlot.getSeriesColors();
1101:
1102:                if (seriesColors != null) {
1103:                    Iterator iter = seriesColors.iterator();
1104:                    while (iter.hasNext()) {
1105:                        JRSeriesColor seriesColor = (JRSeriesColor) iter.next();
1106:                        renderer.setSeriesPaint(seriesColor.getSeriesOrder(),
1107:                                seriesColor.getColor());
1108:                    }
1109:                }
1110:            }
1111:
1112:            /**
1113:             * Sets all the axis formatting options.  This includes the colors and fonts to use on
1114:             * the axis as well as the color to use when drawing the axis line.
1115:             *
1116:             * @param axis the axis to format
1117:             * @param labelFont the font to use for the axis label
1118:             * @param labelColor the color of the axis label
1119:             * @param tickLabelFont the font to use for each tick mark value label
1120:             * @param tickLabelColor the color of each tick mark value label
1121:             * @param tickLabelMask formatting mask for the label.  If the axis is a NumberAxis then
1122:             * 					    the mask should be <code>java.text.DecimalFormat</code> mask, and
1123:             * 						if it is a DateAxis then the mask should be a
1124:             * 						<code>java.text.SimpleDateFormat</code> mask.
1125:             * @param lineColor color to use when drawing the axis line and any tick marks
1126:             */
1127:            private void configureAxis(Axis axis, JRFont labelFont,
1128:                    Color labelColor, JRFont tickLabelFont,
1129:                    Color tickLabelColor, String tickLabelMask, Color lineColor) {
1130:                axis
1131:                        .setLabelFont(new Font(JRFontUtil
1132:                                .getAttributes(labelFont)));
1133:                axis.setTickLabelFont(new Font(JRFontUtil
1134:                        .getAttributes(tickLabelFont)));
1135:
1136:                if (labelColor != null) {
1137:                    axis.setLabelPaint(labelColor);
1138:                }
1139:
1140:                if (tickLabelColor != null) {
1141:                    axis.setTickLabelPaint(tickLabelColor);
1142:                }
1143:
1144:                if (lineColor != null) {
1145:                    axis.setAxisLinePaint(lineColor);
1146:                    axis.setTickMarkPaint(lineColor);
1147:                }
1148:
1149:                if (tickLabelMask != null) {
1150:                    if (axis instanceof  NumberAxis) {
1151:                        NumberFormat fmt = NumberFormat.getInstance();
1152:                        if (fmt instanceof  DecimalFormat)
1153:                            ((DecimalFormat) fmt).applyPattern(tickLabelMask);
1154:                        ((NumberAxis) axis).setNumberFormatOverride(fmt);
1155:                    } else if (axis instanceof  DateAxis) {
1156:                        DateFormat fmt = null;
1157:                        if (tickLabelMask.equals("SHORT")
1158:                                || tickLabelMask.equals("DateFormat.SHORT"))
1159:                            fmt = DateFormat.getDateInstance(DateFormat.SHORT);
1160:                        else if (tickLabelMask.equals("MEDIUM")
1161:                                || tickLabelMask.equals("DateFormat.MEDIUM"))
1162:                            fmt = DateFormat.getDateInstance(DateFormat.MEDIUM);
1163:                        else if (tickLabelMask.equals("LONG")
1164:                                || tickLabelMask.equals("DateFormat.LONG"))
1165:                            fmt = DateFormat.getDateInstance(DateFormat.LONG);
1166:                        else if (tickLabelMask.equals("FULL")
1167:                                || tickLabelMask.equals("DateFormat.FULL"))
1168:                            fmt = DateFormat.getDateInstance(DateFormat.FULL);
1169:                        else
1170:                            fmt = new SimpleDateFormat(tickLabelMask);
1171:
1172:                        ((DateAxis) axis).setDateFormatOverride(fmt);
1173:                    }
1174:                    // ignore mask for other axis types.
1175:                }
1176:            }
1177:
1178:            /**
1179:             *
1180:             */
1181:            protected JFreeChartRenderer evaluateAreaImage(byte evaluation)
1182:                    throws JRException {
1183:                JFreeChart chart = ChartFactory.createAreaChart(
1184:                        (String) evaluateExpression(getTitleExpression(),
1185:                                evaluation), (String) evaluateExpression(
1186:                                ((JRAreaPlot) getPlot())
1187:                                        .getCategoryAxisLabelExpression(),
1188:                                evaluation), (String) evaluateExpression(
1189:                                ((JRAreaPlot) getPlot())
1190:                                        .getValueAxisLabelExpression(),
1191:                                evaluation), (CategoryDataset) dataset
1192:                                .getDataset(), getPlot().getOrientation(),
1193:                        isShowLegend(), true, false);
1194:
1195:                configureChart(chart, getPlot(), evaluation);
1196:                JRFillAreaPlot areaPlot = (JRFillAreaPlot) getPlot();
1197:
1198:                // Handle the axis formating for the catagory axis
1199:                configureAxis(((CategoryPlot) chart.getPlot()).getDomainAxis(),
1200:                        areaPlot.getCategoryAxisLabelFont(), areaPlot
1201:                                .getCategoryAxisLabelColor(), areaPlot
1202:                                .getCategoryAxisTickLabelFont(), areaPlot
1203:                                .getCategoryAxisTickLabelColor(), areaPlot
1204:                                .getCategoryAxisTickLabelMask(), areaPlot
1205:                                .getCategoryAxisLineColor());
1206:
1207:                // Handle the axis formating for the value axis
1208:                configureAxis(((CategoryPlot) chart.getPlot()).getRangeAxis(),
1209:                        areaPlot.getValueAxisLabelFont(), areaPlot
1210:                                .getValueAxisLabelColor(), areaPlot
1211:                                .getValueAxisTickLabelFont(), areaPlot
1212:                                .getValueAxisTickLabelColor(), areaPlot
1213:                                .getCategoryAxisTickLabelMask(), areaPlot
1214:                                .getValueAxisLineColor());
1215:
1216:                return getCategoryRenderer(chart);
1217:            }
1218:
1219:            protected JFreeChartRenderer evaluateBar3DImage(byte evaluation)
1220:                    throws JRException {
1221:                JFreeChart chart = ChartFactory.createBarChart3D(
1222:                        (String) evaluateExpression(getTitleExpression(),
1223:                                evaluation), (String) evaluateExpression(
1224:                                ((JRBar3DPlot) getPlot())
1225:                                        .getCategoryAxisLabelExpression(),
1226:                                evaluation), (String) evaluateExpression(
1227:                                ((JRBar3DPlot) getPlot())
1228:                                        .getValueAxisLabelExpression(),
1229:                                evaluation), (CategoryDataset) dataset
1230:                                .getDataset(), getPlot().getOrientation(),
1231:                        isShowLegend(), true, false);
1232:
1233:                configureChart(chart, getPlot(), evaluation);
1234:
1235:                CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
1236:                JRFillBar3DPlot bar3DPlot = (JRFillBar3DPlot) getPlot();
1237:
1238:                BarRenderer3D barRenderer3D = new BarRenderer3D(bar3DPlot
1239:                        .getXOffset(), bar3DPlot.getYOffset());
1240:                categoryPlot.setRenderer(barRenderer3D);
1241:
1242:                barRenderer3D
1243:                        .setBaseItemLabelGenerator(((JRFillCategoryDataset) getDataset())
1244:                                .getLabelGenerator());
1245:                barRenderer3D.setItemLabelsVisible(bar3DPlot.isShowLabels());
1246:
1247:                // Handle the axis formating for the catagory axis
1248:                configureAxis(categoryPlot.getDomainAxis(), bar3DPlot
1249:                        .getCategoryAxisLabelFont(), bar3DPlot
1250:                        .getCategoryAxisLabelColor(), bar3DPlot
1251:                        .getCategoryAxisTickLabelFont(), bar3DPlot
1252:                        .getCategoryAxisTickLabelColor(), bar3DPlot
1253:                        .getCategoryAxisTickLabelMask(), bar3DPlot
1254:                        .getCategoryAxisLineColor());
1255:
1256:                // Handle the axis formating for the value axis
1257:                configureAxis(categoryPlot.getRangeAxis(), bar3DPlot
1258:                        .getValueAxisLabelFont(), bar3DPlot
1259:                        .getValueAxisLabelColor(), bar3DPlot
1260:                        .getValueAxisTickLabelFont(), bar3DPlot
1261:                        .getValueAxisTickLabelColor(), bar3DPlot
1262:                        .getValueAxisTickLabelMask(), bar3DPlot
1263:                        .getValueAxisLineColor());
1264:
1265:                return getCategoryRenderer(chart);
1266:            }
1267:
1268:            /**
1269:             *
1270:             */
1271:            protected JFreeChartRenderer evaluateBarImage(byte evaluation)
1272:                    throws JRException {
1273:                CategoryDataset categoryDataset = (CategoryDataset) dataset
1274:                        .getDataset();
1275:                JFreeChart chart = ChartFactory.createBarChart(
1276:                        (String) evaluateExpression(getTitleExpression(),
1277:                                evaluation), (String) evaluateExpression(
1278:                                ((JRBarPlot) getPlot())
1279:                                        .getCategoryAxisLabelExpression(),
1280:                                evaluation), (String) evaluateExpression(
1281:                                ((JRBarPlot) getPlot())
1282:                                        .getValueAxisLabelExpression(),
1283:                                evaluation), categoryDataset, getPlot()
1284:                                .getOrientation(), isShowLegend(), true, false);
1285:
1286:                configureChart(chart, getPlot(), evaluation);
1287:
1288:                CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
1289:                //plot.setNoDataMessage("No data to display");
1290:
1291:                JRFillBarPlot barPlot = (JRFillBarPlot) getPlot();
1292:                categoryPlot.getDomainAxis().setTickMarksVisible(
1293:                        barPlot.isShowTickMarks());
1294:                categoryPlot.getDomainAxis().setTickLabelsVisible(
1295:                        barPlot.isShowTickLabels());
1296:                // Handle the axis formating for the catagory axis
1297:                configureAxis(categoryPlot.getDomainAxis(), barPlot
1298:                        .getCategoryAxisLabelFont(), barPlot
1299:                        .getCategoryAxisLabelColor(), barPlot
1300:                        .getCategoryAxisTickLabelFont(), barPlot
1301:                        .getCategoryAxisTickLabelColor(), barPlot
1302:                        .getCategoryAxisTickLabelMask(), barPlot
1303:                        .getCategoryAxisLineColor());
1304:
1305:                ((NumberAxis) categoryPlot.getRangeAxis())
1306:                        .setTickMarksVisible(barPlot.isShowTickMarks());
1307:                ((NumberAxis) categoryPlot.getRangeAxis())
1308:                        .setTickLabelsVisible(barPlot.isShowTickLabels());
1309:                // Handle the axis formating for the value axis
1310:                configureAxis(categoryPlot.getRangeAxis(), barPlot
1311:                        .getValueAxisLabelFont(), barPlot
1312:                        .getValueAxisLabelColor(), barPlot
1313:                        .getValueAxisTickLabelFont(), barPlot
1314:                        .getValueAxisTickLabelColor(), barPlot
1315:                        .getValueAxisTickLabelMask(), barPlot
1316:                        .getValueAxisLineColor());
1317:
1318:                CategoryItemRenderer categoryRenderer = categoryPlot
1319:                        .getRenderer();
1320:                categoryRenderer
1321:                        .setBaseItemLabelGenerator(((JRFillCategoryDataset) getDataset())
1322:                                .getLabelGenerator());
1323:                categoryRenderer.setItemLabelsVisible(barPlot.isShowLabels());
1324:
1325:                return getCategoryRenderer(chart);
1326:
1327:            }
1328:
1329:            protected JFreeChartRenderer evaluateBubbleImage(byte evaluation)
1330:                    throws JRException {
1331:                JFreeChart chart = ChartFactory.createBubbleChart(
1332:                        (String) evaluateExpression(getTitleExpression(),
1333:                                evaluation),
1334:                        (String) evaluateExpression(((JRBubblePlot) getPlot())
1335:                                .getXAxisLabelExpression(), evaluation),
1336:                        (String) evaluateExpression(((JRBubblePlot) getPlot())
1337:                                .getYAxisLabelExpression(), evaluation),
1338:                        (XYZDataset) dataset.getDataset(), getPlot()
1339:                                .getOrientation(), isShowLegend(), true, false);
1340:
1341:                configureChart(chart, getPlot(), evaluation);
1342:
1343:                XYPlot xyPlot = (XYPlot) chart.getPlot();
1344:                JRBubblePlot bubblePlot = (JRBubblePlot) getPlot();
1345:
1346:                XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer(
1347:                        bubblePlot.getScaleType());
1348:                xyPlot.setRenderer(bubbleRenderer);
1349:
1350:                // Handle the axis formating for the catagory axis
1351:                configureAxis(xyPlot.getDomainAxis(), bubblePlot
1352:                        .getXAxisLabelFont(), bubblePlot.getXAxisLabelColor(),
1353:                        bubblePlot.getXAxisTickLabelFont(), bubblePlot
1354:                                .getXAxisTickLabelColor(), bubblePlot
1355:                                .getXAxisTickLabelMask(), bubblePlot
1356:                                .getXAxisLineColor());
1357:
1358:                // Handle the axis formating for the value axis
1359:                configureAxis(xyPlot.getRangeAxis(), bubblePlot
1360:                        .getYAxisLabelFont(), bubblePlot.getYAxisLabelColor(),
1361:                        bubblePlot.getYAxisTickLabelFont(), bubblePlot
1362:                                .getYAxisTickLabelColor(), bubblePlot
1363:                                .getYAxisTickLabelMask(), bubblePlot
1364:                                .getYAxisLineColor());
1365:
1366:                return getXYZRenderer(chart);
1367:            }
1368:
1369:            /**
1370:             *
1371:             * @param evaluation
1372:             * @throws net.sf.jasperreports.engine.JRException
1373:             */
1374:            protected JFreeChartRenderer evaluateCandlestickImage(
1375:                    byte evaluation) throws JRException {
1376:                JFreeChart chart = ChartFactory.createCandlestickChart(
1377:                        (String) evaluateExpression(getTitleExpression(),
1378:                                evaluation), (String) evaluateExpression(
1379:                                ((JRCandlestickPlot) getPlot())
1380:                                        .getTimeAxisLabelExpression(),
1381:                                evaluation), (String) evaluateExpression(
1382:                                ((JRCandlestickPlot) getPlot())
1383:                                        .getValueAxisLabelExpression(),
1384:                                evaluation), (DefaultHighLowDataset) dataset
1385:                                .getDataset(), isShowLegend());
1386:
1387:                configureChart(chart, getPlot(), evaluation);
1388:
1389:                XYPlot xyPlot = (XYPlot) chart.getPlot();
1390:                JRCandlestickPlot candlestickPlot = (JRCandlestickPlot) getPlot();
1391:                CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot
1392:                        .getRenderer();
1393:                candlestickRenderer.setDrawVolume(candlestickPlot
1394:                        .isShowVolume());
1395:
1396:                // Handle the axis formating for the catagory axis
1397:                configureAxis(xyPlot.getDomainAxis(), candlestickPlot
1398:                        .getTimeAxisLabelFont(), candlestickPlot
1399:                        .getTimeAxisLabelColor(), candlestickPlot
1400:                        .getTimeAxisTickLabelFont(), candlestickPlot
1401:                        .getTimeAxisTickLabelColor(), candlestickPlot
1402:                        .getTimeAxisTickLabelMask(), candlestickPlot
1403:                        .getTimeAxisLineColor());
1404:
1405:                // Handle the axis formating for the value axis
1406:                configureAxis(xyPlot.getRangeAxis(), candlestickPlot
1407:                        .getValueAxisLabelFont(), candlestickPlot
1408:                        .getValueAxisLabelColor(), candlestickPlot
1409:                        .getValueAxisTickLabelFont(), candlestickPlot
1410:                        .getValueAxisTickLabelColor(), candlestickPlot
1411:                        .getValueAxisTickLabelMask(), candlestickPlot
1412:                        .getValueAxisLineColor());
1413:
1414:                return getHighLowRenderer(chart);
1415:            }
1416:
1417:            /**
1418:             *
1419:             * @param evaluation
1420:             * @throws JRException
1421:             */
1422:            protected JFreeChartRenderer evaluateHighLowImage(byte evaluation)
1423:                    throws JRException {
1424:                JFreeChart chart = ChartFactory.createHighLowChart(
1425:                        (String) evaluateExpression(getTitleExpression(),
1426:                                evaluation), (String) evaluateExpression(
1427:                                ((JRHighLowPlot) getPlot())
1428:                                        .getTimeAxisLabelExpression(),
1429:                                evaluation), (String) evaluateExpression(
1430:                                ((JRHighLowPlot) getPlot())
1431:                                        .getValueAxisLabelExpression(),
1432:                                evaluation), (DefaultHighLowDataset) dataset
1433:                                .getDataset(), isShowLegend());
1434:
1435:                configureChart(chart, getPlot(), evaluation);
1436:
1437:                XYPlot xyPlot = (XYPlot) chart.getPlot();
1438:                JRHighLowPlot highLowPlot = (JRHighLowPlot) getPlot();
1439:                HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot
1440:                        .getRenderer();
1441:                hlRenderer.setDrawOpenTicks(highLowPlot.isShowOpenTicks());
1442:                hlRenderer.setDrawCloseTicks(highLowPlot.isShowCloseTicks());
1443:
1444:                // Handle the axis formating for the catagory axis
1445:                configureAxis(xyPlot.getDomainAxis(), highLowPlot
1446:                        .getTimeAxisLabelFont(), highLowPlot
1447:                        .getTimeAxisLabelColor(), highLowPlot
1448:                        .getTimeAxisTickLabelFont(), highLowPlot
1449:                        .getTimeAxisTickLabelColor(), highLowPlot
1450:                        .getTimeAxisTickLabelMask(), highLowPlot
1451:                        .getTimeAxisLineColor());
1452:
1453:                // Handle the axis formating for the value axis
1454:                configureAxis(xyPlot.getRangeAxis(), highLowPlot
1455:                        .getValueAxisLabelFont(), highLowPlot
1456:                        .getValueAxisLabelColor(), highLowPlot
1457:                        .getValueAxisTickLabelFont(), highLowPlot
1458:                        .getValueAxisTickLabelColor(), highLowPlot
1459:                        .getValueAxisTickLabelMask(), highLowPlot
1460:                        .getValueAxisLineColor());
1461:
1462:                return getHighLowRenderer(chart);
1463:            }
1464:
1465:            protected JFreeChartRenderer evaluateLineImage(byte evaluation)
1466:                    throws JRException {
1467:                JFreeChart chart = ChartFactory.createLineChart(
1468:                        (String) evaluateExpression(getTitleExpression(),
1469:                                evaluation), (String) evaluateExpression(
1470:                                ((JRLinePlot) getPlot())
1471:                                        .getCategoryAxisLabelExpression(),
1472:                                evaluation), (String) evaluateExpression(
1473:                                ((JRLinePlot) getPlot())
1474:                                        .getValueAxisLabelExpression(),
1475:                                evaluation), (CategoryDataset) dataset
1476:                                .getDataset(), getPlot().getOrientation(),
1477:                        isShowLegend(), true, false);
1478:
1479:                configureChart(chart, getPlot(), evaluation);
1480:
1481:                CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
1482:                JRFillLinePlot linePlot = (JRFillLinePlot) getPlot();
1483:
1484:                LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer) categoryPlot
1485:                        .getRenderer();
1486:                lineRenderer.setShapesVisible(linePlot.isShowShapes());//FIXMECHART check this
1487:                lineRenderer.setLinesVisible(linePlot.isShowLines());
1488:
1489:                // Handle the axis formating for the catagory axis
1490:                configureAxis(categoryPlot.getDomainAxis(), linePlot
1491:                        .getCategoryAxisLabelFont(), linePlot
1492:                        .getCategoryAxisLabelColor(), linePlot
1493:                        .getCategoryAxisTickLabelFont(), linePlot
1494:                        .getCategoryAxisTickLabelColor(), linePlot
1495:                        .getCategoryAxisTickLabelMask(), linePlot
1496:                        .getCategoryAxisLineColor());
1497:
1498:                // Handle the axis formating for the value axis
1499:                configureAxis(categoryPlot.getRangeAxis(), linePlot
1500:                        .getValueAxisLabelFont(), linePlot
1501:                        .getValueAxisLabelColor(), linePlot
1502:                        .getValueAxisTickLabelFont(), linePlot
1503:                        .getValueAxisTickLabelColor(), linePlot
1504:                        .getValueAxisTickLabelMask(), linePlot
1505:                        .getValueAxisLineColor());
1506:
1507:                return getCategoryRenderer(chart);
1508:            }
1509:
1510:            /**
1511:             *
1512:             */
1513:            protected JFreeChartRenderer evaluatePie3DImage(byte evaluation)
1514:                    throws JRException {
1515:                JFreeChart chart = ChartFactory.createPieChart3D(
1516:                        (String) evaluateExpression(getTitleExpression(),
1517:                                evaluation), (PieDataset) dataset.getDataset(),
1518:                        isShowLegend(), true, false);
1519:
1520:                configureChart(chart, getPlot(), evaluation);
1521:
1522:                PiePlot3D piePlot3D = (PiePlot3D) chart.getPlot();
1523:                //plot.setStartAngle(290);
1524:                //plot.setDirection(Rotation.CLOCKWISE);
1525:                //plot.setNoDataMessage("No data to display");
1526:                piePlot3D.setDepthFactor(((JRFillPie3DPlot) getPlot())
1527:                        .getDepthFactor());
1528:                piePlot3D.setCircular(((JRFillPie3DPlot) getPlot())
1529:                        .isCircular());
1530:
1531:                PieSectionLabelGenerator labelGenerator = ((JRFillPieDataset) getDataset())
1532:                        .getLabelGenerator();
1533:                if (labelGenerator != null) {
1534:                    piePlot3D.setLabelGenerator(labelGenerator);
1535:                }
1536:
1537:                //FIXMECHART at this moment, there are no label font, label backcolor
1538:                // and label forecolor properties defined for the PieChart3D
1539:
1540:                piePlot3D
1541:                        .setLabelFont(new Font(JRFontUtil
1542:                                .getAttributes(new JRBaseFont(null, null, this ,
1543:                                        null))));
1544:
1545:                piePlot3D.setLabelPaint(getForecolor());
1546:
1547:                return getPieRenderer(chart);
1548:            }
1549:
1550:            /**
1551:             *
1552:             */
1553:            protected JFreeChartRenderer evaluatePieImage(byte evaluation)
1554:                    throws JRException {
1555:                JFreeChart chart = ChartFactory.createPieChart(
1556:                        (String) evaluateExpression(getTitleExpression(),
1557:                                evaluation), (PieDataset) dataset.getDataset(),
1558:                        isShowLegend(), true, false);
1559:
1560:                configureChart(chart, getPlot(), evaluation);
1561:                PiePlot piePlot = (PiePlot) chart.getPlot();
1562:                //plot.setStartAngle(290);
1563:                //plot.setDirection(Rotation.CLOCKWISE);
1564:                //plot.setNoDataMessage("No data to display");
1565:                piePlot.setCircular(((JRFillPiePlot) getPlot()).isCircular());
1566:
1567:                PieSectionLabelGenerator labelGenerator = ((JRFillPieDataset) getDataset())
1568:                        .getLabelGenerator();
1569:                if (labelGenerator != null) {
1570:                    piePlot.setLabelGenerator(labelGenerator);
1571:                }
1572:
1573:                //FIXMECHART at this moment, there are no label font, label backcolor
1574:                // and label forecolor properties defined for the PieChart
1575:
1576:                piePlot
1577:                        .setLabelFont(new Font(JRFontUtil
1578:                                .getAttributes(new JRBaseFont(null, null, this ,
1579:                                        null))));
1580:
1581:                piePlot.setLabelPaint(getForecolor());
1582:
1583:                return getPieRenderer(chart);
1584:            }
1585:
1586:            protected JFreeChartRenderer evaluateScatterImage(byte evaluation)
1587:                    throws JRException {
1588:                JFreeChart chart = ChartFactory.createScatterPlot(
1589:                        (String) evaluateExpression(getTitleExpression(),
1590:                                evaluation),
1591:                        (String) evaluateExpression(((JRScatterPlot) getPlot())
1592:                                .getXAxisLabelExpression(), evaluation),
1593:                        (String) evaluateExpression(((JRScatterPlot) getPlot())
1594:                                .getYAxisLabelExpression(), evaluation),
1595:                        (XYDataset) dataset.getDataset(), getPlot()
1596:                                .getOrientation(), isShowLegend(), true, false);
1597:
1598:                configureChart(chart, getPlot(), evaluation);
1599:                XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) chart
1600:                        .getPlot()).getRenderer();
1601:
1602:                JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
1603:                plotRenderer.setLinesVisible(scatterPlot.isShowLines());
1604:                plotRenderer.setShapesVisible(scatterPlot.isShowShapes());
1605:
1606:                // Handle the axis formating for the catagory axis
1607:                configureAxis(chart.getXYPlot().getDomainAxis(), scatterPlot
1608:                        .getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(),
1609:                        scatterPlot.getXAxisTickLabelFont(), scatterPlot
1610:                                .getXAxisTickLabelColor(), scatterPlot
1611:                                .getXAxisTickLabelMask(), scatterPlot
1612:                                .getXAxisLineColor());
1613:
1614:                // Handle the axis formating for the value axis
1615:                configureAxis(chart.getXYPlot().getRangeAxis(), scatterPlot
1616:                        .getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(),
1617:                        scatterPlot.getYAxisTickLabelFont(), scatterPlot
1618:                                .getYAxisTickLabelColor(), scatterPlot
1619:                                .getYAxisTickLabelMask(), scatterPlot
1620:                                .getYAxisLineColor());
1621:
1622:                return getXYRenderer(chart);
1623:            }
1624:
1625:            /**
1626:             *
1627:             */
1628:            protected JFreeChartRenderer evaluateStackedBar3DImage(
1629:                    byte evaluation) throws JRException {
1630:                JFreeChart chart = ChartFactory.createStackedBarChart3D(
1631:                        (String) evaluateExpression(getTitleExpression(),
1632:                                evaluation), (String) evaluateExpression(
1633:                                ((JRBar3DPlot) getPlot())
1634:                                        .getCategoryAxisLabelExpression(),
1635:                                evaluation), (String) evaluateExpression(
1636:                                ((JRBar3DPlot) getPlot())
1637:                                        .getValueAxisLabelExpression(),
1638:                                evaluation), (CategoryDataset) dataset
1639:                                .getDataset(), getPlot().getOrientation(),
1640:                        isShowLegend(), true, false);
1641:
1642:                configureChart(chart, getPlot(), evaluation);
1643:
1644:                CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
1645:                JRFillBar3DPlot bar3DPlot = (JRFillBar3DPlot) getPlot();
1646:
1647:                StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D(
1648:                        bar3DPlot.getXOffset(), bar3DPlot.getYOffset());
1649:                categoryPlot.setRenderer(stackedBarRenderer3D);
1650:
1651:                stackedBarRenderer3D
1652:                        .setBaseItemLabelGenerator(((JRFillCategoryDataset) getDataset())
1653:                                .getLabelGenerator());
1654:                stackedBarRenderer3D.setItemLabelsVisible(bar3DPlot
1655:                        .isShowLabels());
1656:
1657:                // Handle the axis formating for the catagory axis
1658:                configureAxis(categoryPlot.getDomainAxis(), bar3DPlot
1659:                        .getCategoryAxisLabelFont(), bar3DPlot
1660:                        .getCategoryAxisLabelColor(), bar3DPlot
1661:                        .getCategoryAxisTickLabelFont(), bar3DPlot
1662:                        .getCategoryAxisTickLabelColor(), bar3DPlot
1663:                        .getCategoryAxisTickLabelMask(), bar3DPlot
1664:                        .getCategoryAxisLineColor());
1665:
1666:                // Handle the axis formating for the value axis
1667:                configureAxis(categoryPlot.getRangeAxis(), bar3DPlot
1668:                        .getValueAxisLabelFont(), bar3DPlot
1669:                        .getValueAxisLabelColor(), bar3DPlot
1670:                        .getValueAxisTickLabelFont(), bar3DPlot
1671:                        .getValueAxisTickLabelColor(), bar3DPlot
1672:                        .getValueAxisTickLabelMask(), bar3DPlot
1673:                        .getValueAxisLineColor());
1674:
1675:                return getCategoryRenderer(chart);
1676:            }
1677:
1678:            /**
1679:             *
1680:             */
1681:            protected JFreeChartRenderer evaluateStackedBarImage(byte evaluation)
1682:                    throws JRException {
1683:                JFreeChart chart = ChartFactory.createStackedBarChart(
1684:                        (String) evaluateExpression(getTitleExpression(),
1685:                                evaluation), (String) evaluateExpression(
1686:                                ((JRBarPlot) getPlot())
1687:                                        .getCategoryAxisLabelExpression(),
1688:                                evaluation), (String) evaluateExpression(
1689:                                ((JRBarPlot) getPlot())
1690:                                        .getValueAxisLabelExpression(),
1691:                                evaluation), (CategoryDataset) dataset
1692:                                .getDataset(), getPlot().getOrientation(),
1693:                        isShowLegend(), true, false);
1694:
1695:                configureChart(chart, getPlot(), evaluation);
1696:
1697:                CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
1698:                JRFillBarPlot barPlot = (JRFillBarPlot) getPlot();
1699:                //plot.setNoDataMessage("No data to display");
1700:
1701:                categoryPlot.getDomainAxis().setTickMarksVisible(
1702:                        barPlot.isShowTickMarks());
1703:                categoryPlot.getDomainAxis().setTickLabelsVisible(
1704:                        barPlot.isShowTickLabels());
1705:                ((NumberAxis) categoryPlot.getRangeAxis())
1706:                        .setTickMarksVisible(barPlot.isShowTickMarks());
1707:                ((NumberAxis) categoryPlot.getRangeAxis())
1708:                        .setTickLabelsVisible(barPlot.isShowTickLabels());
1709:
1710:                CategoryItemRenderer categoryRenderer = categoryPlot
1711:                        .getRenderer();
1712:                categoryRenderer
1713:                        .setBaseItemLabelGenerator(((JRFillCategoryDataset) getDataset())
1714:                                .getLabelGenerator());
1715:                categoryRenderer
1716:                        .setItemLabelsVisible(((JRFillBarPlot) getPlot())
1717:                                .isShowLabels());
1718:
1719:                // Handle the axis formating for the catagory axis
1720:                configureAxis(categoryPlot.getDomainAxis(), barPlot
1721:                        .getCategoryAxisLabelFont(), barPlot
1722:                        .getCategoryAxisLabelColor(), barPlot
1723:                        .getCategoryAxisTickLabelFont(), barPlot
1724:                        .getCategoryAxisTickLabelColor(), barPlot
1725:                        .getCategoryAxisTickLabelMask(), barPlot
1726:                        .getCategoryAxisLineColor());
1727:
1728:                // Handle the axis formating for the value axis
1729:                configureAxis(categoryPlot.getRangeAxis(), barPlot
1730:                        .getValueAxisLabelFont(), barPlot
1731:                        .getValueAxisLabelColor(), barPlot
1732:                        .getValueAxisTickLabelFont(), barPlot
1733:                        .getValueAxisTickLabelColor(), barPlot
1734:                        .getValueAxisTickLabelMask(), barPlot
1735:                        .getValueAxisLineColor());
1736:
1737:                return getCategoryRenderer(chart);
1738:            }
1739:
1740:            /**
1741:             *
1742:             */
1743:            protected JFreeChartRenderer evaluateStackedAreaImage(
1744:                    byte evaluation) throws JRException {
1745:                JFreeChart chart = ChartFactory.createStackedAreaChart(
1746:                        (String) evaluateExpression(getTitleExpression(),
1747:                                evaluation), (String) evaluateExpression(
1748:                                ((JRAreaPlot) getPlot())
1749:                                        .getCategoryAxisLabelExpression(),
1750:                                evaluation), (String) evaluateExpression(
1751:                                ((JRAreaPlot) getPlot())
1752:                                        .getValueAxisLabelExpression(),
1753:                                evaluation), (CategoryDataset) dataset
1754:                                .getDataset(), getPlot().getOrientation(),
1755:                        isShowLegend(), true, false);
1756:
1757:                configureChart(chart, getPlot(), evaluation);
1758:                JRFillAreaPlot areaPlot = (JRFillAreaPlot) getPlot();
1759:
1760:                // Handle the axis formating for the catagory axis
1761:                configureAxis(((CategoryPlot) chart.getPlot()).getDomainAxis(),
1762:                        areaPlot.getCategoryAxisLabelFont(), areaPlot
1763:                                .getCategoryAxisLabelColor(), areaPlot
1764:                                .getCategoryAxisTickLabelFont(), areaPlot
1765:                                .getCategoryAxisTickLabelColor(), areaPlot
1766:                                .getCategoryAxisTickLabelMask(), areaPlot
1767:                                .getCategoryAxisLineColor());
1768:
1769:                // Handle the axis formating for the value axis
1770:                configureAxis(((CategoryPlot) chart.getPlot()).getRangeAxis(),
1771:                        areaPlot.getValueAxisLabelFont(), areaPlot
1772:                                .getValueAxisLabelColor(), areaPlot
1773:                                .getValueAxisTickLabelFont(), areaPlot
1774:                                .getValueAxisTickLabelColor(), areaPlot
1775:                                .getCategoryAxisTickLabelMask(), areaPlot
1776:                                .getValueAxisLineColor());
1777:
1778:                return getCategoryRenderer(chart);
1779:            }
1780:
1781:            protected JFreeChartRenderer evaluateXyAreaImage(byte evaluation)
1782:                    throws JRException {
1783:                JFreeChart chart = ChartFactory
1784:                        .createXYAreaChart(
1785:                                (String) evaluateExpression(
1786:                                        getTitleExpression(), evaluation),
1787:                                (String) evaluateExpression(
1788:                                        ((JRAreaPlot) getPlot())
1789:                                                .getCategoryAxisLabelExpression(),
1790:                                        evaluation),
1791:                                (String) evaluateExpression(
1792:                                        ((JRAreaPlot) getPlot())
1793:                                                .getValueAxisLabelExpression(),
1794:                                        evaluation), (XYDataset) dataset
1795:                                        .getDataset(), getPlot()
1796:                                        .getOrientation(), isShowLegend(),
1797:                                true, false);
1798:
1799:                configureChart(chart, getPlot(), evaluation);
1800:                JRAreaPlot areaPlot = (JRAreaPlot) getPlot();
1801:
1802:                // Handle the axis formating for the catagory axis
1803:                configureAxis(chart.getXYPlot().getDomainAxis(), areaPlot
1804:                        .getCategoryAxisLabelFont(), areaPlot
1805:                        .getCategoryAxisLabelColor(), areaPlot
1806:                        .getCategoryAxisTickLabelFont(), areaPlot
1807:                        .getCategoryAxisTickLabelColor(), areaPlot
1808:                        .getCategoryAxisTickLabelMask(), areaPlot
1809:                        .getCategoryAxisLineColor());
1810:
1811:                // Handle the axis formating for the value axis
1812:                configureAxis(chart.getXYPlot().getRangeAxis(), areaPlot
1813:                        .getValueAxisLabelFont(), areaPlot
1814:                        .getValueAxisLabelColor(), areaPlot
1815:                        .getValueAxisTickLabelFont(), areaPlot
1816:                        .getValueAxisTickLabelColor(), areaPlot
1817:                        .getValueAxisTickLabelMask(), areaPlot
1818:                        .getValueAxisLineColor());
1819:                return getXYRenderer(chart);
1820:            }
1821:
1822:            /**
1823:             *
1824:             */
1825:            protected JFreeChartRenderer evaluateXYBarImage(byte evaluation)
1826:                    throws JRException {
1827:                IntervalXYDataset tmpDataset = (IntervalXYDataset) dataset
1828:                        .getDataset();
1829:
1830:                boolean isDate = true;
1831:                if (dataset.getDatasetType() == JRChartDataset.XY_DATASET) {
1832:                    isDate = false;
1833:                }
1834:
1835:                JFreeChart chart = ChartFactory.createXYBarChart(
1836:                        (String) evaluateExpression(getTitleExpression(),
1837:                                evaluation), (String) evaluateExpression(
1838:                                ((JRBarPlot) getPlot())
1839:                                        .getCategoryAxisLabelExpression(),
1840:                                evaluation), isDate,
1841:                        (String) evaluateExpression(((JRBarPlot) getPlot())
1842:                                .getValueAxisLabelExpression(), evaluation),
1843:                        tmpDataset, getPlot().getOrientation(), isShowLegend(),
1844:                        true, false);
1845:
1846:                configureChart(chart, getPlot(), evaluation);
1847:
1848:                XYPlot xyPlot = (XYPlot) chart.getPlot();
1849:                //plot.setNoDataMessage("No data to display");
1850:                //		((XYPlot)plot.getDomainAxis()).setTickMarksVisible(
1851:                //			((JRFillBarPlot)getPlot()).isShowTickMarks()
1852:                //			);
1853:                //		((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible(
1854:                //				((JRFillBarPlot)getPlot()).isShowTickLabels()
1855:                //				);
1856:                //		((NumberAxis)plot.getRangeAxis()).setTickMarksVisible(
1857:                //				((JRFillBarPlot)getPlot()).isShowTickMarks()
1858:                //				);
1859:                //		((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible(
1860:                //				((JRFillBarPlot)getPlot()).isShowTickLabels()
1861:                //				);
1862:
1863:                XYItemRenderer itemRenderer = xyPlot.getRenderer();
1864:                if (getDataset().getDatasetType() == JRChartDataset.TIMESERIES_DATASET) {
1865:                    itemRenderer
1866:                            .setBaseItemLabelGenerator(((JRFillTimeSeriesDataset) getDataset())
1867:                                    .getLabelGenerator());
1868:                } else if (getDataset().getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET) {
1869:                    itemRenderer
1870:                            .setBaseItemLabelGenerator(((JRFillTimePeriodDataset) getDataset())
1871:                                    .getLabelGenerator());
1872:                } else if (getDataset().getDatasetType() == JRChartDataset.XY_DATASET) {
1873:                    itemRenderer
1874:                            .setBaseItemLabelGenerator(((JRFillXyDataset) getDataset())
1875:                                    .getLabelGenerator());
1876:                }
1877:
1878:                JRFillBarPlot barPlot = (JRFillBarPlot) getPlot();
1879:
1880:                itemRenderer.setBaseItemLabelsVisible(barPlot.isShowLabels());
1881:
1882:                // Handle the axis formating for the catagory axis
1883:                configureAxis(xyPlot.getDomainAxis(), barPlot
1884:                        .getCategoryAxisLabelFont(), barPlot
1885:                        .getCategoryAxisLabelColor(), barPlot
1886:                        .getCategoryAxisTickLabelFont(), barPlot
1887:                        .getCategoryAxisTickLabelColor(), barPlot
1888:                        .getCategoryAxisTickLabelMask(), barPlot
1889:                        .getCategoryAxisLineColor());
1890:
1891:                // Handle the axis formating for the value axis
1892:                configureAxis(xyPlot.getRangeAxis(), barPlot
1893:                        .getValueAxisLabelFont(), barPlot
1894:                        .getValueAxisLabelColor(), barPlot
1895:                        .getValueAxisTickLabelFont(), barPlot
1896:                        .getValueAxisTickLabelColor(), barPlot
1897:                        .getValueAxisTickLabelMask(), barPlot
1898:                        .getValueAxisLineColor());
1899:
1900:                return getXYBarRenderer(chart);
1901:            }
1902:
1903:            protected JFreeChartRenderer evaluateXyLineImage(byte evaluation)
1904:                    throws JRException {
1905:                JRLinePlot linePlot = (JRLinePlot) getPlot();
1906:
1907:                JFreeChart chart = ChartFactory.createXYLineChart(
1908:                        (String) evaluateExpression(getTitleExpression(),
1909:                                evaluation), (String) evaluateExpression(
1910:                                linePlot.getCategoryAxisLabelExpression(),
1911:                                evaluation), (String) evaluateExpression(
1912:                                linePlot.getValueAxisLabelExpression(),
1913:                                evaluation), (XYDataset) dataset.getDataset(),
1914:                        linePlot.getOrientation(), isShowLegend(), true, false);
1915:
1916:                configureChart(chart, getPlot(), evaluation);
1917:
1918:                // Handle the axis formating for the catagory axis
1919:                configureAxis(chart.getXYPlot().getDomainAxis(), linePlot
1920:                        .getCategoryAxisLabelFont(), linePlot
1921:                        .getCategoryAxisLabelColor(), linePlot
1922:                        .getCategoryAxisTickLabelFont(), linePlot
1923:                        .getCategoryAxisTickLabelColor(), linePlot
1924:                        .getCategoryAxisTickLabelMask(), linePlot
1925:                        .getCategoryAxisLineColor());
1926:
1927:                // Handle the axis formating for the value axis
1928:                configureAxis(chart.getXYPlot().getRangeAxis(), linePlot
1929:                        .getValueAxisLabelFont(), linePlot
1930:                        .getValueAxisLabelColor(), linePlot
1931:                        .getValueAxisTickLabelFont(), linePlot
1932:                        .getValueAxisTickLabelColor(), linePlot
1933:                        .getValueAxisTickLabelMask(), linePlot
1934:                        .getValueAxisLineColor());
1935:
1936:                XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) chart
1937:                        .getXYPlot().getRenderer();
1938:                lineRenderer.setShapesVisible(linePlot.isShowShapes());
1939:                lineRenderer.setLinesVisible(linePlot.isShowLines());
1940:
1941:                return getXYRenderer(chart);
1942:            }
1943:
1944:            protected JFreeChartRenderer evaluateTimeSeriesImage(byte evaluation)
1945:                    throws JRException {
1946:
1947:                String timeAxisLabel = (String) evaluateExpression(
1948:                        ((JRTimeSeriesPlot) getPlot())
1949:                                .getTimeAxisLabelExpression(), evaluation);
1950:                String valueAxisLabel = (String) evaluateExpression(
1951:                        ((JRTimeSeriesPlot) getPlot())
1952:                                .getValueAxisLabelExpression(), evaluation);
1953:
1954:                JFreeChart chart = ChartFactory.createTimeSeriesChart(
1955:                        (String) evaluateExpression(getTitleExpression(),
1956:                                evaluation), timeAxisLabel, valueAxisLabel,
1957:                        (TimeSeriesCollection) dataset.getDataset(),
1958:                        isShowLegend(), true, false);
1959:
1960:                configureChart(chart, getPlot(), evaluation);
1961:
1962:                XYPlot xyPlot = (XYPlot) chart.getPlot();
1963:                JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot) getPlot();
1964:
1965:                XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot
1966:                        .getRenderer();
1967:                lineRenderer.setLinesVisible(((JRTimeSeriesPlot) getPlot())
1968:                        .isShowLines());
1969:                lineRenderer.setShapesVisible(((JRTimeSeriesPlot) getPlot())
1970:                        .isShowShapes());
1971:
1972:                // Handle the axis formating for the catagory axis
1973:                configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot
1974:                        .getTimeAxisLabelFont(), timeSeriesPlot
1975:                        .getTimeAxisLabelColor(), timeSeriesPlot
1976:                        .getTimeAxisTickLabelFont(), timeSeriesPlot
1977:                        .getTimeAxisTickLabelColor(), timeSeriesPlot
1978:                        .getTimeAxisTickLabelMask(), timeSeriesPlot
1979:                        .getTimeAxisLineColor());
1980:
1981:                // Handle the axis formating for the value axis
1982:                configureAxis(xyPlot.getRangeAxis(), timeSeriesPlot
1983:                        .getValueAxisLabelFont(), timeSeriesPlot
1984:                        .getValueAxisLabelColor(), timeSeriesPlot
1985:                        .getValueAxisTickLabelFont(), timeSeriesPlot
1986:                        .getValueAxisTickLabelColor(), timeSeriesPlot
1987:                        .getValueAxisTickLabelMask(), timeSeriesPlot
1988:                        .getValueAxisLineColor());
1989:
1990:                return getTimeSeriesRenderer(chart);
1991:
1992:            }
1993:
1994:            /**
1995:             * Converts a JasperReport data range into one understood by JFreeChart.
1996:             *
1997:             * @param dataRange the JasperReport version of the range
1998:             * @param evaluation current expression evaluation phase
1999:             * @return the JFreeChart version of the range
2000:             * @throws JRException thrown when the low value of the range is greater than the
2001:             * 						high value
2002:             */
2003:            protected Range convertRange(JRDataRange dataRange, byte evaluation)
2004:                    throws JRException {
2005:                if (dataRange == null)
2006:                    return null;
2007:
2008:                Number low = (Number) evaluateExpression(dataRange
2009:                        .getLowExpression(), evaluation);
2010:                Number high = (Number) evaluateExpression(dataRange
2011:                        .getHighExpression(), evaluation);
2012:                return new Range(low != null ? low.doubleValue() : 0.0,
2013:                        high != null ? high.doubleValue() : 100.0);
2014:            }
2015:
2016:            /**
2017:             * Converts a JasperReports meter interval to one that JFreeChart understands.
2018:             *
2019:             * @param interval the JasperReports definition of an interval
2020:             * @param evaluation current evaluation time
2021:             * @return the JFreeChart version of the same interval
2022:             * @throws JRException thrown when the interval contains an invalid range
2023:             */
2024:            protected MeterInterval convertInterval(JRMeterInterval interval,
2025:                    byte evaluation) throws JRException {
2026:                String label = interval.getLabel();
2027:                if (label == null)
2028:                    label = "";
2029:
2030:                Range range = convertRange(interval.getDataRange(), evaluation);
2031:
2032:                Color color = interval.getBackgroundColor();
2033:                float[] components = color.getRGBColorComponents(null);
2034:
2035:                Color alphaColor = new Color(components[0], components[1],
2036:                        components[2], (float) interval.getAlpha());
2037:
2038:                return new MeterInterval(label, range, alphaColor, null,
2039:                        alphaColor);
2040:            }
2041:
2042:            /**
2043:             * Build and configure a meter chart.
2044:             *
2045:             * @param evaluation current expression evaluation phase
2046:             * @return the JFreeChart meter chart
2047:             * @throws JRException
2048:             */
2049:            protected JFreeChartRenderer evaluateMeterImage(byte evaluation)
2050:                    throws JRException {
2051:
2052:                JRFillMeterPlot jrPlot = (JRFillMeterPlot) getPlot();
2053:
2054:                // Start by creating the plot that wil hold the meter
2055:                MeterPlot chartPlot = new MeterPlot((ValueDataset) dataset
2056:                        .getDataset());
2057:
2058:                // Set the shape
2059:                int shape = jrPlot.getShape();
2060:                if (shape == JRMeterPlot.SHAPE_CHORD)
2061:                    chartPlot.setDialShape(DialShape.CHORD);
2062:                else if (shape == JRMeterPlot.SHAPE_CIRCLE)
2063:                    chartPlot.setDialShape(DialShape.CIRCLE);
2064:                else
2065:                    chartPlot.setDialShape(DialShape.PIE);
2066:
2067:                // Set the meter's range
2068:                chartPlot.setRange(convertRange(jrPlot.getDataRange(),
2069:                        evaluation));
2070:
2071:                // Set the size of the meter
2072:                chartPlot.setMeterAngle(jrPlot.getMeterAngle());
2073:
2074:                // Set the units - this is just a string that will be shown next to the
2075:                // value
2076:                String units = jrPlot.getUnits();
2077:                if (units != null && units.length() > 0)
2078:                    chartPlot.setUnits(units);
2079:
2080:                // Set the spacing between ticks.  I hate the name "tickSize" since to me it
2081:                // implies I am changing the size of the tick, not the spacing between them.
2082:                chartPlot.setTickSize(jrPlot.getTickInterval());
2083:
2084:                // Set all the colors we support
2085:                Color color = jrPlot.getMeterBackgroundColor();
2086:                if (color != null)
2087:                    chartPlot.setDialBackgroundPaint(color);
2088:
2089:                color = jrPlot.getNeedleColor();
2090:                if (color != null)
2091:                    chartPlot.setNeedlePaint(color);
2092:
2093:                // Set how the value is displayed.
2094:                JRValueDisplay display = jrPlot.getValueDisplay();
2095:                if (display != null) {
2096:                    if (display.getColor() != null) {
2097:                        chartPlot.setValuePaint(display.getColor());
2098:                    }
2099:
2100:                    if (display.getMask() != null) {
2101:                        chartPlot.setTickLabelFormat(new DecimalFormat(display
2102:                                .getMask()));
2103:                    }
2104:                    if (display.getFont() != null) {
2105:                        chartPlot.setValueFont(new Font(JRFontUtil
2106:                                .getAttributes(display.getFont())));
2107:                    }
2108:
2109:                }
2110:
2111:                color = jrPlot.getTickColor();
2112:                if (color != null)
2113:                    chartPlot.setTickPaint(color);
2114:
2115:                // Now define all of the intervals, setting their range and color
2116:                List intervals = jrPlot.getIntervals();
2117:                if (intervals != null) {
2118:                    Iterator iter = intervals.iterator();
2119:                    while (iter.hasNext()) {
2120:                        JRMeterInterval interval = (JRMeterInterval) iter
2121:                                .next();
2122:                        chartPlot.addInterval(convertInterval(interval,
2123:                                evaluation));
2124:                    }
2125:                }
2126:
2127:                // Actually create the chart around the plot
2128:                JFreeChart chart = new JFreeChart((String) evaluateExpression(
2129:                        getTitleExpression(), evaluation), null, chartPlot,
2130:                        isShowLegend());
2131:
2132:                // Set all the generic options
2133:                configureChart(chart, getPlot(), evaluation);
2134:
2135:                // Meters only display a single value, so no hyperlinks are supported
2136:                return new JFreeChartRenderer(chart);
2137:
2138:            }
2139:
2140:            /**
2141:             * Build and run a thermometer chart.  JFreeChart thermometer charts have some
2142:             * limitations.  They always have a maximum of three ranges, and the colors of those
2143:             * ranges seems to be fixed.
2144:             *
2145:             * @param evaluation current expression evaluation phase
2146:             * @return the JFreeChart thermometer chart
2147:             * @throws JRException
2148:             */
2149:            protected JFreeChartRenderer evaluateThermometerImage(
2150:                    byte evaluation) throws JRException {
2151:
2152:                JRFillThermometerPlot jrPlot = (JRFillThermometerPlot) getPlot();
2153:
2154:                // Create the plot that will hold the thermometer.
2155:                ThermometerPlot chartPlot = new ThermometerPlot(
2156:                        (ValueDataset) dataset.getDataset());
2157:
2158:                Range range = convertRange(jrPlot.getDataRange(), evaluation);
2159:
2160:                // Set the boundary of the thermomoter
2161:                chartPlot.setLowerBound(range.getLowerBound());
2162:                chartPlot.setUpperBound(range.getUpperBound());
2163:
2164:                chartPlot.setShowValueLines(jrPlot.isShowValueLines());
2165:
2166:                // Units can only be Fahrenheit, Celsius or none, so turn off for now.
2167:                chartPlot.setUnits(ThermometerPlot.UNITS_NONE);
2168:
2169:                // Set the color of the mercury.  Only used when the value is outside of
2170:                // any defined ranges.
2171:                Color color = jrPlot.getMercuryColor();
2172:                if (color != null) {
2173:                    chartPlot.setMercuryPaint(color);
2174:                }
2175:
2176:                // Set the formatting of the value display
2177:                JRValueDisplay display = jrPlot.getValueDisplay();
2178:                if (display != null) {
2179:                    if (display.getColor() != null) {
2180:                        chartPlot.setValuePaint(display.getColor());
2181:                    }
2182:                    if (display.getMask() != null) {
2183:                        chartPlot.setValueFormat(new DecimalFormat(display
2184:                                .getMask()));
2185:                    }
2186:                    if (display.getFont() != null) {
2187:                        chartPlot.setValueFont(new Font(JRFontUtil
2188:                                .getAttributes(display.getFont())));
2189:                    }
2190:                }
2191:
2192:                // Set the location of where the value is displayed
2193:                switch (jrPlot.getValueLocation()) {
2194:                case JRThermometerPlot.LOCATION_NONE:
2195:                    chartPlot.setValueLocation(ThermometerPlot.NONE);
2196:                    break;
2197:                case JRThermometerPlot.LOCATION_LEFT:
2198:                    chartPlot.setValueLocation(ThermometerPlot.LEFT);
2199:                    break;
2200:                case JRThermometerPlot.LOCATION_RIGHT:
2201:                    chartPlot.setValueLocation(ThermometerPlot.RIGHT);
2202:                    break;
2203:                case JRThermometerPlot.LOCATION_BULB:
2204:                default:
2205:                    chartPlot.setValueLocation(ThermometerPlot.BULB);
2206:                    break;
2207:                }
2208:
2209:                // Define the three ranges
2210:                range = convertRange(jrPlot.getLowRange(), evaluation);
2211:                if (range != null) {
2212:                    chartPlot.setSubrangeInfo(2, range.getLowerBound(), range
2213:                            .getUpperBound());
2214:                }
2215:
2216:                range = convertRange(jrPlot.getMediumRange(), evaluation);
2217:                if (range != null) {
2218:                    chartPlot.setSubrangeInfo(1, range.getLowerBound(), range
2219:                            .getUpperBound());
2220:                }
2221:
2222:                range = convertRange(jrPlot.getHighRange(), evaluation);
2223:                if (range != null) {
2224:                    chartPlot.setSubrangeInfo(0, range.getLowerBound(), range
2225:                            .getUpperBound());
2226:                }
2227:
2228:                // Build a chart around this plot
2229:                JFreeChart chart = new JFreeChart(chartPlot);
2230:
2231:                // Set the generic options
2232:                configureChart(chart, getPlot(), evaluation);
2233:
2234:                // Thermometer plots only show a single value, so no drilldown or
2235:                // hyperlinking is supported.
2236:                return new JFreeChartRenderer(chart);
2237:
2238:            }
2239:
2240:            /**
2241:             * Build and configure a multiple axis chart.  A multiple axis chart support more than
2242:             * one range axis.  Multiple datasets using different ranges can be displayed as long as
2243:             * they share a common domain axis.  Each dataset can be rendered differently, so one chart
2244:             * can contain (for example) two line charts, a bar chart and an area chart.
2245:             * <br><br>
2246:             * Multiple axis charts are handled differently than the other chart types.  They do not
2247:             * have a dataset, as each chart that is added to the multiple axis chart has its own
2248:             * dataset.  For simplicity, each dataset is treated as its own chart, and in fact we
2249:             * reuse the design of all the chart types and let JFreeChart actually run them.  Then
2250:             * we pull out the bits we need and add it to the common chart.  All the plot and chart
2251:             * options on the nested charts is ignored, and all formatting is controlled by the plot
2252:             * attached to the multiAxisChart.  The one exception is seriesColor, which can be used in
2253:             * a nested report to specify a color for a specific series in that report.
2254:             *
2255:             * @param evaluation current expression evaluation phase
2256:             * @return the JFreeChart chart
2257:             * @throws JRException
2258:             */
2259:            protected JFreeChartRenderer evaluateMultiAxisImage(byte evaluation)
2260:                    throws JRException {
2261:                // A multi axis chart has to have at least one axis and chart specified.
2262:                // Create the first axis as the base plot, and then go ahead and create the
2263:                // charts for any additional axes.  Just take the renderer and data series
2264:                // from those charts and add them to the first one.
2265:                JFreeChart mainChart = null;
2266:                Plot mainPlot = null;
2267:
2268:                JRFillMultiAxisPlot jrPlot = (JRFillMultiAxisPlot) getPlot();
2269:
2270:                // Generate the main plot from the first axes specified.
2271:                Iterator iter = jrPlot.getAxes().iterator();
2272:                if (iter.hasNext()) {
2273:                    JRFillChartAxis axis = (JRFillChartAxis) iter.next();
2274:                    JRFillChart fillChart = axis.getFillChart();
2275:                    mainChart = fillChart.evaluateImage(evaluation).getChart();
2276:                    // Override the plot from the first axis with the plot for the multi-axis
2277:                    // chart.
2278:                    configureChart(mainChart, getPlot(), evaluation);
2279:                    mainPlot = mainChart.getPlot();
2280:                    if (axis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM) {
2281:                        if (mainPlot instanceof  CategoryPlot)
2282:                            ((CategoryPlot) mainPlot).setRangeAxisLocation(0,
2283:                                    AxisLocation.BOTTOM_OR_RIGHT);
2284:                        if (mainPlot instanceof  XYPlot)
2285:                            ((XYPlot) mainPlot).setRangeAxisLocation(0,
2286:                                    AxisLocation.BOTTOM_OR_RIGHT);
2287:                    } else {
2288:                        if (mainPlot instanceof  CategoryPlot)
2289:                            ((CategoryPlot) mainPlot).setRangeAxisLocation(0,
2290:                                    AxisLocation.TOP_OR_LEFT);
2291:                        if (mainPlot instanceof  XYPlot)
2292:                            ((XYPlot) mainPlot).setRangeAxisLocation(0,
2293:                                    AxisLocation.TOP_OR_LEFT);
2294:                    }
2295:                }
2296:
2297:                // Now handle all the extra axes, if any.
2298:                int axisNumber = 0;
2299:                while (iter.hasNext()) {
2300:                    axisNumber++;
2301:                    JRFillChartAxis chartAxis = (JRFillChartAxis) iter.next();
2302:                    JRFillChart fillChart = chartAxis.getFillChart();
2303:                    JFreeChart axisChart = fillChart.evaluateImage(evaluation)
2304:                            .getChart();
2305:
2306:                    // In JFreeChart to add a second chart type to an existing chart
2307:                    // you need to add an axis, a data series and a renderer.  To
2308:                    // leverage existing code we simply create a new chart for the
2309:                    // axis and then pull out the bits we need and add them to the multi
2310:                    // chart.  Currently JFree only supports category plots and xy plots
2311:                    // in a multi-axis chart, and you can not mix the two.
2312:                    if (mainPlot instanceof  CategoryPlot) {
2313:                        CategoryPlot mainCatPlot = (CategoryPlot) mainPlot;
2314:                        if (!(axisChart.getPlot() instanceof  CategoryPlot)) {
2315:                            throw new JRException(
2316:                                    "You can not mix plot types in a MultiAxisChart");
2317:                        }
2318:
2319:                        // Get the axis and add it to the multi axis chart plot
2320:                        CategoryPlot axisPlot = (CategoryPlot) axisChart
2321:                                .getPlot();
2322:                        mainCatPlot.setRangeAxis(axisNumber, axisPlot
2323:                                .getRangeAxis());
2324:                        if (chartAxis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM) {
2325:                            mainCatPlot.setRangeAxisLocation(axisNumber,
2326:                                    AxisLocation.BOTTOM_OR_RIGHT);
2327:                        } else {
2328:                            mainCatPlot.setRangeAxisLocation(axisNumber,
2329:                                    AxisLocation.TOP_OR_LEFT);
2330:                        }
2331:
2332:                        // Add the data set and map it to the recently added axis
2333:                        mainCatPlot.setDataset(axisNumber, axisPlot
2334:                                .getDataset());
2335:                        mainCatPlot.mapDatasetToRangeAxis(axisNumber,
2336:                                axisNumber);
2337:
2338:                        // Set the renderer to use to draw the dataset.
2339:                        mainCatPlot.setRenderer(axisNumber, axisPlot
2340:                                .getRenderer());
2341:
2342:                        // Handle any color series for this chart
2343:                        configureAxisSeriesColors(axisPlot.getRenderer(),
2344:                                fillChart.getPlot());
2345:                    } else if (mainPlot instanceof  XYPlot) {
2346:                        XYPlot mainXyPlot = (XYPlot) mainPlot;
2347:                        if (!(axisChart.getPlot() instanceof  XYPlot)) {
2348:                            throw new JRException(
2349:                                    "You can not mix plot types in a MultiAxisChart");
2350:                        }
2351:
2352:                        // Get the axis and add it to the multi axis chart plot
2353:                        XYPlot axisPlot = (XYPlot) axisChart.getPlot();
2354:                        mainXyPlot.setRangeAxis(axisNumber, axisPlot
2355:                                .getRangeAxis());
2356:                        if (chartAxis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM) {
2357:                            mainXyPlot.setRangeAxisLocation(axisNumber,
2358:                                    AxisLocation.BOTTOM_OR_RIGHT);
2359:                        } else {
2360:                            mainXyPlot.setRangeAxisLocation(axisNumber,
2361:                                    AxisLocation.TOP_OR_LEFT);
2362:                        }
2363:
2364:                        // Add the data set and map it to the recently added axis
2365:                        mainXyPlot
2366:                                .setDataset(axisNumber, axisPlot.getDataset());
2367:                        mainXyPlot
2368:                                .mapDatasetToRangeAxis(axisNumber, axisNumber);
2369:
2370:                        // Set the renderer to use to draw the dataset.
2371:                        mainXyPlot.setRenderer(axisNumber, axisPlot
2372:                                .getRenderer());
2373:
2374:                        // Handle any color series for this chart
2375:                        configureAxisSeriesColors(axisPlot.getRenderer(),
2376:                                fillChart.getPlot());
2377:                    } else {
2378:                        throw new JRException(
2379:                                "MultiAxis charts only support Category and XY plots.");
2380:                    }
2381:                }
2382:                return new JFreeChartRenderer(mainChart);
2383:            }
2384:
2385:            protected void resolveElement(JRPrintElement element,
2386:                    byte evaluation) throws JRException {
2387:                evaluateImage(evaluation);
2388:
2389:                copy((JRPrintImage) element);
2390:            }
2391:
2392:            public int getBookmarkLevel() {
2393:                return ((JRChart) parent).getBookmarkLevel();
2394:            }
2395:
2396:            /**
2397:             *
2398:             */
2399:            public String getCustomizerClass() {
2400:                return customizerClass;
2401:            }
2402:
2403:            /**
2404:             *
2405:             */
2406:            public byte getBorder() {
2407:                return JRStyleResolver.getBorder(this );
2408:            }
2409:
2410:            public Byte getOwnBorder() {
2411:                return ((JRBox) parent).getOwnBorder();
2412:            }
2413:
2414:            /**
2415:             *
2416:             */
2417:            public void setBorder(byte border) {
2418:            }
2419:
2420:            /**
2421:             *
2422:             */
2423:            public void setBorder(Byte border) {
2424:            }
2425:
2426:            /**
2427:             *
2428:             */
2429:            public Color getBorderColor() {
2430:                return JRStyleResolver.getBorderColor(this , getForecolor());
2431:            }
2432:
2433:            public Color getOwnBorderColor() {
2434:                return ((JRBox) parent).getOwnBorderColor();
2435:            }
2436:
2437:            /**
2438:             *
2439:             */
2440:            public void setBorderColor(Color borderColor) {
2441:            }
2442:
2443:            /**
2444:             *
2445:             */
2446:            public int getPadding() {
2447:                return JRStyleResolver.getPadding(this );
2448:            }
2449:
2450:            public Integer getOwnPadding() {
2451:                return ((JRBox) parent).getOwnPadding();
2452:            }
2453:
2454:            /**
2455:             *
2456:             */
2457:            public void setPadding(int padding) {
2458:            }
2459:
2460:            /**
2461:             *
2462:             */
2463:            public void setPadding(Integer padding) {
2464:            }
2465:
2466:            /**
2467:             *
2468:             */
2469:            public byte getTopBorder() {
2470:                return JRStyleResolver.getTopBorder(this );
2471:            }
2472:
2473:            /**
2474:             *
2475:             */
2476:            public Byte getOwnTopBorder() {
2477:                return ((JRBox) parent).getOwnTopBorder();
2478:            }
2479:
2480:            /**
2481:             *
2482:             */
2483:            public void setTopBorder(byte topBorder) {
2484:            }
2485:
2486:            /**
2487:             *
2488:             */
2489:            public void setTopBorder(Byte topBorder) {
2490:            }
2491:
2492:            /**
2493:             *
2494:             */
2495:            public Color getTopBorderColor() {
2496:                return JRStyleResolver.getTopBorderColor(this , getForecolor());
2497:            }
2498:
2499:            /**
2500:             *
2501:             */
2502:            public Color getOwnTopBorderColor() {
2503:                return ((JRBox) parent).getOwnTopBorderColor();
2504:            }
2505:
2506:            /**
2507:             *
2508:             */
2509:            public void setTopBorderColor(Color topBorderColor) {
2510:            }
2511:
2512:            /**
2513:             *
2514:             */
2515:            public int getTopPadding() {
2516:                return JRStyleResolver.getTopPadding(this );
2517:            }
2518:
2519:            /**
2520:             *
2521:             */
2522:            public Integer getOwnTopPadding() {
2523:                return ((JRBox) parent).getOwnTopPadding();
2524:            }
2525:
2526:            /**
2527:             *
2528:             */
2529:            public void setTopPadding(int topPadding) {
2530:            }
2531:
2532:            /**
2533:             *
2534:             */
2535:            public void setTopPadding(Integer topPadding) {
2536:            }
2537:
2538:            /**
2539:             *
2540:             */
2541:            public byte getLeftBorder() {
2542:                return JRStyleResolver.getLeftBorder(this );
2543:            }
2544:
2545:            /**
2546:             *
2547:             */
2548:            public Byte getOwnLeftBorder() {
2549:                return ((JRBox) parent).getOwnLeftBorder();
2550:            }
2551:
2552:            /**
2553:             *
2554:             */
2555:            public void setLeftBorder(byte leftBorder) {
2556:            }
2557:
2558:            /**
2559:             *
2560:             */
2561:            public void setLeftBorder(Byte leftBorder) {
2562:            }
2563:
2564:            /**
2565:             *
2566:             */
2567:            public Color getLeftBorderColor() {
2568:                return JRStyleResolver.getLeftBorderColor(this , getForecolor());
2569:            }
2570:
2571:            /**
2572:             *
2573:             */
2574:            public Color getOwnLeftBorderColor() {
2575:                return ((JRBox) parent).getOwnLeftBorderColor();
2576:            }
2577:
2578:            /**
2579:             *
2580:             */
2581:            public void setLeftBorderColor(Color leftBorderColor) {
2582:            }
2583:
2584:            /**
2585:             *
2586:             */
2587:            public int getLeftPadding() {
2588:                return JRStyleResolver.getLeftPadding(this );
2589:            }
2590:
2591:            /**
2592:             *
2593:             */
2594:            public Integer getOwnLeftPadding() {
2595:                return ((JRBox) parent).getOwnLeftPadding();
2596:            }
2597:
2598:            /**
2599:             *
2600:             */
2601:            public void setLeftPadding(int leftPadding) {
2602:            }
2603:
2604:            /**
2605:             *
2606:             */
2607:            public void setLeftPadding(Integer leftPadding) {
2608:            }
2609:
2610:            /**
2611:             *
2612:             */
2613:            public byte getBottomBorder() {
2614:                return JRStyleResolver.getBottomBorder(this );
2615:            }
2616:
2617:            /**
2618:             *
2619:             */
2620:            public Byte getOwnBottomBorder() {
2621:                return ((JRBox) parent).getOwnBottomBorder();
2622:            }
2623:
2624:            /**
2625:             *
2626:             */
2627:            public void setBottomBorder(byte bottomBorder) {
2628:            }
2629:
2630:            /**
2631:             *
2632:             */
2633:            public void setBottomBorder(Byte bottomBorder) {
2634:            }
2635:
2636:            /**
2637:             *
2638:             */
2639:            public Color getBottomBorderColor() {
2640:                return JRStyleResolver.getBottomBorderColor(this ,
2641:                        getForecolor());
2642:            }
2643:
2644:            /**
2645:             *
2646:             */
2647:            public Color getOwnBottomBorderColor() {
2648:                return ((JRBox) parent).getOwnBottomBorderColor();
2649:            }
2650:
2651:            /**
2652:             *
2653:             */
2654:            public void setBottomBorderColor(Color bottomBorderColor) {
2655:            }
2656:
2657:            /**
2658:             *
2659:             */
2660:            public int getBottomPadding() {
2661:                return JRStyleResolver.getBottomPadding(this );
2662:            }
2663:
2664:            /**
2665:             *
2666:             */
2667:            public Integer getOwnBottomPadding() {
2668:                return ((JRBox) parent).getOwnBottomPadding();
2669:            }
2670:
2671:            /**
2672:             *
2673:             */
2674:            public void setBottomPadding(int bottomPadding) {
2675:            }
2676:
2677:            /**
2678:             *
2679:             */
2680:            public void setBottomPadding(Integer bottomPadding) {
2681:            }
2682:
2683:            /**
2684:             *
2685:             */
2686:            public byte getRightBorder() {
2687:                return JRStyleResolver.getRightBorder(this );
2688:            }
2689:
2690:            /**
2691:             *
2692:             */
2693:            public Byte getOwnRightBorder() {
2694:                return ((JRBox) parent).getOwnRightBorder();
2695:            }
2696:
2697:            /**
2698:             *
2699:             */
2700:            public void setRightBorder(byte rightBorder) {
2701:            }
2702:
2703:            /**
2704:             *
2705:             */
2706:            public void setRightBorder(Byte rightBorder) {
2707:            }
2708:
2709:            /**
2710:             *
2711:             */
2712:            public Color getRightBorderColor() {
2713:                return JRStyleResolver
2714:                        .getRightBorderColor(this , getForecolor());
2715:            }
2716:
2717:            /**
2718:             *
2719:             */
2720:            public Color getOwnRightBorderColor() {
2721:                return ((JRBox) parent).getOwnRightBorderColor();
2722:            }
2723:
2724:            /**
2725:             *
2726:             */
2727:            public void setRightBorderColor(Color rightBorderColor) {
2728:            }
2729:
2730:            /**
2731:             *
2732:             */
2733:            public int getRightPadding() {
2734:                return JRStyleResolver.getRightPadding(this );
2735:            }
2736:
2737:            /**
2738:             *
2739:             */
2740:            public Integer getOwnRightPadding() {
2741:                return ((JRBox) parent).getOwnRightPadding();
2742:            }
2743:
2744:            /**
2745:             *
2746:             */
2747:            public void setRightPadding(int rightPadding) {
2748:            }
2749:
2750:            /**
2751:             *
2752:             */
2753:            public void setRightPadding(Integer rightPadding) {
2754:            }
2755:
2756:            private void evaluateDatasetRun(byte evaluation) throws JRException {
2757:                dataset.evaluateDatasetRun(evaluation);
2758:            }
2759:
2760:            public JRCloneable createClone(JRFillCloneFactory factory) {
2761:                //not needed
2762:                return null;
2763:            }
2764:
2765:            public JRHyperlinkParameter[] getHyperlinkParameters() {
2766:                return ((JRChart) parent).getHyperlinkParameters();
2767:            }
2768:
2769:            public String getLinkType() {
2770:                return ((JRChart) parent).getLinkType();
2771:            }
2772:
2773:            public JRExpression getHyperlinkTooltipExpression() {
2774:                return ((JRChart) parent).getHyperlinkTooltipExpression();
2775:            }
2776:
2777:            protected JFreeChartRenderer getCategoryRenderer(JFreeChart chart) {
2778:                JFreeChartRenderer chartRenderer;
2779:                JRFillCategoryDataset categoryDataset = (JRFillCategoryDataset) getDataset();
2780:                if (categoryDataset.hasItemHyperlinks()) {
2781:                    chartRenderer = new JRCategoryChartImageMapRenderer(chart,
2782:                            categoryDataset.getItemHyperlinks());
2783:                } else {
2784:                    chartRenderer = new JFreeChartRenderer(chart);
2785:                }
2786:                return chartRenderer;
2787:            }
2788:
2789:            protected JFreeChartRenderer getPieRenderer(JFreeChart chart) {
2790:                JFreeChartRenderer chartRenderer;
2791:                JRFillPieDataset pieDataset = (JRFillPieDataset) getDataset();
2792:                if (pieDataset.hasSectionHyperlinks()) {
2793:                    chartRenderer = new JRPieChartImageMapRenderer(chart,
2794:                            pieDataset.getSectionHyperlinks());
2795:                } else {
2796:                    chartRenderer = new JFreeChartRenderer(chart);
2797:                }
2798:                return chartRenderer;
2799:            }
2800:
2801:            protected JFreeChartRenderer getXYRenderer(JFreeChart chart) {
2802:                JFreeChartRenderer chartRenderer;
2803:                JRFillXyDataset xyDataset = (JRFillXyDataset) getDataset();
2804:                if (xyDataset.hasItemHyperlinks()) {
2805:                    chartRenderer = new JRXYChartImageMapRenderer(chart,
2806:                            xyDataset.getItemHyperlinks());
2807:                } else {
2808:                    chartRenderer = new JFreeChartRenderer(chart);
2809:                }
2810:                return chartRenderer;
2811:            }
2812:
2813:            protected JFreeChartRenderer getXYBarRenderer(JFreeChart chart) {
2814:                JFreeChartRenderer chartRenderer;
2815:                if (getDataset().getDatasetType() == JRChartDataset.TIMESERIES_DATASET) {
2816:                    chartRenderer = getTimeSeriesRenderer(chart);
2817:                } else if (getDataset().getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET) {
2818:                    chartRenderer = getTimePeriodRenderer(chart);
2819:                } else if (getDataset().getDatasetType() == JRChartDataset.XY_DATASET) {
2820:                    chartRenderer = getXYRenderer(chart);
2821:                } else {
2822:                    chartRenderer = new JFreeChartRenderer(chart);
2823:                }
2824:                return chartRenderer;
2825:            }
2826:
2827:            protected JFreeChartRenderer getXYZRenderer(JFreeChart chart) {
2828:                JFreeChartRenderer chartRenderer;
2829:                JRFillXyzDataset xyDataset = (JRFillXyzDataset) getDataset();
2830:                if (xyDataset.hasItemHyperlinks()) {
2831:                    chartRenderer = new JRXYChartImageMapRenderer(chart,
2832:                            xyDataset.getItemHyperlinks());
2833:                } else {
2834:                    chartRenderer = new JFreeChartRenderer(chart);
2835:                }
2836:                return chartRenderer;
2837:            }
2838:
2839:            protected JFreeChartRenderer getHighLowRenderer(JFreeChart chart) {
2840:                JFreeChartRenderer chartRenderer;
2841:                JRFillHighLowDataset hlDataset = (JRFillHighLowDataset) getDataset();
2842:                if (hlDataset.hasItemHyperlink()) {
2843:                    chartRenderer = new JRHighLowChartImageMapRenderer(chart,
2844:                            hlDataset.getItemHyperlinks());
2845:                } else {
2846:                    chartRenderer = new JFreeChartRenderer(chart);
2847:                }
2848:                return chartRenderer;
2849:            }
2850:
2851:            protected JFreeChartRenderer getTimeSeriesRenderer(JFreeChart chart) {
2852:                JFreeChartRenderer chartRenderer;
2853:                JRFillTimeSeriesDataset tsDataset = (JRFillTimeSeriesDataset) getDataset();
2854:                if (tsDataset.hasItemHyperlinks()) {
2855:                    chartRenderer = new JRTimeSeriesChartImageMapRenderer(
2856:                            chart, tsDataset.getItemHyperlinks());
2857:                } else {
2858:                    chartRenderer = new JFreeChartRenderer(chart);
2859:                }
2860:                return chartRenderer;
2861:            }
2862:
2863:            protected JFreeChartRenderer getTimePeriodRenderer(JFreeChart chart) {
2864:                JFreeChartRenderer chartRenderer;
2865:                JRFillTimePeriodDataset tpDataset = (JRFillTimePeriodDataset) getDataset();
2866:                if (tpDataset.hasItemHyperlinks()) {
2867:                    chartRenderer = new JRTimePeriodChartImageMapRenderer(
2868:                            chart, tpDataset.getItemHyperlinks());
2869:                } else {
2870:                    chartRenderer = new JFreeChartRenderer(chart);
2871:                }
2872:                return chartRenderer;
2873:            }
2874:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.