KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > chart > ChartComponent


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  */

11 package com.tonbeller.jpivot.chart;
12
13 import java.awt.Color JavaDoc;
14 import java.io.ByteArrayInputStream JavaDoc;
15 import java.io.InputStream JavaDoc;
16 import java.io.StringWriter JavaDoc;
17 import java.io.Writer JavaDoc;
18 import java.text.DecimalFormat JavaDoc;
19 import java.text.DecimalFormatSymbols JavaDoc;
20 import java.util.HashMap JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Locale JavaDoc;
24
25 import javax.servlet.http.HttpSession JavaDoc;
26 import javax.xml.parsers.DocumentBuilder JavaDoc;
27
28 import org.apache.log4j.Logger;
29 import org.jfree.chart.ChartRenderingInfo;
30 import org.jfree.chart.JFreeChart;
31 import org.jfree.chart.axis.CategoryLabelPosition;
32 import org.jfree.chart.axis.CategoryLabelPositions;
33 import org.jfree.chart.axis.CategoryLabelWidthType;
34 import org.jfree.chart.entity.ChartEntity;
35 import org.jfree.chart.entity.EntityCollection;
36 import org.jfree.chart.entity.StandardEntityCollection;
37 import org.jfree.chart.plot.CategoryPlot;
38 import org.jfree.chart.plot.PiePlot;
39 import org.jfree.chart.plot.PiePlot3D;
40 import org.jfree.chart.plot.Plot;
41 import org.jfree.chart.plot.PlotOrientation;
42 import org.jfree.chart.servlet.ServletUtilities;
43 import org.jfree.chart.title.LegendTitle;
44 import org.jfree.chart.title.TextTitle;
45 import org.jfree.chart.title.Title;
46 import org.jfree.chart.urls.CategoryURLGenerator;
47 import org.jfree.chart.urls.StandardCategoryURLGenerator;
48 import org.jfree.chart.urls.StandardPieURLGenerator;
49 import org.jfree.data.category.CategoryDataset;
50 import org.jfree.data.category.DefaultCategoryDataset;
51 import org.jfree.data.general.PieDataset;
52 import org.jfree.text.TextBlockAnchor;
53 import org.jfree.ui.HorizontalAlignment;
54 import org.jfree.ui.RectangleAnchor;
55 import org.jfree.ui.RectangleEdge;
56 import org.jfree.ui.RectangleInsets;
57 import org.jfree.ui.TextAnchor;
58 import org.jfree.ui.VerticalAlignment;
59 import org.jfree.util.TableOrder;
60 import org.w3c.dom.Document JavaDoc;
61 import org.w3c.dom.Element JavaDoc;
62
63 import com.tonbeller.jpivot.core.ModelChangeEvent;
64 import com.tonbeller.jpivot.core.ModelChangeListener;
65 import com.tonbeller.jpivot.olap.model.Cell;
66 import com.tonbeller.jpivot.olap.model.Member;
67 import com.tonbeller.jpivot.olap.model.OlapModel;
68 import com.tonbeller.jpivot.olap.model.Position;
69 import com.tonbeller.jpivot.olap.model.Result;
70 import com.tonbeller.jpivot.olap.navi.DrillThrough;
71 import com.tonbeller.jpivot.olap.navi.MemberTree;
72 import com.tonbeller.wcf.component.Component;
73 import com.tonbeller.wcf.component.ComponentSupport;
74 import com.tonbeller.wcf.controller.Dispatcher;
75 import com.tonbeller.wcf.controller.DispatcherSupport;
76 import com.tonbeller.wcf.controller.RequestContext;
77 import com.tonbeller.wcf.controller.RequestListener;
78 import com.tonbeller.wcf.table.ITableComponent;
79 import com.tonbeller.wcf.table.TableModel;
80 import com.tonbeller.wcf.utils.DomUtils;
81 import com.tonbeller.wcf.utils.XmlUtils;
82
83 /**
84  * Contains a reference to an OlapModel.
85  * Produces a chart image.
86  *
87  */

