KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > charts > design > JRDesignMultiAxisPlot


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.charts.design;
29
30 import net.sf.jasperreports.charts.JRChartAxis;
31 import net.sf.jasperreports.charts.base.JRBaseMultiAxisPlot;
32 import net.sf.jasperreports.engine.JRChartPlot;
33 import net.sf.jasperreports.engine.JRConstants;
34 import net.sf.jasperreports.engine.design.JRDesignChart;
35
36 /**
37  * Contains information on how a multiple axis chart should be
38  * displayed. This information overrides the display information
39  * for all the charts sharing the single domain axis in the multiple
40  * axis chart.
41  *
42  * @author Barry Klawans (bklawans@users.sourceforge.net)
43  * @version $Id: JRDesignMultiAxisPlot.java 1400 2006-09-21 10:45:46 +0300 (Thu, 21 Sep 2006) lucianc $
44  */

45 public class JRDesignMultiAxisPlot extends JRBaseMultiAxisPlot
46 {
47     private JRDesignChart chart = null;
48     /**
49      *
50      */

51     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
52
53     
54     /**
55      * Constructs a new plot by copying an existing one.
56      *
57      * @param multiAxisPlot the plot to copy
58      */

59     public JRDesignMultiAxisPlot(JRChartPlot multiAxisPlot)
60     {
61         super(multiAxisPlot);
62     }
63     
64     /**
65      * Adds an axis to the plot. The axis contains the complete information on
66      * the data and rendering to use as well as where to draw the axis.
67      *
68      * @param axis the axis to add to the plot
69      */

70     public void addAxis(JRChartAxis axis)
71     {
72         axes.add(axis);
73         if (axes.size() == 1)
74         {
75             chart.setDataset(axis.getChart().getDataset());
76         }
77     }
78     
79     /**
80      * Removes all the axes from the plot.
81      */

82     public void clearAxes()
83     {
84         axes.clear();
85         chart.setDataset(null);
86     }
87     
88     /**
89      * Returns the definition of the multiple axis chart. This is separate
90      * from and distinct that the definition of the nested charts.
91      *
92      * @return the chart object for this plot
93      */

94     public JRDesignChart getChart()
95     {
96             return chart;
97     }
98     
99     /**
100      * Sets the chart object that this plot belongs to. The chart object defines
101      * all the information about the multiple axis chart.
102      *
103      * @param chart the chart that this plot belongs to
104      */

105     public void setChart(JRDesignChart chart)
106     {
107         this.chart = chart;
108     }
109 }
110
Popular Tags