KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > fill > JRFillChart


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.fill;
29
30 import java.awt.Color JavaDoc;
31 import java.awt.Font JavaDoc;
32 import java.awt.Paint JavaDoc;
33 import java.text.DateFormat JavaDoc;
34 import java.text.DecimalFormat JavaDoc;
35 import java.text.NumberFormat JavaDoc;
36 import java.text.SimpleDateFormat JavaDoc;
37 import java.util.Iterator JavaDoc;
38 import java.util.List JavaDoc;
39 import java.util.Map JavaDoc;
40 import java.util.SortedSet JavaDoc;
41
42 import net.sf.jasperreports.charts.JRAreaPlot;
43 import net.sf.jasperreports.charts.JRBar3DPlot;
44 import net.sf.jasperreports.charts.JRBarPlot;
45 import net.sf.jasperreports.charts.JRBubblePlot;
46 import net.sf.jasperreports.charts.JRCandlestickPlot;
47 import net.sf.jasperreports.charts.JRCategoryDataset;
48 import net.sf.jasperreports.charts.JRChartAxis;
49 import net.sf.jasperreports.charts.JRDataRange;
50 import net.sf.jasperreports.charts.JRHighLowDataset;
51 import net.sf.jasperreports.charts.JRHighLowPlot;
52 import net.sf.jasperreports.charts.JRLinePlot;
53 import net.sf.jasperreports.charts.JRMeterPlot;
54 import net.sf.jasperreports.charts.JRMultiAxisPlot;
55 import net.sf.jasperreports.charts.JRPie3DPlot;
56 import net.sf.jasperreports.charts.JRPieDataset;
57 import net.sf.jasperreports.charts.JRPiePlot;
58 import net.sf.jasperreports.charts.JRScatterPlot;
59 import net.sf.jasperreports.charts.JRThermometerPlot;
60 import net.sf.jasperreports.charts.JRTimePeriodDataset;
61 import net.sf.jasperreports.charts.JRTimeSeriesDataset;
62 import net.sf.jasperreports.charts.JRTimeSeriesPlot;
63 import net.sf.jasperreports.charts.JRValueDataset;
64 import net.sf.jasperreports.charts.JRValueDisplay;
65 import net.sf.jasperreports.charts.JRXyDataset;
66 import net.sf.jasperreports.charts.JRXyzDataset;
67 import net.sf.jasperreports.charts.fill.JRFillAreaPlot;
68 import net.sf.jasperreports.charts.fill.JRFillBar3DPlot;
69 import net.sf.jasperreports.charts.fill.JRFillBarPlot;
70 import net.sf.jasperreports.charts.fill.JRFillCategoryDataset;
71 import net.sf.jasperreports.charts.fill.JRFillChartAxis;
72 import net.sf.jasperreports.charts.fill.JRFillHighLowDataset;
73 import net.sf.jasperreports.charts.fill.JRFillLinePlot;
74 import net.sf.jasperreports.charts.fill.JRFillMeterPlot;
75 import net.sf.jasperreports.charts.fill.JRFillMultiAxisPlot;
76 import net.sf.jasperreports.charts.fill.JRFillPie3DPlot;
77 import net.sf.jasperreports.charts.fill.JRFillPieDataset;
78 import net.sf.jasperreports.charts.fill.JRFillThermometerPlot;
79 import net.sf.jasperreports.charts.fill.JRFillTimePeriodDataset;
80 import net.sf.jasperreports.charts.fill.JRFillTimeSeriesDataset;
81 import net.sf.jasperreports.charts.fill.JRFillXyDataset;
82 import net.sf.jasperreports.charts.fill.JRFillXyzDataset;
83 import net.sf.jasperreports.charts.util.JRMeterInterval;
84 import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
85 import net.sf.jasperreports.engine.JRAbstractObjectFactory;
86 import net.sf.jasperreports.engine.JRBox;
87 import net.sf.jasperreports.engine.JRChart;
88 import net.sf.jasperreports.engine.JRChartCustomizer;
89 import net.sf.jasperreports.engine.JRChartDataset;
90 import net.sf.jasperreports.engine.JRChartPlot;
91 import net.sf.jasperreports.engine.JRChild;
92 import net.sf.jasperreports.engine.JRElement;
93 import net.sf.jasperreports.engine.JRException;
94 import net.sf.jasperreports.engine.JRExpression;
95 import net.sf.jasperreports.engine.JRExpressionCollector;
96 import net.sf.jasperreports.engine.JRFont;
97 import net.sf.jasperreports.engine.JRGroup;
98 import net.sf.jasperreports.engine.JRHyperlinkParameter;
99 import net.sf.jasperreports.engine.JRPrintElement;
100 import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
101 import net.sf.jasperreports.engine.JRPrintImage;
102 import net.sf.jasperreports.engine.JRRenderable;
103 import net.sf.jasperreports.engine.JRRuntimeException;
104 import net.sf.jasperreports.engine.JRStyle;
105 import net.sf.jasperreports.engine.JRChartPlot.JRSeriesColor;
106 import net.sf.jasperreports.engine.util.JRClassLoader;
107 import net.sf.jasperreports.engine.util.JRFontUtil;
108 import net.sf.jasperreports.engine.util.JRStyleResolver;
109 import net.sf.jasperreports.engine.xml.JRXmlWriter;
110 import net.sf.jasperreports.renderers.JFreeChartRenderer;
111 import net.sf.jasperreports.renderers.JRCategoryChartImageMapRenderer;
112 import net.sf.jasperreports.renderers.JRHighLowChartImageMapRenderer;
113 import net.sf.jasperreports.renderers.JRPieChartImageMapRenderer;
114 import net.sf.jasperreports.renderers.JRTimePeriodChartImageMapRenderer;
115 import net.sf.jasperreports.renderers.JRTimeSeriesChartImageMapRenderer;
116 import net.sf.jasperreports.renderers.JRXYChartImageMapRenderer;
117
118 import org.jfree.chart.ChartFactory;
119 import org.jfree.chart.JFreeChart;
120 import org.jfree.chart.axis.Axis;
121 import org.jfree.chart.axis.AxisLocation;
122 import org.jfree.chart.axis.CategoryAxis;
123 import org.jfree.chart.axis.CategoryLabelPositions;
124 import org.jfree.chart.axis.DateAxis;
125 import org.jfree.chart.axis.NumberAxis;
126 import org.jfree.chart.labels.PieSectionLabelGenerator;
127 import org.jfree.chart.plot.CategoryPlot;
128 import org.jfree.chart.plot.DefaultDrawingSupplier;
129 import org.jfree.chart.plot.DialShape;
130 import org.jfree.chart.plot.MeterInterval;
131 import org.jfree.chart.plot.MeterPlot;
132 import org.jfree.chart.plot.PiePlot;
133 import org.jfree.chart.plot.PiePlot3D;
134 import org.jfree.chart.plot.Plot;
135 import org.jfree.chart.plot.ThermometerPlot;
136 import org.jfree.chart.plot.XYPlot;
137 import org.jfree.chart.renderer.category.BarRenderer3D;
138 import org.jfree.chart.renderer.category.CategoryItemRenderer;
139 import org.jfree.chart.renderer.category.LineAndShapeRenderer;
140 import org.jfree.chart.renderer.category.StackedBarRenderer3D;
141 import org.jfree.chart.renderer.xy.CandlestickRenderer;
142 import org.jfree.chart.renderer.xy.HighLowRenderer;
143 import org.jfree.chart.renderer.xy.XYBubbleRenderer;
144 import org.jfree.chart.renderer.xy.XYItemRenderer;
145 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
146 import org.jfree.chart.title.TextTitle;
147 import org.jfree.data.Range;
148 import org.jfree.data.category.CategoryDataset;
149 import org.jfree.data.general.PieDataset;
150 import org.jfree.data.general.ValueDataset;
151 import org.jfree.data.time.TimeSeriesCollection;
152 import org.jfree.data.xy.DefaultHighLowDataset;
153 import org.jfree.data.xy.IntervalXYDataset;
154 import org.jfree.data.xy.XYDataset;
155 import org.jfree.data.xy.XYZDataset;
156
157
158 /**
159  * @author Teodor Danciu (teodord@users.sourceforge.net)
160  * @author Some enhancements by Barry Klawans (bklawans@users.sourceforge.net)
161  * @version $Id: JRFillChart.java 1507 2006-11-27 17:12:17 +0200 (Mon, 27 Nov 2006) teodord $
162  */

