001: /**
002: * Chart2D, a java library for drawing two dimensional charts.
003: * Copyright (C) 2001 Jason J. Simas
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: * The author of this library may be contacted at:
019: * E-mail: jjsimas@users.sourceforge.net
020: * Street Address: J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
021: */package net.sourceforge.chart2d;
022:
023: import java.awt.*;
024:
025: /**
026: * Contains shared methods of XAxisArea and YAxisArea.
027: */
028: abstract class AxisArea extends TitledArea {
029:
030: /**
031: * Specifies the type of the Axis. The type refers to what type of chart
032: * it supports. In any chart the objects are plotted against one side,
033: * the values side, the values side has raw numbers like 0, 100, 200, etc.
034: * The other side, the labels side, has the labels for the data being plotted,
035: * like September, November, etc. If the labels side is along the bottom
036: * of the graph, then set the type to LABELSBOTTOM. If the labels side is
037: * along the left/right side of the graph then set the type to LABELSLEFT.
038: * @param type Whether this axis is used for labels bottom or labels left
039: * applications.
040: */
041: abstract void setType(int type);
042:
043: /**
044: * The color for the ticks.
045: * @param color The x Axis tick color.
046: */
047: abstract void setTicksColor(Color color);
048:
049: /**
050: * The alignment of the ticks respective to the labels. The
051: * bullets can either be place in line with each label, or in in line with
052: * the middle of the space between each label. That is, bullets can be
053: * centered in the middle of the label, or placed between each label.
054: * @param alignment With values of either Area.CENTERED or Area.BETWEEN
055: */
056: abstract void setTicksAlignment(int alignment);
057:
058: /**
059: * The number of ticks should be equal to the number of axis labels at all
060: * times, EXCEPT with a type of chart with a (LABELSBOTTOM axis and a
061: * graph components alignment is true).
062: * @param num The number of axis ticks.
063: */
064: abstract void setNumTicks(int num);
065:
066: /**
067: * The model size for the ticks. If auto maximum sizing is enabled,
068: * then the actual tick size can grow and shrink; in this case a ratio based
069: * on the maximum area size / model area size is computed and applied to the
070: * model size in order to find the actual size. With maximum sizing
071: * disabled, the actual size is the model size.
072: * @param size The model size for the ticks. [Do not pass null]
073: */
074: abstract void setTicksSizeModel(Dimension size);
075:
076: /**
077: * The existence of a gap between each tick and the next. If the gap does
078: * not exist, then it will not be used in calculations.
079: * @param existence The existence of a gap between each tick and the next. If
080: * true, then they do.
081: */
082: abstract void setBetweenTicksGapExistence(boolean existence);
083:
084: /**
085: * The model thickness for the gap between each tick. If auto maximum sizing
086: * is enabled,
087: * then the actual thickness size can grow and shrink; in this case a ratio
088: * based
089: * on the maximum area size / model area size is computed and applied to the
090: * model thickness in order to find the actual thickness. With maximum sizing
091: * disabled, the actual thickness is the model thickness.
092: * @param gap The model thickness for the gap between each tick.
093: */
094: abstract void setBetweenTicksGapThicknessModel(int gap);
095:
096: /**
097: * The existence of a gap between the row of labels and the row of ticks. If
098: * the gap does
099: * not exist, then it will not be used in calculations.
100: * @param existence The existence of a gap between the labels and ticks. If
101: * true, then they do.
102: */
103: abstract void setBetweenTicksAndLabelsGapExistence(boolean existence);
104:
105: /**
106: * The model thickness for the gap between the row of labels and the row of
107: * ticks. If auto maximum sizing
108: * is enabled,
109: * then the actual thickness size can grow and shrink; in this case a ratio
110: * based
111: * on the maximum area size / model area size is computed and applied to the
112: * model thickness in order to find the actual thickness. With maximum sizing
113: * disabled, the actual thickness is the model thickness. This thickness
114: * is not used in calculations if either the ticks or labels do not exist.
115: * @param gap The model thickness for the gap between the labels and ticks.
116: */
117: abstract void setBetweenTicksAndLabelsGapThicknessModel(int gap);
118:
119: /**
120: * The labels of the axis. The lowest order array label is the top
121: * most label.
122: * @param g2D The graphics context to use for calculations.
123: * @return The text labels; this will never be null.
124: */
125: abstract TextArea[] getLabels(Graphics2D g2D);
126:
127: /**
128: * The model size for the ticks. If auto maximum sizing is enabled,
129: * then the actual tick size can grow and shrink; in this case a ratio based
130: * on the maximum area size / model area size is computed and applied to the
131: * model size in order to find the actual size. With maximum sizing
132: * disabled, the actual size is the model size.
133: * @return The model size for the ticks. [Do not pass null]
134: */
135: abstract Dimension getTicksSizeModel();
136:
137: /**
138: * The bounds of the ticks. The bounds of the ticks specify the locations
139: * and sizes of each actual tick. The lowest order array tick is the left
140: * most tick.
141: * @param g2D The graphics context to use for calculations.
142: * @return The bounds of the ticks. This will never be null.
143: */
144: abstract Rectangle[] getTicks(Graphics2D g2D);
145:
146: /**
147: * Returns the model thickness of the gap between the ticks.
148: * @return The thickness.
149: */
150: abstract int getBetweenTicksGapThicknessModel();
151:
152: /**
153: * Returns the color of the ticks.
154: * @return The color.
155: */
156: abstract Color getTicksColor();
157:
158: /**
159: * Returns how the ticks are aligned with respect to the labels.
160: * @return int With values of either Area.CENTERED or Area.BETWEEN
161: */
162: abstract int getTicksAlignment();
163: }
|