88 public class ChartComponent extends ComponentSupport implements ModelChangeListener {
89     private static Logger logger = Logger.getLogger(ChartComponent.class);
90
91     String JavaDoc ref;
92     Document JavaDoc document;
93     OlapModel olapModel;
94     boolean dirty = true;
95     Locale JavaDoc locale;
96
97     Result result;
98     Iterator JavaDoc cellIterator;
99     int dimCount;
100     Element JavaDoc rootElement;
101     int colCount;
102
103     // servlet mapping - optionally can be set as a servlet context parameter
104
// with name "chartServlet"
105
// for example:
106
/*
107     <context-param>
108       <param-name>chartServlet</param-name>
109       <param-value>/path/to/chartServlet</param-value>
110     </context-param>
111     */

112     String JavaDoc CHART_SERVLET = "/DisplayChart";
113     final String JavaDoc CHART_SERVLET_KEY = "chartServlet";
114     boolean baseDisplayURLSet = false;
115     String JavaDoc webControllerURL = "";
116
117     String JavaDoc filename = null;
118     // chart properties
119
final int DEFAULT_CHART_WIDTH = 500;
120     final int DEFAULT_CHART_HEIGHT = 300;
121     String JavaDoc chartTitle = "";
122     java.awt.Font JavaDoc titleFont = JFreeChart.DEFAULT_TITLE_FONT;
123     String JavaDoc fontName = "SansSerif";
124     int fontStyle = java.awt.Font.BOLD;
125     int fontSize = 18;
126     String JavaDoc slicerFontName = "SansSerif";
127     int slicerFontStyle = java.awt.Font.PLAIN;
128     int slicerFontSize = 12;
129     String JavaDoc axisFontName = "SansSerif";
130     int axisFontStyle = java.awt.Font.PLAIN;
131     int axisFontSize = 12;
132     String JavaDoc axisTickFontName = "SansSerif";
133     int axisTickFontStyle = java.awt.Font.PLAIN;
134     int axisTickFontSize = 12;
135     String JavaDoc legendFontName = "SansSerif";
136     int legendFontStyle = java.awt.Font.PLAIN;
137     int legendFontSize = 10;
138     int legendPosition = 3; //RectangleEdge.BOTTOM;
139
int slicerPosition = 1; // BOTTOM - see chartpropertiesform.xsl
140
int slicerAlignment = 3; // LEFT
141
//java.awt.Color bgColor = java.awt.Color.white;
142
int bgColorR = 255;
143     int bgColorG = 255;
144     int bgColorB = 255;
145     int chartType = 1;
146     int chartHeight = DEFAULT_CHART_HEIGHT;
147     int chartWidth = DEFAULT_CHART_WIDTH;
148     String JavaDoc horizAxisLabel = "";
149     String JavaDoc vertAxisLabel = "";
150     boolean showLegend = true;
151     boolean showSlicer = true;
152     boolean showTooltips = true;
153     boolean drillThroughEnabled = false;
154         int tickLabelRotate = 30; //default 30 degree rotation
155

156     ChartRenderingInfo info = null;
157
158     Dispatcher dispatcher = new DispatcherSupport();
159
160     /**
161      * Constructor
162      * @param id the id of this component
163      * @param parent parent component
164      * @param ref a reference to an olap model
165      * @param baseDisplayURL URL for chart servlet. Overrides default
166      * @param controllerURL URL for web application where JPivot/WCF is running. Overrides default
167      * @param context RequestContext
168      */

169     public ChartComponent(String JavaDoc id, Component parent, String JavaDoc ref, String JavaDoc baseDisplayURL, String JavaDoc controllerURL, RequestContext context) {
170         super(id, parent);
171         this.ref = ref;
172
173         this.olapModel = (OlapModel) context.getModelReference(ref);
174         this.olapModel.addModelChangeListener(this);
175         this.locale = context.getLocale();
176         // extend the controller
177
getDispatcher().addRequestListener(null, null, dispatcher);
178         // optional servlet context parameter for chart servlet location
179
String JavaDoc chartServlet = baseDisplayURL;
180         if ( chartServlet == null ) {
181             chartServlet = context.getServletContext().getInitParameter(CHART_SERVLET_KEY);
182         } else {
183             baseDisplayURLSet = true;
184         }
185         if ( chartServlet != null ) {
186             this.CHART_SERVLET = chartServlet;
187         }
188         if (controllerURL != null) {
189             this.webControllerURL = controllerURL;
190         }
191     }
192
193     public ChartComponent(String JavaDoc id, Component parent, String JavaDoc ref, RequestContext context) {
194         this(id, parent, ref, null, null, context);
195     }
196
197     /**
198      * called once by the creating tag
199      */

200     public void initialize(RequestContext context) throws Exception JavaDoc {
201         super.initialize(context);
202     }
203
204     /**
205      * Entry point for producing charts, called by wcf render tag.
206      * Produces a jfreechart dataset from olap model, then creates a chart and
207      * writes it to the servlet container temp directory.
208      * Returns a DOM document for Renderer to transform into html.
209      * Requires that jfreechart servlet is installed in this application context.
210      */

211     public Document JavaDoc render(RequestContext context) throws Exception JavaDoc {
212         // check if we need to produce a new chart
213
if (dirty) {
214             // clear old listeners
215
dispatcher.clear();
216             this.result = olapModel.getResult();
217             this.cellIterator = result.getCells().iterator();
218             this.dimCount = result.getAxes().length;
219             DefaultCategoryDataset dataset = null;
220                         switch (dimCount) {
221               case 1 :
222                 logger.info("1-dim data");
223                 dataset = build1dimDataset();
224                 break;
225               case 2 :
226                 logger.info("2-dim data");
227                 dataset = build2dimDataset();
228                 break;
229               default :
230                 logger.error("less than 1 or more than 2 dimensions");
231                 throw new IllegalArgumentException JavaDoc("ChartRenderer requires a 1 or 2 dimensional result");
232             }
233             // re-set dirty flag
234
dirty = false;
235
236             // create font
237
titleFont = new java.awt.Font JavaDoc(fontName, fontStyle, fontSize);
238
239             CategoryURLGenerator urlGenerator = new jpivotCategoryURLGenerator(webControllerURL);
240
241             // Create the chart object
242
JFreeChart chart=null;
243             switch (chartType) {
244                 case 1 :
245                     chart = ChartFactory.createBarChart(
246                         chartTitle,
247                         titleFont,
248                         horizAxisLabel,
249                         vertAxisLabel,
250                         dataset,
251                         PlotOrientation.VERTICAL,
252                         showLegend,
253                         showTooltips,
254                         drillThroughEnabled,
255                         urlGenerator
256                         );
257                     break;
258                 case 2 :
259                     chart = ChartFactory.createBarChart3D(
260                         chartTitle,
261                         titleFont,
262                         horizAxisLabel,
263                         vertAxisLabel,
264                         dataset,
265                         PlotOrientation.VERTICAL,
266                         showLegend,
267                         showTooltips,
268                         drillThroughEnabled,
269                         urlGenerator
270                         );
271                     break;
272                 case 3 :
273                     chart = ChartFactory.createBarChart(
274                         chartTitle,
275                         titleFont,
276                         horizAxisLabel,
277                         vertAxisLabel,
278                         dataset,
279                         PlotOrientation.HORIZONTAL,
280                         showLegend,
281                         showTooltips,
282                         drillThroughEnabled,
283                         urlGenerator
284                         );
285                     break;
286                 case 4 :
287                     chart = ChartFactory.createBarChart3D(
288                         chartTitle,
289                         titleFont,
290                         horizAxisLabel,
291                         vertAxisLabel,
292                         dataset,
293                         PlotOrientation.HORIZONTAL,
294                         showLegend,
295                         showTooltips,
296                         drillThroughEnabled,
297                         urlGenerator
298                         );
299                     break;
300                 case 5 :
301                     chart = ChartFactory.createStackedBarChart(
302                         chartTitle,
303                         titleFont,
304                         horizAxisLabel,
305                         vertAxisLabel,
306                         dataset,
307                         PlotOrientation.VERTICAL,
308                         showLegend,
309                         showTooltips,
310                         drillThroughEnabled,
311                         urlGenerator
312                         );
313                     break;
314                 case 6 :
315                     chart = ChartFactory.createStackedBarChart3D(
316                         chartTitle,
317                         titleFont,
318                         horizAxisLabel,
319                         vertAxisLabel,
320                         dataset,
321                         PlotOrientation.VERTICAL,
322                         showLegend,
323                         showTooltips,
324                         drillThroughEnabled,
325                         urlGenerator
326                         );
327                     break;
328                 case 7 :
329                     chart = ChartFactory.createStackedBarChart(
330                         chartTitle,
331                         titleFont,
332                         horizAxisLabel,
333                         vertAxisLabel,
334                         dataset,
335                         PlotOrientation.HORIZONTAL,
336                         showLegend,
337                         showTooltips,
338                         drillThroughEnabled,
339                         urlGenerator
340                         );
341                     break;
342                 case 8 :
343                     chart = ChartFactory.createStackedBarChart3D(
344                         chartTitle,
345                         titleFont,
346                         horizAxisLabel,
347                         vertAxisLabel,
348                         dataset,
349                         PlotOrientation.HORIZONTAL,
350                         showLegend,
351                         showTooltips,
352                         drillThroughEnabled,
353                         urlGenerator
354                         );
355                     break;
356                 case 9 :
357                     chart = ChartFactory.createLineChart(
358                         chartTitle,
359                         titleFont,
360                         horizAxisLabel,
361                         vertAxisLabel,
362                         dataset,
363                         PlotOrientation.VERTICAL,
364                         showLegend,
365                         showTooltips,
366                         drillThroughEnabled,
367                         urlGenerator
368                         );
369                     break;
370                 case 10 :
371                     chart = ChartFactory.createLineChart(
372                         chartTitle,
373                         titleFont,
374                         horizAxisLabel,
375                         vertAxisLabel,
376                         dataset,
377                         PlotOrientation.HORIZONTAL,
378                         showLegend,
379                         showTooltips,
380                         drillThroughEnabled,
381                         urlGenerator
382                         );
383                     break;
384                 case 11 :
385                     chart = ChartFactory.createAreaChart(
386                         chartTitle,
387                         titleFont,
388                         horizAxisLabel,
389                         vertAxisLabel,
390                         dataset,
391                         PlotOrientation.VERTICAL,
392                         showLegend,
393                         showTooltips,
394                         drillThroughEnabled,
395                         urlGenerator
396                         );
397                     break;
398                 case 12 :
399                     chart = ChartFactory.createAreaChart(
400                         chartTitle,
401                         titleFont,
402                         horizAxisLabel,
403                         vertAxisLabel,
404                         dataset,
405                         PlotOrientation.HORIZONTAL,
406                         showLegend,
407                         showTooltips,
408                         drillThroughEnabled,
409                         urlGenerator
410                         );
411                     break;
412
413                 case 13 :
414                     chart = ChartFactory.createStackedAreaChart(
415                         chartTitle,
416                         titleFont,
417                         horizAxisLabel,
418                         vertAxisLabel,
419                         dataset,
420                         PlotOrientation.VERTICAL,
421                         showLegend,
422                         showTooltips,
423                         drillThroughEnabled,
424                         urlGenerator
425                         );
426                     break;
427                 case 14 :
428                     chart = ChartFactory.createStackedAreaChart(
429                         chartTitle,
430                         titleFont,
431                         horizAxisLabel,
432                         vertAxisLabel,
433                         dataset,
434                         PlotOrientation.HORIZONTAL,
435                         showLegend,
436                         showTooltips,
437                         drillThroughEnabled,
438                         urlGenerator
439                         );
440                     break;
441
442                 case 15 :
443                     chart = ChartFactory.createPieChart(
444                         chartTitle,
445                         titleFont,
446                         dataset,
447                         TableOrder.BY_COLUMN,
448                         showLegend,
449                         showTooltips,
450                                                 drillThroughEnabled,
451                                                 new jpivotPieURLGenerator(TableOrder.BY_COLUMN,dataset, webControllerURL)
452                         );
453                     break;
454                 case 16 :
455                     chart = ChartFactory.createPieChart(
456                         chartTitle,
457                         titleFont,
458                         dataset,
459                         TableOrder.BY_ROW,
460                         showLegend,
461                         showTooltips,
462                                                 drillThroughEnabled,
463                                                 new jpivotPieURLGenerator(TableOrder.BY_ROW,dataset, webControllerURL)
464                         );
465                     break;
466                                 case 17 :
467                     chart = ChartFactory.create3DPieChart(
468                         chartTitle,
469                         titleFont,
470                         dataset,
471                         TableOrder.BY_COLUMN,
472                         showLegend,
473                         showTooltips,
474                                                 drillThroughEnabled,
475                                                 new jpivotPieURLGenerator(TableOrder.BY_COLUMN,dataset, webControllerURL)
476                         );
477
478                     break;
479                 case 18 :
480                     chart = ChartFactory.create3DPieChart(
481                         chartTitle,
482                         titleFont,
483                         dataset,
484                         TableOrder.BY_ROW,
485                         showLegend,
486                         showTooltips,
487                                                 drillThroughEnabled,
488                                                 new jpivotPieURLGenerator(TableOrder.BY_ROW,dataset, webControllerURL)
489                         );
490
491                     break;
492
493                 default :
494                     throw new Exception JavaDoc("An unknown Chart Type was requested");
495             }
496             try {
497                 chart.setBackgroundPaint(new java.awt.Color JavaDoc(bgColorR, bgColorG, bgColorB));
498
499                 java.awt.Font JavaDoc slicerFont = new java.awt.Font JavaDoc(slicerFontName, slicerFontStyle, slicerFontSize);
500                 java.awt.Font JavaDoc axisFont = new java.awt.Font JavaDoc(axisFontName, axisFontStyle, axisFontSize);
501                 java.awt.Font JavaDoc axisTickFont = new java.awt.Font JavaDoc(axisTickFontName, axisTickFontStyle, axisTickFontSize);
502                 java.awt.Font JavaDoc legendFont = new java.awt.Font JavaDoc(legendFontName, legendFontStyle, legendFontSize);
503                 Plot plot = chart.getPlot();
504
505                 if ( plot instanceof CategoryPlot ) {
506                     CategoryPlot catPlot = (CategoryPlot) plot;
507                     catPlot.getDomainAxis().setLabelFont(axisFont);
508                     catPlot.getRangeAxis().setLabelFont(axisFont);
509                     catPlot.getDomainAxis().setTickLabelFont(axisTickFont);
510                     catPlot.getRangeAxis().setTickLabelFont(axisTickFont);
511                     catPlot.getDomainAxis().setMaximumCategoryLabelWidthRatio(100.0f);
512                     double angle = -2.0 * Math.PI / 360.0 * (double) tickLabelRotate;
513                     CategoryLabelPositions oldp = catPlot.getDomainAxis().getCategoryLabelPositions();
514                     CategoryLabelPositions newp = new CategoryLabelPositions(
515                         oldp.getLabelPosition(RectangleEdge.TOP),
516                         new CategoryLabelPosition(
517                               RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT,
518                               TextAnchor.TOP_RIGHT, angle,
519                               CategoryLabelWidthType.RANGE, 0.0f),
520                         oldp.getLabelPosition(RectangleEdge.LEFT),
521                         oldp.getLabelPosition(RectangleEdge.RIGHT)
522                     );
523                     catPlot.getDomainAxis().setCategoryLabelPositions(newp);
524                 }
525                                 else if ( plot instanceof PiePlot3D ) {
526                                     PiePlot3D piePlot = (PiePlot3D) plot;
527                                     //piePlot.setSectionLabelFont(axisFont);
528
piePlot.setLabelFont(axisFont);
529                                     //piePlot.setSeriesLabelFont(axisTickFont);
530
//piePlot.setSectionLabelType(piePlot.NO_LABELS);
531
piePlot.setDirection(org.jfree.util.Rotation.CLOCKWISE);
532                                     piePlot.setForegroundAlpha(0.5f);
533                                     piePlot.setNoDataMessage("No data to display");
534                                 }
535                 else if ( plot instanceof PiePlot ) {
536                     PiePlot piePlot = (PiePlot) plot;
537                     //piePlot.setSectionLabelFont(axisFont);
538
//piePlot.setSeriesLabelFont(axisTickFont);
539
piePlot.setLabelFont(axisFont);
540                                         //piePlot.setSectionLabelType(piePlot.NO_LABELS);
541

542                 }
543                 LegendTitle legend = (LegendTitle) chart.getLegend();
544                 if ( legend != null ) {
545                     legend.setItemFont(legendFont);
546                     /*
547                     RectangleAnchor legendRectAnchor=RectangleAnchor.BOTTOM;
548
549                         switch (legendPosition){
550                              case 0:
551                                  legendRectAnchor = RectangleAnchor.LEFT;
552                                 break;
553                             case 1:
554                                 legendRectAnchor = RectangleAnchor.TOP;
555                                 break;
556                             case 2:
557                                 legendRectAnchor = RectangleAnchor.RIGHT;
558                                 break;
559                             case 3:
560                                 legendRectAnchor = RectangleAnchor.BOTTOM;
561                                 break;
562                         }
563                     legend.setLegendItemGraphicAnchor(legendRectAnchor);
564                     */

565                     RectangleEdge legendRectEdge=RectangleEdge.BOTTOM;
566                     switch (legendPosition){
567                         case 0:
568                             legendRectEdge = RectangleEdge.LEFT;
569                             break;
570                         case 1:
571                             legendRectEdge = RectangleEdge.TOP;
572                             break;
573                         case 2:
574                             legendRectEdge = RectangleEdge.RIGHT;
575                             break;
576                         case 3:
577                             legendRectEdge = RectangleEdge.BOTTOM;
578                             break;
579                     }
580                     legend.setPosition(legendRectEdge);
581                 }
582                 if ( showSlicer ) {
583                                     RectangleEdge slicerRectPos=RectangleEdge.BOTTOM;
584                                     HorizontalAlignment slicerHorizAlignment=HorizontalAlignment.LEFT;
585
586                                         switch (slicerPosition){
587                                              case 0:
588                                                 slicerRectPos = RectangleEdge.TOP;
589                                                 break;
590                                             case 1:
591                                                 slicerRectPos = RectangleEdge.BOTTOM;
592                                                 break;
593                                             case 2:
594                                                 slicerRectPos = RectangleEdge.RIGHT;
595                                                 break;
596                                             case 3:
597                                                 slicerRectPos = RectangleEdge.LEFT;
598                                                 break;
599                                         }
600
601                                      switch (slicerAlignment){
602                                             case 4:
603                                                 slicerHorizAlignment = HorizontalAlignment.CENTER;
604                                                 break;
605                                             case 3:
606                                                 slicerHorizAlignment = HorizontalAlignment.LEFT;
607                                                 break;
608                                             case 2:
609                                                 slicerHorizAlignment = HorizontalAlignment.RIGHT;
610                                                 break;
611                                      }
612                     TextTitle slicer = new TextTitle(buildSlicer(),
613                                             slicerFont,
614                                             Color.BLACK,
615                                             slicerRectPos,
616                                             slicerHorizAlignment,
617                                             VerticalAlignment.CENTER,
618                                             new RectangleInsets(0,0,0,0));
619
620
621                     slicer.setPosition(slicerRectPos);
622                     chart.addSubtitle(slicer);
623                                      }
624                 info = new ChartRenderingInfo(new StandardEntityCollection());
625                 // Write the chart image to the temporary directory
626
HttpSession JavaDoc session = context.getSession();
627                 filename = ServletUtilities.saveChartAsPNG(
628                         chart,
629                         chartWidth,
630                         chartHeight,
631                         info,
632                         session);
633
634             }
635             catch (Exception JavaDoc e) {
636                 filename = "public_error_500x300.png";
637                 dirty = true;
638             }
639         }
640         // new DOM document
641
DocumentBuilder JavaDoc parser = XmlUtils.getParser();
642         // get an image map for the chart, wrap it in xchart tags
643
String JavaDoc xchart = "<xchart>" + writeImageMap(filename, info, false) + "</xchart>";
644 /*
645         if (logger.isDebugEnabled()) {
646             logger.debug("Chart XML");
647             logger.debug(xchart);
648         }
649 */

650         // create an InputStream from the DOM document
651
InputStream JavaDoc stream =
652             new ByteArrayInputStream JavaDoc(xchart.getBytes("UTF-8"));
653
654         document = parser.parse(stream);
655         Element JavaDoc root = document.getDocumentElement();
656         // create url for img tag
657
String JavaDoc graphURL = getGraphURL(context);
658
659         Element JavaDoc img = document.createElement("img");
660         img.setAttribute("src", graphURL);
661         img.setAttribute("width", new Integer JavaDoc(chartWidth).toString());
662         img.setAttribute("height", new Integer JavaDoc(chartHeight).toString());
663         img.setAttribute("style", "border:0;");
664         img.setAttribute("usemap", "#"+filename);
665         root.appendChild(img);
666
667         return document;
668     }
669
670     public String JavaDoc getGraphURL(RequestContext context) {
671         String JavaDoc graphURL = "";
672         if (baseDisplayURLSet) {
673             graphURL = CHART_SERVLET;
674         } else {
675             graphURL = context.getRequest().getContextPath() + CHART_SERVLET;
676         }
677         graphURL = graphURL + (graphURL.indexOf('?') >= 0 ? "&" : "?") + "filename=" + getFilename();
678         return graphURL;
679     }
680
681     /**
682      * Writes an image map as a String
683      * This function has been requested to be added to jfreechart
684      * Also requires slight change to ChartEntity.getImageMapAreaTag()
685      * to produce valid xml tag and use &amp; entity in urls.
686      * Diffs sent to jfreechart project - so hopefully this will be in there soon
687      *
688      * @param name the map name.
689      * @param info the chart rendering info.
690      * @param useOverLibForToolTips whether to use OverLIB for tooltips
691      * (http://www.bosrup.com/web/overlib/).
692      */

693     public String JavaDoc writeImageMap(String JavaDoc name,
694                 ChartRenderingInfo info, boolean useOverLibForToolTips) {
695         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
696         sb.append("<map name=\"" + name + "\">");
697         EntityCollection entities = info.getEntityCollection();
698         Iterator JavaDoc iterator = entities.iterator();
699
700         while (iterator.hasNext()) {
701             ChartEntity entity = (ChartEntity) iterator.next();
702             // the tag returned by getImageMapAreaTag is not valid xml
703
//String area = entity.getImageMapAreaTag(useOverLibForToolTips);
704

705                         String JavaDoc area="";
706
707                         if (useOverLibForToolTips)
708                              area = entity.getImageMapAreaTag(new org.jfree.chart.imagemap.OverLIBToolTipTagFragmentGenerator(), new org.jfree.chart.imagemap.StandardURLTagFragmentGenerator());
709                         else
710                             area = entity.getImageMapAreaTag(new org.jfree.chart.imagemap.StandardToolTipTagFragmentGenerator(), new org.jfree.chart.imagemap.StandardURLTagFragmentGenerator());
711             // modify to valid xml tag
712
area = area.replaceAll("&", "&amp;");
713             //area = area.toLowerCase();
714
//area = area.replaceAll(">$", "/>");
715
if (area.length() > 0) {
716                 sb.append(area);
717             }
718         }
719         sb.append("</map>");
720         return sb.toString();
721     }
722
723     /**
724      * build slicer text string
725      */

726     private String JavaDoc buildSlicer() {
727         StringBuffer JavaDoc slicer = new StringBuffer JavaDoc();
728         slicer.append("Slicer: ");
729         Iterator JavaDoc pi = result.getSlicer().getPositions().iterator();
730         while (pi.hasNext()) {
731             Position p = (Position) pi.next();
732             Member[] members = p.getMembers();
733             for (int i = 0; i < members.length; i++) {
734                 slicer.append(members[i].getLevel().getLabel());
735                 slicer.append("=");
736                 slicer.append(members[i].getLabel());
737                 if ( i < members.length-1 ) {
738                     slicer.append(", ");
739                 }
740             }
741         }
742         return slicer.toString();
743     }
744
745     /**
746      * Build a jfreechart CategoryDataset with a single series
747      *
748      */

749     private DefaultCategoryDataset build1dimDataset() {
750         DefaultCategoryDataset dataset = new DefaultCategoryDataset();
751
752         // column axis
753
List JavaDoc columnPositions = result.getAxes()[0].getPositions();
754         colCount = columnPositions.size();
755         // cells
756
List JavaDoc cells = result.getCells();
757
758         String JavaDoc series = "Series";
759
760         // loop on column positions
761
for (int i = 0; i < colCount; i++) {
762             Member[] colMembers = ((Position) columnPositions.get(i)).getMembers();
763
764             StringBuffer JavaDoc key = new StringBuffer JavaDoc();
765             // loop on col position members
766
for (int j = 0; j < colMembers.length; j++) {
767                 // build up composite name for this row
768
key.append(colMembers[j].getLabel() + ".");
769             }
770             dataset.addValue(getNumberValue((Cell)cells.get(i)), series, key.toString());
771         }
772         return dataset;
773     }
774
775     /**
776      * Get cell value as a Number. Parses the cell value string
777      * using the locale set in this.locale.
778      * @param cell
779      * @return value as Number (can be null)
780      */

781     private Number JavaDoc getNumberValue(Cell cell) {
782             //**** HACK AR 2004.01.10
783
//String value = cell.getFormattedValue();
784
Object JavaDoc value = cell.getValue();
785
786         DecimalFormatSymbols JavaDoc dfs = new DecimalFormatSymbols JavaDoc(locale);
787         DecimalFormat JavaDoc formatter = new DecimalFormat JavaDoc();
788         formatter.setDecimalFormatSymbols(dfs);
789         Number JavaDoc number = null;
790         try {
791             number = (Number JavaDoc)value;
792                         //number = formatter.parse(value, new ParsePosition(0));
793
}
794         catch (Exception JavaDoc e) {
795             number = null;
796         }
797         return number;
798     }
799         /**
800      * Get a unique name string for a dataitem derived from the member chain
801      *
802      * @param myTree (full member tree)
803          * @param members - the list to be processed (either X/Y axis)
804      * @return retValue as String
805      */

806         private String JavaDoc buildName( MemberTree myTree, Member [] members){
807             String JavaDoc retValue = new String JavaDoc();
808             HashMap JavaDoc levelMap = new HashMap JavaDoc();
809             HashMap JavaDoc hierarchyMap = new HashMap JavaDoc();
810             for (int j=members.length-1;j>=0;j--){
811                 Member member = members[j];
812                 while (member!=null){
813                     // only process if no other items from this level processed - should not be duplicates!
814
if (!levelMap.containsValue(member.getLevel())){
815                         levelMap.put(member.getLevel().toString(),member.getLevel());
816                         if (member.getRootDistance()==0){
817                             // if root member, only add to name if no other members of the hierarchy are already added
818
if (!hierarchyMap.containsValue(member.getLevel().getHierarchy())
819                             || myTree.getRootMembers(member.getLevel().getHierarchy()).length>1){
820                                 hierarchyMap.put(member.getLevel().getHierarchy().toString(),member.getLevel().getHierarchy());
821                                 retValue=member.getLabel()+"."+retValue;
822                             }
823                         } else{
824                             hierarchyMap.put(member.getLevel().getHierarchy().toString(),member.getLevel().getHierarchy());
825                             retValue=member.getLabel()+"."+retValue;
826                         }
827                     }
828                     member = myTree.getParent(member);
829                 }
830             }
831             return retValue;
832         }
833     /**
834      * Build a jfreechart CategoryDataset with multiple series
835      *
836      */

837         private DefaultCategoryDataset build2dimDataset() {
838
839             DefaultCategoryDataset dataset = new DefaultCategoryDataset();
840
841             // column axis
842

843             List JavaDoc columnPositions = result.getAxes()[0].getPositions();//ladX.getPositions();
844
int colCount = columnPositions.size();
845
846             // row axis
847

848             List JavaDoc rowPositions = result.getAxes()[1].getPositions();//ladY.getPositions();
849
int rowCount = rowPositions.size();
850             List JavaDoc cells = result.getCells();
851
852             // get the full member tree
853
MemberTree myTree = ((MemberTree) olapModel.getExtension(MemberTree.ID));
854
855             // for each column, starting with the bottom member, progress up the mmeber chain until the root is reached
856
// keep track of the levels and hierarchies to avoid duplicates on level or hierarchys.
857
// *note: keeping track of the levels might be just extra work, I don't know if they CAN be repeated.
858
// if not, that logic can be easily removed (see buildName - above)
859
// For each hierarchy, If a root member is reached (getRootDistance()=0), then only include it if there have been no other
860
// lower level members already added:
861
// ie. All_dim1.dim1_lvl1.dim1_lvl2.All_dim2.dim2_lvl1 renders as dim1_lvl1.dim1_lvl2.dim2_lvl1
862
// whereas All_dim1.All_dim2 renders as the same.
863
// The important part is that we include each parent on the way up, to ensure a unique name to
864
// place in the map for the dataset (no longer overwriting each other)
865

866
867             for(int i=0;i<colCount;i++){
868                 Position p= (Position) columnPositions.get(i);
869                 Member colMembers[] =p.getMembers();
870
871                 // build the label name for this column
872
String JavaDoc label=buildName(myTree, colMembers);
873
874                 // For each row, use the same logic to build a unique key for each data item
875
for(int k=0;k<rowCount;k++){
876                     Position rp= (Position) rowPositions.get(k);
877                     Member rowMembers[] =rp.getMembers();
878
879                     // build key name
880
String JavaDoc key=buildName(myTree, rowMembers);
881
882                     Cell cell = (Cell) cells.get((k * colCount) + i);
883                     dataset.addValue(getNumberValue(cell), label.toString(), key.toString());
884                 }
885
886             }
887             return dataset;
888         }
889
890     /**
891      * @return
892      */

893     public int getColCount() {
894         return colCount;
895     }
896
897     /**
898      * true means that render() will create a new chart
899      */

900     public boolean isDirty() {
901       return dirty;
902     }
903
904     public void setDirty(boolean dirty) {
905       this.dirty = dirty;
906     }
907
908     public void modelChanged(ModelChangeEvent e) {
909       this.dirty = true;
910     }
911
912     public void structureChanged(ModelChangeEvent e) {
913       this.dirty = true;
914     }
915
916     /**
917      * @return
918      */

919     public int getChartHeight() {
920         return chartHeight;
921     }
922
923     /**
924      * @param chartHeight
925      */

926     public void setChartHeight(int chartHeight) {
927         this.chartHeight = chartHeight;
928         this.dirty = true;
929     }
930
931     /**
932      * @return
933      */

934     public String JavaDoc getChartTitle() {
935         return chartTitle;
936     }
937
938     /**
939      * @param chartTitle
940      */

941     public void setChartTitle(String JavaDoc chartTitle) {
942         this.chartTitle = chartTitle;
943         this.dirty = true;
944     }
945
946     /**
947      * @return
948      */

949     public int getChartType() {
950         return chartType;
951     }
952
953     /**
954      * @param chartType
955      */

956     public void setChartType(int chartType) {
957         this.chartType = chartType;
958         this.dirty = true;
959     }
960
961     /**
962      * @return
963      */

964     public int getChartWidth() {
965         return chartWidth;
966     }
967
968     /**
969      * @param chartWidth
970      */

971     public void setChartWidth(int chartWidth) {
972         this.chartWidth = chartWidth;
973         this.dirty = true;
974     }
975
976     /**
977      * @return
978      */

979     public String JavaDoc getHorizAxisLabel() {
980         return horizAxisLabel;
981     }
982
983     /**
984      * @param axisLabel
985      */

986     public void setHorizAxisLabel(String JavaDoc axisLabel) {
987         horizAxisLabel = axisLabel;
988         this.dirty = true;
989     }
990
991     /**
992      * @return
993      */

994     public boolean getShowLegend() {
995         return showLegend;
996     }
997
998     /**
999      * @param showLegend
1000     */

1001    public void setShowLegend(boolean showLegend) {
1002        this.showLegend = showLegend;
1003        this.dirty = true;
1004    }
1005
1006    /**
1007     * @return
1008     */

1009    public String JavaDoc getFontName() {
1010        return fontName;
1011    }
1012
1013    /**
1014     * @param titleFont
1015     */

1016    public void setFontName(String JavaDoc fontname) {
1017        this.fontName = fontname;
1018        this.dirty = true;
1019    }
1020
1021    /**
1022     * @return
1023     */

1024    public String JavaDoc getVertAxisLabel() {
1025        return vertAxisLabel;
1026    }
1027
1028    /**
1029     * @param axisLabel
1030     */

1031    public void setVertAxisLabel(String JavaDoc axisLabel) {
1032        vertAxisLabel = axisLabel;
1033        this.dirty = true;
1034    }
1035
1036    /**
1037     * @return
1038     */

1039    public int getFontSize() {
1040        return fontSize;
1041    }
1042
1043    /**
1044     * @param fontSize
1045     */

1046    public void setFontSize(int fontSize) {
1047        this.fontSize = fontSize;
1048        this.dirty = true;
1049    }
1050
1051    /**
1052     * @return
1053     */

1054    public int getFontStyle() {
1055        return fontStyle;
1056    }
1057
1058    /**
1059     * @param fontStyle
1060     */

1061    public void setFontStyle(int fontStyle) {
1062        this.fontStyle = fontStyle;
1063        this.dirty = true;
1064    }
1065
1066    /**
1067     * @return
1068     */

1069    public int getBgColorB() {
1070        return bgColorB;
1071    }
1072
1073    /**
1074     * @param bgColorB
1075     */

1076    public void setBgColorB(int bgColorB) {
1077        this.bgColorB = checkRGB(bgColorB);
1078        this.dirty = true;
1079    }
1080
1081    /**
1082     * @return
1083     */

1084    public int getBgColorG() {
1085        return bgColorG;
1086    }
1087
1088    /**
1089     * @param bgColorG
1090     */

1091    public void setBgColorG(int bgColorG) {
1092        this.bgColorG = checkRGB(bgColorG);
1093        this.dirty = true;
1094    }
1095
1096    /**
1097     * @return
1098     */

1099    public int getBgColorR() {
1100        return bgColorR;
1101    }
1102
1103    /**
1104     * @param bgColorR
1105     */

1106    public void setBgColorR(int bgColorR) {
1107        this.bgColorR = checkRGB(bgColorR);
1108        this.dirty = true;
1109    }
1110
1111    /**
1112     * Enforce limits of 0 - 255 for RGB values.
1113     */

1114    private int checkRGB(int v) {
1115        if ( v > 255 ) {
1116            v = 255;
1117        }
1118        else if ( v < 0 ) {
1119            v = 0;
1120        }
1121        return v;
1122    }
1123        /**
1124     * A URLGenerator class to generate pie urls that work with jpivot
1125     * @author ati
1126     *
1127     */

1128    public class jpivotPieURLGenerator extends StandardPieURLGenerator {
1129            /** Prefix to the URL */
1130        private String JavaDoc prefix = "";
1131
1132                private List JavaDoc cells = result.getCells();
1133
1134                private int rowCount;
1135
1136                private TableOrder order; // COLUMN or ROW - used to calculate cell Position
1137

1138                jpivotPieURLGenerator() {
1139        }
1140
1141        jpivotPieURLGenerator(String JavaDoc prefix) {
1142            this.prefix = prefix;
1143        }
1144                /*
1145                 * Use this constructor to set dataExtraction type (PER_COLUMN/PER_ROW), and allow for
1146                 * rowcount of current dataset (could be changed to just take rowCount)
1147                 */

1148                jpivotPieURLGenerator(TableOrder order, DefaultCategoryDataset dataset){
1149                        this.order= order;
1150                        this.rowCount=dataset.getRowCount();
1151                }
1152
1153                /*
1154                 * As above with web controller URL
1155                 */

1156                jpivotPieURLGenerator(TableOrder order, DefaultCategoryDataset dataset, String JavaDoc controllerURL){
1157                    this(order, dataset);
1158                    this.prefix = controllerURL;
1159                }
1160        /**
1161         * Implementation of generateURL that integrates with jpivot/wcf framework.
1162         * A request handler is added for each cell/item.
1163         * No test is done to see if a cell is drillable, since the url has to added (I think, like an all or nothing ?)
1164         * Generates a URL for a particular item within a series.
1165         *
1166         * @param data the dataset.
1167         * @param key the data item key.
1168         * @param pieIndex the index of the pie containing key (zero-based).
1169         *
1170         * @return the generated URL
1171         */

1172        public String JavaDoc generateURL(PieDataset data, Comparable JavaDoc key, int pieIndex) {
1173            String JavaDoc url = prefix;
1174                        int index = data.getIndex(key);
1175
1176                        int cellpos;
1177                        if (order == TableOrder.BY_COLUMN){
1178                            cellpos = (pieIndex*rowCount)+index;
1179                        } else {
1180                            cellpos = pieIndex+(rowCount*index);
1181                        }
1182
1183            if ( canDrillThrough((Cell) cells.get(cellpos)) && (!((Cell) cells.get(cellpos)).isNull()) ) {
1184                String JavaDoc id = DomUtils.randomId();
1185                dispatcher.addRequestListener(
1186                    id,
1187                    null,
1188                    new DrillThroughHandler((Cell) cells.get(cellpos)));
1189
1190                boolean firstParameter = url.indexOf("?") == -1;
1191                url += firstParameter ? "?" : "&";
1192                url += id;
1193                return url;
1194            }
1195            else {
1196                return null;
1197            }
1198        }
1199        }
1200
1201    /**
1202     * A URLGenerator class to generate chart urls that work with jpivot
1203     * @author robin
1204     *
1205     */

1206    public class jpivotCategoryURLGenerator extends StandardCategoryURLGenerator {
1207
1208        /** Prefix to the URL */
1209        private String JavaDoc prefix = "";
1210
1211        /** Series parameter name to go in each URL */
1212        private String JavaDoc seriesParameterName = "col";
1213
1214        /** Category parameter name to go in each URL */
1215        private String JavaDoc categoryParameterName = "row";
1216
1217        private List JavaDoc cells = result.getCells();
1218
1219        jpivotCategoryURLGenerator() {
1220        }
1221
1222        jpivotCategoryURLGenerator(String JavaDoc prefix) {
1223            this.prefix = prefix;
1224        }
1225        /**
1226         * Implementation of generateURL that integrates with jpivot/wcf framework.
1227         * A request handler is added for each cell/item.
1228         * No test is done to see if a cell is drillable, since the url has to added (I think, like an all or nothing ?)
1229         * Generates a URL for a particular item within a series.
1230         *
1231         * @param data the dataset.
1232         * @param series the series index (zero-based).
1233         * @param category the category index (zero-based).
1234         *
1235         * @return the generated URL
1236         */

1237        public String JavaDoc generateURL(CategoryDataset data, int series, int category) {
1238            String JavaDoc url = prefix;
1239            // convert col, row into ordinal
1240
// series is col, category is row
1241
// (reverese terminology to jfreechart, that way series on measures which is more logical)
1242
int cellpos = (category * colCount) + series;
1243            if ( canDrillThrough((Cell) cells.get(cellpos)) && (!((Cell) cells.get(cellpos)).isNull()) ) {
1244                String JavaDoc id = DomUtils.randomId();
1245                dispatcher.addRequestListener(
1246                    id,
1247                    null,
1248                    new DrillThroughHandler((Cell) cells.get(cellpos)));
1249
1250                boolean firstParameter = url.indexOf("?") == -1;
1251                url += firstParameter ? "?" : "&";
1252                url += id;
1253                return url;
1254            }
1255            else {
1256                return null;
1257            }
1258        }
1259    }
1260
1261    /**
1262     * request handler for chart drill through
1263     * does nothing if cell can't be drilled through (e.g. calculated measure)
1264     * @author robin
1265     *
1266     */

1267// class DrillThroughHandler implements RequestListener {
1268
// Cell cell;
1269
// DrillThroughHandler(Cell cell) {
1270
// this.cell = cell;
1271
// }
1272
// public void request(RequestContext context) throws Exception {
1273
//
1274
// if ( canDrillThrough(cell) ) {
1275
//
1276
// HttpSession session = context.getSession();
1277
// final String drillTableRef = olapModel.getID() + ".drillthroughtable";
1278
// com.tonbeller.wcf.table.TableComponent tc =
1279
// (com.tonbeller.wcf.table.TableComponent)
1280
// session.getAttribute(drillTableRef);
1281
// // get a new drill through table model
1282
// TableModel tm = drillThrough(cell);
1283
//
1284
// // need to create a new table model for each drill through request
1285
// // because table model creates an array of columns
1286
// tc = new com.tonbeller.wcf.table.TableComponent(drillTableRef, tm);
1287
// tc.initialize(context);
1288
// ((DefaultSelectionModel) tc.getSelectionModel()).setMode(SelectionModel.NO_SELECTION);
1289
// session.setAttribute(drillTableRef, tc);
1290
// tc.setVisible(true);
1291
// }
1292
// }
1293
// }
1294
class DrillThroughHandler implements RequestListener {
1295        Cell cell;
1296        DrillThroughHandler(Cell cell) {
1297            this.cell = cell;
1298        }
1299        public void request(RequestContext context) throws Exception JavaDoc {
1300
1301            if ( canDrillThrough(cell) ) {
1302
1303                HttpSession JavaDoc session = context.getSession();
1304                final String JavaDoc drillTableRef = olapModel.getID() + ".drillthroughtable";
1305                ITableComponent tc =
1306                  (ITableComponent) session.getAttribute(drillTableRef);
1307                // get a new drill through table model
1308
TableModel tm = drillThrough(cell);
1309                tc.setModel(tm);
1310                tc.setVisible(true);
1311            }
1312        }
1313    }
1314
1315    protected boolean canDrillThrough(Cell cell) {
1316        return ((DrillThrough) olapModel.getExtension(DrillThrough.ID)).canDrillThrough((Cell) cell.getRootDecoree());
1317    }
1318
1319    /**
1320     * returns a DrillThroughTableModel for the drill through
1321     * @param cell
1322     * @return
1323     */

1324    protected TableModel drillThrough(Cell cell) {
1325        return ((DrillThrough) olapModel.getExtension(DrillThrough.ID)).drillThrough((Cell) cell.getRootDecoree());
1326    }
1327
1328    public boolean isDrillThroughEnabled() {
1329        return drillThroughEnabled;
1330    }
1331
1332    public void setDrillThroughEnabled(boolean drillThroughEnabled) {
1333        this.drillThroughEnabled = drillThroughEnabled;
1334    }
1335
1336    /**
1337     * @return
1338     */

1339    public String JavaDoc getAxisFontName() {
1340        return axisFontName;
1341    }
1342
1343    /**
1344     * @param axisFontName
1345     */

1346    public void setAxisFontName(String JavaDoc axisFontName) {
1347        this.axisFontName = axisFontName;
1348    }
1349
1350    /**
1351     * @return
1352     */

1353    public int getAxisFontSize() {
1354        return axisFontSize;
1355    }
1356
1357    /**
1358     * @param axisFontSize
1359     */

1360    public void setAxisFontSize(int axisFontSize) {
1361        this.axisFontSize = axisFontSize;
1362    }
1363
1364    /**
1365     * @return
1366     */

1367    public int getAxisFontStyle() {
1368        return axisFontStyle;
1369    }
1370
1371    /**
1372     * @param axisFontStyle
1373     */

1374    public void setAxisFontStyle(int axisFontStyle) {
1375        this.axisFontStyle = axisFontStyle;
1376    }
1377
1378    /**
1379     * @return
1380     */

1381    public String JavaDoc getLegendFontName() {
1382        return legendFontName;
1383    }
1384
1385    /**
1386     * @param legendFontName
1387     */

1388    public void setLegendFontName(String JavaDoc legendFontName) {
1389        this.legendFontName = legendFontName;
1390    }
1391
1392    /**
1393     * @return
1394     */

1395    public int getLegendFontSize() {
1396        return legendFontSize;
1397    }
1398
1399    /**
1400     * @param legendFontSize
1401     */

1402    public void setLegendFontSize(int legendFontSize) {
1403        this.legendFontSize = legendFontSize;
1404    }
1405
1406    /**
1407     * @return
1408     */

1409    public int getLegendFontStyle() {
1410        return legendFontStyle;
1411    }
1412
1413    /**
1414     * @param legendFontStyle
1415     */

1416    public void setLegendFontStyle(int legendFontStyle) {
1417        this.legendFontStyle = legendFontStyle;
1418    }
1419
1420    /**
1421     * @return
1422     */

1423    public int getSlicerAlignment() {
1424        return slicerAlignment;
1425    }
1426
1427    /**
1428     * @param slicerAlignment
1429     */

1430    public void setSlicerAlignment(int slicerAlignment) {
1431        this.slicerAlignment = slicerAlignment;
1432    }
1433
1434    /**
1435     * @return
1436     */

1437    public String JavaDoc getSlicerFontName() {
1438        return slicerFontName;
1439    }
1440
1441    /**
1442     * @param slicerFontName
1443     */

1444    public void setSlicerFontName(String JavaDoc slicerFontName) {
1445        this.slicerFontName = slicerFontName;
1446    }
1447
1448    /**
1449     * @return
1450     */

1451    public int getSlicerFontSize() {
1452        return slicerFontSize;
1453    }
1454
1455    /**
1456     * @param slicerFontSize
1457     */

1458    public void setSlicerFontSize(int slicerFontSize) {
1459        this.slicerFontSize = slicerFontSize;
1460    }
1461
1462    /**
1463     * @return
1464     */

1465    public int getSlicerFontStyle() {
1466        return slicerFontStyle;
1467    }
1468
1469    /**
1470     * @param slicerFontStyle
1471     */

1472    public void setSlicerFontStyle(int slicerFontStyle) {
1473        this.slicerFontStyle = slicerFontStyle;
1474    }
1475
1476    /**
1477     * @return
1478     */

1479    public int getSlicerPosition() {
1480        return slicerPosition;
1481    }
1482
1483    /**
1484     * @param slicerPosition
1485     */

1486    public void setSlicerPosition(int slicerPosition) {
1487        this.slicerPosition = slicerPosition;
1488    }
1489
1490    /**
1491     * @return
1492     */

1493    public int getLegendPosition() {
1494        return legendPosition;
1495    }
1496
1497    /**
1498     * @param legendPosition
1499     */

1500    public void setLegendPosition(int legendPosition) {
1501        this.legendPosition = legendPosition;
1502    }
1503
1504    /**
1505     * @return
1506     */

1507    public String JavaDoc getAxisTickFontName() {
1508        return axisTickFontName;
1509    }
1510
1511    /**
1512     * @param axisTickFontName
1513     */

1514    public void setAxisTickFontName(String JavaDoc axisTickFontName) {
1515        this.axisTickFontName = axisTickFontName;
1516    }
1517
1518    /**
1519     * @return
1520     */

1521    public int getAxisTickFontSize() {
1522        return axisTickFontSize;
1523    }
1524
1525    /**
1526     * @param axisTickFontSize
1527     */

1528    public void setAxisTickFontSize(int axisTickFontSize) {
1529        this.axisTickFontSize = axisTickFontSize;
1530    }
1531
1532    /**
1533     * @return
1534     */

1535    public int getAxisTickFontStyle() {
1536        return axisTickFontStyle;
1537    }
1538
1539    /**
1540     * @param axisTickFontStyle
1541     */

1542    public void setAxisTickFontStyle(int axisTickFontStyle) {
1543        this.axisTickFontStyle = axisTickFontStyle;
1544    }
1545      /**
1546       * @return Returns the tickLabelRotate.
1547       */

1548      public int getTickLabelRotate() {
1549        return tickLabelRotate;
1550      }
1551      /**
1552       * @param tickLabelRotate The tickLabelRotate to set.
1553       */

1554      public void setTickLabelRotate(int tickLabelRotate) {
1555        this.tickLabelRotate = tickLabelRotate;
1556      }
1557    /**
1558     * @return
1559     */

1560    public boolean isShowSlicer() {
1561        return showSlicer;
1562    }
1563
1564    /**
1565     * @param showSlicer
1566     */

1567    public void setShowSlicer(boolean showSlicer) {
1568        this.showSlicer = showSlicer;
1569    }
1570
1571        /**
1572     * @return
1573     */

1574    public String JavaDoc getFilename() {
1575        return filename;
1576    }
1577}
1578
Popular Tags