01: /***********************************************************************************************
02: * File Info: $Id: NonStackedDataProcessor.java,v 1.1 2003/05/17 16:57:50 nathaniel_auvil Exp $
03: * Copyright (C) 2000
04: * Author: Nathaniel G. Auvil
05: * Contributor(s):
06: *
07: * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
08: *
09: * 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: ************************************************************************************************/package org.krysalis.jcharts.chartData.processors;
48:
49: import org.krysalis.jcharts.chartData.interfaces.IAxisChartDataSet;
50:
51: /*******************************************************************************************
52: *
53: *
54: *******************************************************************************************/
55: abstract class NonStackedDataProcessor {
56:
57: /*******************************************************************************************
58: * Does a single pass through the data set and calculates the min, max, and label dimensions.
59: * This stuff is grouped together so we can try to limit the number of passes through the data.
60: *
61: * @param iAxisChartDataSet
62: * @param axisChartDataProcessor
63: ********************************************************************************************/
64: public static final void processData(
65: IAxisChartDataSet iAxisChartDataSet,
66: AxisChartDataProcessor axisChartDataProcessor) {
67: //LOOP
68: for (int i = 0; i < iAxisChartDataSet.getNumberOfDataItems(); i++) {
69: //LOOP
70: for (int j = 0; j < iAxisChartDataSet.getNumberOfDataSets(); j++) {
71: if (Double.isNaN(iAxisChartDataSet.getValue(j, i))) {
72: continue;
73: }
74:
75: if (iAxisChartDataSet.getValue(j, i) > axisChartDataProcessor
76: .getMaxValue()) {
77: axisChartDataProcessor
78: .setMaxValue(iAxisChartDataSet.getValue(j,
79: i));
80: }
81:
82: if (iAxisChartDataSet.getValue(j, i) < axisChartDataProcessor
83: .getMinValue()) {
84: axisChartDataProcessor
85: .setMinValue(iAxisChartDataSet.getValue(j,
86: i));
87: }
88: }
89: }
90: }
91: }
|