0001: /**
0002: * Chart2D, a java library for drawing two dimensional charts.
0003: * Copyright (C) 2001 Jason J. Simas
0004: *
0005: * This library is free software; you can redistribute it and/or
0006: * modify it under the terms of the GNU Lesser General Public
0007: * License as published by the Free Software Foundation; either
0008: * version 2.1 of the License, or (at your option) any later version.
0009: *
0010: * This library is distributed in the hope that it will be useful,
0011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013: * Lesser General Public License for more details.
0014: * You should have received a copy of the GNU Lesser General Public
0015: * License along with this library; if not, write to the Free Software
0016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0017: *
0018: * The author of this library may be contacted at:
0019: * E-mail: jjsimas@users.sourceforge.net
0020: * Street Address: J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
0021: */package net.sourceforge.chart2d;
0022:
0023: import java.awt.Color;
0024: import java.util.Vector;
0025: import java.awt.AlphaComposite;
0026:
0027: /**
0028: * A data structure for holding the properties common to all graph area objects.
0029: * A graph area is the rectangular region surrounded on two sides by axes and containing either
0030: * lines, dots, or bars as graph components.
0031: * Pass this to any number of GraphChart2D objects.
0032: */
0033: public final class GraphProperties {
0034:
0035: /**
0036: * Indicates the lines will be continuous.
0037: * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
0038: */
0039: public static float[] CONTINUOUS = { 10.0f, 0.0f };
0040:
0041: /**
0042: * Indicates the lines will be dashed.
0043: * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
0044: */
0045: public static float[] DASHED = { 7.0f, 3.0f };
0046:
0047: /**
0048: * Indicates the lines will be dotted.
0049: * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
0050: */
0051: public static float[] DOTTED = { 3.0f, 3.0f };
0052:
0053: /**
0054: * Indicates the left of something. Used by setGraphComponentsLightSource(int).
0055: */
0056: public static int LEFT = 0;
0057:
0058: /**
0059: * Indicates the right of something. Used by setGraphComponentsLightSource(int).
0060: */
0061: public static int RIGHT = 1;
0062:
0063: /**
0064: * Indicates the top of something. Used by setGraphComponentsLightSource(int).
0065: */
0066: public static int TOP = 2;
0067:
0068: /**
0069: * Indicates the bottom of something. Used by setGraphComponentsLightSource(int).
0070: */
0071: public static int BOTTOM = 3;
0072:
0073: /**
0074: * Indicates none. Used by setGraphComponentsLightSource(int).
0075: */
0076: public static int NONE = 6;
0077:
0078: /**
0079: * Indicates only the component. Used by setGraphComponentsLightType(int).
0080: */
0081: public static int COMPONENT = 0;
0082:
0083: /**
0084: * Indicates only the graph. Used by setGraphComponentsLightType(int).
0085: */
0086: public static int GRAPH = 1;
0087:
0088: /**
0089: * An opaque (no blending) alpha composite.
0090: */
0091: public static AlphaComposite ALPHA_COMPOSITE_NONE = AlphaComposite
0092: .getInstance(AlphaComposite.SRC_OVER, 1f);
0093:
0094: /**
0095: * A mildly transparent (some blending) alpha composite.
0096: */
0097: public static AlphaComposite ALPHA_COMPOSITE_MILD = AlphaComposite
0098: .getInstance(AlphaComposite.SRC_OVER, .9f);
0099:
0100: /**
0101: * A medium transparent (some blending) alpha composite.
0102: */
0103: public static AlphaComposite ALPHA_COMPOSITE_MEDIUM = AlphaComposite
0104: .getInstance(AlphaComposite.SRC_OVER, .75f);
0105:
0106: /**
0107: * The default is false.
0108: */
0109: public static final boolean GRAPH_BACKGROUND_EXISTENCE_DEFAULT = false;
0110:
0111: /**
0112: * The default is Color.white.
0113: */
0114: public static final Color GRAPH_BACKGROUND_COLOR_DEFAULT = Color.white;
0115:
0116: /**
0117: * The default is true.
0118: */
0119: public static final boolean GRAPH_BORDER_EXISTENCE_DEFAULT = true;
0120:
0121: /**
0122: * The default is 2.
0123: */
0124: public static final int GRAPH_BORDER_THICKNESS_MODEL_DEFAULT = 2;
0125:
0126: /**
0127: * The default is Color.black.
0128: */
0129: public static final Color GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT = Color.black;
0130:
0131: /**
0132: * The default is Color.gray.
0133: */
0134: public static final Color GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT = Color.gray;
0135:
0136: /**
0137: * The default is false.
0138: */
0139: public static final boolean GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT = false;
0140:
0141: /**
0142: * The default is false.
0143: */
0144: public static final boolean GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT = false;
0145:
0146: /**
0147: * The default is Color.black.
0148: */
0149: public static final Color GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT = Color.black;
0150:
0151: /**
0152: * The default is true.
0153: */
0154: public static final boolean GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT = true;
0155:
0156: /**
0157: * The default is 2.
0158: */
0159: public static final int GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT = 2;
0160:
0161: /**
0162: * The default is true.
0163: */
0164: public static final boolean GRAPH_BARS_EXISTENCE_DEFAULT = true;
0165:
0166: /**
0167: * The default is 10.
0168: */
0169: public static final int GRAPH_BARS_THICKNESS_MODEL_DEFAULT = 10;
0170:
0171: /**
0172: * The default is 1f.
0173: */
0174: public static final float GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 1f;
0175:
0176: /**
0177: * The default is .535f.
0178: */
0179: public static final float GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .535f;
0180:
0181: /**
0182: * The default is false.
0183: */
0184: public static final boolean GRAPH_LINES_EXISTENCE_DEFAULT = false;
0185:
0186: /**
0187: * The default is 5.
0188: */
0189: public static final int GRAPH_LINES_THICKNESS_MODEL_DEFAULT = 5;
0190:
0191: /**
0192: * The default is false.
0193: */
0194: public static final boolean GRAPH_LINES_FILL_INTERIOR_DEFAULT = false;
0195:
0196: /**
0197: * The default is 0f.
0198: */
0199: public static final float GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f;
0200:
0201: /**
0202: * The default is 0f.
0203: */
0204: public static final float GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = 0f;
0205:
0206: /**
0207: * The default is false.
0208: */
0209: public static final boolean GRAPH_DOTS_EXISTENCE_DEFAULT = false;
0210:
0211: /**
0212: * The default is 8.
0213: */
0214: public static final int GRAPH_DOTS_THICKNESS_MODEL_DEFAULT = 8;
0215:
0216: /**
0217: * The default is 0f.
0218: */
0219: public static final float GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f;
0220:
0221: /**
0222: * The default is .40f.
0223: */
0224: public static final float GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .40f;
0225:
0226: /**
0227: * The default is true.
0228: */
0229: public static final boolean GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT = true;
0230:
0231: /**
0232: * The default is 2.
0233: */
0234: public static final int GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT = 2;
0235:
0236: /**
0237: * The default is CONTINUOUS.
0238: */
0239: public static final float[] GRAPH_NUMBERS_LINES_STYLE_DEFAULT = CONTINUOUS;
0240:
0241: /**
0242: * The default is Color.gray.
0243: */
0244: public static final Color GRAPH_NUMBERS_LINES_COLOR_DEFAULT = Color.gray;
0245:
0246: /**
0247: * The default is false.
0248: */
0249: public static final boolean GRAPH_LABELS_LINES_EXISTENCE_DEFAULT = false;
0250:
0251: /**
0252: * The default is 2.
0253: */
0254: public static final int GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT = 2;
0255:
0256: /**
0257: * The default is CONTINUOUS.
0258: */
0259: public static final float[] GRAPH_LABELS_LINES_STYLE_DEFAULT = CONTINUOUS;
0260:
0261: /**
0262: * The default is Color.gray.
0263: */
0264: public static final Color GRAPH_LABELS_LINES_COLOR_DEFAULT = Color.gray;
0265:
0266: /**
0267: * The default is true.
0268: */
0269: public static final boolean GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT = true;
0270:
0271: /**
0272: * The default is TOP.
0273: */
0274: public static int GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT = TOP;
0275:
0276: /**
0277: * The default is COMPONENT.
0278: */
0279: public static int GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT = COMPONENT;
0280:
0281: /**
0282: * The default is .75f.
0283: */
0284: public static float GRAPH_BARS_ROUNDING_RATIO_DEFAULT = .75f;
0285:
0286: /**
0287: * The default is true.
0288: */
0289: public static final boolean GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT = true;
0290:
0291: /**
0292: * The default is ALPHA_COMPOSITE_NONE.
0293: */
0294: public static AlphaComposite GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT = ALPHA_COMPOSITE_NONE;
0295:
0296: private boolean graphBackgroundExistence;
0297: private Color graphBackgroundColor;
0298: private boolean graphBorderExistence;
0299: private int graphBorderThicknessModel;
0300: private Color graphBorderLeftBottomColor;
0301: private Color graphBorderRightTopColor;
0302: private boolean graphAllowComponentAlignment;
0303: private boolean graphOutlineComponentsExistence;
0304: private Color graphOutlineComponentsColor;
0305: private boolean graphBetweenComponentsGapExistence;
0306: private int graphBetweenComponentsGapThicknessModel;
0307: private boolean graphBarsExistence;
0308: private int graphBarsThicknessModel;
0309: private float graphBarsExcessSpaceFeedbackRatio;
0310: private float graphBarsWithinCategoryOverlapRatio;
0311: private boolean graphLinesExistence;
0312: private int graphLinesThicknessModel;
0313: private boolean graphLinesFillInterior;
0314: private float graphLinesExcessSpaceFeedbackRatio;
0315: private float graphLinesWithinCategoryOverlapRatio;
0316: private boolean graphDotsExistence;
0317: private int graphDotsThicknessModel;
0318: private float graphDotsWithinCategoryOverlapRatio;
0319: private float graphDotsExcessSpaceFeedbackRatio;
0320: private boolean graphNumbersLinesExistence;
0321: private int graphNumbersLinesThicknessModel;
0322: private float[] graphNumbersLinesStyle;
0323: private Color graphNumbersLinesColor;
0324: private boolean graphLabelsLinesExistence;
0325: private int graphLabelsLinesThicknessModel;
0326: private float[] graphLabelsLinesStyle;
0327: private Color graphLabelsLinesColor;
0328: private boolean graphLinesThicknessAssociation;
0329: private int graphComponentsLightSource;
0330: private int graphComponentsLightType;
0331: private float graphBarsRoundingRatio;
0332: private boolean graphComponentsOverflowClip;
0333: private AlphaComposite graphComponentsAlphaComposite;
0334:
0335: private boolean needsUpdate = true;
0336: private final Vector needsUpdateVector = new Vector(5, 5);
0337: private final Vector graphChart2DVector = new Vector(5, 5);
0338:
0339: /**
0340: * Creates a GraphProperties object with the documented default values.
0341: */
0342: public GraphProperties() {
0343:
0344: needsUpdate = true;
0345: setGraphPropertiesToDefaults();
0346: }
0347:
0348: /**
0349: * Creates a GraphProperties object with property values copied from another object.
0350: * The copying is a deep copy.
0351: * @param graphProps The properties to copy.
0352: */
0353: public GraphProperties(GraphProperties graphProps) {
0354:
0355: needsUpdate = true;
0356: setGraphProperties(graphProps);
0357: }
0358:
0359: /**
0360: * Sets all properties to their default values.
0361: */
0362: public final void setGraphPropertiesToDefaults() {
0363:
0364: needsUpdate = true;
0365: setGraphBackgroundExistence(GRAPH_BACKGROUND_EXISTENCE_DEFAULT);
0366: setGraphBackgroundColor(GRAPH_BACKGROUND_COLOR_DEFAULT);
0367: setGraphBorderExistence(GRAPH_BORDER_EXISTENCE_DEFAULT);
0368: setGraphBorderThicknessModel(GRAPH_BORDER_THICKNESS_MODEL_DEFAULT);
0369: setGraphBorderLeftBottomColor(GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT);
0370: setGraphBorderRightTopColor(GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT);
0371: setGraphAllowComponentAlignment(GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT);
0372: setGraphOutlineComponentsExistence(GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT);
0373: setGraphOutlineComponentsColor(GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT);
0374: setGraphBetweenComponentsGapExistence(GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT);
0375: setGraphBetweenComponentsGapThicknessModel(GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT);
0376: setGraphBarsExistence(GRAPH_BARS_EXISTENCE_DEFAULT);
0377: setGraphBarsThicknessModel(GRAPH_BARS_THICKNESS_MODEL_DEFAULT);
0378: setGraphBarsExcessSpaceFeedbackRatio(GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
0379: setGraphBarsWithinCategoryOverlapRatio(GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
0380: setGraphLinesExistence(GRAPH_LINES_EXISTENCE_DEFAULT);
0381: setGraphLinesThicknessModel(GRAPH_LINES_THICKNESS_MODEL_DEFAULT);
0382: setGraphLinesFillInterior(GRAPH_LINES_FILL_INTERIOR_DEFAULT);
0383: setGraphLinesExcessSpaceFeedbackRatio(GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
0384: setGraphLinesWithinCategoryOverlapRatio(GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
0385: setGraphDotsExistence(GRAPH_DOTS_EXISTENCE_DEFAULT);
0386: setGraphDotsThicknessModel(GRAPH_DOTS_THICKNESS_MODEL_DEFAULT);
0387: setGraphDotsExcessSpaceFeedbackRatio(GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
0388: setGraphDotsWithinCategoryOverlapRatio(GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
0389: setGraphNumbersLinesExistence(GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT);
0390: setGraphNumbersLinesThicknessModel(GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT);
0391: setGraphNumbersLinesStyle(GRAPH_NUMBERS_LINES_STYLE_DEFAULT);
0392: setGraphNumbersLinesColor(GRAPH_NUMBERS_LINES_COLOR_DEFAULT);
0393: setGraphLabelsLinesExistence(GRAPH_LABELS_LINES_EXISTENCE_DEFAULT);
0394: setGraphLabelsLinesThicknessModel(GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT);
0395: setGraphLabelsLinesStyle(GRAPH_LABELS_LINES_STYLE_DEFAULT);
0396: setGraphLabelsLinesColor(GRAPH_LABELS_LINES_COLOR_DEFAULT);
0397: setGraphLinesThicknessAssociation(GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT);
0398: setGraphComponentsLightSource(GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT);
0399: setGraphComponentsLightType(GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT);
0400: setGraphBarsRoundingRatio(GRAPH_BARS_ROUNDING_RATIO_DEFAULT);
0401: setGraphComponentsOverflowClip(GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT);
0402: setGraphComponentsAlphaComposite(GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT);
0403: }
0404:
0405: /**
0406: * Sets all properties to be the values of another GraphProperties object.
0407: * The copying is a deep copy.
0408: * @param graphProps The properties to copy.
0409: */
0410: public final void setGraphProperties(GraphProperties graphProps) {
0411:
0412: needsUpdate = true;
0413: setGraphBackgroundExistence(graphProps
0414: .getGraphBackgroundExistence());
0415: setGraphBackgroundColor(graphProps.getGraphBackgroundColor());
0416: setGraphBorderExistence(graphProps.getGraphBorderExistence());
0417: setGraphBorderThicknessModel(graphProps
0418: .getGraphBorderThicknessModel());
0419: setGraphBorderLeftBottomColor(graphProps
0420: .getGraphBorderLeftBottomColor());
0421: setGraphBorderRightTopColor(graphProps
0422: .getGraphBorderRightTopColor());
0423: setGraphAllowComponentAlignment(graphProps
0424: .getGraphAllowComponentAlignment());
0425: setGraphOutlineComponentsExistence(graphProps
0426: .getGraphOutlineComponentsExistence());
0427: setGraphOutlineComponentsColor(graphProps
0428: .getGraphOutlineComponentsColor());
0429: setGraphBetweenComponentsGapExistence(graphProps
0430: .getGraphBetweenComponentsGapExistence());
0431: setGraphBetweenComponentsGapThicknessModel(graphProps
0432: .getGraphBetweenComponentsGapThicknessModel());
0433: setGraphBarsExistence(graphProps.getGraphBarsExistence());
0434: setGraphBarsThicknessModel(graphProps
0435: .getGraphBarsThicknessModel());
0436: setGraphBarsExcessSpaceFeedbackRatio(graphProps
0437: .getGraphBarsExcessSpaceFeedbackRatio());
0438: setGraphBarsWithinCategoryOverlapRatio(graphProps
0439: .getGraphBarsWithinCategoryOverlapRatio());
0440: setGraphLinesExistence(graphProps.getGraphLinesExistence());
0441: setGraphLinesThicknessModel(graphProps
0442: .getGraphLinesThicknessModel());
0443: setGraphLinesFillInterior(graphProps
0444: .getGraphLinesFillInterior());
0445: setGraphLinesExcessSpaceFeedbackRatio(graphProps
0446: .getGraphLinesExcessSpaceFeedbackRatio());
0447: setGraphLinesWithinCategoryOverlapRatio(graphProps
0448: .getGraphLinesWithinCategoryOverlapRatio());
0449: setGraphDotsExistence(graphProps.getGraphDotsExistence());
0450: setGraphDotsThicknessModel(graphProps
0451: .getGraphDotsThicknessModel());
0452: setGraphDotsExcessSpaceFeedbackRatio(graphProps
0453: .getGraphDotsExcessSpaceFeedbackRatio());
0454: setGraphDotsWithinCategoryOverlapRatio(graphProps
0455: .getGraphDotsWithinCategoryOverlapRatio());
0456: setGraphNumbersLinesExistence(graphProps
0457: .getGraphNumbersLinesExistence());
0458: setGraphNumbersLinesThicknessModel(graphProps
0459: .getGraphNumbersLinesThicknessModel());
0460: setGraphNumbersLinesStyle(graphProps
0461: .getGraphNumbersLinesStyle());
0462: setGraphNumbersLinesColor(graphProps
0463: .getGraphNumbersLinesColor());
0464: setGraphLabelsLinesExistence(graphProps
0465: .getGraphLabelsLinesExistence());
0466: setGraphLabelsLinesThicknessModel(graphProps
0467: .getGraphLabelsLinesThicknessModel());
0468: setGraphLabelsLinesStyle(graphProps.getGraphLabelsLinesStyle());
0469: setGraphLabelsLinesColor(graphProps.getGraphLabelsLinesColor());
0470: setGraphLinesThicknessAssociation(graphProps
0471: .getGraphLinesThicknessAssociation());
0472: setGraphComponentsLightSource(graphProps
0473: .getGraphComponentsLightSource());
0474: setGraphComponentsLightType(graphProps
0475: .getGraphComponentsLightType());
0476: setGraphBarsRoundingRatio(graphProps
0477: .getGraphBarsRoundingRatio());
0478: setGraphComponentsOverflowClip(graphProps
0479: .getGraphComponentsOverflowClip());
0480: setGraphComponentsAlphaComposite(graphProps
0481: .getGraphComponentsAlphaComposite());
0482: }
0483:
0484: /**
0485: * Sets whether the background of this graph exists. For each chart this
0486: * graph is added to, this property will only be respected if its the first
0487: * graph added that the chart; otherwise, graphs added after any chart would
0488: * totally paint over the previous graph.
0489: * @param existence If true, the background of this graph will exist.
0490: */
0491: public final void setGraphBackgroundExistence(boolean existence) {
0492:
0493: needsUpdate = true;
0494: graphBackgroundExistence = existence;
0495: }
0496:
0497: /**
0498: * Sets the color of the background of this graph. For each chart this
0499: * graph is added to, this property will only be respected if its the first
0500: * graph added that the chart; otherwise, graphs added after any chart would
0501: * totally paint over the previous graph.
0502: * @param color The color of the background of this graph.
0503: */
0504: public final void setGraphBackgroundColor(Color color) {
0505:
0506: needsUpdate = true;
0507: graphBackgroundColor = color;
0508: }
0509:
0510: /**
0511: * Sets whether the graph's left and bottom border exists.
0512: * @param existence If true, then the graph's left and bottom border exists.
0513: */
0514: public final void setGraphBorderExistence(boolean existence) {
0515:
0516: needsUpdate = true;
0517: graphBorderExistence = existence;
0518: }
0519:
0520: /**
0521: * Sets the thickness of the graph's left and bottom border for the
0522: * chart's model size.
0523: * @param thickness The model thickness of the graph's left and bottom border.
0524: */
0525: public final void setGraphBorderThicknessModel(int thickness) {
0526:
0527: needsUpdate = true;
0528: graphBorderThicknessModel = thickness;
0529: }
0530:
0531: /**
0532: * Sets the color of the graph's left and bottom border.
0533: * @param color The color of the graph's left and bottom border.
0534: */
0535: public final void setGraphBorderLeftBottomColor(Color color) {
0536:
0537: needsUpdate = true;
0538: graphBorderLeftBottomColor = color;
0539: }
0540:
0541: /**
0542: * Sets the color of the graph's right and top border.
0543: * @param color The color of the graph's right and top border.
0544: */
0545: public final void setGraphBorderRightTopColor(Color color) {
0546:
0547: needsUpdate = true;
0548: graphBorderRightTopColor = color;
0549: }
0550:
0551: /**
0552: * Sets whether the graph's components (ie bars, dots, or lines) are
0553: * allowed to overlap/align or are offset for each set and within each
0554: * category. For non-stacked bars charts, don't align; for all other chart
0555: * types alignment is generally preferrable.
0556: * @param alignment If true, the components will not be offset within the
0557: * category.
0558: */
0559: public final void setGraphAllowComponentAlignment(boolean alignment) {
0560:
0561: needsUpdate = true;
0562: graphAllowComponentAlignment = alignment;
0563: }
0564:
0565: /**
0566: * Sets whether there exists a thin outline around each component
0567: * (ie bars, lines, or dots).
0568: * @param existence If true, the components will have an outline.
0569: */
0570: public final void setGraphOutlineComponentsExistence(
0571: boolean existence) {
0572:
0573: needsUpdate = true;
0574: graphOutlineComponentsExistence = existence;
0575: }
0576:
0577: /**
0578: * Sets the color of the thin outline around components
0579: * (ie bars, lines, or dots).
0580: * @param color The color of each component's outline.
0581: */
0582: public final void setGraphOutlineComponentsColor(Color color) {
0583:
0584: needsUpdate = true;
0585: graphOutlineComponentsColor = color;
0586: }
0587:
0588: /**
0589: * Sets whether a gap between each category of components exists (ie
0590: * not the gap between each each component with each category).
0591: * @param existence If true, then the gap between components exists.
0592: */
0593: public final void setGraphBetweenComponentsGapExistence(
0594: boolean existence) {
0595:
0596: needsUpdate = true;
0597: graphBetweenComponentsGapExistence = existence;
0598: }
0599:
0600: /**
0601: * Sets the thickness of the gap between each category of components for
0602: * the chart's model size.
0603: * @param thickness The model thickness of teh gap between components.
0604: */
0605: public final void setGraphBetweenComponentsGapThicknessModel(
0606: int thickness) {
0607:
0608: needsUpdate = true;
0609: graphBetweenComponentsGapThicknessModel = thickness;
0610: }
0611:
0612: /**
0613: * Sets whether the graph contains bar components.
0614: * @param existence If true, then the graph contains bars.
0615: */
0616: public final void setGraphBarsExistence(boolean existence) {
0617:
0618: needsUpdate = true;
0619: graphBarsExistence = existence;
0620: }
0621:
0622: /**
0623: * Sets the thickness of the bar components for the chart's model size.
0624: * @param thickness The model thickness of the bars.
0625: */
0626: public final void setGraphBarsThicknessModel(int thickness) {
0627:
0628: needsUpdate = true;
0629: graphBarsThicknessModel = thickness;
0630: }
0631:
0632: /**
0633: * Sets the amount of the excess space to feed back to bars thickness.
0634: * Frequently the graphs are larger than necessary, the excess space can
0635: * be fedback to the bars, making them larger. The ratio is the amount of
0636: * space to feed back to the bars, to the total amount of space.
0637: * @param ratio The ratio on the total amount of space to feedback.
0638: */
0639: public final void setGraphBarsExcessSpaceFeedbackRatio(float ratio) {
0640:
0641: needsUpdate = true;
0642: graphBarsExcessSpaceFeedbackRatio = ratio;
0643: }
0644:
0645: /**
0646: * Sets how much the bars can overlap eachother when there are multiple
0647: * data values per data set and per data category.
0648: * @param ratio The ratio on the thickness of the bar for overlap.
0649: */
0650: public final void setGraphBarsWithinCategoryOverlapRatio(float ratio) {
0651:
0652: needsUpdate = true;
0653: graphBarsWithinCategoryOverlapRatio = ratio;
0654: }
0655:
0656: /**
0657: * Sets whether the graph contains line components.
0658: * @param existence If true, then the graph contains lines.
0659: */
0660: public final void setGraphLinesExistence(boolean existence) {
0661:
0662: needsUpdate = true;
0663: graphLinesExistence = existence;
0664: }
0665:
0666: /**
0667: * Sets the thickness of the line components for the chart's model size.
0668: * @param thickness The model thickness of the lines.
0669: */
0670: public final void setGraphLinesThicknessModel(int thickness) {
0671:
0672: needsUpdate = true;
0673: graphLinesThicknessModel = thickness;
0674: }
0675:
0676: /**
0677: * Sets whether the graph lines will made to form a shap (ie like a
0678: * mountain range).
0679: * @param fill If true, then the lines will be filled.
0680: */
0681: public final void setGraphLinesFillInterior(boolean fill) {
0682:
0683: needsUpdate = true;
0684: graphLinesFillInterior = fill;
0685: }
0686:
0687: /**
0688: * Sets the amount of the excess space to feed back to lines thickness.
0689: * Frequently the graphs are larger than necessary, the excess space can
0690: * be fedback to the lines, making them larger. The ratio is the amount of
0691: * space to feed back to the lines, to the total amount of space.
0692: * @param ratio The ratio on the total amount of space to feedback.
0693: */
0694: public final void setGraphLinesExcessSpaceFeedbackRatio(float ratio) {
0695:
0696: needsUpdate = true;
0697: graphLinesExcessSpaceFeedbackRatio = ratio;
0698: }
0699:
0700: /**
0701: * Sets how much the lines can overlap eachother when there are multiple
0702: * data values per data set and per data category.
0703: * @param ratio The ratio on the thickness of the line for overlap.
0704: */
0705: public final void setGraphLinesWithinCategoryOverlapRatio(
0706: float ratio) {
0707:
0708: needsUpdate = true;
0709: graphLinesWithinCategoryOverlapRatio = ratio;
0710: }
0711:
0712: /**
0713: * Sets whether the graph contains dot components.
0714: * @param existence If true, then the graph contains dots.
0715: */
0716: public final void setGraphDotsExistence(boolean existence) {
0717:
0718: needsUpdate = true;
0719: graphDotsExistence = existence;
0720: }
0721:
0722: /**
0723: * Sets the thickness of the dot components for the chart's model size.
0724: * @param thickness The model thickness of the dots.
0725: */
0726: public final void setGraphDotsThicknessModel(int thickness) {
0727:
0728: needsUpdate = true;
0729: graphDotsThicknessModel = thickness;
0730: }
0731:
0732: /**
0733: * Sets the amount of the excess space to feed back to dots thickness.
0734: * Frequently the graphs are larger than necessary, the excess space can
0735: * be fedback to the dots, making them larger. The ratio is the amount of
0736: * space to feed back to the dots, to the total amount of space.
0737: * @param ratio The ratio on the total amount of space to feedback.
0738: */
0739: public final void setGraphDotsExcessSpaceFeedbackRatio(float ratio) {
0740:
0741: needsUpdate = true;
0742: graphDotsExcessSpaceFeedbackRatio = ratio;
0743: }
0744:
0745: /**
0746: * Sets how much the dots can overlap eachother when there are multiple
0747: * data values per data set and per data category.
0748: * @param ratio The ratio on the thickness of the dot for overlap.
0749: */
0750: public final void setGraphDotsWithinCategoryOverlapRatio(float ratio) {
0751:
0752: needsUpdate = true;
0753: graphDotsWithinCategoryOverlapRatio = ratio;
0754: }
0755:
0756: /**
0757: * Sets whether the horizontal lines of this graph exist. These lines
0758: * are aligned with the axis' ticks. For each chart this graph is added to,
0759: * this property will only be respected if its the first graph added that the
0760: * chart; otherwise, graphs added after any chart would paint over the
0761: * previous graph's components.
0762: * @param existence If true, the horizontal lines exist.
0763: */
0764: public final void setGraphNumbersLinesExistence(boolean existence) {
0765:
0766: needsUpdate = true;
0767: graphNumbersLinesExistence = existence;
0768: }
0769:
0770: /**
0771: * Sets the thickness of the horizontal lines of this graph for the
0772: * chart's model size. These lines are aligned with the axis's ticks. For
0773: * each chart this graph is added to, this property will only be respected if
0774: * its the first graph added that the chart; otherwise, graphs added after any
0775: * chart would paint over the previous graph's components.
0776: * @param thickness The model thickness of the horizontal lines.
0777: */
0778: public final void setGraphNumbersLinesThicknessModel(int thickness) {
0779:
0780: needsUpdate = true;
0781: graphNumbersLinesThicknessModel = thickness;
0782: }
0783:
0784: /**
0785: * Sets the style of the horizontal lines of this graph. These lines
0786: * are aligned with the axis's ticks. For each chart this graph is added to,
0787: * this property will only be respected if its the first graph added that the
0788: * chart; otherwise, graphs added after any chart would paint over the
0789: * previous graph's components. Possible values for style are:
0790: * CONTINUOUS, DASHED, and DOTTED.
0791: * @param style The style of the horizontal lines.
0792: */
0793: public final void setGraphNumbersLinesStyle(float[] style) {
0794:
0795: needsUpdate = true;
0796: graphNumbersLinesStyle = style;
0797: }
0798:
0799: /**
0800: * Sets the color of the horizontal lines of this graph. These lines
0801: * are aligned with the axis's ticks. For each chart this graph is added to,
0802: * this property will only be respected if its the first graph added that the
0803: * chart; otherwise, graphs added after any chart would paint over the
0804: * previous graph's components.
0805: * @param color The color of the horizontal lines.
0806: */
0807: public final void setGraphNumbersLinesColor(Color color) {
0808:
0809: needsUpdate = true;
0810: graphNumbersLinesColor = color;
0811: }
0812:
0813: /**
0814: * Sets whether the vertical lines of this graph exist. These lines
0815: * are aligned with the axis' ticks. For each chart this graph is added to,
0816: * this property will only be respected if its the first graph added that the
0817: * chart; otherwise, graphs added after any chart would paint over the
0818: * previous graph's components.
0819: * @param existence If true, the vertical lines exist.
0820: */
0821: public final void setGraphLabelsLinesExistence(boolean existence) {
0822:
0823: needsUpdate = true;
0824: graphLabelsLinesExistence = existence;
0825: }
0826:
0827: /**
0828: * Sets the thickness of the vertical lines of this graph for the
0829: * chart's model size. These lines are aligned with the axis's ticks. For
0830: * each chart this graph is added to, this property will only be respected if
0831: * its the first graph added that the chart; otherwise, graphs added after any
0832: * chart would paint over the previous graph's components.
0833: * @param thickness The model thickness of the vertical lines.
0834: */
0835: public final void setGraphLabelsLinesThicknessModel(int thickness) {
0836:
0837: needsUpdate = true;
0838: graphLabelsLinesThicknessModel = thickness;
0839: }
0840:
0841: /**
0842: * Sets the style of the vertical lines of this graph. These lines
0843: * are aligned with the axis's ticks. For each chart this graph is added to,
0844: * this property will only be respected if its the first graph added that the
0845: * chart; otherwise, graphs added after any chart would paint over the
0846: * previous graph's components. Possible values for style are:
0847: * CONTINUOUS, DASHED, and DOTTED.
0848: * @param style The style of the vertical lines.
0849: */
0850: public final void setGraphLabelsLinesStyle(float[] style) {
0851:
0852: needsUpdate = true;
0853: graphLabelsLinesStyle = style;
0854: }
0855:
0856: /**
0857: * Sets the color of the vertical lines of this graph. These lines
0858: * are aligned with the axis's ticks. For each chart this graph is added to,
0859: * this property will only be respected if its the first graph added that the
0860: * chart; otherwise, graphs added after any chart would paint over the
0861: * previous graph's components.
0862: * @param color The color of the vertical lines.
0863: */
0864: public final void setGraphLabelsLinesColor(Color color) {
0865:
0866: needsUpdate = true;
0867: graphLabelsLinesColor = color;
0868: }
0869:
0870: /**
0871: * Sets whether the horizontal and vertical lines (if they both exist)
0872: * should both be the same thickness at all times. Uses the smaller thickness
0873: * if they are not already equal.
0874: * @param association If true, then these lines will have equal thickness.
0875: */
0876: public final void setGraphLinesThicknessAssociation(
0877: boolean association) {
0878:
0879: needsUpdate = true;
0880: graphLinesThicknessAssociation = association;
0881: }
0882:
0883: /**
0884: * Sets the direction of the source of the light if any.
0885: * Possible values are: TOP, BOTTOM, LEFT, RIGHT, TOPLEFT, BOTTOMRIGHT, and NONE.
0886: * @param s The direction of the light source.
0887: */
0888: public final void setGraphComponentsLightSource(int s) {
0889:
0890: needsUpdate = true;
0891: graphComponentsLightSource = s;
0892: }
0893:
0894: /**
0895: * Sets the type of the lighting affect.
0896: * Possible values are: COMPONENT and GRAPH.
0897: * COMPONENT implies that the light source is positioned directly on the components (for example
0898: * leaving a complete shading affect for each component).
0899: * GRAPH implies that the light source is positioned directly on the graph (for example leaving
0900: * the components on one side of the graph lighter than the others).
0901: * @param t The lighting affect type.
0902: */
0903: public final void setGraphComponentsLightType(int t) {
0904:
0905: needsUpdate = true;
0906: graphComponentsLightType = t;
0907: }
0908:
0909: /**
0910: * Sets the degree of rounding for the bars. Uses the RoundRectangle in its implemenation.
0911: * See the arcw and arch properties for guidance of RoundRectangle.
0912: * The ratio is the diameter of the half-ellipse making the arc over the dimension in one
0913: * direction of a bar. For the "Labels" ratio, the direction is the same direction in which the
0914: * labels axis runs. Possible values are between zero and 1. Zero means less round, one means
0915: * more round.
0916: * @param r The rounding ratio.
0917: */
0918: public final void setGraphBarsRoundingRatio(float r) {
0919:
0920: needsUpdate = true;
0921: graphBarsRoundingRatio = r;
0922: }
0923:
0924: /**
0925: * Sets whether the graph's components will be clipped if they pass over the graph's inner space
0926: * or border. The only time the graph's components should not be clipped is if the graph's
0927: * inner space and border are set to not exist. Not clipping may cause components to be painted
0928: * over other chart components such as the legend or axis.
0929: * @param c If true, then the components will be clipped.
0930: */
0931: public final void setGraphComponentsOverflowClip(boolean c) {
0932:
0933: needsUpdate = true;
0934: graphComponentsOverflowClip = c;
0935: }
0936:
0937: /**
0938: * Sets the actual AlphaComposite object to use on the Graphics2D object context for painting the
0939: * graph components managed by this GraphProperties object. By passing different AlphaComposite
0940: * objects, the graph components can take on a blending or transparency effect. Underneath
0941: * components can be seen through components painted over them. This is especially useful for
0942: * "line area" or "filled line" charts because top lines can paint over underneath lines if not
0943: * using a "stacked" dataset object.
0944: * @param a The AlphaComposite object to use.
0945: */
0946: public final void setGraphComponentsAlphaComposite(AlphaComposite a) {
0947:
0948: graphComponentsAlphaComposite = a;
0949: needsUpdate = true;
0950: }
0951:
0952: /**
0953: * Gets whether the background of this graph exists. For each chart this
0954: * graph is added to, this property will only be respected if its the first
0955: * graph added that the chart; otherwise, graphs added after any chart would
0956: * totally paint over the previous graph.
0957: * @return boolean If true, the background of this graph will exist.
0958: */
0959: public final boolean getGraphBackgroundExistence() {
0960: return graphBackgroundExistence;
0961: }
0962:
0963: /**
0964: * Gets the color of the background of this graph. For each chart this
0965: * graph is added to, this property will only be respected if its the first
0966: * graph added that the chart; otherwise, graphs added after any chart would
0967: * totally paint over the previous graph.
0968: * @return Color The color of the background of this graph.
0969: */
0970: public final Color getGraphBackgroundColor() {
0971: return graphBackgroundColor;
0972: }
0973:
0974: /**
0975: * Gets whether the graph's left and bottom border exists.
0976: * @return boolean If true, then the graph's left and bottom border exists.
0977: */
0978: public final boolean getGraphBorderExistence() {
0979: return graphBorderExistence;
0980: }
0981:
0982: /**
0983: * Gets the thickness of the graph's left and bottom border for the
0984: * chart's model size.
0985: * @return int The model thickness of the graph's left and bottom border.
0986: */
0987: public final int getGraphBorderThicknessModel() {
0988: return graphBorderThicknessModel;
0989: }
0990:
0991: /**
0992: * Gets the color of the graph's left and bottom border.
0993: * @return Color The color of the graph's left and bottom border.
0994: */
0995: public final Color getGraphBorderLeftBottomColor() {
0996: return graphBorderLeftBottomColor;
0997: }
0998:
0999: /**
1000: * Gets the color of the graph's right and top border.
1001: * @return Color The color of the graph's right and top border.
1002: */
1003: public final Color getGraphBorderRightTopColor() {
1004: return graphBorderRightTopColor;
1005: }
1006:
1007: /**
1008: * Gets whether the graph's components (ie bars, dots, or lines) are
1009: * allowed to overlap/align or are offset for each set and within each
1010: * category. For non-stacked bars charts, don't align; for all other chart
1011: * types alignment is generally preferrable.
1012: * @return boolean If true, the components will not be offset within the
1013: * category.
1014: */
1015: public final boolean getGraphAllowComponentAlignment() {
1016: return graphAllowComponentAlignment;
1017: }
1018:
1019: /**
1020: * Gets whether there exists a thin outline around each component
1021: * (ie bars, lines, or dots).
1022: * @return boolean If true, the components will have an outline.
1023: */
1024: public final boolean getGraphOutlineComponentsExistence() {
1025: return graphOutlineComponentsExistence;
1026: }
1027:
1028: /**
1029: * Gets the color of the thin outline around components
1030: * (ie bars, lines, or dots).
1031: * @return Color The color of each component's outline.
1032: */
1033: public final Color getGraphOutlineComponentsColor() {
1034: return graphOutlineComponentsColor;
1035: }
1036:
1037: /**
1038: * Gets whether a gap between each category of components exists (ie
1039: * not the gap between each each component with each category).
1040: * @return boolean If true, then the gap between components exists.
1041: */
1042: public final boolean getGraphBetweenComponentsGapExistence() {
1043: return graphBetweenComponentsGapExistence;
1044: }
1045:
1046: /**
1047: * Gets the thickness of the gap between each category of components for
1048: * the chart's model size.
1049: * @return int The model thickness of teh gap between components.
1050: */
1051: public final int getGraphBetweenComponentsGapThicknessModel() {
1052: return graphBetweenComponentsGapThicknessModel;
1053: }
1054:
1055: /**
1056: * Gets whether the graph contains bar components.
1057: * @return boolean If true, then the graph contains bars.
1058: */
1059: public final boolean getGraphBarsExistence() {
1060: return graphBarsExistence;
1061: }
1062:
1063: /**
1064: * Gets the thickness of the bar components for the chart's model size.
1065: * @return int The model thickness of the bars.
1066: */
1067: public final int getGraphBarsThicknessModel() {
1068: return graphBarsThicknessModel;
1069: }
1070:
1071: /**
1072: * Gets the amount of the excess space to feed back to bars thickness.
1073: * Frequently the graphs are larger than necessary, the excess space can
1074: * be fedback to the bars, making them larger. The ratio is the amount of
1075: * space to feed back to the bars, to the total amount of space.
1076: * @return float The ratio on the total amount of space to feedback.
1077: */
1078: public final float getGraphBarsExcessSpaceFeedbackRatio() {
1079: return graphBarsExcessSpaceFeedbackRatio;
1080: }
1081:
1082: /**
1083: * Gets how much the bars can overlap eachother when there are multiple
1084: * data values per data set and per data category.
1085: * @return ratio The ratio on the thickness of the bar for overlap.
1086: */
1087: public final float getGraphBarsWithinCategoryOverlapRatio() {
1088: return graphBarsWithinCategoryOverlapRatio;
1089: }
1090:
1091: /**
1092: * Gets whether the graph contains line components.
1093: * @return boolean If true, then the graph contains lines.
1094: */
1095: public final boolean getGraphLinesExistence() {
1096: return graphLinesExistence;
1097: }
1098:
1099: /**
1100: * Gets the thickness of the line components for the chart's model size.
1101: * @return int The model thickness of the lines.
1102: */
1103: public final int getGraphLinesThicknessModel() {
1104: return graphLinesThicknessModel;
1105: }
1106:
1107: /**
1108: * Gets whether the graph lines will made to form a shap (ie like a
1109: * mountain range).
1110: * @return boolean If true, then the lines will be filled.
1111: */
1112: public final boolean getGraphLinesFillInterior() {
1113: return graphLinesFillInterior;
1114: }
1115:
1116: /**
1117: * Gets the amount of the excess space to feed back to lines thickness.
1118: * Frequently the graphs are larger than necessary, the excess space can
1119: * be fedback to the lines, making them larger. The ratio is the amount of
1120: * space to feed back to the lines, to the total amount of space.
1121: * @return float The ratio on the total amount of space to feedback.
1122: */
1123: public final float getGraphLinesExcessSpaceFeedbackRatio() {
1124: return graphLinesExcessSpaceFeedbackRatio;
1125: }
1126:
1127: /**
1128: * Gets how much the lines can overlap eachother when there are multiple
1129: * data values per data set and per data category.
1130: * @return ratio The ratio on the thickness of the line for overlap.
1131: */
1132: public final float getGraphLinesWithinCategoryOverlapRatio() {
1133: return graphLinesWithinCategoryOverlapRatio;
1134: }
1135:
1136: /**
1137: * Gets whether the graph contains dot components.
1138: * @return boolean If true, then the graph contains dots.
1139: */
1140: public final boolean getGraphDotsExistence() {
1141: return graphDotsExistence;
1142: }
1143:
1144: /**
1145: * Gets the thickness of the dot components for the chart's model size.
1146: * @return int The model thickness of the dots.
1147: */
1148: public final int getGraphDotsThicknessModel() {
1149: return graphDotsThicknessModel;
1150: }
1151:
1152: /**
1153: * Gets the amount of the excess space to feed back to dots thickness.
1154: * Frequently the graphs are larger than necessary, the excess space can
1155: * be fedback to the dots, making them larger. The ratio is the amount of
1156: * space to feed back to the dots, to the total amount of space.
1157: * @return float The ratio on the total amount of space to feedback.
1158: */
1159: public final float getGraphDotsExcessSpaceFeedbackRatio() {
1160: return graphDotsExcessSpaceFeedbackRatio;
1161: }
1162:
1163: /**
1164: * Gets how much the dots can overlap eachother when there are multiple
1165: * data values per data set and per data category.
1166: * @return ratio The ratio on the thickness of the dot for overlap.
1167: */
1168: public final float getGraphDotsWithinCategoryOverlapRatio() {
1169: return graphDotsWithinCategoryOverlapRatio;
1170: }
1171:
1172: /**
1173: * Gets whether the horizontal lines of this graph exist. These lines
1174: * are aligned with the axis' ticks. For each chart this graph is added to,
1175: * this property will only be respected if its the first graph added that the
1176: * chart; otherwise, graphs added after any chart would paint over the
1177: * previous graph's components.
1178: * @return boolean If true, the horizontal lines exist.
1179: */
1180: public final boolean getGraphNumbersLinesExistence() {
1181: return graphNumbersLinesExistence;
1182: }
1183:
1184: /**
1185: * Gets the thickness of the horizontal lines of this graph for the
1186: * chart's model size. These lines are aligned with the axis's ticks. For
1187: * each chart this graph is added to, this property will only be respected if
1188: * its the first graph added that the chart; otherwise, graphs added after any
1189: * chart would paint over the previous graph's components.
1190: * @return int The model thickness of the horizontal lines.
1191: */
1192: public final int getGraphNumbersLinesThicknessModel() {
1193: return graphNumbersLinesThicknessModel;
1194: }
1195:
1196: /**
1197: * Gets the style of the horizontal lines of this graph. These lines
1198: * are aligned with the axis's ticks. For each chart this graph is added to,
1199: * this property will only be respected if its the first graph added that the
1200: * chart; otherwise, graphs added after any chart would paint over the
1201: * previous graph's components. Possible values for style are:
1202: * CONTINUOUS, DASHED, and DOTTED.
1203: * @return float[] The style of the horizontal lines.
1204: */
1205: public final float[] getGraphNumbersLinesStyle() {
1206: return graphNumbersLinesStyle;
1207: }
1208:
1209: /**
1210: * Gets the color of the horizontal lines of this graph. These lines
1211: * are aligned with the axis's ticks. For each chart this graph is added to,
1212: * this property will only be respected if its the first graph added that the
1213: * chart; otherwise, graphs added after any chart would paint over the
1214: * previous graph's components.
1215: * @return Color The color of the horizontal lines.
1216: */
1217: public final Color getGraphNumbersLinesColor() {
1218: return graphNumbersLinesColor;
1219: }
1220:
1221: /**
1222: * Gets whether the vertical lines of this graph exist. These lines
1223: * are aligned with the axis' ticks. For each chart this graph is added to,
1224: * this property will only be respected if its the first graph added that the
1225: * chart; otherwise, graphs added after any chart would paint over the
1226: * previous graph's components.
1227: * @return boolean If true, the vertical lines exist.
1228: */
1229: public final boolean getGraphLabelsLinesExistence() {
1230: return graphLabelsLinesExistence;
1231: }
1232:
1233: /**
1234: * Gets the thickness of the vertical lines of this graph for the
1235: * chart's model size. These lines are aligned with the axis's ticks. For
1236: * each chart this graph is added to, this property will only be respected if
1237: * its the first graph added that the chart; otherwise, graphs added after any
1238: * chart would paint over the previous graph's components.
1239: * @return int The model thickness of the vertical lines.
1240: */
1241: public final int getGraphLabelsLinesThicknessModel() {
1242: return graphLabelsLinesThicknessModel;
1243: }
1244:
1245: /**
1246: * Gets the style of the vertical lines of this graph. These lines
1247: * are aligned with the axis's ticks. For each chart this graph is added to,
1248: * this property will only be respected if its the first graph added that the
1249: * chart; otherwise, graphs added after any chart would paint over the
1250: * previous graph's components. Possible values for style are:
1251: * CONTINUOUS, DASHED, and DOTTED.
1252: * @return float[] The style of the vertical lines.
1253: */
1254: public final float[] getGraphLabelsLinesStyle() {
1255: return graphLabelsLinesStyle;
1256: }
1257:
1258: /**
1259: * Gets the color of the vertical lines of this graph. These lines
1260: * are aligned with the axis's ticks. For each chart this graph is added to,
1261: * this property will only be respected if its the first graph added that the
1262: * chart; otherwise, graphs added after any chart would paint over the
1263: * previous graph's components.
1264: * @return Color The color of the vertical lines.
1265: */
1266: public final Color getGraphLabelsLinesColor() {
1267: return graphLabelsLinesColor;
1268: }
1269:
1270: /**
1271: * Gets whether the horizontal and vertical lines (if they both exist)
1272: * should both be the same thickness at all times. Uses the smaller thickness
1273: * if they are not already equal.
1274: * @return boolean If true, then these lines will have equal thickness.
1275: */
1276: public final boolean getGraphLinesThicknessAssociation() {
1277: return graphLinesThicknessAssociation;
1278: }
1279:
1280: /**
1281: * Gets the direction of the source of the light if any.
1282: * Possible values are: TOP, BOTTOM, LEFT, RIGHT, and NONE.
1283: * @return The direction of the light source.
1284: */
1285: public final int getGraphComponentsLightSource() {
1286: return graphComponentsLightSource;
1287: }
1288:
1289: /**
1290: * Gets the type of the lighting affect.
1291: * Possible values are: COMPONENT and GRAPH.
1292: * COMPONENT implies that the light source is positioned directly on the components (for example
1293: * leaving a complete shading affect for each component).
1294: * GRAPH implies that the light source is positioned directly on the graph (for example leaving
1295: * the components on one side of the graph lighter than the others).
1296: * @return The lighting affect type.
1297: */
1298: public final int getGraphComponentsLightType() {
1299: return graphComponentsLightType;
1300: }
1301:
1302: /**
1303: * Gets the degree of rounding for the bars. Uses the RoundRectangle in its implemenation.
1304: * See the arcw and arch properties for guidance of RoundRectangle.
1305: * The ratio is the diameter of the half-ellipse making the arc over the dimension in one
1306: * direction of a bar. For the "Labels" ratio, the direction is the same direction in which the
1307: * labels axis runs. Possible values are between zero and 1. Zero means less round, one means
1308: * more round.
1309: * @return The rounding ratio.
1310: */
1311: public final float getGraphBarsRoundingRatio() {
1312: return graphBarsRoundingRatio;
1313: }
1314:
1315: /**
1316: * Gets whether the graph's components will be clipped if they pass over the graph's inner
1317: * space or border. The only time the graph's components should not be clipped is if the graph's
1318: * inner space and border are set to not exist. Not clipping may cause components to be painted
1319: * over other chart components such as the legend or axis.
1320: * @return If true, then the components will be clipped.
1321: */
1322: public final boolean getGraphComponentsOverflowClip() {
1323: return graphComponentsOverflowClip;
1324: }
1325:
1326: /**
1327: * Gets whether this object needs to be updated with new properties.
1328: * @param graphChart2D The object that may need to be updated.
1329: * @return If true then needs update.
1330: */
1331: final boolean getGraphChart2DNeedsUpdate(GraphChart2D graphChart2D) {
1332:
1333: if (needsUpdate)
1334: return true;
1335:
1336: int index = -1;
1337: if ((index = graphChart2DVector.indexOf(graphChart2D)) != -1) {
1338: return ((Boolean) needsUpdateVector.get(index))
1339: .booleanValue();
1340: }
1341:
1342: return false;
1343: }
1344:
1345: /**
1346: * Gets the actual AlphaComposite object to use on the Graphics2D object context for painting the
1347: * graph components managed by this GraphProperties object. By passing different AlphaComposite
1348: * objects, the graph components can take on a blending or transparency effect. Underneath
1349: * components can be seen through components painted over them. This is especially useful for
1350: * "line area" or "filled line" charts because top lines can paint over underneath lines if not
1351: * using a "stacked" dataset object.
1352: * @return The AlphaComposite object to use.
1353: */
1354: public final AlphaComposite getGraphComponentsAlphaComposite() {
1355: return graphComponentsAlphaComposite;
1356: }
1357:
1358: /**
1359: * Adds a GraphChart2D to the set of objects using these properties.
1360: * @param graphChart2D The Object2D to add.
1361: */
1362: final void addGraphChart2D(GraphChart2D graphChart2D) {
1363:
1364: if (!graphChart2DVector.contains(graphChart2D)) {
1365: graphChart2DVector.add(graphChart2D);
1366: needsUpdateVector.add(new Boolean(true));
1367: }
1368: }
1369:
1370: /**
1371: * Removes a GraphChart2D from the set of objects using these properties.
1372: * @param graphChart2D The Object2D to remove.
1373: */
1374: final void removeGraphChart2D(GraphChart2D graphChart2D) {
1375:
1376: int index = -1;
1377: if ((index = graphChart2DVector.indexOf(graphChart2D)) != -1) {
1378: graphChart2DVector.remove(index);
1379: needsUpdateVector.remove(index);
1380: }
1381: }
1382:
1383: /**
1384: * Validates the properties of this object.
1385: * If debug is true then prints a messages indicating whether each property is valid.
1386: * Returns true if all the properties were valid and false otherwise.
1387: * @param debug If true then will print status messages.
1388: * @return If true then valid.
1389: */
1390: final boolean validate(boolean debug) {
1391:
1392: if (debug)
1393: System.out.println("Validating GraphProperties");
1394:
1395: boolean valid = true;
1396:
1397: if (graphBackgroundColor == null) {
1398: valid = false;
1399: if (debug)
1400: System.out.println("GraphBackgroundColor == null");
1401: }
1402: if (graphBorderThicknessModel < 0) {
1403: valid = false;
1404: if (debug)
1405: System.out.println("GraphBorderThicknessModel < 0");
1406: }
1407: if (graphBorderLeftBottomColor == null) {
1408: valid = false;
1409: if (debug)
1410: System.out
1411: .println("GraphBorderLeftBottomColor == null");
1412: }
1413: if (graphBorderRightTopColor == null) {
1414: valid = false;
1415: if (debug)
1416: System.out.println("GraphBorderRightTopColor == null");
1417: }
1418: if (graphOutlineComponentsColor == null) {
1419: valid = false;
1420: if (debug)
1421: System.out
1422: .println("GraphOutlineComponentsColor == null");
1423: }
1424: if (graphBetweenComponentsGapThicknessModel < 0) {
1425: valid = false;
1426: if (debug)
1427: System.out
1428: .println("GraphBetweenComponentsGapThicknessModel < 0");
1429: }
1430: if (graphBarsThicknessModel < 0) {
1431: valid = false;
1432: if (debug)
1433: System.out.println("GraphBarsThicknessModel < 0");
1434: }
1435: if (graphBarsExcessSpaceFeedbackRatio < 0f
1436: || graphBarsExcessSpaceFeedbackRatio > 1f) {
1437: valid = false;
1438: if (debug)
1439: System.out
1440: .println("Problem with graphBarsExcessSpaceFeedbackRatio");
1441: }
1442: if (graphBarsWithinCategoryOverlapRatio < 0f
1443: || graphBarsWithinCategoryOverlapRatio > 1f) {
1444: valid = false;
1445: if (debug)
1446: System.out
1447: .println("Problem with graphBarsWithinCategoryOverlapRatio");
1448: }
1449: if (graphLinesThicknessModel < 0) {
1450: valid = false;
1451: if (debug)
1452: System.out.println("GraphLinesThicknessModel < 0");
1453: }
1454: if (graphLinesExcessSpaceFeedbackRatio < 0f
1455: || graphLinesExcessSpaceFeedbackRatio > 1f) {
1456: valid = false;
1457: if (debug)
1458: System.out
1459: .println("Problem with graphLinesExcessSpaceFeedbackRatio");
1460: }
1461: if (graphLinesWithinCategoryOverlapRatio < 0f
1462: || graphLinesWithinCategoryOverlapRatio > 1f) {
1463: valid = false;
1464: if (debug)
1465: System.out
1466: .println("Problem with graphLinesWithinCategoryOverlapRatio");
1467: }
1468: if (graphDotsThicknessModel < 0) {
1469: valid = false;
1470: if (debug)
1471: System.out.println("GraphDotsThicknessModel < 0");
1472: }
1473: if (graphDotsExcessSpaceFeedbackRatio < 0f
1474: || graphDotsExcessSpaceFeedbackRatio > 1f) {
1475: valid = false;
1476: if (debug)
1477: System.out
1478: .println("Problem with graphDotsExcessSpaceFeedbackRatio");
1479: }
1480: if (graphDotsWithinCategoryOverlapRatio < 0f
1481: || graphDotsWithinCategoryOverlapRatio > 1f) {
1482: valid = false;
1483: if (debug)
1484: System.out
1485: .println("Problem with graphDotsWithinCategoryOverlapRatio");
1486: }
1487: if (graphNumbersLinesThicknessModel < 0) {
1488: valid = false;
1489: if (debug)
1490: System.out
1491: .println("GraphNumbersLinesThicknessModel < 0");
1492: }
1493: if (graphNumbersLinesStyle != CONTINUOUS
1494: && graphNumbersLinesStyle != DASHED
1495: && graphNumbersLinesStyle != DOTTED) {
1496: valid = false;
1497: if (debug)
1498: System.out
1499: .println("Problem with graphNumbersLinesStyle");
1500: }
1501: if (graphNumbersLinesColor == null) {
1502: valid = false;
1503: if (debug)
1504: System.out.println("GraphNumbersLinesColor == null");
1505: }
1506: if (graphLabelsLinesThicknessModel < 0) {
1507: valid = false;
1508: if (debug)
1509: System.out
1510: .println("GraphLabelsLinesThicknessModel < 0");
1511: }
1512: if (graphLabelsLinesStyle != CONTINUOUS
1513: && graphLabelsLinesStyle != DASHED
1514: && graphLabelsLinesStyle != DOTTED) {
1515: valid = false;
1516: if (debug)
1517: System.out
1518: .println("problem with graphLabelsLinesStyle");
1519: }
1520: if (graphLabelsLinesColor == null) {
1521: valid = false;
1522: if (debug)
1523: System.out.println("GraphLabelsLinesColor == null");
1524: }
1525: if (graphComponentsLightSource != NONE
1526: && graphComponentsLightSource != TOP
1527: && graphComponentsLightSource != BOTTOM
1528: && graphComponentsLightSource != LEFT
1529: && graphComponentsLightSource != RIGHT) {
1530: valid = false;
1531: if (debug)
1532: System.out
1533: .println("Problem with GraphComponentsLightSource");
1534: }
1535: if (graphComponentsLightType != COMPONENT
1536: && graphComponentsLightType != GRAPH) {
1537: valid = false;
1538: if (debug)
1539: System.out
1540: .println("Problem with GraphComponentsLightType");
1541: }
1542: if (graphBarsRoundingRatio < 0f || graphBarsRoundingRatio > 1f) {
1543: valid = false;
1544: if (debug)
1545: System.out
1546: .println("Problem with GraphBarsRoundingRatio");
1547: }
1548: if (graphComponentsAlphaComposite == null) {
1549: valid = false;
1550: if (debug)
1551: System.out
1552: .println("graphComponentsAlphaComposite == null");
1553: }
1554:
1555: if (debug) {
1556: if (valid)
1557: System.out.println("GraphProperties was valid");
1558: else
1559: System.out.println("GraphProperties was invalid");
1560: }
1561:
1562: return valid;
1563: }
1564:
1565: /**
1566: * Updates the properties of this GraphChart2D.
1567: * @param graphChart2D The object to update.
1568: */
1569: final void updateGraphChart2D(GraphChart2D graphChart2D) {
1570:
1571: if (getGraphChart2DNeedsUpdate(graphChart2D)) {
1572:
1573: if (needsUpdate) {
1574: for (int i = 0; i < needsUpdateVector.size(); ++i) {
1575: needsUpdateVector.set(i, new Boolean(true));
1576: }
1577: needsUpdate = false;
1578: }
1579:
1580: int index = -1;
1581: if ((index = graphChart2DVector.indexOf(graphChart2D)) != -1) {
1582: needsUpdateVector.set(index, new Boolean(false));
1583: }
1584: }
1585: }
1586:
1587: /**
1588: * Accepts a graph area and configures it with current properties.
1589: * @param type Whether the graph is labels bottom or labels left using GraphChart2D fields.
1590: * @param graph The graph area to configure.
1591: */
1592: final void configureGraphArea(int type, GraphArea graph) {
1593:
1594: graph.setBackgroundExistence(getGraphBackgroundExistence());
1595: graph.setBackgroundColor(getGraphBackgroundColor());
1596: graph.setBorderExistence(getGraphBorderExistence());
1597: graph.setBorderThicknessModel(getGraphBorderThicknessModel());
1598: graph.setBorderColors(getGraphBorderLeftBottomColor(),
1599: getGraphBorderRightTopColor(),
1600: getGraphBorderRightTopColor(),
1601: getGraphBorderLeftBottomColor());
1602: graph
1603: .setAllowComponentAlignment(getGraphAllowComponentAlignment());
1604: graph
1605: .setOutlineComponents(getGraphOutlineComponentsExistence());
1606: graph
1607: .setOutlineComponentsColor(getGraphOutlineComponentsColor());
1608: graph
1609: .setBetweenComponentsGapExistence(getGraphBetweenComponentsGapExistence());
1610: graph
1611: .setBetweenComponentsGapThicknessModel(getGraphBetweenComponentsGapThicknessModel());
1612: graph.setBarsExistence(getGraphBarsExistence());
1613: graph.setBarsThicknessModel(getGraphBarsThicknessModel());
1614: graph
1615: .setBarsExcessSpaceFeedbackRatio(getGraphBarsExcessSpaceFeedbackRatio());
1616: graph
1617: .setBarsWithinCategoryOverlapRatio(getGraphBarsWithinCategoryOverlapRatio());
1618: graph.setLinesExistence(getGraphLinesExistence());
1619: graph.setLinesThicknessModel(getGraphLinesThicknessModel());
1620: graph.setLinesFillInterior(getGraphLinesFillInterior());
1621: graph
1622: .setLinesExcessSpaceFeedbackRatio(getGraphLinesExcessSpaceFeedbackRatio());
1623: graph
1624: .setLinesWithinCategoryOverlapRatio(getGraphLinesWithinCategoryOverlapRatio());
1625: graph.setDotsExistence(getGraphDotsExistence());
1626: graph.setDotsThicknessModel(getGraphDotsThicknessModel());
1627: graph
1628: .setDotsExcessSpaceFeedbackRatio(getGraphDotsExcessSpaceFeedbackRatio());
1629: graph
1630: .setDotsWithinCategoryOverlapRatio(getGraphDotsWithinCategoryOverlapRatio());
1631: graph.setBarRoundingRatio(getGraphBarsRoundingRatio());
1632:
1633: if (type == GraphChart2D.LABELS_BOTTOM) {
1634:
1635: graph
1636: .setHorizontalLinesExistence(getGraphNumbersLinesExistence());
1637: graph
1638: .setHorizontalLinesThicknessModel(getGraphNumbersLinesThicknessModel());
1639: graph.setHorizontalLinesStyle(getGraphNumbersLinesStyle());
1640: graph.setHorizontalLinesColor(getGraphNumbersLinesColor());
1641: graph
1642: .setVerticalLinesExistence(getGraphLabelsLinesExistence());
1643: graph
1644: .setVerticalLinesThicknessModel(getGraphLabelsLinesThicknessModel());
1645: graph.setVerticalLinesStyle(getGraphLabelsLinesStyle());
1646: graph.setVerticalLinesColor(getGraphLabelsLinesColor());
1647: } else {
1648:
1649: graph
1650: .setVerticalLinesExistence(getGraphNumbersLinesExistence());
1651: graph
1652: .setVerticalLinesThicknessModel(getGraphNumbersLinesThicknessModel());
1653: graph.setVerticalLinesStyle(getGraphNumbersLinesStyle());
1654: graph.setVerticalLinesColor(getGraphNumbersLinesColor());
1655: graph
1656: .setHorizontalLinesExistence(getGraphLabelsLinesExistence());
1657: graph
1658: .setHorizontalLinesThicknessModel(getGraphLabelsLinesThicknessModel());
1659: graph.setHorizontalLinesStyle(getGraphLabelsLinesStyle());
1660: graph.setHorizontalLinesColor(getGraphLabelsLinesColor());
1661: }
1662:
1663: graph
1664: .setLinesThicknessAssociation(getGraphLinesThicknessAssociation());
1665: graph.setComponentsLightSource(getGraphComponentsLightSource());
1666: graph.setComponentsLightType(getGraphComponentsLightType());
1667: graph.setClip(getGraphComponentsOverflowClip());
1668: graph
1669: .setComponentsAlphaComposite(getGraphComponentsAlphaComposite());
1670: }
1671:
1672: /**
1673: * Accepts a graph area and configures it with current properties.
1674: * Uses the properties of the background graph in order to overlay correctly.
1675: * @param backgroundGraphProps The properties of the background graph.
1676: * @param type Whether the graph is labels bottom or labels left using GraphChart2D fields.
1677: * @param graph The graph area to configure.
1678: */
1679: final void configureGraphArea(GraphProperties backgroundGraphProps,
1680: int type, GraphArea graph) {
1681:
1682: graph.setBackgroundExistence(false);
1683: graph.setBorderExistence(backgroundGraphProps
1684: .getGraphBorderExistence());
1685: graph.setBorderThicknessModel(backgroundGraphProps
1686: .getGraphBorderThicknessModel());
1687: graph.setBorderColors(backgroundGraphProps
1688: .getGraphBorderLeftBottomColor(), backgroundGraphProps
1689: .getGraphBorderRightTopColor(), backgroundGraphProps
1690: .getGraphBorderRightTopColor(), backgroundGraphProps
1691: .getGraphBorderLeftBottomColor());
1692: graph
1693: .setAllowComponentAlignment(getGraphAllowComponentAlignment());
1694: graph
1695: .setOutlineComponents(getGraphOutlineComponentsExistence());
1696: graph
1697: .setOutlineComponentsColor(getGraphOutlineComponentsColor());
1698: graph
1699: .setBetweenComponentsGapExistence(getGraphBetweenComponentsGapExistence());
1700: graph
1701: .setBetweenComponentsGapThicknessModel(getGraphBetweenComponentsGapThicknessModel());
1702: graph.setBarsExistence(getGraphBarsExistence());
1703: graph.setBarsThicknessModel(getGraphBarsThicknessModel());
1704: graph
1705: .setBarsExcessSpaceFeedbackRatio(getGraphBarsExcessSpaceFeedbackRatio());
1706: graph
1707: .setBarsWithinCategoryOverlapRatio(getGraphBarsWithinCategoryOverlapRatio());
1708: graph.setLinesExistence(getGraphLinesExistence());
1709: graph.setLinesThicknessModel(getGraphLinesThicknessModel());
1710: graph.setLinesFillInterior(getGraphLinesFillInterior());
1711: graph
1712: .setLinesExcessSpaceFeedbackRatio(getGraphLinesExcessSpaceFeedbackRatio());
1713: graph
1714: .setLinesWithinCategoryOverlapRatio(getGraphLinesWithinCategoryOverlapRatio());
1715: graph.setDotsExistence(getGraphDotsExistence());
1716: graph.setDotsThicknessModel(getGraphDotsThicknessModel());
1717: graph
1718: .setDotsExcessSpaceFeedbackRatio(getGraphDotsExcessSpaceFeedbackRatio());
1719: graph
1720: .setDotsWithinCategoryOverlapRatio(getGraphDotsWithinCategoryOverlapRatio());
1721:
1722: graph.setHorizontalLinesExistence(false);
1723: graph.setVerticalLinesExistence(false);
1724: graph.setBarRoundingRatio(getGraphBarsRoundingRatio());
1725:
1726: graph.setComponentsLightSource(getGraphComponentsLightSource());
1727: graph.setComponentsLightType(getGraphComponentsLightType());
1728: graph.setClip(getGraphComponentsOverflowClip());
1729: graph
1730: .setComponentsAlphaComposite(getGraphComponentsAlphaComposite());
1731: }
1732: }
|