KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > krysalis > jcharts > test > StackedAreaTestDriver


1 /***********************************************************************************************
2  * File Info: $Id: StackedAreaTestDriver.java,v 1.1 2003/05/17 17:01:13 nathaniel_auvil Exp $
3  * Copyright (C) 2000
4  * Author: Nathaniel G. Auvil
5  * Contributor(s):
6  *
7  * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
8  *
9  * Redistribution and use of this software and associated documentation
10  * ("Software"), with or without modification, are permitted provided
11  * that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain copyright
14  * statements and notices. Redistributions must also contain a
15  * copy of this document.
16  *
17  * 2. Redistributions in binary form must reproduce the
18  * above copyright notice, this list of conditions and the
19  * following disclaimer in the documentation and/or other
20  * materials provided with the distribution.
21  *
22  * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to
23  * endorse or promote products derived from this Software without
24  * prior written permission of Nathaniel G. Auvil. For written
25  * permission, please contact nathaniel_auvil@users.sourceforge.net
26  *
27  * 4. Products derived from this Software may not be called "jCharts"
28  * nor may "jCharts" appear in their names without prior written
29  * permission of Nathaniel G. Auvil. jCharts is a registered
30  * trademark of Nathaniel G. Auvil.
31  *
32  * 5. Due credit should be given to the jCharts Project
33  * (http://jcharts.sourceforge.net/).
34  *
35  * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS
36  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
37  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
38  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
39  * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
40  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46  * OF THE POSSIBILITY OF SUCH DAMAGE.
47  ************************************************************************************************/

48
49 package org.krysalis.jcharts.test;
50
51
52 import org.krysalis.jcharts.chartData.*;
53 import org.krysalis.jcharts.properties.ChartTypeProperties;
54 import org.krysalis.jcharts.properties.StackedAreaChartProperties;
55 import org.krysalis.jcharts.types.ChartType;
56
57
58 /******************************************************************************************
59  * This file provides examples of how to create all the different chart types provided by
60  * this package.
61  *
62  *******************************************************************************************/

63 class StackedAreaTestDriver extends AxisChartTestBase
64 {
65     boolean supportsImageMap()
66     {
67         return false;
68     }
69
70
71     /******************************************************************************************
72      * Separate this so can use for combo chart test
73      *
74      ******************************************************************************************/

75     static ChartTypeProperties getChartTypeProperties( int numberOfDataSets )
76     {
77         /*
78         Stroke[] strokes= new Stroke[ numberOfDataSets ];
79         for( int j=0; j < numberOfDataSets; j++ )
80         {
81             strokes[ j ]= LineChartProperties.DEFAULT_LINE_STROKE;
82         }
83         strokes[ 0 ]= new BasicStroke( 3.0f );
84
85         Shape[] shapes= new Shape[ numberOfDataSets ];
86         for( int j=0; j < numberOfDataSets; j++ )
87         {
88             shapes[ j ]= PointChartProperties.SHAPE_DIAMOND;
89         }
90         shapes[ 0 ]= PointChartProperties.SHAPE_CIRCLE;
91         */

92
93         return new StackedAreaChartProperties();
94     }
95
96
97     /******************************************************************************************
98      *
99      *
100      ******************************************************************************************/

101     DataSeries getDataSeries() throws ChartDataException
102     {
103         DataSeries dataSeries;
104         AxisChartDataSet axisChartDataSet;
105
106         int dataSize=(int) TestDataGenerator.getRandomNumber( 10, 50 );
107         int numberOfDataSets=(int) TestDataGenerator.getRandomNumber( 1, 3 );
108
109
110         dataSeries=super.createDataSeries( dataSize );
111
112         axisChartDataSet=super.createAxisChartDataSet( ChartType.AREA_STACKED,
113                                                                       getChartTypeProperties( numberOfDataSets ),
114                                                                       numberOfDataSets,
115                                                                       dataSize,
116                                                                       0,
117                                                                       5000 );
118
119         dataSeries.addIAxisPlotDataSet( axisChartDataSet );
120
121         return dataSeries;
122     }
123
124 }
125
Popular Tags