163 public class JRFillChart extends JRFillElement implements JRChart
164 {
165
166
167     /**
168      *
169      */

170     private static final Color JavaDoc TRANSPARENT_PAINT = new Color JavaDoc(0, 0, 0, 0);
171
172     /**
173      *
174      */

175     protected byte chartType = 0;
176
177     /**
178      *
179      */

180     protected JRFont titleFont = null;
181     protected JRFont subtitleFont = null;
182     protected JRFont legendFont = null;
183
184     /**
185      *
186      */

187     protected JRGroup evaluationGroup = null;
188
189     protected JRFillChartDataset dataset = null;
190     protected JRChartPlot plot = null;
191
192     protected JRRenderable renderer = null;
193     private String JavaDoc anchorName = null;
194     private String JavaDoc hyperlinkReference = null;
195     private String JavaDoc hyperlinkAnchor = null;
196     private Integer JavaDoc hyperlinkPage = null;
197     private String JavaDoc hyperlinkTooltip;
198     private JRPrintHyperlinkParameters hyperlinkParameters;
199
200     protected String JavaDoc customizerClass;
201     protected JRChartCustomizer chartCustomizer;
202
203     /**
204      *
205      */

206     protected JRFillChart(
207         JRBaseFiller filler,
208         JRChart chart,
209         JRFillObjectFactory factory
210         )
211     {
212         super(filler, chart, factory);
213
214         /* */
215         chartType = chart.getChartType();
216
217         switch(chartType) {
218             case CHART_TYPE_AREA:
219                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
220                 plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
221                 break;
222             case CHART_TYPE_BAR:
223                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
224                 plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
225                 break;
226             case CHART_TYPE_BAR3D:
227                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
228                 plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
229                 break;
230             case CHART_TYPE_BUBBLE:
231                 dataset = (JRFillChartDataset) factory.getXyzDataset((JRXyzDataset) chart.getDataset());
232                 plot = factory.getBubblePlot((JRBubblePlot) chart.getPlot());
233                 break;
234             case CHART_TYPE_CANDLESTICK:
235                 dataset = (JRFillChartDataset) factory.getHighLowDataset((JRHighLowDataset) chart.getDataset());
236                 plot = factory.getCandlestickPlot((JRCandlestickPlot) chart.getPlot());
237                 break;
238             case CHART_TYPE_HIGHLOW:
239                 dataset = (JRFillChartDataset) factory.getHighLowDataset((JRHighLowDataset) chart.getDataset());
240                 plot = factory.getHighLowPlot((JRHighLowPlot) chart.getPlot());
241                 break;
242             case CHART_TYPE_LINE:
243                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
244                 plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
245                 break;
246             case CHART_TYPE_METER:
247                 dataset = (JRFillChartDataset) factory.getValueDataset((JRValueDataset) chart.getDataset());
248                 plot = factory.getMeterPlot((JRMeterPlot) chart.getPlot());
249                 break;
250             case CHART_TYPE_MULTI_AXIS:
251                 plot = factory.getMultiAxisPlot((JRMultiAxisPlot) chart.getPlot());
252                 dataset = ((JRFillMultiAxisPlot)plot).getMainDataset();
253                 break;
254             case CHART_TYPE_PIE:
255                 dataset = (JRFillChartDataset) factory.getPieDataset((JRPieDataset) chart.getDataset());
256                 plot = factory.getPiePlot((JRPiePlot) chart.getPlot());
257                 break;
258             case CHART_TYPE_PIE3D:
259                 dataset = (JRFillChartDataset) factory.getPieDataset((JRPieDataset) chart.getDataset());
260                 plot = factory.getPie3DPlot((JRPie3DPlot) chart.getPlot());
261                 break;
262             case CHART_TYPE_SCATTER:
263                 dataset = (JRFillChartDataset) factory.getXyDataset((JRXyDataset) chart.getDataset());
264                 plot = factory.getScatterPlot((JRScatterPlot) chart.getPlot());
265                 break;
266             case CHART_TYPE_STACKEDBAR:
267                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
268                 plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
269                 break;
270             case CHART_TYPE_STACKEDBAR3D:
271                 dataset = (JRFillChartDataset) factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
272                 plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
273                 break;
274             case CHART_TYPE_THERMOMETER:
275                 dataset = (JRFillChartDataset) factory.getValueDataset((JRValueDataset) chart.getDataset());
276                 plot = factory.getThermometerPlot((JRThermometerPlot) chart.getPlot());
277                 break;
278             case CHART_TYPE_TIMESERIES:
279                 dataset = (JRFillChartDataset) factory.getTimeSeriesDataset((JRTimeSeriesDataset)chart.getDataset());
280                 plot = factory.getTimeSeriesPlot((JRTimeSeriesPlot)chart.getPlot());
281                 break;
282             case CHART_TYPE_XYAREA:
283                 dataset = (JRFillChartDataset) factory.getXyDataset((JRXyDataset) chart.getDataset());
284                 plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
285                 break;
286             case CHART_TYPE_XYBAR:
287                 switch (chart.getDataset().getDatasetType()){
288                     case JRChartDataset.TIMESERIES_DATASET:
289                         dataset = (JRFillChartDataset) factory.getTimeSeriesDataset( (JRTimeSeriesDataset)chart.getDataset() );
290                         break;
291                     case JRChartDataset.TIMEPERIOD_DATASET:
292                         dataset = (JRFillChartDataset) factory.getTimePeriodDataset((JRTimePeriodDataset) chart.getDataset() );
293                         break;
294                     case JRChartDataset.XY_DATASET:
295                         dataset = (JRFillChartDataset) factory.getXyDataset( (JRXyDataset)chart.getDataset() );
296                         break;
297                 }
298                 
299                 plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
300                 break;
301             case CHART_TYPE_XYLINE:
302                 dataset = (JRFillChartDataset) factory.getXyDataset((JRXyDataset) chart.getDataset());
303                 plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
304                 break;
305             default:
306                 throw new JRRuntimeException("Chart type not supported.");
307         }
308
309         if (chart.getTitleFont() != null)
310             titleFont = factory.getFont(chart.getTitleFont());
311
312         if (chart.getSubtitleFont() != null)
313             subtitleFont = factory.getFont(chart.getSubtitleFont());
314         
315         if (chart.getLegendFont() != null)
316             legendFont = factory.getFont(chart.getLegendFont());
317
318         evaluationGroup = factory.getGroup(chart.getEvaluationGroup());
319
320         customizerClass = chart.getCustomizerClass();
321         if (customizerClass != null && customizerClass.length() > 0) {
322             try {
323                 Class JavaDoc myClass = JRClassLoader.loadClassForName(customizerClass);
324                 chartCustomizer = (JRChartCustomizer) myClass.newInstance();
325             } catch (Exception JavaDoc e) {
326                 throw new JRRuntimeException("Could not create chart customizer instance.", e);
327             }
328             
329             if (chartCustomizer instanceof JRAbstractChartCustomizer)
330             {
331                 ((JRAbstractChartCustomizer) chartCustomizer).init(filler, this);
332             }
333         }
334     }
335
336
337     /**
338      *
339      */

340     public byte getMode()
341     {
342         return JRStyleResolver.getMode(this, MODE_TRANSPARENT);
343     }
344
345     /**
346      *
347      */

348     public boolean isShowLegend()
349     {
350         return ((JRChart)parent).isShowLegend();
351     }
352         
353     /**
354      *
355      */

356     public void setShowLegend(boolean isShowLegend)
357     {
358     }
359         
360     /**
361      *
362      */

363     public byte getEvaluationTime()
364     {
365         return ((JRChart)parent).getEvaluationTime();
366     }
367         
368     /**
369      *
370      */

371     public JRGroup getEvaluationGroup()
372     {
373         return evaluationGroup;
374     }
375         
376     /**
377      * @deprecated
378      */

379     public JRBox getBox()
380     {
381         return (JRBox)parent;
382     }
383
384     /**
385      *
386      */

387     public JRFont getTitleFont()
388     {
389         return titleFont;
390     }
391
392     /**
393      *
394      */

395     public byte getTitlePosition()
396     {
397         return ((JRChart)parent).getTitlePosition();
398     }
399
400     /**
401      *
402      */

403     public void setTitlePosition(byte titlePosition)
404     {
405     }
406
407     /**
408      *
409      */

410     public Color JavaDoc getTitleColor()
411     {
412         return ((JRChart)parent).getTitleColor();
413     }
414
415     /**
416      *
417      */

418     public void setTitleColor(Color JavaDoc titleColor)
419     {
420     }
421
422     /**
423      *
424      */

425     public JRFont getSubtitleFont()
426     {
427         return subtitleFont;
428     }
429
430     /**
431      *
432      */

433     public Color JavaDoc getSubtitleColor()
434     {
435         return ((JRChart)parent).getSubtitleColor();
436     }
437
438     /**
439      *
440      */

441     public void setSubtitleColor(Color JavaDoc subtitleColor)
442     {
443     }
444
445     /**
446      * Returns the color to use for text in the legend.
447      *
448      * @return the color to use for text in the legend
449      */

450     public Color JavaDoc getLegendColor()
451     {
452         return ((JRChart)parent).getLegendColor();
453     }
454
455     /**
456      * Sets the color to use for text in the legend.
457      *
458      * @param legendColor the color to use for text in the legend
459      */

460     public void setLegendColor(Color JavaDoc legendColor)
461     {
462     }
463     
464     /**
465      * Returns the color to use as the background of the legend.
466      *
467      * @return the color to use as the background of the legend
468      */

469     public Color JavaDoc getLegendBackgroundColor()
470     {
471         return ((JRChart)parent).getLegendBackgroundColor();
472     }
473
474     /**
475      * Sets the color to use for the background of the legend.
476      *
477      * @param legendBackgroundColor the color to use for the background of the legend
478      */

479     public void setLegendBackgroundColor(Color JavaDoc legendBackgroundColor)
480     {
481     }
482     
483     /**
484      * Returns the font to use in the legend.
485      *
486      * @return the font to use in the legend
487      */

488     public JRFont getLegendFont()
489     {
490         return legendFont;
491     }
492
493     /**
494      *
495      */

496     public JRExpression getTitleExpression()
497     {
498         return ((JRChart)parent).getTitleExpression();
499     }
500
501     /**
502      *
503      */

504     public JRExpression getSubtitleExpression()
505     {
506         return ((JRChart)parent).getSubtitleExpression();
507     }
508
509     /**
510      *
511      */

512     public byte getHyperlinkType()
513     {
514         return ((JRChart)parent).getHyperlinkType();
515     }
516         
517     /**
518      *
519      */

520     public byte getHyperlinkTarget()
521     {
522         return ((JRChart)parent).getHyperlinkTarget();
523     }
524         
525     /**
526      *
527      */

528     public JRExpression getAnchorNameExpression()
529     {
530         return ((JRChart)parent).getAnchorNameExpression();
531     }
532
533     /**
534      *
535      */

536     public JRExpression getHyperlinkReferenceExpression()
537     {
538         return ((JRChart)parent).getHyperlinkReferenceExpression();
539     }
540
541     /**
542      *
543      */

544     public JRExpression getHyperlinkAnchorExpression()
545     {
546         return ((JRChart)parent).getHyperlinkAnchorExpression();
547     }
548
549     /**
550      *
551      */

552     public JRExpression getHyperlinkPageExpression()
553     {
554         return ((JRChart)parent).getHyperlinkPageExpression();
555     }
556
557     
558     /**
559      *
560      */

561     public JRChartDataset getDataset()
562     {
563         return dataset;
564     }
565
566     /**
567      *
568      */

569     public void setDataset(JRFillChartDataset dataset)
570     {
571         this.dataset = dataset;
572     }
573     
574     /**
575      *
576      */

577     public JRChartPlot getPlot()
578     {
579         return plot;
580     }
581
582     /**
583      *
584      */

585     protected JRRenderable getRenderer()
586     {
587         return renderer;
588     }
589         
590     /**
591      *
592      */

593     protected String JavaDoc getAnchorName()
594     {
595         return anchorName;
596     }
597
598     /**
599      *
600      */

601     protected String JavaDoc getHyperlinkReference()
602     {
603         return hyperlinkReference;
604     }
605
606     /**
607      *
608      */

609     protected String JavaDoc getHyperlinkAnchor()
610     {
611         return hyperlinkAnchor;
612     }
613
614     /**
615      *
616      */

617     protected Integer JavaDoc getHyperlinkPage()
618     {
619         return hyperlinkPage;
620     }
621     
622     protected String JavaDoc getHyperlinkTooltip()
623     {
624         return hyperlinkTooltip;
625     }
626         
627
628     /**
629      *
630      */

631     protected JRTemplateImage getJRTemplateImage()
632     {
633         JRStyle style = getStyle();
634         JRTemplateImage template = (JRTemplateImage) getTemplate(style);
635         if (template == null)
636         {
637             template = new JRTemplateImage(filler.getJasperPrint().getDefaultStyleProvider(), this);
638             registerTemplate(style, template);
639         }
640         return template;
641     }
642
643
644     /**
645      *
646      */

647     protected void rewind()
648     {
649     }
650
651
652     /**
653      *
654      */

655     protected void evaluate(byte evaluation) throws JRException
656     {
657         reset();
658         
659         evaluatePrintWhenExpression(evaluation);
660
661         if (
662             (isPrintWhenExpressionNull() ||
663             (!isPrintWhenExpressionNull() &&
664             isPrintWhenTrue()))
665             )
666         {
667             if (getEvaluationTime() == JRExpression.EVALUATION_TIME_NOW)
668             {
669                 evaluateImage(evaluation);
670             }
671         }
672     }
673
674
675     /**
676      *
677      */

678     protected JFreeChartRenderer evaluateImage(byte evaluation) throws JRException
679     {
680         evaluateDatasetRun(evaluation);
681         
682         JFreeChartRenderer chartRenderer;
683         switch(chartType) {
684             case CHART_TYPE_AREA:
685                 chartRenderer = evaluateAreaImage(evaluation);
686                 break;
687             case CHART_TYPE_BAR:
688                 chartRenderer = evaluateBarImage(evaluation);
689                 break;
690             case CHART_TYPE_BAR3D:
691                 chartRenderer = evaluateBar3DImage(evaluation);
692                 break;
693             case CHART_TYPE_BUBBLE:
694                 chartRenderer = evaluateBubbleImage(evaluation);
695                 break;
696             case CHART_TYPE_CANDLESTICK:
697                 chartRenderer = evaluateCandlestickImage(evaluation);
698                 break;
699             case CHART_TYPE_HIGHLOW:
700                 chartRenderer = evaluateHighLowImage(evaluation);
701                 break;
702             case CHART_TYPE_LINE:
703                 chartRenderer = evaluateLineImage(evaluation);
704                 break;
705             case CHART_TYPE_METER:
706                 chartRenderer = evaluateMeterImage(evaluation);
707                 break;
708             case CHART_TYPE_MULTI_AXIS:
709                 chartRenderer = evaluateMultiAxisImage(evaluation);
710                 break;
711             case CHART_TYPE_PIE:
712                 chartRenderer = evaluatePieImage(evaluation);
713                 break;
714             case CHART_TYPE_PIE3D:
715                 chartRenderer = evaluatePie3DImage(evaluation);
716                 break;
717             case CHART_TYPE_SCATTER:
718                 chartRenderer = evaluateScatterImage(evaluation);
719                 break;
720             case CHART_TYPE_STACKEDBAR:
721                 chartRenderer = evaluateStackedBarImage(evaluation);
722                 break;
723             case CHART_TYPE_STACKEDBAR3D:
724                 chartRenderer = evaluateStackedBar3DImage(evaluation);
725                 break;
726             case CHART_TYPE_THERMOMETER:
727                 chartRenderer = evaluateThermometerImage(evaluation);
728                 break;
729             case CHART_TYPE_TIMESERIES:
730                 chartRenderer = evaluateTimeSeriesImage( evaluation );
731                 break;
732             case CHART_TYPE_XYAREA:
733                 chartRenderer = evaluateXyAreaImage(evaluation);
734                 break;
735             case CHART_TYPE_XYBAR:
736                 chartRenderer = evaluateXYBarImage(evaluation);
737                 break;
738             case CHART_TYPE_XYLINE:
739                 chartRenderer = evaluateXyLineImage(evaluation);
740                 break;
741             default:
742                 throw new JRRuntimeException("Chart type " + getChartType() + " not supported.");
743         }
744
745         if (chartCustomizer != null)
746         {
747             chartCustomizer.customize(chartRenderer.getChart(), this);
748         }
749
750         renderer = chartRenderer;
751
752         anchorName = (String JavaDoc) evaluateExpression(getAnchorNameExpression(), evaluation);
753         hyperlinkReference = (String JavaDoc) evaluateExpression(getHyperlinkReferenceExpression(), evaluation);
754         hyperlinkAnchor = (String JavaDoc) evaluateExpression(getHyperlinkAnchorExpression(), evaluation);
755         hyperlinkPage = (Integer JavaDoc) evaluateExpression(getHyperlinkPageExpression(), evaluation);
756         hyperlinkTooltip = (String JavaDoc) evaluateExpression(getHyperlinkTooltipExpression(), evaluation);
757         hyperlinkParameters = JRFillHyperlinkHelper.evaluateHyperlinkParameters(this, expressionEvaluator, evaluation);
758         
759         return chartRenderer;
760     }
761
762
763     /**
764      *
765      */

766     protected boolean prepare(
767         int availableStretchHeight,
768         boolean isOverflow
769         )
770     {
771         boolean willOverflow = false;
772
773         if (
774             isPrintWhenExpressionNull() ||
775             ( !isPrintWhenExpressionNull() &&
776             isPrintWhenTrue() )
777             )
778         {
779             setToPrint(true);
780         }
781         else
782         {
783             setToPrint(false);
784         }
785
786         if (!isToPrint())
787         {
788             return willOverflow;
789         }
790         
791         boolean isToPrint = true;
792         boolean isReprinted = false;
793
794         if (getEvaluationTime() == JRExpression.EVALUATION_TIME_NOW)
795         {
796             if (isOverflow && isAlreadyPrinted() && !isPrintWhenDetailOverflows())
797             {
798                 isToPrint = false;
799             }
800     
801             if (
802                 isToPrint &&
803                 availableStretchHeight < getRelativeY() - getY() - getBandBottomY()
804                 )
805             {
806                 isToPrint = false;
807                 willOverflow = true;
808             }
809             
810             if (
811                 isToPrint &&
812                 isOverflow &&
813                 //(this.isAlreadyPrinted() || !this.isPrintRepeatedValues())
814
(isPrintWhenDetailOverflows() && (isAlreadyPrinted() || (!isAlreadyPrinted() && !isPrintRepeatedValues())))
815                 )
816             {
817                 isReprinted = true;
818             }
819
820             if (
821                 isToPrint &&
822                 isRemoveLineWhenBlank() &&
823                 getRenderer() == null
824                 )
825             {
826                 isToPrint = false;
827             }
828         }
829         else
830         {
831             if (isOverflow && isAlreadyPrinted() && !isPrintWhenDetailOverflows())
832             {
833                 isToPrint = false;
834             }
835     
836             if (
837                 isToPrint &&
838                 availableStretchHeight < getRelativeY() - getY() - getBandBottomY()
839                 )
840             {
841                 isToPrint = false;
842                 willOverflow = true;
843             }
844             
845             if (
846                 isToPrint &&
847                 isOverflow &&
848                 //(this.isAlreadyPrinted() || !this.isPrintRepeatedValues())
849
(isPrintWhenDetailOverflows() && (isAlreadyPrinted() || (!isAlreadyPrinted() && !isPrintRepeatedValues())))
850                 )
851             {
852                 isReprinted = true;
853             }
854         }
855
856         setToPrint(isToPrint);
857         setReprinted(isReprinted);
858         
859         return willOverflow;
860     }
861
862
863     /**
864      *
865      */

866     protected JRPrintElement fill()
867     {
868         JRTemplatePrintImage printImage = new JRTemplatePrintImage(getJRTemplateImage());
869         
870         printImage.setX(getX());
871         printImage.setY(getRelativeY());
872         printImage.setWidth(getWidth());
873         printImage.setHeight(getStretchHeight());
874
875         byte evaluationType = getEvaluationTime();
876         if (evaluationType == JRExpression.EVALUATION_TIME_NOW)
877         {
878             copy(printImage);
879         }
880         else
881         {
882             filler.addBoundElement(this, printImage, evaluationType, getEvaluationGroup(), band);
883         }
884         
885         return printImage;
886     }
887
888
889     /**
890      *
891      */

892     protected void copy(JRPrintImage printImage)
893     {
894         printImage.setRenderer(getRenderer());
895         printImage.setAnchorName(getAnchorName());
896         printImage.setHyperlinkReference(getHyperlinkReference());
897         printImage.setHyperlinkAnchor(getHyperlinkAnchor());
898         printImage.setHyperlinkPage(getHyperlinkPage());
899         printImage.setHyperlinkTooltip(getHyperlinkTooltip());
900         printImage.setBookmarkLevel(getBookmarkLevel());
901         printImage.setHyperlinkParameters(hyperlinkParameters);
902     }
903
904     public byte getChartType()
905     {
906         return chartType;
907     }
908
909
910     public JRChild getCopy(JRAbstractObjectFactory factory)
911     {
912         return factory.getChart(this);
913     }
914
915
916     public void collectExpressions(JRExpressionCollector collector)
917     {
918         collector.collect(this);
919     }
920
921
922     /**
923      * The method is never called for fill charts
924      * @param writer
925      */

926     public void writeXml(JRXmlWriter writer)
927     {
928     }
929
930
931     /**
932      *
933      */

934     private void configureChart(JFreeChart chart, JRChartPlot jrPlot, byte evaluation) throws JRException
935     {
936         if (getMode() == JRElement.MODE_OPAQUE)
937         {
938             chart.setBackgroundPaint(getBackcolor());
939         }
940         else
941         {
942             chart.setBackgroundPaint(TRANSPARENT_PAINT);
943         }
944
945         if (chart.getTitle() != null)
946         {
947             TextTitle title = chart.getTitle();
948             title.setPaint(getTitleColor());
949
950             JRFont font = getTitleFont();
951             if (font != null) {
952                 Map JavaDoc attributes = JRFontUtil.getAttributes(font);
953                 title.setFont(new Font JavaDoc(attributes));
954             }
955
956         }
957
958         String JavaDoc subtitleText = (String JavaDoc)evaluateExpression(getSubtitleExpression(), evaluation);
959         if (subtitleText != null)
960         {
961             TextTitle subtitle = new TextTitle(subtitleText);
962             subtitle.setPaint(getSubtitleColor());
963
964             JRFont font = getSubtitleFont();
965             if (font != null) {
966                 Map JavaDoc attributes = JRFontUtil.getAttributes(font);
967                 subtitle.setFont(new Font JavaDoc(attributes));
968             }
969
970             chart.addSubtitle(subtitle);
971         }
972         
973         // Apply all of the legend formatting options
974
if (getLegendColor() != null)
975             chart.getLegend().setItemPaint(getLegendColor());
976         if (getLegendBackgroundColor() != null)
977             chart.getLegend().setBackgroundPaint(getLegendBackgroundColor());
978         if (getLegendFont() != null)
979         {
980             Map JavaDoc attributes = JRFontUtil.getAttributes(getLegendFont());
981             chart.getLegend().setItemFont(new Font JavaDoc(attributes));
982         }
983         
984         configurePlot(chart.getPlot(), jrPlot);
985     }
986
987     
988     /**
989      *
990      */

991     private void configurePlot(Plot p, JRChartPlot jrPlot)
992     {
993         p.setOutlinePaint(TRANSPARENT_PAINT);
994
995         if (getPlot().getBackcolor() == null)
996         {
997             p.setBackgroundPaint(TRANSPARENT_PAINT);
998         }
999         else
1000        {
1001            p.setBackgroundPaint(getPlot().getBackcolor());
1002        }
1003        
1004        p.setBackgroundAlpha(getPlot().getBackgroundAlpha());
1005        p.setForegroundAlpha(getPlot().getForegroundAlpha());
1006        
1007        SortedSet JavaDoc seriesColors = getPlot().getSeriesColors();
1008        if (p instanceof CategoryPlot)
1009        {
1010            // Handle rotation of the category labels.
1011
CategoryAxis axis = ((CategoryPlot)p).getDomainAxis();
1012            double labelRotation = getPlot().getLabelRotation();
1013            if (labelRotation == 90)
1014            {
1015                axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
1016            }
1017            else if (labelRotation == -90) {
1018                axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
1019            }
1020            else if (labelRotation < 0)
1021            {
1022                axis.setCategoryLabelPositions(
1023                        CategoryLabelPositions.createUpRotationLabelPositions( (-labelRotation / 180.0) * Math.PI));
1024            }
1025            else if (labelRotation > 0)
1026            {
1027                axis.setCategoryLabelPositions(
1028                        CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
1029            }
1030        }
1031        
1032        
1033        // Set any color series
1034
if (seriesColors != null)
1035        {
1036            if (seriesColors.size() == 1)
1037            {
1038                // Add the single color to the beginning of the color cycle, using all the default
1039
// colors. To replace the defaults you have to specify at least two colors.
1040
Paint JavaDoc[] colors = new Paint JavaDoc[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + 1];
1041                colors[0] = ((JRSeriesColor)seriesColors.first()).getColor();
1042                for (int i = 0; i < DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length; i++)
1043                {
1044                    colors[i + 1] = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i];
1045                }
1046
1047                p.setDrawingSupplier(new DefaultDrawingSupplier(colors,
1048                        DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
1049                        DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
1050                        DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
1051                        DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
1052            }
1053            else if (seriesColors.size() > 1)
1054            {
1055                // Set up a custom drawing supplier that cycles through the user's colors
1056
// instead of the default colors.
1057
Color JavaDoc[] colors = new Color JavaDoc[seriesColors.size()];
1058                JRSeriesColor[] colorSequence = new JRSeriesColor[seriesColors.size()];
1059                seriesColors.toArray(colorSequence);
1060                for (int i = 0; i < colorSequence.length; i++)
1061                {
1062                    colors[i] = colorSequence[i].getColor();
1063                }
1064
1065                p.setDrawingSupplier(new DefaultDrawingSupplier(colors,
1066                                            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
1067                                            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
1068                                            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
1069                                            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
1070            }
1071        }
1072    }
1073
1074    /**
1075     * The series colors set in the main plot of a multiple axis chart are used for
1076     * all the rendered charts in the plot. This is a problem with multiple line
1077     * charts, using different scales and thus different axis. All the lines will
1078     * be drawn using the first series color (since they are the first series for that
1079     * rendered) and it will be impossible to tell them apart.
1080     * <br><br>
1081     * For this reason we interpret series colors for charts included in a multiple
1082     * axis chart as specify absolute series colors for that renderer.
1083     *
1084     * @param renderer the renderer of the chart being created
1085     * @param jrPlot the Jasper view of that plot
1086     */

1087    private void configureAxisSeriesColors(CategoryItemRenderer renderer, JRChartPlot jrPlot)
1088    {
1089        SortedSet JavaDoc seriesColors = jrPlot.getSeriesColors();
1090
1091        if (seriesColors != null)
1092        {
1093            Iterator JavaDoc iter = seriesColors.iterator();
1094            while (iter.hasNext())
1095            {
1096                JRSeriesColor seriesColor = (JRSeriesColor)iter.next();
1097                renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor());
1098            }
1099        }
1100    }
1101
1102    /**
1103     * The series colors set in the main plot of a multiple axis chart are used for
1104     * all the rendered charts in the plot. This is a problem with multiple line
1105     * charts, using different scales and thus different axis. All the lines will
1106     * be drawn using the first series color (since they are the first series for that
1107     * rendered) and it will be impossible to tell them apart.
1108     * <br>
1109     * For this reason we interpret series colors for charts included in a multiple
1110     * axis chart as specify absolute series colors for that renderer.
1111     *
1112     * @param renderer the renderer of the chart being created
1113     * @param jrPlot the Jasper view of that plot
1114     */

1115    private void configureAxisSeriesColors(XYItemRenderer renderer, JRChartPlot jrPlot)
1116    {
1117        SortedSet JavaDoc seriesColors = jrPlot.getSeriesColors();
1118
1119        if (seriesColors != null)
1120        {
1121            Iterator JavaDoc iter = seriesColors.iterator();
1122            while (iter.hasNext())
1123            {
1124                JRSeriesColor seriesColor = (JRSeriesColor)iter.next();
1125                renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor());
1126            }
1127        }
1128    }
1129
1130    /**
1131     * Sets all the axis formatting options. This includes the colors and fonts to use on
1132     * the axis as well as the color to use when drawing the axis line.
1133     *
1134     * @param axis the axis to format
1135     * @param labelFont the font to use for the axis label
1136     * @param labelColor the color of the axis label
1137     * @param tickLabelFont the font to use for each tick mark value label
1138     * @param tickLabelColor the color of each tick mark value label
1139     * @param tickLabelMask formatting mask for the label. If the axis is a NumberAxis then
1140     * the mask should be <code>java.text.DecimalFormat</code> mask, and
1141     * if it is a DateAxis then the mask should be a
1142     * <code>java.text.SimpleDateFormat</code> mask.
1143     * @param lineColor color to use when drawing the axis line and any tick marks
1144     */

1145    private void configureAxis(Axis axis, JRFont labelFont, Color JavaDoc labelColor,
1146                                 JRFont tickLabelFont, Color JavaDoc tickLabelColor, String JavaDoc tickLabelMask,
1147                                 Color JavaDoc lineColor)
1148    {
1149        if (labelFont != null)
1150        {
1151            Map JavaDoc attributes = JRFontUtil.getAttributes(labelFont);
1152            axis.setLabelFont(new Font JavaDoc(attributes));
1153        }
1154        
1155        if (tickLabelFont != null)
1156        {
1157            Map JavaDoc attributes = JRFontUtil.getAttributes(tickLabelFont);
1158            axis.setTickLabelFont(new Font JavaDoc(attributes));
1159        }
1160        
1161        if (labelColor != null)
1162        {
1163            axis.setLabelPaint(labelColor);
1164        }
1165        
1166        if (tickLabelColor != null)
1167        {
1168            axis.setTickLabelPaint(tickLabelColor);
1169        }
1170
1171        if (lineColor != null)
1172        {
1173            axis.setAxisLinePaint(lineColor);
1174            axis.setTickMarkPaint(lineColor);
1175        }
1176        
1177        if (tickLabelMask != null)
1178        {
1179            if (axis instanceof NumberAxis)
1180            {
1181                NumberFormat JavaDoc fmt = NumberFormat.getInstance();
1182                if (fmt instanceof DecimalFormat JavaDoc)
1183                    ((DecimalFormat JavaDoc) fmt).applyPattern(tickLabelMask);
1184                ((NumberAxis)axis).setNumberFormatOverride(fmt);
1185            }
1186            else if (axis instanceof DateAxis)
1187            {
1188                DateFormat JavaDoc fmt = null;
1189                if (tickLabelMask.equals("SHORT") || tickLabelMask.equals("DateFormat.SHORT"))
1190                    fmt = DateFormat.getDateInstance(DateFormat.SHORT);
1191                else if (tickLabelMask.equals("MEDIUM") || tickLabelMask.equals("DateFormat.MEDIUM"))
1192                    fmt = DateFormat.getDateInstance(DateFormat.MEDIUM);
1193                else if (tickLabelMask.equals("LONG") || tickLabelMask.equals("DateFormat.LONG"))
1194                    fmt = DateFormat.getDateInstance(DateFormat.LONG);
1195                else if (tickLabelMask.equals("FULL") || tickLabelMask.equals("DateFormat.FULL"))
1196                    fmt = DateFormat.getDateInstance(DateFormat.FULL);
1197                else
1198                    fmt = new SimpleDateFormat JavaDoc(tickLabelMask);
1199                
1200                ((DateAxis)axis).setDateFormatOverride(fmt);
1201            }
1202            // ignore mask for other axis types.
1203
}
1204    }
1205    /**
1206     *
1207     */

1208    protected JFreeChartRenderer evaluateAreaImage( byte evaluation ) throws JRException {
1209        JFreeChart chart = ChartFactory.createAreaChart( (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation ),
1210                (String JavaDoc)evaluateExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation ),
1211                (String JavaDoc)evaluateExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1212                (CategoryDataset)dataset.getDataset(),
1213                getPlot().getOrientation(),
1214                isShowLegend(),
1215                true,
1216                false);
1217
1218        configureChart(chart, getPlot(), evaluation);
1219        JRFillAreaPlot areaPlot = (JRFillAreaPlot)getPlot();
1220
1221        // Handle the axis formating for the catagory axis
1222
configureAxis(((CategoryPlot)chart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(),
1223                areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(),
1224                areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(),
1225                areaPlot.getCategoryAxisLineColor());
1226
1227        // Handle the axis formating for the value axis
1228
configureAxis(((CategoryPlot)chart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(),
1229                areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(),
1230                areaPlot.getValueAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(),
1231                areaPlot.getValueAxisLineColor());
1232
1233        return getCategoryRenderer(chart);
1234    }
1235
1236
1237    protected JFreeChartRenderer evaluateBar3DImage( byte evaluation ) throws JRException {
1238        JFreeChart chart =
1239            ChartFactory.createBarChart3D(
1240                    (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation ),
1241                    (String JavaDoc)evaluateExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation ),
1242                    (String JavaDoc)evaluateExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression(), evaluation ),
1243                    (CategoryDataset)dataset.getDataset(),
1244                    getPlot().getOrientation(),
1245                    isShowLegend(),
1246                    true,
1247                    false );
1248
1249        configureChart(chart, getPlot(), evaluation);
1250
1251        CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot();
1252        JRFillBar3DPlot bar3DPlot = (JRFillBar3DPlot)getPlot();
1253
1254        BarRenderer3D barRenderer3D =
1255            new BarRenderer3D(
1256                bar3DPlot.getXOffset(),
1257                bar3DPlot.getYOffset()
1258                );
1259        categoryPlot.setRenderer(barRenderer3D);
1260
1261        barRenderer3D.setBaseItemLabelGenerator(((JRFillCategoryDataset)getDataset()).getLabelGenerator());
1262        barRenderer3D.setItemLabelsVisible( bar3DPlot.isShowLabels() );
1263
1264        // Handle the axis formating for the catagory axis
1265
configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
1266                bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
1267                bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
1268                bar3DPlot.getCategoryAxisLineColor());
1269
1270        // Handle the axis formating for the value axis
1271
configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
1272                bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
1273                bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
1274                bar3DPlot.getValueAxisLineColor());
1275
1276        return getCategoryRenderer(chart);
1277    }
1278
1279
1280    /**
1281     *
1282     */

