KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chart2d > AxisArea


1 /**
2  * Chart2D, a java library for drawing two dimensional charts.
3  * Copyright (C) 2001 Jason J. Simas
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * The author of this library may be contacted at:
19  * E-mail: jjsimas@users.sourceforge.net
20  * Street Address: J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
21  */

22
23
24 package net.sourceforge.chart2d;
25
26
27 import java.awt.*;
28
29
30 /**
31  * Contains shared methods of XAxisArea and YAxisArea.
32  */

33 abstract class AxisArea extends TitledArea {
34
35
36
37   /**
38    * Specifies the type of the Axis. The type refers to what type of chart
39    * it supports. In any chart the objects are plotted against one side,
40    * the values side, the values side has raw numbers like 0, 100, 200, etc.
41    * The other side, the labels side, has the labels for the data being plotted,
42    * like September, November, etc. If the labels side is along the bottom
43    * of the graph, then set the type to LABELSBOTTOM. If the labels side is
44    * along the left/right side of the graph then set the type to LABELSLEFT.
45    * @param type Whether this axis is used for labels bottom or labels left
46    * applications.
47    */

48   abstract void setType (int type);
49
50
51   /**
52    * The color for the ticks.
53    * @param color The x Axis tick color.
54    */

55   abstract void setTicksColor (Color color);
56
57
58   /**
59    * The alignment of the ticks respective to the labels. The
60    * bullets can either be place in line with each label, or in in line with
61    * the middle of the space between each label. That is, bullets can be
62    * centered in the middle of the label, or placed between each label.
63    * @param alignment With values of either Area.CENTERED or Area.BETWEEN
64    */

65   abstract void setTicksAlignment (int alignment);
66
67
68  /**
69    * The number of ticks should be equal to the number of axis labels at all
70    * times, EXCEPT with a type of chart with a (LABELSBOTTOM axis and a
71    * graph components alignment is true).
72    * @param num The number of axis ticks.
73    */

74   abstract void setNumTicks (int num);
75
76
77   /**
78    * The model size for the ticks. If auto maximum sizing is enabled,
79    * then the actual tick size can grow and shrink; in this case a ratio based
80    * on the maximum area size / model area size is computed and applied to the
81    * model size in order to find the actual size. With maximum sizing
82    * disabled, the actual size is the model size.
83    * @param size The model size for the ticks. [Do not pass null]
84    */

85   abstract void setTicksSizeModel (Dimension size);
86
87
88   /**
89    * The existence of a gap between each tick and the next. If the gap does
90    * not exist, then it will not be used in calculations.
91    * @param existence The existence of a gap between each tick and the next. If
92    * true, then they do.
93    */

94   abstract void setBetweenTicksGapExistence (boolean existence);
95
96
97   /**
98    * The model thickness for the gap between each tick. If auto maximum sizing
99    * is enabled,
100    * then the actual thickness size can grow and shrink; in this case a ratio
101    * based
102    * on the maximum area size / model area size is computed and applied to the
103    * model thickness in order to find the actual thickness. With maximum sizing
104    * disabled, the actual thickness is the model thickness.
105    * @param gap The model thickness for the gap between each tick.
106    */

107   abstract void setBetweenTicksGapThicknessModel (int gap);
108
109
110   /**
111    * The existence of a gap between the row of labels and the row of ticks. If
112    * the gap does
113    * not exist, then it will not be used in calculations.
114    * @param existence The existence of a gap between the labels and ticks. If
115    * true, then they do.
116    */

117   abstract void setBetweenTicksAndLabelsGapExistence (boolean existence);
118
119
120   /**
121    * The model thickness for the gap between the row of labels and the row of
122    * ticks. If auto maximum sizing
123    * is enabled,
124    * then the actual thickness size can grow and shrink; in this case a ratio
125    * based
126    * on the maximum area size / model area size is computed and applied to the
127    * model thickness in order to find the actual thickness. With maximum sizing
128    * disabled, the actual thickness is the model thickness. This thickness
129    * is not used in calculations if either the ticks or labels do not exist.
130    * @param gap The model thickness for the gap between the labels and ticks.
131    */

132   abstract void setBetweenTicksAndLabelsGapThicknessModel (int gap);
133
134
135   /**
136    * The labels of the axis. The lowest order array label is the top
137    * most label.
138    * @param g2D The graphics context to use for calculations.
139    * @return The text labels; this will never be null.
140    */

141   abstract TextArea[] getLabels (Graphics2D g2D);
142
143
144   /**
145    * The model size for the ticks. If auto maximum sizing is enabled,
146    * then the actual tick size can grow and shrink; in this case a ratio based
147    * on the maximum area size / model area size is computed and applied to the
148    * model size in order to find the actual size. With maximum sizing
149    * disabled, the actual size is the model size.
150    * @return The model size for the ticks. [Do not pass null]
151    */

152   abstract Dimension getTicksSizeModel();
153
154
155   /**
156    * The bounds of the ticks. The bounds of the ticks specify the locations
157    * and sizes of each actual tick. The lowest order array tick is the left
158    * most tick.
159    * @param g2D The graphics context to use for calculations.
160    * @return The bounds of the ticks. This will never be null.
161    */

162   abstract Rectangle[] getTicks (Graphics2D g2D);
163
164
165   /**
166    * Returns the model thickness of the gap between the ticks.
167    * @return The thickness.
168    */

169   abstract int getBetweenTicksGapThicknessModel();
170
171
172   /**
173    * Returns the color of the ticks.
174    * @return The color.
175    */

176   abstract Color getTicksColor();
177
178
179   /**
180    * Returns how the ticks are aligned with respect to the labels.
181    * @return int With values of either Area.CENTERED or Area.BETWEEN
182    */

183   abstract int getTicksAlignment();
184 }
Popular Tags