001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: ChartValue.java,v $
023   Revision 1.5  2004/05/05 22:24:14  markl
024   comment block updates
025
026   Revision 1.4  2003/01/19 09:33:21  markl
027   Javadoc & comment header updates.
028
029   Revision 1.3  2001/03/12 07:23:29  markl
030   Javadoc cleanup.
031
032   Revision 1.2  2000/10/15 09:40:29  markl
033   Added javadoc and final API polishing.
034
035   Revision 1.1  2000/10/13 02:04:19  markl
036   Added remaining classes, and integrated components with models.
037   ----------------------------------------------------------------------------
038*/
039
040package kiwi.ui.graph;
041
042import java.awt.Color;
043
044/** A class that represents a data value in a chart. A <code>ChartValue</code>
045 * consists of a name (which is used to look up the data value in a
046 * <code>DataSample</code>), a label (which is used when rendering the legend
047 * for a chart), and a color (which is used by the <code>ChartView</code> to
048 * render the value).
049 *
050 * @see kiwi.ui.graph.DataSample
051 * @see kiwi.ui.graph.ChartView
052 * @see kiwi.ui.graph.ChartLegend
053 * 
054 * @author Mark Lindner
055 */
056
057public class ChartValue implements Cloneable
058  {
059  private String name;
060  private String label;
061  private Color color;
062
063  /** Construct a new <code>ChartValue</code> with the specified variable name,
064   * label, and color.
065   *
066   * @param name The name of the variable that contains this value.
067   * @param label The textual label for this value.
068   * @param color The color in which to render the graphical representation of
069   * this value.
070   */
071  
072  public ChartValue(String name, String label, Color color)
073    {
074    this.name = name;
075    this.label = label;
076    this.color = color;
077    }
078
079  /** Get the name of the variable that contains this value.
080   *
081   * @return The variable name.
082   */
083  
084  public String getName()
085    {
086    return(name);
087    }
088
089  /** Set the name of the variable that contains this value.
090   *
091   * @param name The variable name.
092   */
093  
094  public void setName(String name)
095    {
096    this.name = name;
097    }
098  
099  /** Get the textual label for this variable.
100   *
101   * @return The label.
102   */
103  
104  public String getLabel()
105    {
106    return(label);
107    }
108
109  /** set the textual label for this variable.
110   *
111   * @param label The label.
112   */
113
114  public void setLabel(String label)
115    {
116    this.label = label;
117    }
118  
119  /** Get the color for this value.
120   *
121   * @return The color.
122   */
123  
124  public Color getColor()
125    {
126    return(color);
127    }
128
129  /** Set the color for this value.
130   *
131   * @param color The color.
132   */
133
134  public void setColor(Color color)
135    {
136    this.color = color;
137    }
138
139  /** Create a copy of this object.
140   */
141
142  public Object clone()
143    {
144    Object o = null;
145
146    try
147      {
148      o = super.clone();
149      }
150    catch(CloneNotSupportedException ex) {}
151
152    return(o);
153    }
154  }
155
156/* end of source file */