1283    protected JFreeChartRenderer evaluateBarImage(byte evaluation) throws JRException
1284    {
1285        CategoryDataset categoryDataset = (CategoryDataset)dataset.getDataset();
1286        JFreeChart chart =
1287            ChartFactory.createBarChart(
1288                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1289                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation),
1290                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1291                categoryDataset,
1292                getPlot().getOrientation(),
1293                isShowLegend(),
1294                true,
1295                false
1296                );
1297
1298        configureChart(chart, getPlot(), evaluation);
1299
1300        CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot();
1301        //plot.setNoDataMessage("No data to display");
1302

1303        JRFillBarPlot barPlot = (JRFillBarPlot)getPlot();
1304        categoryPlot.getDomainAxis().setTickMarksVisible(
1305            barPlot.isShowTickMarks()
1306            );
1307        categoryPlot.getDomainAxis().setTickLabelsVisible(
1308                barPlot.isShowTickLabels()
1309                );
1310        // Handle the axis formating for the catagory axis
1311
configureAxis(categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
1312                barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
1313                barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(),
1314                barPlot.getCategoryAxisLineColor());
1315
1316        ((NumberAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(
1317                barPlot.isShowTickMarks()
1318                );
1319        ((NumberAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(
1320                barPlot.isShowTickLabels()
1321                );
1322        // Handle the axis formating for the value axis
1323
configureAxis(categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
1324                barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
1325                barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(),
1326                barPlot.getValueAxisLineColor());
1327
1328
1329        CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
1330        categoryRenderer.setBaseItemLabelGenerator(((JRFillCategoryDataset)getDataset()).getLabelGenerator());
1331        categoryRenderer.setItemLabelsVisible( barPlot.isShowLabels() );
1332        
1333        return getCategoryRenderer(chart);
1334
1335    }
1336
1337
1338    protected JFreeChartRenderer evaluateBubbleImage( byte evaluation ) throws JRException {
1339        JFreeChart chart = ChartFactory.createBubbleChart(
1340                (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation),
1341                (String JavaDoc)evaluateExpression(((JRBubblePlot)getPlot()).getXAxisLabelExpression(), evaluation ),
1342                (String JavaDoc)evaluateExpression(((JRBubblePlot)getPlot()).getYAxisLabelExpression(), evaluation ),
1343                 (XYZDataset)dataset.getDataset(),
1344                 getPlot().getOrientation(),
1345                 isShowLegend(),
1346                 true,
1347                 false);
1348
1349        configureChart(chart, getPlot(), evaluation);
1350
1351        XYPlot xyPlot = (XYPlot)chart.getPlot();
1352        JRBubblePlot bubblePlot = (JRBubblePlot)getPlot();
1353
1354        XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer( bubblePlot.getScaleType() );
1355        xyPlot.setRenderer( bubbleRenderer );
1356
1357        // Handle the axis formating for the catagory axis
1358
configureAxis(xyPlot.getDomainAxis(), bubblePlot.getXAxisLabelFont(),
1359                bubblePlot.getXAxisLabelColor(), bubblePlot.getXAxisTickLabelFont(),
1360                bubblePlot.getXAxisTickLabelColor(), bubblePlot.getXAxisTickLabelMask(),
1361                bubblePlot.getXAxisLineColor());
1362
1363        // Handle the axis formating for the value axis
1364
configureAxis(xyPlot.getRangeAxis(), bubblePlot.getYAxisLabelFont(),
1365                bubblePlot.getYAxisLabelColor(), bubblePlot.getYAxisTickLabelFont(),
1366                bubblePlot.getYAxisTickLabelColor(), bubblePlot.getYAxisTickLabelMask(),
1367                bubblePlot.getYAxisLineColor());
1368
1369        return getXYZRenderer(chart);
1370    }
1371
1372
1373    /**
1374     *
1375     * @param evaluation
1376     * @throws net.sf.jasperreports.engine.JRException
1377     */

1378    protected JFreeChartRenderer evaluateCandlestickImage(byte evaluation) throws JRException
1379    {
1380        JFreeChart chart =
1381            ChartFactory.createCandlestickChart(
1382                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1383                (String JavaDoc)evaluateExpression(((JRCandlestickPlot)getPlot()).getTimeAxisLabelExpression(), evaluation),
1384                (String JavaDoc)evaluateExpression(((JRCandlestickPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1385                (DefaultHighLowDataset)dataset.getDataset(),
1386                isShowLegend()
1387                );
1388
1389        configureChart(chart, getPlot(), evaluation);
1390
1391        XYPlot xyPlot = (XYPlot) chart.getPlot();
1392        JRCandlestickPlot candlestickPlot = (JRCandlestickPlot)getPlot();
1393        CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
1394        candlestickRenderer.setDrawVolume(candlestickPlot.isShowVolume());
1395
1396        // Handle the axis formating for the catagory axis
1397
configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
1398                candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
1399                candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(),
1400                candlestickPlot.getTimeAxisLineColor());
1401
1402        // Handle the axis formating for the value axis
1403
configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(),
1404                candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(),
1405                candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(),
1406                candlestickPlot.getValueAxisLineColor());
1407        
1408        return getHighLowRenderer(chart);
1409    }
1410
1411
1412    /**
1413     *
1414     * @param evaluation
1415     * @throws JRException
1416     */

1417    protected JFreeChartRenderer evaluateHighLowImage(byte evaluation) throws JRException
1418    {
1419        JFreeChart chart =
1420            ChartFactory.createHighLowChart(
1421                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1422                (String JavaDoc)evaluateExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression(), evaluation),
1423                (String JavaDoc)evaluateExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1424                (DefaultHighLowDataset)dataset.getDataset(),
1425                isShowLegend()
1426                );
1427
1428        configureChart(chart, getPlot(), evaluation);
1429
1430        XYPlot xyPlot = (XYPlot) chart.getPlot();
1431        JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
1432        HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
1433        hlRenderer.setDrawOpenTicks(highLowPlot.isShowOpenTicks());
1434        hlRenderer.setDrawCloseTicks(highLowPlot.isShowCloseTicks());
1435
1436        // Handle the axis formating for the catagory axis
1437
configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
1438                highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
1439                highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(),
1440                highLowPlot.getTimeAxisLineColor());
1441
1442        // Handle the axis formating for the value axis
1443
configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
1444                highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
1445                highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(),
1446                highLowPlot.getValueAxisLineColor());
1447        
1448        return getHighLowRenderer(chart);
1449    }
1450
1451
1452    protected JFreeChartRenderer evaluateLineImage( byte evaluation ) throws JRException {
1453        JFreeChart chart = ChartFactory.createLineChart(
1454                (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation),
1455                (String JavaDoc)evaluateExpression( ((JRLinePlot)getPlot()).getCategoryAxisLabelExpression(), evaluation),
1456                (String JavaDoc)evaluateExpression(((JRLinePlot)getPlot()).getValueAxisLabelExpression(), evaluation ),
1457                (CategoryDataset)dataset.getDataset(),
1458                getPlot().getOrientation(),
1459                isShowLegend(),
1460                true,
1461                false);
1462
1463        configureChart(chart, getPlot(), evaluation);
1464
1465        CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot();
1466        JRFillLinePlot linePlot = (JRFillLinePlot)getPlot();
1467
1468        LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
1469        lineRenderer.setShapesVisible( linePlot.isShowShapes() );//FIXMECHART check this
1470
lineRenderer.setLinesVisible( linePlot.isShowLines() );
1471
1472        // Handle the axis formating for the catagory axis
1473
configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
1474                linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
1475                linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(),
1476                linePlot.getCategoryAxisLineColor());
1477
1478        // Handle the axis formating for the value axis
1479
configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
1480                linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
1481                linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(),
1482                linePlot.getValueAxisLineColor());
1483
1484        return getCategoryRenderer(chart);
1485    }
1486
1487
1488    /**
1489     *
1490     */

