001: /***********************************************************************************************
002: * File Info: $Id: StackedAreaTestDriver.java,v 1.1 2003/05/17 17:01:13 nathaniel_auvil Exp $
003: * Copyright (C) 2000
004: * Author: Nathaniel G. Auvil
005: * Contributor(s):
006: *
007: * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
008: *
009: * Redistribution and use of this software and associated documentation
010: * ("Software"), with or without modification, are permitted provided
011: * that the following conditions are met:
012: *
013: * 1. Redistributions of source code must retain copyright
014: * statements and notices. Redistributions must also contain a
015: * copy of this document.
016: *
017: * 2. Redistributions in binary form must reproduce the
018: * above copyright notice, this list of conditions and the
019: * following disclaimer in the documentation and/or other
020: * materials provided with the distribution.
021: *
022: * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to
023: * endorse or promote products derived from this Software without
024: * prior written permission of Nathaniel G. Auvil. For written
025: * permission, please contact nathaniel_auvil@users.sourceforge.net
026: *
027: * 4. Products derived from this Software may not be called "jCharts"
028: * nor may "jCharts" appear in their names without prior written
029: * permission of Nathaniel G. Auvil. jCharts is a registered
030: * trademark of Nathaniel G. Auvil.
031: *
032: * 5. Due credit should be given to the jCharts Project
033: * (http://jcharts.sourceforge.net/).
034: *
035: * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS
036: * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
037: * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
038: * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
039: * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
040: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
041: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
042: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
043: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
044: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
045: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
046: * OF THE POSSIBILITY OF SUCH DAMAGE.
047: ************************************************************************************************/package org.krysalis.jcharts.test;
048:
049: import org.krysalis.jcharts.chartData.*;
050: import org.krysalis.jcharts.properties.ChartTypeProperties;
051: import org.krysalis.jcharts.properties.StackedAreaChartProperties;
052: import org.krysalis.jcharts.types.ChartType;
053:
054: /******************************************************************************************
055: * This file provides examples of how to create all the different chart types provided by
056: * this package.
057: *
058: *******************************************************************************************/
059: class StackedAreaTestDriver extends AxisChartTestBase {
060: boolean supportsImageMap() {
061: return false;
062: }
063:
064: /******************************************************************************************
065: * Separate this so can use for combo chart test
066: *
067: ******************************************************************************************/
068: static ChartTypeProperties getChartTypeProperties(
069: int numberOfDataSets) {
070: /*
071: Stroke[] strokes= new Stroke[ numberOfDataSets ];
072: for( int j=0; j < numberOfDataSets; j++ )
073: {
074: strokes[ j ]= LineChartProperties.DEFAULT_LINE_STROKE;
075: }
076: strokes[ 0 ]= new BasicStroke( 3.0f );
077:
078: Shape[] shapes= new Shape[ numberOfDataSets ];
079: for( int j=0; j < numberOfDataSets; j++ )
080: {
081: shapes[ j ]= PointChartProperties.SHAPE_DIAMOND;
082: }
083: shapes[ 0 ]= PointChartProperties.SHAPE_CIRCLE;
084: */
085:
086: return new StackedAreaChartProperties();
087: }
088:
089: /******************************************************************************************
090: *
091: *
092: ******************************************************************************************/
093: DataSeries getDataSeries() throws ChartDataException {
094: DataSeries dataSeries;
095: AxisChartDataSet axisChartDataSet;
096:
097: int dataSize = (int) TestDataGenerator.getRandomNumber(10, 50);
098: int numberOfDataSets = (int) TestDataGenerator.getRandomNumber(
099: 1, 3);
100:
101: dataSeries = super .createDataSeries(dataSize);
102:
103: axisChartDataSet = super .createAxisChartDataSet(
104: ChartType.AREA_STACKED,
105: getChartTypeProperties(numberOfDataSets),
106: numberOfDataSets, dataSize, 0, 5000);
107:
108: dataSeries.addIAxisPlotDataSet(axisChartDataSet);
109:
110: return dataSeries;
111: }
112:
113: }
|