KickJava   Java API By Example, From Geeks To Geeks.

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


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

22
23
24 package net.sourceforge.chart2d;
25
26
27 import java.awt.*;
28 import java.util.*;
29
30
31 /**
32  * An abstract class for the common methods of LBChart2D and LLChart2D.
33  * A GraphChart2D object is an area that contains axes and one or more overlaid graphs.
34  * Changes through its set methods are updated upon next repaint() or getImage() calls.
35  */

36 public abstract class GraphChart2D extends Chart2D {
37
38
39   /**
40    * Indicates a LBGraphArea.
41    */

42   static final int LABELS_BOTTOM = 0;
43
44   /**
45    * Indicates a LLGraphArea.
46    */

47   static final int LABELS_LEFT = 1;
48
49
50   private GraphChart2DProperties graphChart2DProps;
51   private Vector graphPropsVector = new Vector (5, 5);
52   private Vector datasetsVector = new Vector (5, 5);
53   private Vector multiColorsPropsVector = new Vector (5, 5);
54   private Vector warningRegionPropsVector = new Vector (5, 5);
55   private boolean needsUpdate;
56
57
58   /**
59    * Creates a GraphChart2D object with its defaults.
60    * A GraphChart2DProperties object must be set for this object before it is used.
61    * A GraphProperties object must be added for this object before it is used.
62    * A Dataset object must be added for this object before it is used.
63    * A MultiColorsProperties object must be added for this object before it is used.
64    */

65   public GraphChart2D() {
66     needsUpdate = true;
67   }
68
69
70   /**
71    * Sets the GraphChart2DProperties for this GraphChart2D.
72    * @param props The GraphChart2DProperties.
73    */

74   public final void setGraphChart2DProperties (GraphChart2DProperties props) {
75
76     needsUpdate = true;
77     props.addGraphChart2D (this);
78     if (graphChart2DProps != null) graphChart2DProps.removeGraphChart2D (this);
79     graphChart2DProps = props;
80   }
81
82
83   /**
84    * Sets the allocation of space to each component of a graph chart.
85    * There are four components: numbers axis, labels axis, graph, and legend.
86    * The ratios of the axes can be determined from the ratios of the graph and the legend.
87    * Depending on the chart type, the left and bottom axes can be the numbers axis and labels axis.
88    * The width of the left axis is 1f - graphW - legendW.
89    * The width of the bottom axis is graphW.
90    * The height of the left axis is graphH.
91    * The ratio of the legend height is always 1f.
92    * @param graphW The ratio of graph width to total.
93    * @param graphH The ratio of graph height to total.
94    * @param legendW The ratio of graph width to total.
95    * @param legendH The ratio of legend height to total.
96    */

97   public final void setLayoutRatios (float graphW, float graphH, float legendW) {
98
99     needsUpdate = true;
100     GraphChartArea chart = (GraphChartArea)getObjectArea();
101
102     chart.setGraphToWidthRatio (graphW);
103     chart.setGraphToHeightRatio (graphH);
104     chart.setLegendToWidthRatio (legendW);
105     chart.setLegendToHeightRatio (1f);
106
107     float numbersW, numbersH, labelsW, labelsH;
108     if (getGraphChartType() == LABELS_BOTTOM) {
109
110       numbersW = 1f - graphW - legendW;
111       numbersH = graphH;
112       labelsW = graphW;
113       labelsH = 1f - graphH;
114
115       chart.setYAxisToWidthRatio (numbersW);
116       chart.setYAxisToHeightRatio (numbersH);
117       chart.setXAxisToWidthRatio (labelsW);
118       chart.setXAxisToHeightRatio (labelsH);
119     }
120     else {
121
122       numbersW = graphW;
123       numbersH = 1 - graphH;
124       labelsW = 1 - graphW - legendW;
125       labelsH = graphH;
126
127       chart.setYAxisToWidthRatio (labelsW);
128       chart.setYAxisToHeightRatio (labelsH);
129       chart.setXAxisToWidthRatio (numbersW);
130       chart.setXAxisToHeightRatio (numbersH);
131     }
132
133     chart.setAutoSetLayoutRatios (true);
134   }
135
136
137   /**
138    * Gets the GraphChart2DProperties for this Chart2D.
139    * @param props The GraphChart2DProperties.
140    */

141   public final GraphChart2DProperties getGraphChart2DProperties() {
142     return graphChart2DProps;
143   }
144
145
146   /**
147    * Gets a graph properties based on the order the graph properties were added.
148    * First added is number zero.
149    * @return The graph properties object added to this chart.
150    */

151   public final GraphProperties getGraphProperties (int i) {
152     return (GraphProperties)graphPropsVector.get (i);
153   }
154
155
156   /**
157    * Gets a dataset based on the order the dataset was added.
158    * First added is number zero.
159    * @return The dataset added to this chart.
160    */

161   public final Dataset getDataset (int i) {
162     return (Dataset)datasetsVector.get (i);
163   }
164
165
166   /**
167    * Gets a multiColorsProps based on the order the multiColorsProps was added.
168    * First added is number zero.
169    * @return The multiColorsProps added to this chart.
170    */

171   public final MultiColorsProperties getMultiColorsProperties (int i) {
172     return (MultiColorsProperties)multiColorsPropsVector.get (i);
173   }
174
175
176   /**
177    * Gets a warning region properties based on the order the properties were added.
178    * First added is number zero.
179    * @return The warning region properties object added to this chart.
180    */

181   public final WarningRegionProperties getWarningRegionProperties (int i) {
182     return (WarningRegionProperties)warningRegionPropsVector.get (i);
183   }
184
185
186   /**
187    * Adds a GraphProperties object to this chart.
188    * @param graphProps The graph properties to add to this chart.
189    */

190   public final void addGraphProperties (GraphProperties graphProps) {
191     needsUpdate = true;
192     graphProps.addGraphChart2D (this);
193     graphPropsVector.add (graphProps);
194   }
195
196
197   /**
198    * Adds a Dataset object to this chart.
199    * @param dataset The dataset to add to this chart.
200    */

201   public final void addDataset (Dataset dataset) {
202     needsUpdate = true;
203     dataset.addChart2D (this);
204     datasetsVector.add (dataset);
205   }
206
207
208   /**
209    * Adds a MultiColorsProperties object to this chart.
210    * @param multiColorsProps The multi colors properties to add to this chart.
211    */

212   public final void addMultiColorsProperties (MultiColorsProperties multiColorsProps) {
213     needsUpdate = true;
214     multiColorsProps.addObject2D (this);
215     multiColorsPropsVector.add (multiColorsProps);
216   }
217
218
219   /**
220    * Adds a WarningRegionProperties object to this chart.
221    * @param warningRegion The warning region properties to add to this chart.
222    */

223   public final void addWarningRegionProperties (WarningRegionProperties warningRegionProps) {
224     needsUpdate = true;
225     warningRegionProps.addGraphChart2D (this);
226     warningRegionPropsVector.add (warningRegionProps);
227   }
228
229
230   /**
231    * Removes GraphProperties object from this chart.
232    * @param graphProps The graph properties to remove from this chart.
233    */

234   public final void removeGraphProperties (GraphProperties graphProps) {
235     needsUpdate = true;
236     graphProps.removeGraphChart2D (this);
237     graphPropsVector.remove (graphProps);
238   }
239
240
241   /**
242    * Removes a Dataset object from this chart.
243    * @param dataset The dataset to remove from this chart.
244    */

245   public final void removeDataset (Dataset dataset) {
246     needsUpdate = true;
247     dataset.removeChart2D (this);
248     datasetsVector.remove (dataset);
249   }
250
251
252   /**
253    * Removes a MultiColorsProperties object from this chart.
254    * @param multiColorsProperties The multi colors properties to remove from this chart.
255    */

256   public final void removeMultiColorsProperties (MultiColorsProperties multiColorsProps) {
257     needsUpdate = true;
258     multiColorsProps.removeObject2D (this);
259     multiColorsPropsVector.remove (multiColorsProps);
260   }
261
262
263   /**
264    * Removes a warning region with the specified properties to this chart.
265    * @param warningRegion The warning region to remove from this chart.
266    */

267   public final void removeWarningRegionProperties (WarningRegionProperties warningRegionProps) {
268     needsUpdate = true;
269     warningRegionProps.removeGraphChart2D (this);
270     warningRegionPropsVector.remove (warningRegionProps);
271   }
272
273
274   /**
275    * Returns either LABELS_BOTTOM or LABELS_LEFT depending on whether LBChart2D or LLChart2D.
276    * @return The type of the chart.
277    */

278   abstract int getGraphChartType();
279
280
281   /**
282    * Gets the number of sets total over all the Dataset objects.
283    * @return The total number of sets.
284    */

285   final int getNumSetsTotal() {
286
287     int numSets = 0;
288     for (int i = 0; i < datasetsVector.size(); ++i) {
289       numSets += ((Dataset)datasetsVector.get (i)).getNumSets();
290     }
291     return numSets;
292   }
293
294
295   /**
296    * Gets the vector of GraphProperties objects that were added.
297    * @return The graph properties objects vector.
298    */

299   final Vector getGraphPropertiesVector() {
300     return graphPropsVector;
301   }
302
303
304   /**
305    * Gets the vector of Dataset objects that were added.
306    * @return The dataset objects vector.
307    */

308   final Vector getDatasetsVector() {
309     return datasetsVector;
310   }
311
312
313   /**
314    * Gets the vector of MultiColorsProperties objects that were added.
315    * @return The multi colors properties objects vector.
316    */

317   final Vector getMultiColorsPropertiesVector() {
318     return multiColorsPropsVector;
319   }
320
321
322   /**
323    * Gets the vector of WarningRegionProperties objects that were added.
324    * @return The warning region properties objects vector.
325    */

326   final Vector getWarningRegionPropertiesVector() {
327     return warningRegionPropsVector;
328   }
329
330
331   /**
332    * Gets whether this object needs to be updated.
333    * @return If true then needs update.
334    */

335   final boolean getNeedsUpdateGraphChart2D() {
336
337     if (needsUpdate) return true;
338     if (getNeedsUpdateChart2D()) return true;
339     if (graphChart2DProps.getGraphChart2DNeedsUpdate (this)) return true;
340
341     for (int i = 0; i < graphPropsVector.size(); ++i) {
342       if (((GraphProperties)graphPropsVector.get (i)).
343         getGraphChart2DNeedsUpdate (this)) return true;
344     }
345     for (int i = 0; i < datasetsVector.size(); ++i) {
346       if (((Dataset)datasetsVector.get (i)).
347         getChart2DNeedsUpdate (this)) return true;
348     }
349     for (int i = 0; i < multiColorsPropsVector.size(); ++i) {
350       if (((MultiColorsProperties)multiColorsPropsVector.get (i)).
351         getObject2DNeedsUpdate (this)) return true;
352     }
353     for (int i = 0; i < warningRegionPropsVector.size(); ++i) {
354       if (((WarningRegionProperties)warningRegionPropsVector.get (i)).
355         getGraphChart2DNeedsUpdate (this)) return true;
356     }
357
358     return false;
359   }
360
361
362   /**
363    * Validates the properties of this object.
364    * If debug is true then prints a messages indicating whether each property is valid.
365    * Returns true if all the properties were valid and false otherwise.
366    * @param debug If true then will print status messages.
367    * @return If true then valid.
368    */

369   final boolean validateGraphChart2D (boolean debug) {
370
371     if (debug) System.out.println ("Validating GraphChart2D");
372
373     boolean valid = true;
374
375     if (!validateChart2D (debug)) valid = false;
376
377     GraphChartArea chart = (GraphChartArea)getObjectArea();
378
379     if (
380       chart.getXAxisToWidthRatio() < 0f || chart.getXAxisToWidthRatio() > 1f ||
381       chart.getXAxisToHeightRatio() < 0f || chart.getXAxisToHeightRatio() > 1f ||
382       chart.getYAxisToWidthRatio() < 0f || chart.getYAxisToWidthRatio() > 1f ||
383       chart.getYAxisToHeightRatio() < 0f || chart.getYAxisToHeightRatio() > 1f ||
384       chart.getGraphToWidthRatio() < 0f || chart.getGraphToWidthRatio() > 1f ||
385       chart.getGraphToHeightRatio() < 0f || chart.getGraphToHeightRatio() > 1f ||
386       chart.getLegendToWidthRatio() < 0f || chart.getLegendToWidthRatio() > 1f ||
387       chart.getLegendToHeightRatio() < 0f || chart.getLegendToHeightRatio() > 1f) {
388       valid = false;
389       if (debug) System.out.println ("Chart components ratios need to be between 0 and 1");
390     }
391
392     if (graphChart2DProps == null) {
393       valid = false;
394       if (debug) System.out.println ("GraphChart2DProperties is null");
395     }
396     else if (!graphChart2DProps.validate (debug)) valid = false;
397
398     //Restriction: Number of GraphProperties must equal number of Datasets and MultiColorsProps
399
if (graphPropsVector.size() != datasetsVector.size() ||
400       datasetsVector.size() != multiColorsPropsVector.size()) {
401       valid = false;
402       if (debug) System.out.println (
403         "Number of GraphProperties, Datasets, and MultiColorsPropertes objects must be equal");
404     }
405
406     //Restriction: At least one object of each GraphProperties, Dataset, and MultiColorsProperties
407
if (valid) {
408       if (graphPropsVector.size() < 1) {
409         valid = false;
410         if (debug) System.out.println (
411           "Need at least one of each GraphProperties, Dataset, and MultiColorsProperties");
412       }
413     }
414
415     if (valid) {
416
417       for (int i = 0; i < graphPropsVector.size(); ++i) {
418
419         if (debug) System.out.println ("Checking GraphProperties Object " + i);
420         if (!((GraphProperties)graphPropsVector.get (i)).validate (debug)) valid = false;
421       }
422       for (int i = 0; i < datasetsVector.size(); ++i) {
423
424         if (debug) System.out.println ("Checking Datasets Object " + i);
425         if (!((Dataset)datasetsVector.get (i)).validate (debug)) valid = false;
426       }
427       for (int i = 0; i < multiColorsPropsVector.size(); ++i) {
428
429         if (debug) System.out.println ("Checking MultiColorsProperties Object " + i);
430         if (
431           !((MultiColorsProperties)multiColorsPropsVector.get (i)).validate (debug)) valid = false;
432       }
433       for (int i = 0; i < warningRegionPropsVector.size(); ++i) {
434
435         if (debug) System.out.println ("Checking WarningRegionProperties Object " + i);
436         if (!((WarningRegionProperties)warningRegionPropsVector.get (i)).validate (debug)) {
437           valid = false;
438         }
439       }
440     }
441
442     //Restriction: There must be a legend label for each dataset, if the legend exists.
443
if (valid) {
444
445       if (getLegendProperties().getLegendExistence() &&
446         getLegendProperties().getLegendLabelsTexts().length != getNumSetsTotal()) {
447         valid = false;
448         if (debug) System.out.println (
449           "Number of legend labels must equal total number of sets for all datasets");
450       }
451     }
452
453     //Restriction: If dataset at least one and multi colors custom, then at least one custom color
454
if (valid) {
455
456       for (int i = 0; i < datasetsVector.size(); ++i) {
457
458         MultiColorsProperties multiColorsProps =
459           (MultiColorsProperties)multiColorsPropsVector.get (i);
460         if (((Dataset)datasetsVector.get (i)).getNumSets() > 0 &&
461           multiColorsProps.getColorsCustomize() &&
462           multiColorsProps.getColorsCustom().length < 1) {
463             valid = false;
464           if (debug) System.out.println ("Not enough custom colors for MultiColorsProperties " + i);
465         }
466       }
467     }
468
469     //Restriction: All datasets must have equal num cats.
470
if (valid) {
471
472       int numCats = ((Dataset)datasetsVector.get (0)).getNumCats();
473       for (int i = 1; i < datasetsVector.size(); ++i) {
474
475         if (numCats != ((Dataset)datasetsVector.get (i)).getNumCats()) {
476           valid = false;
477           if (debug) System.out.println (
478             "Dataset doesn't have same number of cats as first dataset " + i);
479         }
480       }
481     }
482
483     //Restriction: If labels axis exists, then num labels must equal num dataset cats
484
if (valid) {
485
486       if (graphChart2DProps.getLabelsAxisExistence() &&
487         graphChart2DProps.getLabelsAxisLabelsTexts().length !=
488         ((Dataset)datasetsVector.get (0)).getNumCats()) {
489         valid = false;
490         if (debug) System.out.println (
491           "Number of labels axis labels must equal number of cats in each dataset");
492       }
493     }
494
495     //Restriction: If cat coloring and num cats > 0, then cat colors > 0
496
if (valid) {
497
498       if (graphChart2DProps.getGraphComponentsColoringByCat() &&
499       ((Dataset)datasetsVector.get (0)).getNumCats() > 0 &&
500       graphChart2DProps.getGraphComponentsColorsByCat().getColorsCustomize() &&
501       graphChart2DProps.getGraphComponentsColorsByCat().getColorsCustom().length < 1) {
502         valid = false;
503         if (debug) System.out.println ("Not enough custom colors for cat coloring");
504       }
505     }
506
507     if (debug) {
508       if (valid) System.out.println ("GraphChart2D was valid");
509       else {
510         System.out.println (
511           "Possibly unable to check for all invalidities because of early invalidity");
512         System.out.println ("GraphChart2D was invalid");
513       }
514     }
515
516     return valid;
517   }
518
519
520   /**
521    * Updates this object.
522    */

523   final void updateGraphChart2D() {
524
525     if (getNeedsUpdateGraphChart2D()) {
526
527       needsUpdate = false;
528
529       updateChart2D();
530
531       graphChart2DProps.updateGraphChart2D (this);
532       for (int i = 0; i < datasetsVector.size(); ++i) {
533         ((Dataset)datasetsVector.get (i)).updateChart2D (this);
534       }
535       for (int i = 0; i < multiColorsPropsVector.size(); ++i) {
536         ((MultiColorsProperties)multiColorsPropsVector.get (i)).updateObject2D (this);
537       }
538       for (int i = 0; i < graphPropsVector.size(); ++i) {
539         ((GraphProperties)graphPropsVector.get (i)).updateGraphChart2D (this);
540       }
541       for (int i = 0; i < warningRegionPropsVector.size(); ++i) {
542         ((WarningRegionProperties)warningRegionPropsVector.get (i)).updateGraphChart2D (this);
543       }
544
545       int chartType = getGraphChartType();
546       GraphChartArea graphChart = (GraphChartArea)getObjectArea();
547
548       //configure chart's data
549
graphChart.setDatasetVector (datasetsVector);
550
551       //configure chart's graph properties
552
GraphProperties backgroundGraphProps =
553         (GraphProperties)graphPropsVector.get (graphPropsVector.size() - 1);
554       Vector graphVector = new Vector (graphPropsVector.size(), 0);
555
556       for (int i = graphPropsVector.size() - 2; i >= 0; --i) {
557         GraphArea graph =
558           chartType == LABELS_BOTTOM ? (GraphArea)new LBGraphArea() : (GraphArea)new LLGraphArea();
559         ((GraphProperties)graphPropsVector.get (i)).configureGraphArea (
560           backgroundGraphProps, chartType, graph);
561         graphVector.add (graph);
562       }
563
564       GraphArea graph =
565         chartType == LABELS_BOTTOM ? (GraphArea)new LBGraphArea() : (GraphArea)new LLGraphArea();
566       backgroundGraphProps.configureGraphArea (chartType, graph);
567       graphVector.add (graph);
568
569       graphChart.setGraphVector (graphVector);
570
571       //configure warning regions for background graph only
572
Vector warningRegionsVector = new Vector (warningRegionPropsVector.size(), 0);
573       for (int i = 0; i < warningRegionPropsVector.size(); ++i) {
574         WarningRegion warningRegion =
575           ((WarningRegionProperties)warningRegionPropsVector.get (i)).configureWarningRegion();
576         warningRegion.setGraphType (chartType);
577         warningRegionsVector.add (warningRegion);
578
579       }
580       graphChart.setWarningRegions (warningRegionsVector);
581
582       //create color array from multi colors, one color for each set
583
int numSets = getNumSetsTotal();
584       Color[] multiColors = new Color[numSets];
585       int k = 0;
586       for (int i = 0; i < multiColorsPropsVector.size(); ++i) {
587         MultiColorsProperties multiColorsProps =
588           (MultiColorsProperties)multiColorsPropsVector.get (i);
589         int numSetsThis = ((Dataset)datasetsVector.get (i)).getNumSets();
590         Color[] producer = multiColorsProps.getColorsArray (numSetsThis);
591         for (int j = 0; j < producer.length; ++j) {
592           multiColors[k] = producer[j];
593           ++k;
594         }
595       }
596       graphChart.setDatasetColors (multiColors);
597
598       graphChart.setCustomGreatestValue (
599         graphChart2DProps.getChartDatasetCustomizeGreatestValue(),
600         graphChart2DProps.getChartDatasetCustomGreatestValue());
601       graphChart.setCustomLeastValue (
602         graphChart2DProps.getChartDatasetCustomizeLeastValue(),
603         graphChart2DProps.getChartDatasetCustomLeastValue());
604       graphChart.setGraphableToAvailableRatio (
605         graphChart2DProps.getChartGraphableToAvailableRatio());
606       graphChart.setNumPlotAxisLabels (graphChart2DProps.getNumbersAxisNumLabels());
607
608       graphChart.setGraphComponentsColoringByCat (
609         graphChart2DProps.getGraphComponentsColoringByCat());
610       if (graphChart2DProps.getGraphComponentsColoringByCat()) {
611         graphChart.setGraphComponentsColorsByCat (
612           graphChart2DProps.getGraphComponentsColorsByCat().getColorsArray (
613           ((Dataset)datasetsVector.get (0)).getNumCats()));
614       }
615
616       AxisArea labelsAxis;
617       AxisArea numbersAxis;
618       TextListArea labelsAxisTextList;
619       TextListArea numbersAxisTextList;
620       if (chartType == LABELS_BOTTOM) {
621         labelsAxis = graphChart.getXAxis();
622         numbersAxis = graphChart.getYAxis();
623         labelsAxisTextList = ((XAxisArea)labelsAxis).getTextList();
624         numbersAxisTextList = ((YAxisArea)numbersAxis).getTextList();
625       }
626       else {
627         labelsAxis = graphChart.getYAxis();
628         numbersAxis = graphChart.getXAxis();
629         labelsAxisTextList = ((YAxisArea)labelsAxis).getTextList();
630         numbersAxisTextList = ((XAxisArea)numbersAxis).getTextList();
631       }
632
633       labelsAxis.setTicksAlignment (graphChart2DProps.getLabelsAxisTicksAlignment());
634       labelsAxisTextList.setLabels (graphChart2DProps.getLabelsAxisLabelsTexts());
635
636       labelsAxis.setTitleExistence (graphChart2DProps.getLabelsAxisTitleExistence());
637       labelsAxis.setTitle (graphChart2DProps.getLabelsAxisTitleText());
638       labelsAxis.setFontPointModel (graphChart2DProps.getLabelsAxisTitleFontPointModel());
639       labelsAxis.setFontName (graphChart2DProps.getLabelsAxisTitleFontName());
640       labelsAxis.setFontColor (graphChart2DProps.getLabelsAxisTitleFontColor());
641       labelsAxis.setFontStyle (graphChart2DProps.getLabelsAxisTitleFontStyle());
642       labelsAxis.setBetweenTitleAndSpaceGapExistence (
643         graphChart2DProps.getLabelsAxisTitleBetweenRestGapExistence());
644       labelsAxis.setBetweenTitleAndSpaceGapThicknessModel (
645         graphChart2DProps.getLabelsAxisTitleBetweenRestGapThicknessModel());
646       labelsAxis.setTicksSizeModel (graphChart2DProps.getLabelsAxisTicksExistence() ?
647         graphChart2DProps.getLabelsAxisTicksSizeModel() : new Dimension());
648       labelsAxis.setTicksColor (graphChart2DProps.getLabelsAxisTicksColor());
649       labelsAxisTextList.setBulletsOutline (graphChart2DProps.getLabelsAxisTicksOutlineExistence());
650       labelsAxisTextList.setBulletsOutlineColor (graphChart2DProps.getLabelsAxisTicksOutlineColor());
651       labelsAxisTextList.setFontPointModel (graphChart2DProps.getLabelsAxisLabelsFontPointModel());
652       labelsAxisTextList.setFontName (graphChart2DProps.getLabelsAxisLabelsFontName());
653       labelsAxisTextList.setFontColor (graphChart2DProps.getLabelsAxisLabelsFontColor());
654       labelsAxisTextList.setFontStyle (graphChart2DProps.getLabelsAxisLabelsFontStyle());
655       labelsAxisTextList.setBetweenBulletsGapExistence (
656         graphChart2DProps.getLabelsAxisBetweenLabelsOrTicksGapExistence());
657       labelsAxisTextList.setBetweenLabelsGapExistence (
658         graphChart2DProps.getLabelsAxisBetweenLabelsOrTicksGapExistence());
659       labelsAxisTextList.setBetweenBulletsGapThicknessModel (
660         graphChart2DProps.getLabelsAxisBetweenLabelsOrTicksGapThicknessModel());
661       labelsAxisTextList.setBetweenLabelsGapThicknessModel (
662         graphChart2DProps.getLabelsAxisBetweenLabelsOrTicksGapThicknessModel());
663       labelsAxisTextList.setBetweenBulletsAndLabelsGapExistence (
664         graphChart2DProps.getLabelsAxisBetweenLabelsAndTicksGapExistence());
665       labelsAxisTextList.setBetweenBulletsAndLabelsGapThicknessModel (
666         graphChart2DProps.getLabelsAxisBetweenLabelsAndTicksGapThicknessModel());
667
668       if (!graphChart2DProps.getLabelsAxisExistence()) {
669         int numCats = ((Dataset)datasetsVector.get (0)).getNumCats();
670         labelsAxis.setTitleExistence (false);
671         labelsAxisTextList.setBetweenBulletsAndLabelsGapExistence (false);
672         labelsAxisTextList.setBetweenBulletsGapExistence (false);
673         labelsAxisTextList.setBetweenLabelsGapExistence (false);
674         labelsAxisTextList.setBulletsSizeModel (new Dimension());
675         labelsAxisTextList.setFontPointModel (0);
676         String JavaDoc[] labels = new String JavaDoc[numCats];
677         for (int i = 0; i < numCats; ++i) labels[i] = "";
678         labelsAxisTextList.setLabels (labels);
679       }
680
681       numbersAxis.setTitleExistence (graphChart2DProps.getNumbersAxisTitleExistence());
682       numbersAxis.setTitle (graphChart2DProps.getNumbersAxisTitleText());
683       numbersAxis.setFontPointModel (graphChart2DProps.getNumbersAxisTitleFontPointModel());
684       numbersAxis.setFontName (graphChart2DProps.getNumbersAxisTitleFontName());
685       numbersAxis.setFontColor (graphChart2DProps.getNumbersAxisTitleFontColor());
686       numbersAxis.setFontStyle (graphChart2DProps.getNumbersAxisTitleFontStyle());
687       numbersAxis.setBetweenTitleAndSpaceGapExistence (
688         graphChart2DProps.getNumbersAxisTitleBetweenRestGapExistence());
689       numbersAxis.setBetweenTitleAndSpaceGapThicknessModel (
690         graphChart2DProps.getNumbersAxisTitleBetweenRestGapThicknessModel());
691       numbersAxis.setTicksSizeModel (graphChart2DProps.getNumbersAxisTicksExistence() ?
692         graphChart2DProps.getNumbersAxisTicksSizeModel() : new Dimension());
693       numbersAxis.setTicksColor (graphChart2DProps.getNumbersAxisTicksColor());
694       numbersAxisTextList.setBulletsOutline (graphChart2DProps.getNumbersAxisTicksOutlineExistence());
695       numbersAxisTextList.setBulletsOutlineColor (graphChart2DProps.getNumbersAxisTicksOutlineColor());
696       numbersAxisTextList.setFontPointModel (graphChart2DProps.getNumbersAxisLabelsFontPointModel());
697       numbersAxisTextList.setFontName (graphChart2DProps.getNumbersAxisLabelsFontName());
698       numbersAxisTextList.setFontColor (graphChart2DProps.getNumbersAxisLabelsFontColor());
699       numbersAxisTextList.setFontStyle (graphChart2DProps.getNumbersAxisLabelsFontStyle());
700       numbersAxisTextList.setBetweenBulletsGapExistence (
701         graphChart2DProps.getNumbersAxisBetweenLabelsOrTicksGapExistence());
702       numbersAxisTextList.setBetweenLabelsGapExistence (
703         graphChart2DProps.getNumbersAxisBetweenLabelsOrTicksGapExistence());
704       numbersAxisTextList.setBetweenBulletsGapThicknessModel (
705         graphChart2DProps.getNumbersAxisBetweenLabelsOrTicksGapThicknessModel());
706       numbersAxisTextList.setBetweenLabelsGapThicknessModel (
707         graphChart2DProps.getNumbersAxisBetweenLabelsOrTicksGapThicknessModel());
708       numbersAxisTextList.setBetweenBulletsAndLabelsGapExistence (
709         graphChart2DProps.getNumbersAxisBetweenLabelsAndTicksGapExistence());
710       numbersAxisTextList.setBetweenBulletsAndLabelsGapThicknessModel (
711         graphChart2DProps.getNumbersAxisBetweenLabelsAndTicksGapThicknessModel());
712     }
713   }
714 }
Popular Tags