1491    protected JFreeChartRenderer evaluatePie3DImage(byte evaluation) throws JRException
1492    {
1493        JFreeChart chart =
1494            ChartFactory.createPieChart3D(
1495                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1496                (PieDataset)dataset.getDataset(),
1497                isShowLegend(),
1498                true,
1499                false
1500                );
1501
1502        configureChart(chart, getPlot(), evaluation);
1503
1504        PiePlot3D piePlot3D = (PiePlot3D) chart.getPlot();
1505        //plot.setStartAngle(290);
1506
//plot.setDirection(Rotation.CLOCKWISE);
1507
//plot.setNoDataMessage("No data to display");
1508
piePlot3D.setDepthFactor(((JRFillPie3DPlot)getPlot()).getDepthFactor());
1509        
1510        PieSectionLabelGenerator labelGenerator = ((JRFillPieDataset)getDataset()).getLabelGenerator();
1511        if (labelGenerator != null)
1512        {
1513            piePlot3D.setLabelGenerator(labelGenerator);
1514        }
1515
1516        return getPieRenderer(chart);
1517    }
1518
1519
1520    /**
1521     *
1522     */

1523    protected JFreeChartRenderer evaluatePieImage(byte evaluation) throws JRException
1524    {
1525        JFreeChart chart =
1526            ChartFactory.createPieChart(
1527                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1528                (PieDataset)dataset.getDataset(),
1529                isShowLegend(),
1530                true,
1531                false
1532                );
1533
1534        configureChart(chart, getPlot(), evaluation);
1535
1536        PiePlot piePlot = (PiePlot)chart.getPlot();
1537        //plot.setStartAngle(290);
1538
//plot.setDirection(Rotation.CLOCKWISE);
1539
//plot.setNoDataMessage("No data to display");
1540

1541        PieSectionLabelGenerator labelGenerator = ((JRFillPieDataset)getDataset()).getLabelGenerator();
1542        if (labelGenerator != null)
1543        {
1544            piePlot.setLabelGenerator(labelGenerator);
1545        }
1546
1547        return getPieRenderer(chart);
1548    }
1549
1550
1551    protected JFreeChartRenderer evaluateScatterImage( byte evaluation ) throws JRException {
1552        JFreeChart chart = ChartFactory.createScatterPlot(
1553                (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation),
1554                (String JavaDoc)evaluateExpression( ((JRScatterPlot)getPlot()).getXAxisLabelExpression(), evaluation),
1555                (String JavaDoc)evaluateExpression(((JRScatterPlot)getPlot()).getYAxisLabelExpression(), evaluation ),
1556                (XYDataset)dataset.getDataset(),
1557                getPlot().getOrientation(),
1558                isShowLegend(),
1559                true,
1560                false);
1561
1562        configureChart(chart, getPlot(), evaluation);
1563        XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot)chart.getPlot()).getRenderer();
1564
1565        JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
1566        plotRenderer.setLinesVisible(scatterPlot.isShowLines());
1567        plotRenderer.setShapesVisible(scatterPlot.isShowShapes());
1568
1569        // Handle the axis formating for the catagory axis
1570
configureAxis(chart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(),
1571                scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(),
1572                scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(),
1573                scatterPlot.getXAxisLineColor());
1574
1575        // Handle the axis formating for the value axis
1576
configureAxis(chart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(),
1577                scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(),
1578                scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(),
1579                scatterPlot.getYAxisLineColor());
1580
1581        return getXYRenderer(chart);
1582    }
1583
1584
1585    /**
1586     *
1587     */

