KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > progra > charting > model > ChartDataModel


1 /*
2     JOpenChart Java Charting Library and Toolkit
3     Copyright (C) 2001 Sebastian Müller
4     http://jopenchart.sourceforge.net
5
6     This library is free software; you can redistribute it and/or
7     modify it under the terms of the GNU Lesser General Public
8     License as published by the Free Software Foundation; either
9     version 2.1 of the License, or (at your option) any later version.
10
11     This library is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14     Lesser General Public License for more details.
15
16     You should have received a copy of the GNU Lesser General Public
17     License along with this library; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20     ChartDataModel.java
21     Created on 28. Juni 2001, 18:58
22 */

23
24 package de.progra.charting.model;
25
26 import de.progra.charting.event.*;
27
28 /**
29  * This interface defines the methods to access chart data. It has to deal
30  * with several difficulties. The model is basically
31  * resembling a Swing table model. Furthermore, in the implementation it
32  * needs to be defined whether the datasets are organized in rows or in columns,
33  * whether the x-axis values are numeric etc. In order to layout
34  * certain components, there must be methods to return the maximum and minimum
35  * values.<p>
36  * A DataSet is a series of figures belonging together, whereas a column
37  * is the value printed at the x-axis. They can be rendered using specific
38  * Format classes.
39  * @author mueller
40  * @version 1.0
41  */

42 public interface ChartDataModel {
43
44     /** Returns the total amount of datasets.
45      * @return the total amount of DataSets
46      */

47     public int getDataSetNumber();
48     
49     /** Returns the Axis binding of a specific DataSet.
50      * @param set the DataSet index
51      * @return an integer constant defining the Axis binding
52      */

53     public int getAxisBinding(int set);
54     
55     /** Sets the Axis binding of a DataSet.
56      * @param set the DataSet index
57      * @param axis the Axis binding constant
58      */

59     public void setAxisBinding(int set, int axis);
60     
61     /** Returns the length of a certain dataset. Note that for proper
62      * rendering all datasets should have an equal length.
63      * @param set the DataSet index
64      * @return the int length of a DataSet
65      */

66     public int getDataSetLength(int set);
67     
68     /** Returns the title of the DataSet used for rendering the Legend.
69      * @param set the DataSet index
70      * @return a String containing the Title.
71      */

72     public String JavaDoc getDataSetName(int set);
73     
74     /** Returns the Value in a specific dataset at a certain index.
75      * @param set the DataSet index
76      * @param index the value index in the DataSet
77      * @return the value Object
78      */

79     public Number JavaDoc getValueAt(int set, int index);
80     
81     /** Sets the value in a specific dataset at the given index.
82      * @param set the DataSet index
83      * @param index the value index in the DataSet
84      * @param value the value to be stored
85      */

86     public void setValueAt(int set, int index, Object JavaDoc value);
87     
88     /** Returns the class of the columns.
89      * @return the class of the column values. In case of numeric
90      * columns this is always Number.class.
91      */

92     public Class JavaDoc getColumnClass();
93
94     /** Returns a specific column value.
95      * @param col the column index
96      * @return the column value. In case of numeric columns this is
97      * always a Number object.
98      */

99     public Object JavaDoc getColumnValueAt(int col);
100     
101     /** Returns a specific column value.
102      * @param set the data set index
103      * @param col the column index
104      * @return the column value. In case of numeric columns this is
105      * always a Number object.
106      */

107     public Object JavaDoc getColumnValueAt(int set, int col);
108     
109     /** Defines whether the column values are numeric,
110      * that is, they can be casted to <code>Number</code>.
111      * @return <CODE>true</CODE> if the column value can be
112      * safely casted to Number type.
113      */

114     public boolean isColumnNumeric();
115     
116     /** Adds a ChartDataModelListener
117      * @param l the ChartDataModelListener
118      */

119     public void addChartDataModelListener(ChartDataModelListener l);
120     
121     /** Removes a ChartDataModelListener
122      * @param l the ChartDataModelListener
123      */

124     public void removeChartDataModelListener(ChartDataModelListener l);
125     
126     /** Returns a ChartDataModelConstraints object for the given
127      * axis binding.
128      * @param axis the Axis constant
129      * @return a ChartDataModelConstraints object.
130      */

131     public ChartDataModelConstraints getChartDataModelConstraints(int axis);
132     
133     /** Sets the ChartDataModelConstraints object for the given
134      * axis binding.
135      * @param axis the Axis constant
136      * @param constraints the ChartDataModelConstraints object
137      * @return a ChartDataModelConstraints object.
138      */

139     public void setChartDataModelConstraints(int axis, ChartDataModelConstraints constraints);
140     
141     public void setAutoScale(boolean b);
142     
143     public boolean isAutoScale();
144
145     /** Enables the manual axis scaling. Set the desired
146      * maximum and minimum values using the setMaximum...Value
147      * functions.
148      */

149     public void setManualScale(boolean b);
150
151     /** Returns true if the manual axis scaling is enabled. This overrides
152      * the enabled automatic axis scaling.
153      */

154     public boolean isManualScale();
155
156     /** Sets the maximum x-axis value. */
157     public void setMaximumColumnValue(double d);
158
159     /** Sets the minimum x-axis value. */
160     public void setMinimumColumnValue(double d);
161
162     /** Sets the maximum y-axis value. */
163     public void setMaximumValue(Number JavaDoc n);
164
165     /** Sets the minimum y-axis value. */
166     public void setMinimumValue(Number JavaDoc n);
167
168     public double getManualMaximumColumnValue();
169
170     public double getManualMinimumColumnValue();
171
172     public Number JavaDoc getManualMaximumValue();
173
174     public Number JavaDoc getManualMinimumValue();
175 }
Popular Tags