KickJava   Java API By Example, From Geeks To Geeks.

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


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.Color JavaDoc;
28 import java.util.Vector JavaDoc;
29 import java.awt.AlphaComposite JavaDoc;
30
31
32 /**
33  * A data structure for holding the properties common to all graph area objects.
34  * A graph area is the rectangular region surrounded on two sides by axes and containing either
35  * lines, dots, or bars as graph components.
36  * Pass this to any number of GraphChart2D objects.
37  */

38  public final class GraphProperties {
39
40
41   /**
42    * Indicates the lines will be continuous.
43    * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
44    */

45   public static float[] CONTINUOUS = {10.0f, 0.0f};
46
47   /**
48    * Indicates the lines will be dashed.
49    * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
50    */

51   public static float[] DASHED = {7.0f, 3.0f};
52
53   /**
54    * Indicates the lines will be dotted.
55    * Used by setGraphNumbersLinesStyle(int) and setGraphLabelsLinesStyle(int).
56    */

57   public static float[] DOTTED = {3.0f, 3.0f};
58
59   /**
60    * Indicates the left of something. Used by setGraphComponentsLightSource(int).
61    */

62   public static int LEFT = 0;
63
64
65   /**
66    * Indicates the right of something. Used by setGraphComponentsLightSource(int).
67    */

68   public static int RIGHT = 1;
69
70
71   /**
72    * Indicates the top of something. Used by setGraphComponentsLightSource(int).
73    */

74   public static int TOP = 2;
75
76
77   /**
78    * Indicates the bottom of something. Used by setGraphComponentsLightSource(int).
79    */

80   public static int BOTTOM = 3;
81
82
83   /**
84    * Indicates none. Used by setGraphComponentsLightSource(int).
85    */

86   public static int NONE = 6;
87
88
89   /**
90    * Indicates only the component. Used by setGraphComponentsLightType(int).
91    */

92   public static int COMPONENT = 0;
93
94
95   /**
96    * Indicates only the graph. Used by setGraphComponentsLightType(int).
97    */

98   public static int GRAPH = 1;
99
100
101   /**
102    * An opaque (no blending) alpha composite.
103    */

104   public static AlphaComposite JavaDoc ALPHA_COMPOSITE_NONE =
105     AlphaComposite.getInstance (AlphaComposite.SRC_OVER, 1f);
106
107   /**
108    * A mildly transparent (some blending) alpha composite.
109    */

110   public static AlphaComposite JavaDoc ALPHA_COMPOSITE_MILD =
111     AlphaComposite.getInstance (AlphaComposite.SRC_OVER, .9f);
112
113   /**
114    * A medium transparent (some blending) alpha composite.
115    */

116   public static AlphaComposite JavaDoc ALPHA_COMPOSITE_MEDIUM =
117     AlphaComposite.getInstance (AlphaComposite.SRC_OVER, .75f);
118
119   /**
120    * The default is false.
121    */

122   public static final boolean GRAPH_BACKGROUND_EXISTENCE_DEFAULT = false;
123
124   /**
125    * The default is Color.white.
126    */

127   public static final Color JavaDoc GRAPH_BACKGROUND_COLOR_DEFAULT = Color.white;
128
129   /**
130    * The default is true.
131    */

132   public static final boolean GRAPH_BORDER_EXISTENCE_DEFAULT = true;
133
134   /**
135    * The default is 2.
136    */

137   public static final int GRAPH_BORDER_THICKNESS_MODEL_DEFAULT = 2;
138
139   /**
140    * The default is Color.black.
141    */

142   public static final Color JavaDoc GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT = Color.black;
143
144   /**
145    * The default is Color.gray.
146    */

147   public static final Color JavaDoc GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT = Color.gray;
148
149   /**
150    * The default is false.
151    */

152   public static final boolean GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT = false;
153
154   /**
155    * The default is false.
156    */

157   public static final boolean GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT = false;
158
159   /**
160    * The default is Color.black.
161    */

162   public static final Color JavaDoc GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT = Color.black;
163
164   /**
165    * The default is true.
166    */

167   public static final boolean GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT = true;
168
169   /**
170    * The default is 2.
171    */

172   public static final int GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT = 2;
173
174   /**
175    * The default is true.
176    */

177   public static final boolean GRAPH_BARS_EXISTENCE_DEFAULT = true;
178
179   /**
180    * The default is 10.
181    */

182   public static final int GRAPH_BARS_THICKNESS_MODEL_DEFAULT = 10;
183
184   /**
185    * The default is 1f.
186    */

187   public static final float GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 1f;
188
189   /**
190    * The default is .535f.
191    */

192   public static final float GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .535f;
193
194   /**
195    * The default is false.
196    */

197   public static final boolean GRAPH_LINES_EXISTENCE_DEFAULT = false;
198
199   /**
200    * The default is 5.
201    */

202   public static final int GRAPH_LINES_THICKNESS_MODEL_DEFAULT = 5;
203
204   /**
205    * The default is false.
206    */

207   public static final boolean GRAPH_LINES_FILL_INTERIOR_DEFAULT = false;
208
209   /**
210    * The default is 0f.
211    */

212   public static final float GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f;
213
214   /**
215    * The default is 0f.
216    */

217   public static final float GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = 0f;
218
219   /**
220    * The default is false.
221    */

222   public static final boolean GRAPH_DOTS_EXISTENCE_DEFAULT = false;
223
224   /**
225    * The default is 8.
226    */

227   public static final int GRAPH_DOTS_THICKNESS_MODEL_DEFAULT = 8;
228
229   /**
230    * The default is 0f.
231    */

232   public static final float GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f;
233
234   /**
235    * The default is .40f.
236    */

237   public static final float GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .40f;
238
239   /**
240    * The default is true.
241    */

242   public static final boolean GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT = true;
243
244   /**
245    * The default is 2.
246    */

247   public static final int GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT = 2;
248
249   /**
250    * The default is CONTINUOUS.
251    */

252   public static final float[] GRAPH_NUMBERS_LINES_STYLE_DEFAULT = CONTINUOUS;
253
254   /**
255    * The default is Color.gray.
256    */

257   public static final Color JavaDoc GRAPH_NUMBERS_LINES_COLOR_DEFAULT = Color.gray;
258
259   /**
260    * The default is false.
261    */

262   public static final boolean GRAPH_LABELS_LINES_EXISTENCE_DEFAULT = false;
263
264   /**
265    * The default is 2.
266    */

267   public static final int GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT = 2;
268
269   /**
270    * The default is CONTINUOUS.
271    */

272   public static final float[] GRAPH_LABELS_LINES_STYLE_DEFAULT = CONTINUOUS;
273
274   /**
275    * The default is Color.gray.
276    */

277   public static final Color JavaDoc GRAPH_LABELS_LINES_COLOR_DEFAULT = Color.gray;
278
279   /**
280    * The default is true.
281    */

282   public static final boolean GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT = true;
283
284   /**
285    * The default is TOP.
286    */

287   public static int GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT = TOP;
288
289   /**
290    * The default is COMPONENT.
291    */

292   public static int GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT = COMPONENT;
293
294   /**
295    * The default is .75f.
296    */

297   public static float GRAPH_BARS_ROUNDING_RATIO_DEFAULT = .75f;
298
299   /**
300    * The default is true.
301    */

302   public static final boolean GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT = true;
303
304   /**
305    * The default is ALPHA_COMPOSITE_NONE.
306    */

307   public static AlphaComposite JavaDoc GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT = ALPHA_COMPOSITE_NONE;
308
309
310   private boolean graphBackgroundExistence;
311   private Color JavaDoc graphBackgroundColor;
312   private boolean graphBorderExistence;
313   private int graphBorderThicknessModel;
314   private Color JavaDoc graphBorderLeftBottomColor;
315   private Color JavaDoc graphBorderRightTopColor;
316   private boolean graphAllowComponentAlignment;
317   private boolean graphOutlineComponentsExistence;
318   private Color JavaDoc graphOutlineComponentsColor;
319   private boolean graphBetweenComponentsGapExistence;
320   private int graphBetweenComponentsGapThicknessModel;
321   private boolean graphBarsExistence;
322   private int graphBarsThicknessModel;
323   private float graphBarsExcessSpaceFeedbackRatio;
324   private float graphBarsWithinCategoryOverlapRatio;
325   private boolean graphLinesExistence;
326   private int graphLinesThicknessModel;
327   private boolean graphLinesFillInterior;
328   private float graphLinesExcessSpaceFeedbackRatio;
329   private float graphLinesWithinCategoryOverlapRatio;
330   private boolean graphDotsExistence;
331   private int graphDotsThicknessModel;
332   private float graphDotsWithinCategoryOverlapRatio;
333   private float graphDotsExcessSpaceFeedbackRatio;
334   private boolean graphNumbersLinesExistence;
335   private int graphNumbersLinesThicknessModel;
336   private float[] graphNumbersLinesStyle;
337   private Color JavaDoc graphNumbersLinesColor;
338   private boolean graphLabelsLinesExistence;
339   private int graphLabelsLinesThicknessModel;
340   private float[] graphLabelsLinesStyle;
341   private Color JavaDoc graphLabelsLinesColor;
342   private boolean graphLinesThicknessAssociation;
343   private int graphComponentsLightSource;
344   private int graphComponentsLightType;
345   private float graphBarsRoundingRatio;
346   private boolean graphComponentsOverflowClip;
347   private AlphaComposite JavaDoc graphComponentsAlphaComposite;
348
349   private boolean needsUpdate = true;
350   private final Vector JavaDoc needsUpdateVector = new Vector JavaDoc (5, 5);
351   private final Vector JavaDoc graphChart2DVector = new Vector JavaDoc (5, 5);
352
353
354   /**
355    * Creates a GraphProperties object with the documented default values.
356    */

357   public GraphProperties() {
358
359     needsUpdate = true;
360     setGraphPropertiesToDefaults();
361   }
362
363
364   /**
365    * Creates a GraphProperties object with property values copied from another object.
366    * The copying is a deep copy.
367    * @param graphProps The properties to copy.
368    */

369   public GraphProperties (GraphProperties graphProps) {
370
371     needsUpdate = true;
372     setGraphProperties (graphProps);
373   }
374
375
376   /**
377    * Sets all properties to their default values.
378    */

379   public final void setGraphPropertiesToDefaults() {
380
381     needsUpdate = true;
382     setGraphBackgroundExistence (GRAPH_BACKGROUND_EXISTENCE_DEFAULT);
383     setGraphBackgroundColor (GRAPH_BACKGROUND_COLOR_DEFAULT);
384     setGraphBorderExistence (GRAPH_BORDER_EXISTENCE_DEFAULT);
385     setGraphBorderThicknessModel (GRAPH_BORDER_THICKNESS_MODEL_DEFAULT);
386     setGraphBorderLeftBottomColor (GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT);
387     setGraphBorderRightTopColor (GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT);
388     setGraphAllowComponentAlignment (GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT);
389     setGraphOutlineComponentsExistence (GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT);
390     setGraphOutlineComponentsColor (GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT);
391     setGraphBetweenComponentsGapExistence (GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT);
392     setGraphBetweenComponentsGapThicknessModel (
393       GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT);
394     setGraphBarsExistence (GRAPH_BARS_EXISTENCE_DEFAULT);
395     setGraphBarsThicknessModel (GRAPH_BARS_THICKNESS_MODEL_DEFAULT);
396     setGraphBarsExcessSpaceFeedbackRatio (GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
397     setGraphBarsWithinCategoryOverlapRatio (GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
398     setGraphLinesExistence (GRAPH_LINES_EXISTENCE_DEFAULT);
399     setGraphLinesThicknessModel (GRAPH_LINES_THICKNESS_MODEL_DEFAULT);
400     setGraphLinesFillInterior (GRAPH_LINES_FILL_INTERIOR_DEFAULT);
401     setGraphLinesExcessSpaceFeedbackRatio (GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
402     setGraphLinesWithinCategoryOverlapRatio (GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
403     setGraphDotsExistence (GRAPH_DOTS_EXISTENCE_DEFAULT);
404     setGraphDotsThicknessModel (GRAPH_DOTS_THICKNESS_MODEL_DEFAULT);
405     setGraphDotsExcessSpaceFeedbackRatio (GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT);
406     setGraphDotsWithinCategoryOverlapRatio (GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT);
407     setGraphNumbersLinesExistence (GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT);
408     setGraphNumbersLinesThicknessModel (GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT);
409     setGraphNumbersLinesStyle (GRAPH_NUMBERS_LINES_STYLE_DEFAULT);
410     setGraphNumbersLinesColor (GRAPH_NUMBERS_LINES_COLOR_DEFAULT);
411     setGraphLabelsLinesExistence (GRAPH_LABELS_LINES_EXISTENCE_DEFAULT);
412     setGraphLabelsLinesThicknessModel (GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT);
413     setGraphLabelsLinesStyle (GRAPH_LABELS_LINES_STYLE_DEFAULT);
414     setGraphLabelsLinesColor (GRAPH_LABELS_LINES_COLOR_DEFAULT);
415     setGraphLinesThicknessAssociation (GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT);
416     setGraphComponentsLightSource (GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT);
417     setGraphComponentsLightType (GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT);
418     setGraphBarsRoundingRatio (GRAPH_BARS_ROUNDING_RATIO_DEFAULT);
419     setGraphComponentsOverflowClip (GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT);
420     setGraphComponentsAlphaComposite (GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT);
421   }
422
423
424   /**
425    * Sets all properties to be the values of another GraphProperties object.
426    * The copying is a deep copy.
427    * @param graphProps The properties to copy.
428    */

429   public final void setGraphProperties (GraphProperties graphProps) {
430
431     needsUpdate = true;
432     setGraphBackgroundExistence (graphProps.getGraphBackgroundExistence());
433     setGraphBackgroundColor (graphProps.getGraphBackgroundColor());
434     setGraphBorderExistence (graphProps.getGraphBorderExistence());
435     setGraphBorderThicknessModel (graphProps.getGraphBorderThicknessModel());
436     setGraphBorderLeftBottomColor (graphProps.getGraphBorderLeftBottomColor());
437     setGraphBorderRightTopColor (graphProps.getGraphBorderRightTopColor());
438     setGraphAllowComponentAlignment (graphProps.getGraphAllowComponentAlignment());
439     setGraphOutlineComponentsExistence (graphProps.getGraphOutlineComponentsExistence());
440     setGraphOutlineComponentsColor (graphProps.getGraphOutlineComponentsColor());
441     setGraphBetweenComponentsGapExistence (graphProps.getGraphBetweenComponentsGapExistence());
442     setGraphBetweenComponentsGapThicknessModel (graphProps.getGraphBetweenComponentsGapThicknessModel());
443     setGraphBarsExistence (graphProps.getGraphBarsExistence());
444     setGraphBarsThicknessModel (graphProps.getGraphBarsThicknessModel());
445     setGraphBarsExcessSpaceFeedbackRatio (graphProps.getGraphBarsExcessSpaceFeedbackRatio());
446     setGraphBarsWithinCategoryOverlapRatio (graphProps.getGraphBarsWithinCategoryOverlapRatio());
447     setGraphLinesExistence (graphProps.getGraphLinesExistence());
448     setGraphLinesThicknessModel (graphProps.getGraphLinesThicknessModel());
449     setGraphLinesFillInterior (graphProps.getGraphLinesFillInterior());
450     setGraphLinesExcessSpaceFeedbackRatio (graphProps.getGraphLinesExcessSpaceFeedbackRatio());
451     setGraphLinesWithinCategoryOverlapRatio (graphProps.getGraphLinesWithinCategoryOverlapRatio());
452     setGraphDotsExistence (graphProps.getGraphDotsExistence());
453     setGraphDotsThicknessModel (graphProps.getGraphDotsThicknessModel());
454     setGraphDotsExcessSpaceFeedbackRatio (graphProps.getGraphDotsExcessSpaceFeedbackRatio());
455     setGraphDotsWithinCategoryOverlapRatio (graphProps.getGraphDotsWithinCategoryOverlapRatio());
456     setGraphNumbersLinesExistence (graphProps.getGraphNumbersLinesExistence());
457     setGraphNumbersLinesThicknessModel (graphProps.getGraphNumbersLinesThicknessModel());
458     setGraphNumbersLinesStyle (graphProps.getGraphNumbersLinesStyle());
459     setGraphNumbersLinesColor (graphProps.getGraphNumbersLinesColor());
460     setGraphLabelsLinesExistence (graphProps.getGraphLabelsLinesExistence());
461     setGraphLabelsLinesThicknessModel (graphProps.getGraphLabelsLinesThicknessModel());
462     setGraphLabelsLinesStyle (graphProps.getGraphLabelsLinesStyle());
463     setGraphLabelsLinesColor (graphProps.getGraphLabelsLinesColor());
464     setGraphLinesThicknessAssociation (graphProps.getGraphLinesThicknessAssociation());
465     setGraphComponentsLightSource (graphProps.getGraphComponentsLightSource());
466     setGraphComponentsLightType (graphProps.getGraphComponentsLightType());
467     setGraphBarsRoundingRatio (graphProps.getGraphBarsRoundingRatio());
468     setGraphComponentsOverflowClip (graphProps.getGraphComponentsOverflowClip());
469     setGraphComponentsAlphaComposite (graphProps.getGraphComponentsAlphaComposite());
470   }
471
472
473   /**
474    * Sets whether the background of this graph exists. For each chart this
475    * graph is added to, this property will only be respected if its the first
476    * graph added that the chart; otherwise, graphs added after any chart would
477    * totally paint over the previous graph.
478    * @param existence If true, the background of this graph will exist.
479    */

480   public final void setGraphBackgroundExistence (boolean existence) {
481
482     needsUpdate = true;
483     graphBackgroundExistence = existence;
484   }
485
486
487   /**
488    * Sets the color of the background of this graph. For each chart this
489    * graph is added to, this property will only be respected if its the first
490    * graph added that the chart; otherwise, graphs added after any chart would
491    * totally paint over the previous graph.
492    * @param color The color of the background of this graph.
493    */

494   public final void setGraphBackgroundColor (Color JavaDoc color) {
495
496     needsUpdate = true;
497     graphBackgroundColor = color;
498   }
499
500
501   /**
502    * Sets whether the graph's left and bottom border exists.
503    * @param existence If true, then the graph's left and bottom border exists.
504    */

505   public final void setGraphBorderExistence (boolean existence) {
506
507     needsUpdate = true;
508     graphBorderExistence = existence;
509   }
510
511
512   /**
513    * Sets the thickness of the graph's left and bottom border for the
514    * chart's model size.
515    * @param thickness The model thickness of the graph's left and bottom border.
516    */

517   public final void setGraphBorderThicknessModel (int thickness) {
518
519     needsUpdate = true;
520     graphBorderThicknessModel = thickness;
521   }
522
523
524   /**
525    * Sets the color of the graph's left and bottom border.
526    * @param color The color of the graph's left and bottom border.
527    */

528   public final void setGraphBorderLeftBottomColor (Color JavaDoc color) {
529
530     needsUpdate = true;
531     graphBorderLeftBottomColor = color;
532   }
533
534
535   /**
536    * Sets the color of the graph's right and top border.
537    * @param color The color of the graph's right and top border.
538    */

539   public final void setGraphBorderRightTopColor (Color JavaDoc color) {
540
541     needsUpdate = true;
542     graphBorderRightTopColor = color;
543   }
544
545
546   /**
547    * Sets whether the graph's components (ie bars, dots, or lines) are
548    * allowed to overlap/align or are offset for each set and within each
549    * category. For non-stacked bars charts, don't align; for all other chart
550    * types alignment is generally preferrable.
551    * @param alignment If true, the components will not be offset within the
552    * category.
553    */

554   public final void setGraphAllowComponentAlignment (boolean alignment) {
555
556     needsUpdate = true;
557     graphAllowComponentAlignment = alignment;
558   }
559
560
561   /**
562    * Sets whether there exists a thin outline around each component
563    * (ie bars, lines, or dots).
564    * @param existence If true, the components will have an outline.
565    */

566   public final void setGraphOutlineComponentsExistence (boolean existence) {
567
568     needsUpdate = true;
569     graphOutlineComponentsExistence = existence;
570   }
571
572
573   /**
574    * Sets the color of the thin outline around components
575    * (ie bars, lines, or dots).
576    * @param color The color of each component's outline.
577    */

578   public final void setGraphOutlineComponentsColor (Color JavaDoc color) {
579
580     needsUpdate = true;
581     graphOutlineComponentsColor = color;
582   }
583
584
585   /**
586    * Sets whether a gap between each category of components exists (ie
587    * not the gap between each each component with each category).
588    * @param existence If true, then the gap between components exists.
589    */

590   public final void setGraphBetweenComponentsGapExistence (boolean existence) {
591
592     needsUpdate = true;
593     graphBetweenComponentsGapExistence = existence;
594   }
595
596
597   /**
598    * Sets the thickness of the gap between each category of components for
599    * the chart's model size.
600    * @param thickness The model thickness of teh gap between components.
601    */

602   public final void setGraphBetweenComponentsGapThicknessModel (int thickness) {
603
604     needsUpdate = true;
605     graphBetweenComponentsGapThicknessModel = thickness;
606   }
607
608
609   /**
610    * Sets whether the graph contains bar components.
611    * @param existence If true, then the graph contains bars.
612    */

613   public final void setGraphBarsExistence (boolean existence) {
614
615     needsUpdate = true;
616     graphBarsExistence = existence;
617   }
618
619
620   /**
621    * Sets the thickness of the bar components for the chart's model size.
622    * @param thickness The model thickness of the bars.
623    */

624   public final void setGraphBarsThicknessModel (int thickness) {
625
626     needsUpdate = true;
627     graphBarsThicknessModel = thickness;
628   }
629
630
631   /**
632    * Sets the amount of the excess space to feed back to bars thickness.
633    * Frequently the graphs are larger than necessary, the excess space can
634    * be fedback to the bars, making them larger. The ratio is the amount of
635    * space to feed back to the bars, to the total amount of space.
636    * @param ratio The ratio on the total amount of space to feedback.
637    */

638   public final void setGraphBarsExcessSpaceFeedbackRatio (float ratio) {
639
640     needsUpdate = true;
641     graphBarsExcessSpaceFeedbackRatio = ratio;
642   }
643
644
645   /**
646    * Sets how much the bars can overlap eachother when there are multiple
647    * data values per data set and per data category.
648    * @param ratio The ratio on the thickness of the bar for overlap.
649    */

650    public final void setGraphBarsWithinCategoryOverlapRatio (float ratio) {
651
652     needsUpdate = true;
653     graphBarsWithinCategoryOverlapRatio = ratio;
654   }
655
656
657   /**
658    * Sets whether the graph contains line components.
659    * @param existence If true, then the graph contains lines.
660    */

661   public final void setGraphLinesExistence (boolean existence) {
662
663     needsUpdate = true;
664     graphLinesExistence = existence;
665   }
666
667
668   /**
669    * Sets the thickness of the line components for the chart's model size.
670    * @param thickness The model thickness of the lines.
671    */

672   public final void setGraphLinesThicknessModel (int thickness) {
673
674     needsUpdate = true;
675     graphLinesThicknessModel = thickness;
676   }
677
678
679   /**
680    * Sets whether the graph lines will made to form a shap (ie like a
681    * mountain range).
682    * @param fill If true, then the lines will be filled.
683    */

684   public final void setGraphLinesFillInterior (boolean fill) {
685
686     needsUpdate = true;
687     graphLinesFillInterior = fill;
688   }
689
690
691   /**
692    * Sets the amount of the excess space to feed back to lines thickness.
693    * Frequently the graphs are larger than necessary, the excess space can
694    * be fedback to the lines, making them larger. The ratio is the amount of
695    * space to feed back to the lines, to the total amount of space.
696    * @param ratio The ratio on the total amount of space to feedback.
697    */

698   public final void setGraphLinesExcessSpaceFeedbackRatio (float ratio) {
699
700     needsUpdate = true;
701     graphLinesExcessSpaceFeedbackRatio = ratio;
702   }
703
704
705   /**
706    * Sets how much the lines can overlap eachother when there are multiple
707    * data values per data set and per data category.
708    * @param ratio The ratio on the thickness of the line for overlap.
709    */

710    public final void setGraphLinesWithinCategoryOverlapRatio (float ratio) {
711
712     needsUpdate = true;
713     graphLinesWithinCategoryOverlapRatio = ratio;
714   }
715
716
717   /**
718    * Sets whether the graph contains dot components.
719    * @param existence If true, then the graph contains dots.
720    */

721   public final void setGraphDotsExistence (boolean existence) {
722
723     needsUpdate = true;
724     graphDotsExistence = existence;
725   }
726
727
728   /**
729    * Sets the thickness of the dot components for the chart's model size.
730    * @param thickness The model thickness of the dots.
731    */

732   public final void setGraphDotsThicknessModel (int thickness) {
733
734     needsUpdate = true;
735     graphDotsThicknessModel = thickness;
736   }
737
738
739   /**
740    * Sets the amount of the excess space to feed back to dots thickness.
741    * Frequently the graphs are larger than necessary, the excess space can
742    * be fedback to the dots, making them larger. The ratio is the amount of
743    * space to feed back to the dots, to the total amount of space.
744    * @param ratio The ratio on the total amount of space to feedback.
745    */

746   public final void setGraphDotsExcessSpaceFeedbackRatio (float ratio) {
747
748     needsUpdate = true;
749     graphDotsExcessSpaceFeedbackRatio = ratio;
750   }
751
752
753   /**
754    * Sets how much the dots can overlap eachother when there are multiple
755    * data values per data set and per data category.
756    * @param ratio The ratio on the thickness of the dot for overlap.
757    */

758    public final void setGraphDotsWithinCategoryOverlapRatio (float ratio) {
759
760     needsUpdate = true;
761     graphDotsWithinCategoryOverlapRatio = ratio;
762   }
763
764
765   /**
766    * Sets whether the horizontal lines of this graph exist. These lines
767    * are aligned with the axis' ticks. For each chart this graph is added to,
768    * this property will only be respected if its the first graph added that the
769    * chart; otherwise, graphs added after any chart would paint over the
770    * previous graph's components.
771    * @param existence If true, the horizontal lines exist.
772    */

773   public final void setGraphNumbersLinesExistence (boolean existence) {
774
775     needsUpdate = true;
776     graphNumbersLinesExistence = existence;
777   }
778
779
780   /**
781    * Sets the thickness of the horizontal lines of this graph for the
782    * chart's model size. These lines are aligned with the axis's ticks. For
783    * each chart this graph is added to, this property will only be respected if
784    * its the first graph added that the chart; otherwise, graphs added after any
785    * chart would paint over the previous graph's components.
786    * @param thickness The model thickness of the horizontal lines.
787    */

788   public final void setGraphNumbersLinesThicknessModel (int thickness) {
789
790     needsUpdate = true;
791     graphNumbersLinesThicknessModel = thickness;
792   }
793
794
795   /**
796    * Sets the style of the horizontal lines of this graph. These lines
797    * are aligned with the axis's ticks. For each chart this graph is added to,
798    * this property will only be respected if its the first graph added that the
799    * chart; otherwise, graphs added after any chart would paint over the
800    * previous graph's components. Possible values for style are:
801    * CONTINUOUS, DASHED, and DOTTED.
802    * @param style The style of the horizontal lines.
803    */

804   public final void setGraphNumbersLinesStyle (float[] style) {
805
806     needsUpdate = true;
807     graphNumbersLinesStyle = style;
808   }
809
810
811   /**
812    * Sets the color of the horizontal lines of this graph. These lines
813    * are aligned with the axis's ticks. For each chart this graph is added to,
814    * this property will only be respected if its the first graph added that the
815    * chart; otherwise, graphs added after any chart would paint over the
816    * previous graph's components.
817    * @param color The color of the horizontal lines.
818    */

819   public final void setGraphNumbersLinesColor (Color JavaDoc color) {
820
821     needsUpdate = true;
822     graphNumbersLinesColor = color;
823   }
824
825
826   /**
827    * Sets whether the vertical lines of this graph exist. These lines
828    * are aligned with the axis' ticks. For each chart this graph is added to,
829    * this property will only be respected if its the first graph added that the
830    * chart; otherwise, graphs added after any chart would paint over the
831    * previous graph's components.
832    * @param existence If true, the vertical lines exist.
833    */

834   public final void setGraphLabelsLinesExistence (boolean existence) {
835
836     needsUpdate = true;
837     graphLabelsLinesExistence = existence;
838   }
839
840
841   /**
842    * Sets the thickness of the vertical lines of this graph for the
843    * chart's model size. These lines are aligned with the axis's ticks. For
844    * each chart this graph is added to, this property will only be respected if
845    * its the first graph added that the chart; otherwise, graphs added after any
846    * chart would paint over the previous graph's components.
847    * @param thickness The model thickness of the vertical lines.
848    */

849   public final void setGraphLabelsLinesThicknessModel (int thickness) {
850
851     needsUpdate = true;
852     graphLabelsLinesThicknessModel = thickness;
853   }
854
855
856   /**
857    * Sets the style of the vertical lines of this graph. These lines
858    * are aligned with the axis's ticks. For each chart this graph is added to,
859    * this property will only be respected if its the first graph added that the
860    * chart; otherwise, graphs added after any chart would paint over the
861    * previous graph's components. Possible values for style are:
862    * CONTINUOUS, DASHED, and DOTTED.
863    * @param style The style of the vertical lines.
864    */

865   public final void setGraphLabelsLinesStyle (float[] style) {
866
867     needsUpdate = true;
868     graphLabelsLinesStyle = style;
869   }
870
871
872   /**
873    * Sets the color of the vertical lines of this graph. These lines
874    * are aligned with the axis's ticks. For each chart this graph is added to,
875    * this property will only be respected if its the first graph added that the
876    * chart; otherwise, graphs added after any chart would paint over the
877    * previous graph's components.
878    * @param color The color of the vertical lines.
879    */

880   public final void setGraphLabelsLinesColor (Color JavaDoc color) {
881
882     needsUpdate = true;
883     graphLabelsLinesColor = color;
884   }
885
886
887   /**
888    * Sets whether the horizontal and vertical lines (if they both exist)
889    * should both be the same thickness at all times. Uses the smaller thickness
890    * if they are not already equal.
891    * @param association If true, then these lines will have equal thickness.
892    */

893   public final void setGraphLinesThicknessAssociation (boolean association) {
894
895     needsUpdate = true;
896     graphLinesThicknessAssociation = association;
897   }
898
899
900   /**
901    * Sets the direction of the source of the light if any.
902    * Possible values are: TOP, BOTTOM, LEFT, RIGHT, TOPLEFT, BOTTOMRIGHT, and NONE.
903    * @param s The direction of the light source.
904    */

905   public final void setGraphComponentsLightSource (int s) {
906
907     needsUpdate = true;
908     graphComponentsLightSource = s;
909   }
910
911
912   /**
913    * Sets the type of the lighting affect.
914    * Possible values are: COMPONENT and GRAPH.
915    * COMPONENT implies that the light source is positioned directly on the components (for example
916    * leaving a complete shading affect for each component).
917    * GRAPH implies that the light source is positioned directly on the graph (for example leaving
918    * the components on one side of the graph lighter than the others).
919    * @param t The lighting affect type.
920    */

921   public final void setGraphComponentsLightType (int t) {
922
923     needsUpdate = true;
924     graphComponentsLightType = t;
925   }
926
927
928   /**
929    * Sets the degree of rounding for the bars. Uses the RoundRectangle in its implemenation.
930    * See the arcw and arch properties for guidance of RoundRectangle.
931    * The ratio is the diameter of the half-ellipse making the arc over the dimension in one
932    * direction of a bar. For the "Labels" ratio, the direction is the same direction in which the
933    * labels axis runs. Possible values are between zero and 1. Zero means less round, one means
934    * more round.
935    * @param r The rounding ratio.
936    */

937   public final void setGraphBarsRoundingRatio (float r) {
938
939     needsUpdate = true;
940     graphBarsRoundingRatio = r;
941   }
942
943
944   /**
945    * Sets whether the graph's components will be clipped if they pass over the graph's inner space
946    * or border. The only time the graph's components should not be clipped is if the graph's
947    * inner space and border are set to not exist. Not clipping may cause components to be painted
948    * over other chart components such as the legend or axis.
949    * @param c If true, then the components will be clipped.
950    */

951   public final void setGraphComponentsOverflowClip (boolean c) {
952
953     needsUpdate = true;
954     graphComponentsOverflowClip = c;
955   }
956
957
958   /**
959    * Sets the actual AlphaComposite object to use on the Graphics2D object context for painting the
960    * graph components managed by this GraphProperties object. By passing different AlphaComposite
961    * objects, the graph components can take on a blending or transparency effect. Underneath
962    * components can be seen through components painted over them. This is especially useful for
963    * "line area" or "filled line" charts because top lines can paint over underneath lines if not
964    * using a "stacked" dataset object.
965    * @param a The AlphaComposite object to use.
966    */

967   public final void setGraphComponentsAlphaComposite (AlphaComposite JavaDoc a) {
968
969     graphComponentsAlphaComposite = a;
970     needsUpdate = true;
971   }
972
973
974   /**
975    * Gets whether the background of this graph exists. For each chart this
976    * graph is added to, this property will only be respected if its the first
977    * graph added that the chart; otherwise, graphs added after any chart would
978    * totally paint over the previous graph.
979    * @return boolean If true, the background of this graph will exist.
980    */

981   public final boolean getGraphBackgroundExistence() {
982     return graphBackgroundExistence;
983   }
984
985
986   /**
987    * Gets the color of the background of this graph. For each chart this
988    * graph is added to, this property will only be respected if its the first
989    * graph added that the chart; otherwise, graphs added after any chart would
990    * totally paint over the previous graph.
991    * @return Color The color of the background of this graph.
992    */

993   public final Color JavaDoc getGraphBackgroundColor() {
994     return graphBackgroundColor;
995   }
996
997
998   /**
999    * Gets whether the graph's left and bottom border exists.
1000   * @return boolean If true, then the graph's left and bottom border exists.
1001   */

1002  public final boolean getGraphBorderExistence() {
1003    return graphBorderExistence;
1004  }
1005
1006
1007  /**
1008   * Gets the thickness of the graph's left and bottom border for the
1009   * chart's model size.
1010   * @return int The model thickness of the graph's left and bottom border.
1011   */

1012  public final int getGraphBorderThicknessModel() {
1013    return graphBorderThicknessModel;
1014  }
1015
1016
1017  /**
1018   * Gets the color of the graph's left and bottom border.
1019   * @return Color The color of the graph's left and bottom border.
1020   */

1021  public final Color JavaDoc getGraphBorderLeftBottomColor() {
1022    return graphBorderLeftBottomColor;
1023  }
1024
1025
1026  /**
1027   * Gets the color of the graph's right and top border.
1028   * @return Color The color of the graph's right and top border.
1029   */

1030  public final Color JavaDoc getGraphBorderRightTopColor() {
1031    return graphBorderRightTopColor;
1032  }
1033
1034
1035  /**
1036   * Gets whether the graph's components (ie bars, dots, or lines) are
1037   * allowed to overlap/align or are offset for each set and within each
1038   * category. For non-stacked bars charts, don't align; for all other chart
1039   * types alignment is generally preferrable.
1040   * @return boolean If true, the components will not be offset within the
1041   * category.
1042   */

1043  public final boolean getGraphAllowComponentAlignment() {
1044    return graphAllowComponentAlignment;
1045  }
1046
1047
1048  /**
1049   * Gets whether there exists a thin outline around each component
1050   * (ie bars, lines, or dots).
1051   * @return boolean If true, the components will have an outline.
1052   */

1053  public final boolean getGraphOutlineComponentsExistence() {
1054    return graphOutlineComponentsExistence;
1055  }
1056
1057
1058  /**
1059   * Gets the color of the thin outline around components
1060   * (ie bars, lines, or dots).
1061   * @return Color The color of each component's outline.
1062   */

1063  public final Color JavaDoc getGraphOutlineComponentsColor() {
1064    return graphOutlineComponentsColor;
1065  }
1066
1067
1068  /**
1069   * Gets whether a gap between each category of components exists (ie
1070   * not the gap between each each component with each category).
1071   * @return boolean If true, then the gap between components exists.
1072   */

1073  public final boolean getGraphBetweenComponentsGapExistence() {
1074    return graphBetweenComponentsGapExistence;
1075  }
1076
1077
1078  /**
1079   * Gets the thickness of the gap between each category of components for
1080   * the chart's model size.
1081   * @return int The model thickness of teh gap between components.
1082   */

1083  public final int getGraphBetweenComponentsGapThicknessModel() {
1084    return graphBetweenComponentsGapThicknessModel;
1085  }
1086
1087
1088  /**
1089   * Gets whether the graph contains bar components.
1090   * @return boolean If true, then the graph contains bars.
1091   */

1092  public final boolean getGraphBarsExistence() {
1093    return graphBarsExistence;
1094  }
1095
1096
1097  /**
1098   * Gets the thickness of the bar components for the chart's model size.
1099   * @return int The model thickness of the bars.
1100   */

1101  public final int getGraphBarsThicknessModel() {
1102    return graphBarsThicknessModel;
1103  }
1104
1105
1106  /**
1107   * Gets the amount of the excess space to feed back to bars thickness.
1108   * Frequently the graphs are larger than necessary, the excess space can
1109   * be fedback to the bars, making them larger. The ratio is the amount of
1110   * space to feed back to the bars, to the total amount of space.
1111   * @return float The ratio on the total amount of space to feedback.
1112   */

1113  public final float getGraphBarsExcessSpaceFeedbackRatio() {
1114    return graphBarsExcessSpaceFeedbackRatio;
1115  }
1116
1117
1118  /**
1119   * Gets how much the bars can overlap eachother when there are multiple
1120   * data values per data set and per data category.
1121   * @return ratio The ratio on the thickness of the bar for overlap.
1122   */

1123   public final float getGraphBarsWithinCategoryOverlapRatio() {
1124    return graphBarsWithinCategoryOverlapRatio;
1125  }
1126
1127
1128  /**
1129   * Gets whether the graph contains line components.
1130   * @return boolean If true, then the graph contains lines.
1131   */

1132  public final boolean getGraphLinesExistence() {
1133    return graphLinesExistence;
1134  }
1135
1136
1137  /**
1138   * Gets the thickness of the line components for the chart's model size.
1139   * @return int The model thickness of the lines.
1140   */

1141  public final int getGraphLinesThicknessModel() {
1142    return graphLinesThicknessModel;
1143  }
1144
1145
1146  /**
1147   * Gets whether the graph lines will made to form a shap (ie like a
1148   * mountain range).
1149   * @return boolean If true, then the lines will be filled.
1150   */

1151  public final boolean getGraphLinesFillInterior() {
1152    return graphLinesFillInterior;
1153  }
1154
1155
1156  /**
1157   * Gets the amount of the excess space to feed back to lines thickness.
1158   * Frequently the graphs are larger than necessary, the excess space can
1159   * be fedback to the lines, making them larger. The ratio is the amount of
1160   * space to feed back to the lines, to the total amount of space.
1161   * @return float The ratio on the total amount of space to feedback.
1162   */

1163  public final float getGraphLinesExcessSpaceFeedbackRatio() {
1164    return graphLinesExcessSpaceFeedbackRatio;
1165  }
1166
1167
1168  /**
1169   * Gets how much the lines can overlap eachother when there are multiple
1170   * data values per data set and per data category.
1171   * @return ratio The ratio on the thickness of the line for overlap.
1172   */

1173   public final float getGraphLinesWithinCategoryOverlapRatio() {
1174    return graphLinesWithinCategoryOverlapRatio;
1175  }
1176
1177
1178  /**
1179   * Gets whether the graph contains dot components.
1180   * @return boolean If true, then the graph contains dots.
1181   */

1182  public final boolean getGraphDotsExistence() {
1183    return graphDotsExistence;
1184  }
1185
1186
1187  /**
1188   * Gets the thickness of the dot components for the chart's model size.
1189   * @return int The model thickness of the dots.
1190   */

1191  public final int getGraphDotsThicknessModel() {
1192    return graphDotsThicknessModel;
1193  }
1194
1195
1196  /**
1197   * Gets the amount of the excess space to feed back to dots thickness.
1198   * Frequently the graphs are larger than necessary, the excess space can
1199   * be fedback to the dots, making them larger. The ratio is the amount of
1200   * space to feed back to the dots, to the total amount of space.
1201   * @return float The ratio on the total amount of space to feedback.
1202   */

1203  public final float getGraphDotsExcessSpaceFeedbackRatio() {
1204    return graphDotsExcessSpaceFeedbackRatio;
1205  }
1206
1207
1208  /**
1209   * Gets how much the dots can overlap eachother when there are multiple
1210   * data values per data set and per data category.
1211   * @return ratio The ratio on the thickness of the dot for overlap.
1212   */

1213   public final float getGraphDotsWithinCategoryOverlapRatio() {
1214    return graphDotsWithinCategoryOverlapRatio;
1215  }
1216
1217
1218  /**
1219   * Gets whether the horizontal lines of this graph exist. These lines
1220   * are aligned with the axis' ticks. For each chart this graph is added to,
1221   * this property will only be respected if its the first graph added that the
1222   * chart; otherwise, graphs added after any chart would paint over the
1223   * previous graph's components.
1224   * @return boolean If true, the horizontal lines exist.
1225   */

1226  public final boolean getGraphNumbersLinesExistence() {
1227    return graphNumbersLinesExistence;
1228  }
1229
1230
1231  /**
1232   * Gets the thickness of the horizontal lines of this graph for the
1233   * chart's model size. These lines are aligned with the axis's ticks. For
1234   * each chart this graph is added to, this property will only be respected if
1235   * its the first graph added that the chart; otherwise, graphs added after any
1236   * chart would paint over the previous graph's components.
1237   * @return int The model thickness of the horizontal lines.
1238   */

1239  public final int getGraphNumbersLinesThicknessModel() {
1240    return graphNumbersLinesThicknessModel;
1241  }
1242
1243
1244  /**
1245   * Gets the style of the horizontal lines of this graph. These lines
1246   * are aligned with the axis's ticks. For each chart this graph is added to,
1247   * this property will only be respected if its the first graph added that the
1248   * chart; otherwise, graphs added after any chart would paint over the
1249   * previous graph's components. Possible values for style are:
1250   * CONTINUOUS, DASHED, and DOTTED.
1251   * @return float[] The style of the horizontal lines.
1252   */

1253  public final float[] getGraphNumbersLinesStyle() {
1254    return graphNumbersLinesStyle;
1255  }
1256
1257
1258  /**
1259   * Gets the color of the horizontal 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 horizontal lines.
1265   */

1266  public final Color JavaDoc getGraphNumbersLinesColor() {
1267    return graphNumbersLinesColor;
1268  }
1269
1270
1271  /**
1272   * Gets whether the vertical lines of this graph exist. These lines
1273   * are aligned with the axis' ticks. For each chart this graph is added to,
1274   * this property will only be respected if its the first graph added that the
1275   * chart; otherwise, graphs added after any chart would paint over the
1276   * previous graph's components.
1277   * @return boolean If true, the vertical lines exist.
1278   */

1279  public final boolean getGraphLabelsLinesExistence() {
1280    return graphLabelsLinesExistence;
1281  }
1282
1283
1284  /**
1285   * Gets the thickness of the vertical lines of this graph for the
1286   * chart's model size. These lines are aligned with the axis's ticks. For
1287   * each chart this graph is added to, this property will only be respected if
1288   * its the first graph added that the chart; otherwise, graphs added after any
1289   * chart would paint over the previous graph's components.
1290   * @return int The model thickness of the vertical lines.
1291   */

1292  public final int getGraphLabelsLinesThicknessModel() {
1293    return graphLabelsLinesThicknessModel;
1294  }
1295
1296
1297  /**
1298   * Gets the style of the vertical lines of this graph. These lines
1299   * are aligned with the axis's ticks. For each chart this graph is added to,
1300   * this property will only be respected if its the first graph added that the
1301   * chart; otherwise, graphs added after any chart would paint over the
1302   * previous graph's components. Possible values for style are:
1303   * CONTINUOUS, DASHED, and DOTTED.
1304   * @return float[] The style of the vertical lines.
1305   */

1306  public final float[] getGraphLabelsLinesStyle() {
1307    return graphLabelsLinesStyle;
1308  }
1309
1310
1311  /**
1312   * Gets the color of the vertical lines of this graph. These lines
1313   * are aligned with the axis's ticks. For each chart this graph is added to,
1314   * this property will only be respected if its the first graph added that the
1315   * chart; otherwise, graphs added after any chart would paint over the
1316   * previous graph's components.
1317   * @return Color The color of the vertical lines.
1318   */

1319  public final Color JavaDoc getGraphLabelsLinesColor() {
1320    return graphLabelsLinesColor;
1321  }
1322
1323
1324  /**
1325   * Gets whether the horizontal and vertical lines (if they both exist)
1326   * should both be the same thickness at all times. Uses the smaller thickness
1327   * if they are not already equal.
1328   * @return boolean If true, then these lines will have equal thickness.
1329   */

1330  public final boolean getGraphLinesThicknessAssociation() {
1331    return graphLinesThicknessAssociation;
1332  }
1333
1334
1335  /**
1336   * Gets the direction of the source of the light if any.
1337   * Possible values are: TOP, BOTTOM, LEFT, RIGHT, and NONE.
1338   * @return The direction of the light source.
1339   */

1340  public final int getGraphComponentsLightSource() {
1341    return graphComponentsLightSource;
1342  }
1343
1344
1345  /**
1346   * Gets the type of the lighting affect.
1347   * Possible values are: COMPONENT and GRAPH.
1348   * COMPONENT implies that the light source is positioned directly on the components (for example
1349   * leaving a complete shading affect for each component).
1350   * GRAPH implies that the light source is positioned directly on the graph (for example leaving
1351   * the components on one side of the graph lighter than the others).
1352   * @return The lighting affect type.
1353   */

1354  public final int getGraphComponentsLightType() {
1355    return graphComponentsLightType;
1356  }
1357
1358
1359  /**
1360   * Gets the degree of rounding for the bars. Uses the RoundRectangle in its implemenation.
1361   * See the arcw and arch properties for guidance of RoundRectangle.
1362   * The ratio is the diameter of the half-ellipse making the arc over the dimension in one
1363   * direction of a bar. For the "Labels" ratio, the direction is the same direction in which the
1364   * labels axis runs. Possible values are between zero and 1. Zero means less round, one means
1365   * more round.
1366   * @return The rounding ratio.
1367   */

1368  public final float getGraphBarsRoundingRatio() {
1369    return graphBarsRoundingRatio;
1370  }
1371
1372
1373  /**
1374   * Gets whether the graph's components will be clipped if they pass over the graph's inner
1375   * space or border. The only time the graph's components should not be clipped is if the graph's
1376   * inner space and border are set to not exist. Not clipping may cause components to be painted
1377   * over other chart components such as the legend or axis.
1378   * @return If true, then the components will be clipped.
1379   */

1380  public final boolean getGraphComponentsOverflowClip() {
1381    return graphComponentsOverflowClip;
1382  }
1383
1384
1385  /**
1386   * Gets whether this object needs to be updated with new properties.
1387   * @param graphChart2D The object that may need to be updated.
1388   * @return If true then needs update.
1389   */

1390  final boolean getGraphChart2DNeedsUpdate (GraphChart2D graphChart2D) {
1391
1392    if (needsUpdate) return true;
1393
1394    int index = -1;
1395    if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) {
1396      return ((Boolean JavaDoc)needsUpdateVector.get (index)).booleanValue();
1397    }
1398
1399    return false;
1400  }
1401
1402
1403  /**
1404   * Gets the actual AlphaComposite object to use on the Graphics2D object context for painting the
1405   * graph components managed by this GraphProperties object. By passing different AlphaComposite
1406   * objects, the graph components can take on a blending or transparency effect. Underneath
1407   * components can be seen through components painted over them. This is especially useful for
1408   * "line area" or "filled line" charts because top lines can paint over underneath lines if not
1409   * using a "stacked" dataset object.
1410   * @return The AlphaComposite object to use.
1411   */

1412  public final AlphaComposite JavaDoc getGraphComponentsAlphaComposite() {
1413    return graphComponentsAlphaComposite;
1414  }
1415
1416
1417  /**
1418   * Adds a GraphChart2D to the set of objects using these properties.
1419   * @param graphChart2D The Object2D to add.
1420   */

1421  final void addGraphChart2D (GraphChart2D graphChart2D) {
1422
1423    if (!graphChart2DVector.contains (graphChart2D)) {
1424      graphChart2DVector.add (graphChart2D);
1425      needsUpdateVector.add (new Boolean JavaDoc (true));
1426    }
1427  }
1428
1429
1430  /**
1431   * Removes a GraphChart2D from the set of objects using these properties.
1432   * @param graphChart2D The Object2D to remove.
1433   */

1434  final void removeGraphChart2D (GraphChart2D graphChart2D) {
1435
1436    int index = -1;
1437    if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) {
1438      graphChart2DVector.remove (index);
1439      needsUpdateVector.remove (index);
1440    }
1441  }
1442
1443
1444  /**
1445   * Validates the properties of this object.
1446   * If debug is true then prints a messages indicating whether each property is valid.
1447   * Returns true if all the properties were valid and false otherwise.
1448   * @param debug If true then will print status messages.
1449   * @return If true then valid.
1450   */

1451  final boolean validate (boolean debug) {
1452
1453    if (debug) System.out.println ("Validating GraphProperties");
1454
1455    boolean valid = true;
1456
1457    if (graphBackgroundColor == null) {
1458      valid = false;
1459      if (debug) System.out.println ("GraphBackgroundColor == null");
1460    }
1461    if (graphBorderThicknessModel < 0) {
1462      valid = false;
1463      if (debug) System.out.println ("GraphBorderThicknessModel < 0");
1464    }
1465    if (graphBorderLeftBottomColor == null) {
1466      valid = false;
1467      if (debug) System.out.println ("GraphBorderLeftBottomColor == null");
1468    }
1469    if (graphBorderRightTopColor == null) {
1470      valid = false;
1471      if (debug) System.out.println ("GraphBorderRightTopColor == null");
1472    }
1473    if (graphOutlineComponentsColor == null) {
1474      valid = false;
1475      if (debug) System.out.println ("GraphOutlineComponentsColor == null");
1476    }
1477    if (graphBetweenComponentsGapThicknessModel < 0) {
1478      valid = false;
1479      if (debug) System.out.println ("GraphBetweenComponentsGapThicknessModel < 0");
1480    }
1481    if (graphBarsThicknessModel < 0) {
1482      valid = false;
1483      if (debug) System.out.println ("GraphBarsThicknessModel < 0");
1484    }
1485    if (graphBarsExcessSpaceFeedbackRatio < 0f || graphBarsExcessSpaceFeedbackRatio > 1f) {
1486      valid = false;
1487      if (debug) System.out.println ("Problem with graphBarsExcessSpaceFeedbackRatio");
1488    }
1489    if (graphBarsWithinCategoryOverlapRatio < 0f || graphBarsWithinCategoryOverlapRatio > 1f) {
1490      valid = false;
1491      if (debug) System.out.println ("Problem with graphBarsWithinCategoryOverlapRatio");
1492    }
1493    if (graphLinesThicknessModel < 0) {
1494      valid = false;
1495      if (debug) System.out.println ("GraphLinesThicknessModel < 0");
1496    }
1497    if (graphLinesExcessSpaceFeedbackRatio < 0f || graphLinesExcessSpaceFeedbackRatio > 1f) {
1498      valid = false;
1499      if (debug) System.out.println ("Problem with graphLinesExcessSpaceFeedbackRatio");
1500    }
1501    if (graphLinesWithinCategoryOverlapRatio < 0f || graphLinesWithinCategoryOverlapRatio > 1f) {
1502      valid = false;
1503      if (debug) System.out.println ("Problem with graphLinesWithinCategoryOverlapRatio");
1504    }
1505    if (graphDotsThicknessModel < 0) {
1506      valid = false;
1507      if (debug) System.out.println ("GraphDotsThicknessModel < 0");
1508    }
1509    if (graphDotsExcessSpaceFeedbackRatio < 0f || graphDotsExcessSpaceFeedbackRatio > 1f) {
1510      valid = false;
1511      if (debug) System.out.println ("Problem with graphDotsExcessSpaceFeedbackRatio");
1512    }
1513    if (graphDotsWithinCategoryOverlapRatio < 0f || graphDotsWithinCategoryOverlapRatio > 1f) {
1514      valid = false;
1515      if (debug) System.out.println ("Problem with graphDotsWithinCategoryOverlapRatio");
1516    }
1517    if (graphNumbersLinesThicknessModel < 0) {
1518      valid = false;
1519      if (debug) System.out.println ("GraphNumbersLinesThicknessModel < 0");
1520    }
1521    if (graphNumbersLinesStyle != CONTINUOUS &&
1522      graphNumbersLinesStyle != DASHED &&
1523      graphNumbersLinesStyle != DOTTED) {
1524      valid = false;
1525      if (debug) System.out.println ("Problem with graphNumbersLinesStyle");
1526    }
1527    if (graphNumbersLinesColor == null) {
1528      valid = false;
1529      if (debug) System.out.println ("GraphNumbersLinesColor == null");
1530    }
1531    if (graphLabelsLinesThicknessModel < 0) {
1532      valid = false;
1533      if (debug) System.out.println ("GraphLabelsLinesThicknessModel < 0");
1534    }
1535    if (graphLabelsLinesStyle != CONTINUOUS &&
1536      graphLabelsLinesStyle != DASHED &&
1537      graphLabelsLinesStyle != DOTTED) {
1538      valid = false;
1539      if (debug) System.out.println ("problem with graphLabelsLinesStyle");
1540    }
1541    if (graphLabelsLinesColor == null) {
1542      valid = false;
1543      if (debug) System.out.println ("GraphLabelsLinesColor == null");
1544    }
1545    if (graphComponentsLightSource != NONE &&
1546      graphComponentsLightSource != TOP &&
1547      graphComponentsLightSource != BOTTOM &&
1548      graphComponentsLightSource != LEFT &&
1549      graphComponentsLightSource != RIGHT) {
1550      valid = false;
1551      if (debug) System.out.println ("Problem with GraphComponentsLightSource");
1552    }
1553    if (graphComponentsLightType != COMPONENT && graphComponentsLightType != GRAPH) {
1554      valid = false;
1555      if (debug) System.out.println ("Problem with GraphComponentsLightType");
1556    }
1557    if (graphBarsRoundingRatio < 0f || graphBarsRoundingRatio > 1f) {
1558      valid = false;
1559      if (debug) System.out.println ("Problem with GraphBarsRoundingRatio");
1560    }
1561    if (graphComponentsAlphaComposite == null) {
1562      valid = false;
1563      if (debug) System.out.println ("graphComponentsAlphaComposite == null");
1564    }
1565
1566    if (debug) {
1567      if (valid) System.out.println ("GraphProperties was valid");
1568      else System.out.println ("GraphProperties was invalid");
1569    }
1570
1571    return valid;
1572  }
1573
1574
1575  /**
1576   * Updates the properties of this GraphChart2D.
1577   * @param graphChart2D The object to update.
1578   */

1579  final void updateGraphChart2D (GraphChart2D graphChart2D) {
1580
1581    if (getGraphChart2DNeedsUpdate (graphChart2D)) {
1582
1583      if (needsUpdate) {
1584        for (int i = 0; i < needsUpdateVector.size(); ++i) {
1585          needsUpdateVector.set (i, new Boolean JavaDoc (true));
1586        }
1587        needsUpdate = false;
1588      }
1589
1590      int index = -1;
1591      if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) {
1592        needsUpdateVector.set (index, new Boolean JavaDoc (false));
1593      }
1594    }
1595  }
1596
1597
1598  /**
1599   * Accepts a graph area and configures it with current properties.
1600   * @param type Whether the graph is labels bottom or labels left using GraphChart2D fields.
1601   * @param graph The graph area to configure.
1602   */

1603  final void configureGraphArea (int type, GraphArea graph) {
1604
1605    graph.setBackgroundExistence (getGraphBackgroundExistence());
1606    graph.setBackgroundColor (getGraphBackgroundColor());
1607    graph.setBorderExistence (getGraphBorderExistence());
1608    graph.setBorderThicknessModel (getGraphBorderThicknessModel());
1609    graph.setBorderColors (
1610      getGraphBorderLeftBottomColor(), getGraphBorderRightTopColor(),
1611      getGraphBorderRightTopColor(), getGraphBorderLeftBottomColor());
1612    graph.setAllowComponentAlignment (getGraphAllowComponentAlignment());
1613    graph.setOutlineComponents (getGraphOutlineComponentsExistence());
1614    graph.setOutlineComponentsColor (getGraphOutlineComponentsColor());
1615    graph.setBetweenComponentsGapExistence (getGraphBetweenComponentsGapExistence());
1616    graph.setBetweenComponentsGapThicknessModel (getGraphBetweenComponentsGapThicknessModel());
1617    graph.setBarsExistence (getGraphBarsExistence());
1618    graph.setBarsThicknessModel (getGraphBarsThicknessModel());
1619    graph.setBarsExcessSpaceFeedbackRatio (getGraphBarsExcessSpaceFeedbackRatio());
1620    graph.setBarsWithinCategoryOverlapRatio (getGraphBarsWithinCategoryOverlapRatio());
1621    graph.setLinesExistence (getGraphLinesExistence());
1622    graph.setLinesThicknessModel (getGraphLinesThicknessModel());
1623    graph.setLinesFillInterior (getGraphLinesFillInterior());
1624    graph.setLinesExcessSpaceFeedbackRatio (getGraphLinesExcessSpaceFeedbackRatio());
1625    graph.setLinesWithinCategoryOverlapRatio (getGraphLinesWithinCategoryOverlapRatio());
1626    graph.setDotsExistence (getGraphDotsExistence());
1627    graph.setDotsThicknessModel (getGraphDotsThicknessModel());
1628    graph.setDotsExcessSpaceFeedbackRatio (getGraphDotsExcessSpaceFeedbackRatio());
1629    graph.setDotsWithinCategoryOverlapRatio (getGraphDotsWithinCategoryOverlapRatio());
1630    graph.setBarRoundingRatio (getGraphBarsRoundingRatio());
1631
1632    if (type == GraphChart2D.LABELS_BOTTOM) {
1633
1634      graph.setHorizontalLinesExistence (getGraphNumbersLinesExistence());
1635      graph.setHorizontalLinesThicknessModel (getGraphNumbersLinesThicknessModel());
1636      graph.setHorizontalLinesStyle (getGraphNumbersLinesStyle());
1637      graph.setHorizontalLinesColor (getGraphNumbersLinesColor());
1638      graph.setVerticalLinesExistence (getGraphLabelsLinesExistence());
1639      graph.setVerticalLinesThicknessModel (getGraphLabelsLinesThicknessModel());
1640      graph.setVerticalLinesStyle (getGraphLabelsLinesStyle());
1641      graph.setVerticalLinesColor (getGraphLabelsLinesColor());
1642    }
1643    else {
1644
1645      graph.setVerticalLinesExistence (getGraphNumbersLinesExistence());
1646      graph.setVerticalLinesThicknessModel (getGraphNumbersLinesThicknessModel());
1647      graph.setVerticalLinesStyle (getGraphNumbersLinesStyle());
1648      graph.setVerticalLinesColor (getGraphNumbersLinesColor());
1649      graph.setHorizontalLinesExistence (getGraphLabelsLinesExistence());
1650      graph.setHorizontalLinesThicknessModel (getGraphLabelsLinesThicknessModel());
1651      graph.setHorizontalLinesStyle (getGraphLabelsLinesStyle());
1652      graph.setHorizontalLinesColor (getGraphLabelsLinesColor());
1653    }
1654
1655    graph.setLinesThicknessAssociation (getGraphLinesThicknessAssociation());
1656    graph.setComponentsLightSource (getGraphComponentsLightSource());
1657    graph.setComponentsLightType (getGraphComponentsLightType());
1658    graph.setClip (getGraphComponentsOverflowClip());
1659    graph.setComponentsAlphaComposite (getGraphComponentsAlphaComposite());
1660  }
1661
1662
1663  /**
1664   * Accepts a graph area and configures it with current properties.
1665   * Uses the properties of the background graph in order to overlay correctly.
1666   * @param backgroundGraphProps The properties of the background graph.
1667   * @param type Whether the graph is labels bottom or labels left using GraphChart2D fields.
1668   * @param graph The graph area to configure.
1669   */

1670  final void configureGraphArea (GraphProperties backgroundGraphProps, int type, GraphArea graph) {
1671
1672    graph.setBackgroundExistence (false);
1673    graph.setBorderExistence (backgroundGraphProps.getGraphBorderExistence());
1674    graph.setBorderThicknessModel (backgroundGraphProps.getGraphBorderThicknessModel());
1675    graph.setBorderColors (
1676      backgroundGraphProps.getGraphBorderLeftBottomColor(),
1677      backgroundGraphProps.getGraphBorderRightTopColor(),
1678      backgroundGraphProps.getGraphBorderRightTopColor(),
1679      backgroundGraphProps.getGraphBorderLeftBottomColor());
1680    graph.setAllowComponentAlignment (getGraphAllowComponentAlignment());
1681    graph.setOutlineComponents (getGraphOutlineComponentsExistence());
1682    graph.setOutlineComponentsColor (getGraphOutlineComponentsColor());
1683    graph.setBetweenComponentsGapExistence (getGraphBetweenComponentsGapExistence());
1684    graph.setBetweenComponentsGapThicknessModel (getGraphBetweenComponentsGapThicknessModel());
1685    graph.setBarsExistence (getGraphBarsExistence());
1686    graph.setBarsThicknessModel (getGraphBarsThicknessModel());
1687    graph.setBarsExcessSpaceFeedbackRatio (getGraphBarsExcessSpaceFeedbackRatio());
1688    graph.setBarsWithinCategoryOverlapRatio (getGraphBarsWithinCategoryOverlapRatio());
1689    graph.setLinesExistence (getGraphLinesExistence());
1690    graph.setLinesThicknessModel (getGraphLinesThicknessModel());
1691    graph.setLinesFillInterior (getGraphLinesFillInterior());
1692    graph.setLinesExcessSpaceFeedbackRatio (getGraphLinesExcessSpaceFeedbackRatio());
1693    graph.setLinesWithinCategoryOverlapRatio (getGraphLinesWithinCategoryOverlapRatio());
1694    graph.setDotsExistence (getGraphDotsExistence());
1695    graph.setDotsThicknessModel (getGraphDotsThicknessModel());
1696    graph.setDotsExcessSpaceFeedbackRatio (getGraphDotsExcessSpaceFeedbackRatio());
1697    graph.setDotsWithinCategoryOverlapRatio (getGraphDotsWithinCategoryOverlapRatio());
1698
1699    graph.setHorizontalLinesExistence (false);
1700    graph.setVerticalLinesExistence (false);
1701    graph.setBarRoundingRatio (getGraphBarsRoundingRatio());
1702
1703    graph.setComponentsLightSource (getGraphComponentsLightSource());
1704    graph.setComponentsLightType (getGraphComponentsLightType());
1705    graph.setClip (getGraphComponentsOverflowClip());
1706    graph.setComponentsAlphaComposite (getGraphComponentsAlphaComposite());
1707  }
1708}
Popular Tags