1588    protected JFreeChartRenderer evaluateStackedBar3DImage(byte evaluation) throws JRException
1589    {
1590        JFreeChart chart =
1591            ChartFactory.createStackedBarChart3D(
1592                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1593                (String JavaDoc)evaluateExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation),
1594                (String JavaDoc)evaluateExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1595                (CategoryDataset)dataset.getDataset(),
1596                getPlot().getOrientation(),
1597                isShowLegend(),
1598                true,
1599                false
1600                );
1601
1602        configureChart(chart, getPlot(), evaluation);
1603        
1604        CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot();
1605        JRFillBar3DPlot bar3DPlot = (JRFillBar3DPlot)getPlot();
1606
1607        StackedBarRenderer3D stackedBarRenderer3D =
1608            new StackedBarRenderer3D(
1609                bar3DPlot.getXOffset(),
1610                bar3DPlot.getYOffset()
1611                );
1612        categoryPlot.setRenderer(stackedBarRenderer3D);
1613
1614        stackedBarRenderer3D.setBaseItemLabelGenerator(((JRFillCategoryDataset)getDataset()).getLabelGenerator());
1615        stackedBarRenderer3D.setItemLabelsVisible( bar3DPlot.isShowLabels() );
1616
1617        // Handle the axis formating for the catagory axis
1618
configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
1619                bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
1620                bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
1621                bar3DPlot.getCategoryAxisLineColor());
1622
1623        // Handle the axis formating for the value axis
1624
configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
1625                bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
1626                bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
1627                bar3DPlot.getValueAxisLineColor());
1628
1629        return getCategoryRenderer(chart);
1630    }
1631
1632
1633    /**
1634     *
1635     */

1636    protected JFreeChartRenderer evaluateStackedBarImage(byte evaluation) throws JRException
1637    {
1638        JFreeChart chart =
1639            ChartFactory.createStackedBarChart(
1640                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1641                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation),
1642                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1643                (CategoryDataset)dataset.getDataset(),
1644                getPlot().getOrientation(),
1645                isShowLegend(),
1646                true,
1647                false
1648                );
1649
1650        configureChart(chart, getPlot(), evaluation);
1651
1652        CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot();
1653        JRFillBarPlot barPlot = (JRFillBarPlot)getPlot();
1654        //plot.setNoDataMessage("No data to display");
1655

1656        categoryPlot.getDomainAxis().setTickMarksVisible(
1657                barPlot.isShowTickMarks()
1658                );
1659        categoryPlot.getDomainAxis().setTickLabelsVisible(
1660                barPlot.isShowTickLabels()
1661                );
1662        ((NumberAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(
1663                barPlot.isShowTickMarks()
1664                );
1665        ((NumberAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(
1666                barPlot.isShowTickLabels()
1667                );
1668        
1669        CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
1670        categoryRenderer.setBaseItemLabelGenerator(((JRFillCategoryDataset)getDataset()).getLabelGenerator());
1671        categoryRenderer.setItemLabelsVisible( ((JRFillBarPlot)getPlot()).isShowLabels() );
1672
1673        // Handle the axis formating for the catagory axis
1674
configureAxis(categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
1675                barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
1676                barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(),
1677                barPlot.getCategoryAxisLineColor());
1678
1679        // Handle the axis formating for the value axis
1680
configureAxis(categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
1681                barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
1682                barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(),
1683                barPlot.getValueAxisLineColor());
1684        
1685        return getCategoryRenderer(chart);
1686    }
1687
1688
1689    protected JFreeChartRenderer evaluateXyAreaImage( byte evaluation ) throws JRException {
1690        JFreeChart chart = ChartFactory.createXYAreaChart(
1691            (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation ),
1692            (String JavaDoc)evaluateExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation ),
1693            (String JavaDoc)evaluateExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1694            (XYDataset)dataset.getDataset(),
1695            getPlot().getOrientation(),
1696            isShowLegend(),
1697            true,
1698            false
1699            );
1700
1701        configureChart(chart, getPlot(), evaluation);
1702        JRAreaPlot areaPlot = (JRAreaPlot)getPlot();
1703
1704        // Handle the axis formating for the catagory axis
1705
configureAxis(chart.getXYPlot().getDomainAxis(), areaPlot.getCategoryAxisLabelFont(),
1706                areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(),
1707                areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(),
1708                areaPlot.getCategoryAxisLineColor());
1709
1710        // Handle the axis formating for the value axis
1711
configureAxis(chart.getXYPlot().getRangeAxis(), areaPlot.getValueAxisLabelFont(),
1712                areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(),
1713                areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(),
1714                areaPlot.getValueAxisLineColor());
1715        return getXYRenderer(chart);
1716    }
1717
1718
1719    /**
1720     *
1721     */

1722    protected JFreeChartRenderer evaluateXYBarImage(byte evaluation) throws JRException
1723    {
1724        IntervalXYDataset tmpDataset = (IntervalXYDataset)dataset.getDataset();
1725        
1726        boolean isDate = true;
1727        if( dataset.getDatasetType() == JRChartDataset.XY_DATASET ){
1728            isDate = false;
1729        }
1730        
1731        JFreeChart chart =
1732            ChartFactory.createXYBarChart(
1733                (String JavaDoc)evaluateExpression(getTitleExpression(), evaluation),
1734                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression(), evaluation),
1735                isDate,
1736                (String JavaDoc)evaluateExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression(), evaluation),
1737                tmpDataset,
1738                getPlot().getOrientation(),
1739                isShowLegend(),
1740                true,
1741                false
1742                );
1743
1744        configureChart(chart, getPlot(), evaluation);
1745
1746        XYPlot xyPlot = (XYPlot)chart.getPlot();
1747        //plot.setNoDataMessage("No data to display");
1748
// ((XYPlot)plot.getDomainAxis()).setTickMarksVisible(
1749
// ((JRFillBarPlot)getPlot()).isShowTickMarks()
1750
// );
1751
// ((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible(
1752
// ((JRFillBarPlot)getPlot()).isShowTickLabels()
1753
// );
1754
// ((NumberAxis)plot.getRangeAxis()).setTickMarksVisible(
1755
// ((JRFillBarPlot)getPlot()).isShowTickMarks()
1756
// );
1757
// ((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible(
1758
// ((JRFillBarPlot)getPlot()).isShowTickLabels()
1759
// );
1760

1761        
1762        XYItemRenderer itemRenderer = xyPlot.getRenderer();
1763        if( getDataset().getDatasetType() == JRChartDataset.TIMESERIES_DATASET ) {
1764            itemRenderer.setBaseItemLabelGenerator( ((JRFillTimeSeriesDataset)getDataset()).getLabelGenerator() );
1765        }
1766        else if( getDataset().getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET ){
1767            itemRenderer.setBaseItemLabelGenerator( ((JRFillTimePeriodDataset)getDataset()).getLabelGenerator() );
1768        }
1769        else if( getDataset().getDatasetType() == JRChartDataset.XY_DATASET ) {
1770            itemRenderer.setBaseItemLabelGenerator( ((JRFillXyDataset)getDataset()).getLabelGenerator() );
1771        }
1772        
1773        JRFillBarPlot barPlot = (JRFillBarPlot)getPlot();
1774
1775        itemRenderer.setBaseItemLabelsVisible( barPlot.isShowLabels() );
1776
1777        // Handle the axis formating for the catagory axis
1778
configureAxis(xyPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
1779                barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
1780                barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(),
1781                barPlot.getCategoryAxisLineColor());
1782
1783        // Handle the axis formating for the value axis
1784
configureAxis(xyPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
1785                barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
1786                barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(),
1787                barPlot.getValueAxisLineColor());
1788
1789        return getXYBarRenderer(chart);
1790    }
1791
1792
1793    protected JFreeChartRenderer evaluateXyLineImage( byte evaluation ) throws JRException {
1794        JRLinePlot linePlot = (JRLinePlot) getPlot();
1795        
1796        JFreeChart chart = ChartFactory.createXYLineChart(
1797                (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation),
1798                (String JavaDoc)evaluateExpression(linePlot.getCategoryAxisLabelExpression(), evaluation),
1799                (String JavaDoc)evaluateExpression(linePlot.getValueAxisLabelExpression(), evaluation ),
1800                (XYDataset)dataset.getDataset(),
1801                linePlot.getOrientation(),
1802                isShowLegend(),
1803                true,
1804                false);
1805
1806        configureChart(chart, getPlot(), evaluation);
1807        
1808        // Handle the axis formating for the catagory axis
1809
configureAxis(chart.getXYPlot().getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
1810                linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
1811                linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(),
1812                linePlot.getCategoryAxisLineColor());
1813
1814        // Handle the axis formating for the value axis
1815
configureAxis(chart.getXYPlot().getRangeAxis(), linePlot.getValueAxisLabelFont(),
1816                linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
1817                linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(),
1818                linePlot.getValueAxisLineColor());
1819
1820        XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer();
1821        lineRenderer.setShapesVisible(linePlot.isShowShapes());
1822        lineRenderer.setLinesVisible(linePlot.isShowLines());
1823
1824        return getXYRenderer(chart);
1825    }
1826
1827    protected JFreeChartRenderer evaluateTimeSeriesImage( byte evaluation ) throws JRException {
1828        
1829        
1830        String JavaDoc timeAxisLabel = (String JavaDoc)evaluateExpression( ((JRTimeSeriesPlot)getPlot()).getTimeAxisLabelExpression(), evaluation );
1831        String JavaDoc valueAxisLabel = (String JavaDoc)evaluateExpression( ((JRTimeSeriesPlot)getPlot()).getValueAxisLabelExpression(), evaluation );
1832                
1833        JFreeChart chart = ChartFactory.createTimeSeriesChart(
1834                (String JavaDoc)evaluateExpression( getTitleExpression(), evaluation ),
1835                timeAxisLabel,
1836                valueAxisLabel,
1837                (TimeSeriesCollection)dataset.getDataset(),
1838                isShowLegend(),
1839                true,
1840                false );
1841        
1842        configureChart(chart, getPlot(), evaluation);
1843        
1844        XYPlot xyPlot = (XYPlot)chart.getPlot();
1845        JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot)getPlot();
1846        
1847        XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer)xyPlot.getRenderer();
1848        lineRenderer.setLinesVisible(((JRTimeSeriesPlot)getPlot()).isShowLines() );
1849        lineRenderer.setShapesVisible(((JRTimeSeriesPlot)getPlot()).isShowShapes() );
1850
1851        // Handle the axis formating for the catagory axis
1852
configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot.getTimeAxisLabelFont(),
1853                timeSeriesPlot.getTimeAxisLabelColor(), timeSeriesPlot.getTimeAxisTickLabelFont(),
1854                timeSeriesPlot.getTimeAxisTickLabelColor(), timeSeriesPlot.getTimeAxisTickLabelMask(),
1855                timeSeriesPlot.getTimeAxisLineColor());
1856
1857        // Handle the axis formating for the value axis
1858
configureAxis(xyPlot.getRangeAxis(), timeSeriesPlot.getValueAxisLabelFont(),
1859                timeSeriesPlot.getValueAxisLabelColor(), timeSeriesPlot.getValueAxisTickLabelFont(),
1860                timeSeriesPlot.getValueAxisTickLabelColor(), timeSeriesPlot.getValueAxisTickLabelMask(),
1861                timeSeriesPlot.getValueAxisLineColor());
1862        
1863        return getTimeSeriesRenderer(chart);
1864        
1865    }
1866
1867
1868    /**
1869     * Converts a JasperReport data range into one understood by JFreeChart.
1870     *
1871     * @param dataRange the JasperReport version of the range
1872     * @param evaluation current expression evaluation phase
1873     * @return the JFreeChart version of the range
1874     * @throws JRException thrown when the low value of the range is greater than the
1875     * high value
1876     */

1877    protected Range convertRange(JRDataRange dataRange, byte evaluation) throws JRException
1878    {
1879        if (dataRange == null)
1880            return null;
1881        
1882        Number JavaDoc low = (Number JavaDoc)evaluateExpression(dataRange.getLowExpression(), evaluation);
1883        Number JavaDoc high = (Number JavaDoc)evaluateExpression(dataRange.getHighExpression(), evaluation);
1884        return new Range( low != null ? low.doubleValue() : 0.0,
1885                                 high != null ? high.doubleValue() : 100.0);
1886    }
1887    
1888    /**
1889     * Converts a JasperReports meter interval to one that JFreeChart understands.
1890     *
1891     * @param interval the JasperReports definition of an interval
1892     * @param evaluation current evaluation time
1893     * @return the JFreeChart version of the same interval
1894     * @throws JRException thrown when the interval contains an invalid range
1895     */

1896    protected MeterInterval convertInterval(JRMeterInterval interval, byte evaluation) throws JRException
1897    {
1898        String JavaDoc label = interval.getLabel();
1899        if (label == null)
1900            label = "";
1901        
1902        Range range = convertRange(interval.getDataRange(), evaluation);
1903        
1904        Color JavaDoc color = interval.getBackgroundColor();
1905        float[] components = color.getRGBColorComponents(null);
1906        
1907        Color JavaDoc alphaColor = new Color JavaDoc(components[0], components[1], components[2], (float)interval.getAlpha());
1908
1909        return new MeterInterval(label, range, alphaColor, null, alphaColor);
1910    }
1911    
1912    /**
1913     * Build and configure a meter chart.
1914     *
1915     * @param evaluation current expression evaluation phase
1916     * @return the JFreeChart meter chart
1917     * @throws JRException
1918    */

1919    protected JFreeChartRenderer evaluateMeterImage( byte evaluation ) throws JRException {
1920        
1921        JRFillMeterPlot jrPlot = (JRFillMeterPlot)getPlot();
1922        
1923        // Start by creating the plot that wil hold the meter
1924
MeterPlot chartPlot = new MeterPlot((ValueDataset)dataset.getDataset());
1925        
1926        // Set the shape
1927
int shape = jrPlot.getShape();
1928        if (shape == JRMeterPlot.SHAPE_CHORD)
1929            chartPlot.setDialShape(DialShape.CHORD);
1930        else if (shape == JRMeterPlot.SHAPE_CIRCLE)
1931            chartPlot.setDialShape(DialShape.CIRCLE);
1932        else
1933            chartPlot.setDialShape(DialShape.PIE);
1934        
1935        // Set the meter's range
1936
chartPlot.setRange(convertRange(jrPlot.getDataRange(), evaluation));
1937        
1938        // Set the size of the meter
1939
chartPlot.setMeterAngle(jrPlot.getMeterAngle());
1940        
1941        // Set the units - this is just a string that will be shown next to the
1942
// value
1943
String JavaDoc units = jrPlot.getUnits();
1944        if (units != null && units.length() > 0)
1945            chartPlot.setUnits(units);
1946        
1947        // Set the spacing between ticks. I hate the name "tickSize" since to me it
1948
// implies I am changing the size of the tick, not the spacing between them.
1949
chartPlot.setTickSize(jrPlot.getTickInterval());
1950        
1951        // Set all the colors we support
1952
Color JavaDoc color = jrPlot.getMeterBackgroundColor();
1953        if (color != null)
1954            chartPlot.setDialBackgroundPaint(color);
1955        
1956        color = jrPlot.getNeedleColor();
1957        if (color != null)
1958            chartPlot.setNeedlePaint(color);
1959       
1960        // Set how the value is displayed.
1961
JRValueDisplay display = jrPlot.getValueDisplay();
1962        if (display != null)
1963        {
1964            if (display.getColor() != null)
1965            {
1966                chartPlot.setValuePaint(display.getColor());
1967            }
1968            if (display.getMask() != null)
1969            {
1970                //TODO: this seems broken
1971
//chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
1972
}
1973            if (display.getFont() != null)
1974            {
1975                Map JavaDoc attributes = JRFontUtil.getAttributes(display.getFont());
1976                chartPlot.setValueFont(new Font JavaDoc(attributes));
1977            }
1978        }
1979            
1980        color = jrPlot.getTickColor();
1981        if (color != null)
1982            chartPlot.setTickPaint(color);
1983        
1984        // Now define all of the intervals, setting their range and color
1985
List JavaDoc intervals = jrPlot.getIntervals();
1986        if (intervals != null)
1987        {
1988            Iterator JavaDoc iter = intervals.iterator();
1989            while (iter.hasNext())
1990            {
1991                JRMeterInterval interval = (JRMeterInterval)iter.next();
1992                chartPlot.addInterval(convertInterval(interval, evaluation));
1993            }
1994        }
1995        
1996        // Actually create the chart around the plot
1997
JFreeChart chart = new JFreeChart((String JavaDoc)evaluateExpression( getTitleExpression(), evaluation ),
1998                                          null, chartPlot, isShowLegend());
1999        
2000        // Set all the generic options
2001
configureChart(chart, getPlot(), evaluation);
2002        
2003        // Meters only display a single value, so no hyperlinks are supported
2004
return new JFreeChartRenderer(chart);
2005        
2006    }
2007
2008    /**
2009     * Build and run a thermometer chart. JFreeChart thermometer charts have some
2010     * limitations. They always have a maximum of three ranges, and the colors of those
2011     * ranges seems to be fixed.
2012     *
2013     * @param evaluation current expression evaluation phase
2014     * @return the JFreeChart thermometer chart
2015     * @throws JRException
2016     */

2017    protected JFreeChartRenderer evaluateThermometerImage( byte evaluation ) throws JRException {
2018        
2019        JRFillThermometerPlot jrPlot = (JRFillThermometerPlot)getPlot();
2020        
2021        // Create the plot that will hold the thermometer.
2022
ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)dataset.getDataset());
2023        
2024        Range range = convertRange(jrPlot.getDataRange(), evaluation);
2025        
2026        // Set the boundary of the thermomoter
2027
chartPlot.setLowerBound(range.getLowerBound());
2028        chartPlot.setUpperBound(range.getUpperBound());
2029        
2030        chartPlot.setShowValueLines(jrPlot.isShowValueLines());
2031        
2032        // Units can only be Fahrenheit, Celsius or none, so turn off for now.
2033
chartPlot.setUnits(ThermometerPlot.UNITS_NONE);
2034        
2035        // Set the color of the mercury. Only used when the value is outside of
2036
// any defined ranges.
2037
Color JavaDoc color = jrPlot.getMercuryColor();
2038        if (color != null)
2039        {
2040            chartPlot.setMercuryPaint(color);
2041        }
2042        
2043        // Set the formatting of the value display
2044
JRValueDisplay display = jrPlot.getValueDisplay();
2045        if (display != null)
2046        {
2047            if (display.getColor() != null)
2048            {
2049                chartPlot.setValuePaint(display.getColor());
2050            }
2051            if (display.getMask() != null)
2052            {
2053                chartPlot.setValueFormat(new DecimalFormat JavaDoc(display.getMask()));
2054            }
2055            if (display.getFont() != null)
2056            {
2057                Map JavaDoc attributes = JRFontUtil.getAttributes(display.getFont());
2058                chartPlot.setValueFont(new Font JavaDoc(attributes));
2059            }
2060        }
2061        
2062        // Set the location of where the value is displayed
2063
switch (jrPlot.getValueLocation())
2064        {
2065          case JRThermometerPlot.LOCATION_NONE:
2066             chartPlot.setValueLocation(ThermometerPlot.NONE);
2067             break;
2068          case JRThermometerPlot.LOCATION_LEFT:
2069             chartPlot.setValueLocation(ThermometerPlot.LEFT);
2070             break;
2071          case JRThermometerPlot.LOCATION_RIGHT:
2072             chartPlot.setValueLocation(ThermometerPlot.RIGHT);
2073             break;
2074          case JRThermometerPlot.LOCATION_BULB:
2075          default:
2076             chartPlot.setValueLocation(ThermometerPlot.BULB);
2077             break;
2078        }
2079        
2080        // Define the three ranges
2081
range = convertRange(jrPlot.getLowRange(), evaluation);
2082        if (range != null)
2083        {
2084            chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
2085        }
2086        
2087        range = convertRange(jrPlot.getMediumRange(), evaluation);
2088        if (range != null)
2089        {
2090            chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
2091        }
2092
2093        range = convertRange(jrPlot.getHighRange(), evaluation);
2094        if (range != null)
2095        {
2096            chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
2097        }
2098        
2099        // Build a chart around this plot
2100
JFreeChart chart = new JFreeChart(chartPlot);
2101        
2102        // Set the generic options
2103
configureChart(chart, getPlot(), evaluation);
2104        
2105        // Thermometer plots only show a single value, so no drilldown or
2106
// hyperlinking is supported.
2107
return new JFreeChartRenderer(chart);
2108        
2109    }
2110
2111    /**
2112     * Build and configure a multiple axis chart. A multiple axis chart support more than
2113     * one range axis. Multiple datasets using different ranges can be displayed as long as
2114     * they share a common domain axis. Each dataset can be rendered differently, so one chart
2115     * can contain (for example) two line charts, a bar chart and an area chart.
2116     * <br><br>
2117     * Multiple axis charts are handled differently than the other chart types. They do not
2118     * have a dataset, as each chart that is added to the multiple axis chart has its own
2119     * dataset. For simplicity, each dataset is treated as its own chart, and in fact we
2120     * reuse the design of all the chart types and let JFreeChart actually run them. Then
2121     * we pull out the bits we need and add it to the common chart. All the plot and chart
2122     * options on the nested charts is ignored, and all formatting is controlled by the plot
2123     * attached to the multiAxisChart. The one exception is seriesColor, which can be used in
2124     * a nested report to specify a color for a specific series in that report.
2125     *
2126     * @param evaluation current expression evaluation phase
2127     * @return the JFreeChart chart
2128     * @throws JRException
2129     */

2130    protected JFreeChartRenderer evaluateMultiAxisImage(byte evaluation) throws JRException
2131    {
2132        // A multi axis chart has to have at least one axis and chart specified.
2133
// Create the first axis as the base plot, and then go ahead and create the
2134
// charts for any additional axes. Just take the renderer and data series
2135
// from those charts and add them to the first one.
2136
JFreeChart mainChart = null;
2137        Plot mainPlot = null;
2138        
2139        JRFillMultiAxisPlot jrPlot = (JRFillMultiAxisPlot)getPlot();
2140        
2141        // Generate the main plot from the first axes specified.
2142
Iterator JavaDoc iter = jrPlot.getAxes().iterator();
2143        if (iter.hasNext())
2144        {
2145            JRFillChartAxis axis = (JRFillChartAxis)iter.next();
2146            JRFillChart fillChart = axis.getFillChart();
2147            mainChart = fillChart.evaluateImage(evaluation).getChart();
2148            // Override the plot from the first axis with the plot for the multi-axis
2149
// chart.
2150
configureChart(mainChart, getPlot(), evaluation);
2151            mainPlot = mainChart.getPlot();
2152            if (axis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM)
2153            {
2154                if (mainPlot instanceof CategoryPlot)
2155                    ((CategoryPlot)mainPlot).setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_RIGHT);
2156                if (mainPlot instanceof XYPlot)
2157                    ((XYPlot)mainPlot).setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_RIGHT);
2158            }
2159            else
2160            {
2161                if (mainPlot instanceof CategoryPlot)
2162                    ((CategoryPlot)mainPlot).setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
2163                if (mainPlot instanceof XYPlot)
2164                    ((XYPlot)mainPlot).setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
2165            }
2166         }
2167        
2168        // Now handle all the extra axes, if any.
2169
int axisNumber = 0;
2170        while (iter.hasNext())
2171        {
2172            axisNumber++;
2173            JRFillChartAxis chartAxis = (JRFillChartAxis)iter.next();
2174            JRFillChart fillChart = chartAxis.getFillChart();
2175            JFreeChart axisChart = fillChart.evaluateImage(evaluation).getChart();
2176            
2177            // In JFreeChart to add a second chart type to an existing chart
2178
// you need to add an axis, a data series and a renderer. To
2179
// leverage existing code we simply create a new chart for the
2180
// axis and then pull out the bits we need and add them to the multi
2181
// chart. Currently JFree only supports category plots and xy plots
2182
// in a multi-axis chart, and you can not mix the two.
2183
if (mainPlot instanceof CategoryPlot)
2184            {
2185                CategoryPlot mainCatPlot = (CategoryPlot)mainPlot;
2186                if (!(axisChart.getPlot() instanceof CategoryPlot))
2187                {
2188                    throw new JRException("You can not mix plot types in a MultiAxisChart");
2189                }
2190                
2191                // Get the axis and add it to the multi axis chart plot
2192
CategoryPlot axisPlot = (CategoryPlot)axisChart.getPlot();
2193                mainCatPlot.setRangeAxis(axisNumber, axisPlot.getRangeAxis());
2194                if (chartAxis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM)
2195                {
2196                    mainCatPlot.setRangeAxisLocation(axisNumber, AxisLocation.BOTTOM_OR_RIGHT);
2197                }
2198                else
2199                {
2200                    mainCatPlot.setRangeAxisLocation(axisNumber, AxisLocation.TOP_OR_LEFT);
2201                }
2202
2203                // Add the data set and map it to the recently added axis
2204
mainCatPlot.setDataset(axisNumber, axisPlot.getDataset());
2205                mainCatPlot.mapDatasetToRangeAxis(axisNumber, axisNumber);
2206                
2207                // Set the renderer to use to draw the dataset.
2208
mainCatPlot.setRenderer(axisNumber, axisPlot.getRenderer());
2209                
2210                // Handle any color series for this chart
2211
configureAxisSeriesColors(axisPlot.getRenderer(), fillChart.getPlot());
2212            }
2213            else if (mainPlot instanceof XYPlot)
2214            {
2215                XYPlot mainXyPlot = (XYPlot)mainPlot;
2216                if (!(axisChart.getPlot() instanceof XYPlot))
2217                {
2218                    throw new JRException("You can not mix plot types in a MultiAxisChart");
2219                }
2220                
2221                // Get the axis and add it to the multi axis chart plot
2222
XYPlot axisPlot = (XYPlot)axisChart.getPlot();
2223                mainXyPlot.setRangeAxis(axisNumber, axisPlot.getRangeAxis());
2224                if (chartAxis.getPosition() == JRChartAxis.POSITION_RIGHT_OR_BOTTOM)
2225                {
2226                    mainXyPlot.setRangeAxisLocation(axisNumber, AxisLocation.BOTTOM_OR_RIGHT);
2227                }
2228                else
2229                {
2230                    mainXyPlot.setRangeAxisLocation(axisNumber, AxisLocation.TOP_OR_LEFT);
2231                }
2232
2233                // Add the data set and map it to the recently added axis
2234
mainXyPlot.setDataset(axisNumber, axisPlot.getDataset());
2235                mainXyPlot.mapDatasetToRangeAxis(axisNumber, axisNumber);
2236                
2237                // Set the renderer to use to draw the dataset.
2238
mainXyPlot.setRenderer(axisNumber, axisPlot.getRenderer());
2239                
2240                // Handle any color series for this chart
2241
configureAxisSeriesColors(axisPlot.getRenderer(), fillChart.getPlot());
2242            }
2243            else
2244            {
2245                throw new JRException("MultiAxis charts only support Category and XY plots.");
2246            }
2247        }
2248        return new JFreeChartRenderer(mainChart);
2249    }
2250    
2251    protected void resolveElement(JRPrintElement element, byte evaluation) throws JRException
2252    {
2253        evaluateImage(evaluation);
2254
2255        copy((JRPrintImage) element);
2256    }
2257
2258
2259    public int getBookmarkLevel()
2260    {
2261        return ((JRChart)parent).getBookmarkLevel();
2262    }
2263
2264    /**
2265     *
2266     */

2267    public String JavaDoc getCustomizerClass()
2268    {
2269        return customizerClass;
2270    }
2271
2272    /**
2273     *
2274     */

2275    public byte getBorder()
2276    {
2277        return JRStyleResolver.getBorder(this);
2278    }
2279
2280    public Byte JavaDoc getOwnBorder()
2281    {
2282        return ((JRBox)parent).getOwnBorder();
2283    }
2284
2285    /**
2286     *
2287     */

2288    public void setBorder(byte border)
2289    {
2290    }
2291
2292    /**
2293     *
2294     */

2295    public void setBorder(Byte JavaDoc border)
2296    {
2297    }
2298
2299    /**
2300     *
2301     */

2302    public Color JavaDoc getBorderColor()
2303    {
2304        return JRStyleResolver.getBorderColor(this, getForecolor());
2305    }
2306
2307    public Color JavaDoc getOwnBorderColor()
2308    {
2309        return ((JRBox)parent).getOwnBorderColor();
2310    }
2311
2312    /**
2313     *
2314     */

2315    public void setBorderColor(Color JavaDoc borderColor)
2316    {
2317    }
2318
2319    /**
2320     *
2321     */

2322    public int getPadding()
2323    {
2324        return JRStyleResolver.getPadding(this);
2325    }
2326
2327    public Integer JavaDoc getOwnPadding()
2328    {
2329        return ((JRBox)parent).getOwnPadding();
2330    }
2331
2332    /**
2333     *
2334     */

2335    public void setPadding(int padding)
2336    {
2337    }
2338
2339    /**
2340     *
2341     */

2342    public void setPadding(Integer JavaDoc padding)
2343    {
2344    }
2345
2346    /**
2347     *
2348     */

2349    public byte getTopBorder()
2350    {
2351        return JRStyleResolver.getTopBorder(this);
2352    }
2353
2354    /**
2355     *
2356     */

2357    public Byte JavaDoc getOwnTopBorder()
2358    {
2359        return ((JRBox)parent).getOwnTopBorder();
2360    }
2361
2362    /**
2363     *
2364     */

2365    public void setTopBorder(byte topBorder)
2366    {
2367    }
2368
2369    /**
2370     *
2371     */

2372    public void setTopBorder(Byte JavaDoc topBorder)
2373    {
2374    }
2375
2376    /**
2377     *
2378     */

2379    public Color JavaDoc getTopBorderColor()
2380    {
2381        return JRStyleResolver.getTopBorderColor(this, getForecolor());
2382    }
2383
2384    /**
2385     *
2386     */

2387    public Color JavaDoc getOwnTopBorderColor()
2388    {
2389        return ((JRBox)parent).getOwnTopBorderColor();
2390    }
2391
2392    /**
2393     *
2394     */

2395    public void setTopBorderColor(Color JavaDoc topBorderColor)
2396    {
2397    }
2398
2399    /**
2400     *
2401     */

2402    public int getTopPadding()
2403    {
2404        return JRStyleResolver.getTopPadding(this);
2405    }
2406
2407    /**
2408     *
2409     */

2410    public Integer JavaDoc getOwnTopPadding()
2411    {
2412        return ((JRBox)parent).getOwnTopPadding();
2413    }
2414
2415    /**
2416     *
2417     */

2418    public void setTopPadding(int topPadding)
2419    {
2420    }
2421
2422    /**
2423     *
2424     */

2425    public void setTopPadding(Integer JavaDoc topPadding)
2426    {
2427    }
2428
2429    /**
2430     *
2431     */

2432    public byte getLeftBorder()
2433    {
2434        return JRStyleResolver.getLeftBorder(this);
2435    }
2436
2437    /**
2438     *
2439     */

2440    public Byte JavaDoc getOwnLeftBorder()
2441    {
2442        return ((JRBox)parent).getOwnLeftBorder();
2443    }
2444
2445    /**
2446     *
2447     */

2448    public void setLeftBorder(byte leftBorder)
2449    {
2450    }
2451
2452    /**
2453     *
2454     */

2455    public void setLeftBorder(Byte JavaDoc leftBorder)
2456    {
2457    }
2458
2459    /**
2460     *
2461     */

2462    public Color JavaDoc getLeftBorderColor()
2463    {
2464        return JRStyleResolver.getLeftBorderColor(this, getForecolor());
2465    }
2466
2467    /**
2468     *
2469     */

2470    public Color JavaDoc getOwnLeftBorderColor()
2471    {
2472        return ((JRBox)parent).getOwnLeftBorderColor();
2473    }
2474
2475    /**
2476     *
2477     */

2478    public void setLeftBorderColor(Color JavaDoc leftBorderColor)
2479    {
2480    }
2481
2482    /**
2483     *
2484     */

2485    public int getLeftPadding()
2486    {
2487        return JRStyleResolver.getLeftPadding(this);
2488    }
2489
2490    /**
2491     *
2492     */

2493    public Integer JavaDoc getOwnLeftPadding()
2494    {
2495        return ((JRBox)parent).getOwnLeftPadding();
2496    }
2497
2498    /**
2499     *
2500     */

2501    public void setLeftPadding(int leftPadding)
2502    {
2503    }
2504
2505    /**
2506     *
2507     */

2508    public void setLeftPadding(Integer JavaDoc leftPadding)
2509    {
2510    }
2511
2512    /**
2513     *
2514     */

2515    public byte getBottomBorder()
2516    {
2517        return JRStyleResolver.getBottomBorder(this);
2518    }
2519
2520    /**
2521     *
2522     */

2523    public Byte JavaDoc getOwnBottomBorder()
2524    {
2525        return ((JRBox)parent).getOwnBottomBorder();
2526    }
2527
2528    /**
2529     *
2530     */

2531    public void setBottomBorder(byte bottomBorder)
2532    {
2533    }
2534
2535    /**
2536     *
2537     */

2538    public void setBottomBorder(Byte JavaDoc bottomBorder)
2539    {
2540    }
2541
2542    /**
2543     *
2544     */

2545    public Color JavaDoc getBottomBorderColor()
2546    {
2547        return JRStyleResolver.getBottomBorderColor(this, getForecolor());
2548    }
2549
2550    /**
2551     *
2552     */

2553    public Color JavaDoc getOwnBottomBorderColor()
2554    {
2555        return ((JRBox)parent).getOwnBottomBorderColor();
2556    }
2557
2558    /**
2559     *
2560     */

2561    public void setBottomBorderColor(Color JavaDoc bottomBorderColor)
2562    {
2563    }
2564
2565    /**
2566     *
2567     */

2568    public int getBottomPadding()
2569    {
2570        return JRStyleResolver.getBottomPadding(this);
2571    }
2572
2573    /**
2574     *
2575     */

2576    public Integer JavaDoc getOwnBottomPadding()
2577    {
2578        return ((JRBox)parent).getOwnBottomPadding();
2579    }
2580
2581    /**
2582     *
2583     */

2584    public void setBottomPadding(int bottomPadding)
2585    {
2586    }
2587
2588    /**
2589     *
2590     */

2591    public void setBottomPadding(Integer JavaDoc bottomPadding)
2592    {
2593    }
2594
2595    /**
2596     *
2597     */

2598    public byte getRightBorder()
2599    {
2600        return JRStyleResolver.getRightBorder(this);
2601    }
2602
2603    /**
2604     *
2605     */

2606    public Byte JavaDoc getOwnRightBorder()
2607    {
2608        return ((JRBox)parent).getOwnRightBorder();
2609    }
2610
2611    /**
2612     *
2613     */

2614    public void setRightBorder(byte rightBorder)
2615    {
2616    }
2617
2618    /**
2619     *
2620     */

2621    public void setRightBorder(Byte JavaDoc rightBorder)
2622    {
2623    }
2624
2625    /**
2626     *
2627     */

2628    public Color JavaDoc getRightBorderColor()
2629    {
2630        return JRStyleResolver.getRightBorderColor(this, getForecolor());
2631    }
2632
2633    /**
2634     *
2635     */

2636    public Color JavaDoc getOwnRightBorderColor()
2637    {
2638        return ((JRBox)parent).getOwnRightBorderColor();
2639    }
2640
2641    /**
2642     *
2643     */

2644    public void setRightBorderColor(Color JavaDoc rightBorderColor)
2645    {
2646    }
2647
2648    /**
2649     *
2650     */

2651    public int getRightPadding()
2652    {
2653        return JRStyleResolver.getRightPadding(this);
2654    }
2655
2656    /**
2657     *
2658     */

2659    public Integer JavaDoc getOwnRightPadding()
2660    {
2661        return ((JRBox)parent).getOwnRightPadding();
2662    }
2663
2664    /**
2665     *
2666     */

2667    public void setRightPadding(int rightPadding)
2668    {
2669    }
2670
2671    /**
2672     *
2673     */

2674    public void setRightPadding(Integer JavaDoc rightPadding)
2675    {
2676    }
2677
2678
2679
2680    private void evaluateDatasetRun(byte evaluation) throws JRException
2681    {
2682        dataset.evaluateDatasetRun(evaluation);
2683    }
2684
2685
2686    public JRCloneable createClone(JRFillCloneFactory factory)
2687    {
2688        //not needed
2689
return null;
2690    }
2691
2692
2693    public JRHyperlinkParameter[] getHyperlinkParameters()
2694    {
2695        return ((JRChart) parent).getHyperlinkParameters();
2696    }
2697
2698
2699    public String JavaDoc getLinkType()
2700    {
2701        return ((JRChart) parent).getLinkType();
2702    }
2703
2704
2705    public JRExpression getHyperlinkTooltipExpression()
2706    {
2707        return ((JRChart) parent).getHyperlinkTooltipExpression();
2708    }
2709
2710
2711    protected JFreeChartRenderer getCategoryRenderer(JFreeChart chart)
2712    {
2713        JFreeChartRenderer chartRenderer;
2714        JRFillCategoryDataset categoryDataset = (JRFillCategoryDataset) getDataset();
2715        if (categoryDataset.hasItemHyperlinks())
2716        {
2717            chartRenderer = new JRCategoryChartImageMapRenderer(chart, categoryDataset.getItemHyperlinks());
2718        }
2719        else
2720        {
2721            chartRenderer = new JFreeChartRenderer(chart);
2722        }
2723        return chartRenderer;
2724    }
2725
2726
2727    protected JFreeChartRenderer getPieRenderer(JFreeChart chart)
2728    {
2729        JFreeChartRenderer chartRenderer;
2730        JRFillPieDataset pieDataset = (JRFillPieDataset) getDataset();
2731        if (pieDataset.hasSectionHyperlinks())
2732        {
2733            chartRenderer = new JRPieChartImageMapRenderer(chart, pieDataset.getSectionHyperlinks());
2734        }
2735        else
2736        {
2737            chartRenderer = new JFreeChartRenderer(chart);
2738        }
2739        return chartRenderer;
2740    }
2741
2742
2743    protected JFreeChartRenderer getXYRenderer(JFreeChart chart)
2744    {
2745        JFreeChartRenderer chartRenderer;
2746        JRFillXyDataset xyDataset = (JRFillXyDataset) getDataset();
2747        if (xyDataset.hasItemHyperlinks())
2748        {
2749            chartRenderer = new JRXYChartImageMapRenderer(chart, xyDataset.getItemHyperlinks());
2750        }
2751        else
2752        {
2753            chartRenderer = new JFreeChartRenderer(chart);
2754        }
2755        return chartRenderer;
2756    }
2757
2758    
2759    protected JFreeChartRenderer getXYBarRenderer(JFreeChart chart)
2760    {
2761        JFreeChartRenderer chartRenderer;
2762        if( getDataset().getDatasetType() == JRChartDataset.TIMESERIES_DATASET ) {
2763            chartRenderer = getTimeSeriesRenderer(chart);
2764        }
2765        else if( getDataset().getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET ){
2766            chartRenderer = getTimePeriodRenderer(chart);
2767        }
2768        else if( getDataset().getDatasetType() == JRChartDataset.XY_DATASET ) {
2769            chartRenderer = getXYRenderer(chart);
2770        } else {
2771            chartRenderer = new JFreeChartRenderer(chart);
2772        }
2773        return chartRenderer;
2774    }
2775
2776    protected JFreeChartRenderer getXYZRenderer(JFreeChart chart)
2777    {
2778        JFreeChartRenderer chartRenderer;
2779        JRFillXyzDataset xyDataset = (JRFillXyzDataset) getDataset();
2780        if (xyDataset.hasItemHyperlinks())
2781        {
2782            chartRenderer = new JRXYChartImageMapRenderer(chart, xyDataset.getItemHyperlinks());
2783        }
2784        else
2785        {
2786            chartRenderer = new JFreeChartRenderer(chart);
2787        }
2788        return chartRenderer;
2789    }
2790
2791
2792    protected JFreeChartRenderer getHighLowRenderer(JFreeChart chart)
2793    {
2794        JFreeChartRenderer chartRenderer;
2795        JRFillHighLowDataset hlDataset = (JRFillHighLowDataset) getDataset();
2796        if (hlDataset.hasItemHyperlink())
2797        {
2798            chartRenderer = new JRHighLowChartImageMapRenderer(chart, hlDataset.getItemHyperlinks());
2799        }
2800        else
2801        {
2802            chartRenderer = new JFreeChartRenderer(chart);
2803        }
2804        return chartRenderer;
2805    }
2806
2807
2808    protected JFreeChartRenderer getTimeSeriesRenderer(JFreeChart chart)
2809    {
2810        JFreeChartRenderer chartRenderer;
2811        JRFillTimeSeriesDataset tsDataset = (JRFillTimeSeriesDataset) getDataset();
2812        if (tsDataset.hasItemHyperlinks())
2813        {
2814            chartRenderer = new JRTimeSeriesChartImageMapRenderer(chart, tsDataset.getItemHyperlinks());
2815        }
2816        else
2817        {
2818            chartRenderer = new JFreeChartRenderer(chart);
2819        }
2820        return chartRenderer;
2821    }
2822
2823
2824    protected JFreeChartRenderer getTimePeriodRenderer(JFreeChart chart)
2825    {
2826        JFreeChartRenderer chartRenderer;
2827        JRFillTimePeriodDataset tpDataset = (JRFillTimePeriodDataset) getDataset();
2828        if (tpDataset.hasItemHyperlinks())
2829        {
2830            chartRenderer = new JRTimePeriodChartImageMapRenderer(chart, tpDataset.getItemHyperlinks());
2831        }
2832        else
2833        {
2834            chartRenderer = new JFreeChartRenderer(chart);
2835        }
2836        return chartRenderer;
2837    }
2838}
2839
Popular Tags