All Packages Class Hierarchy This Package Previous Next Index
Class jclass.chart.ChartDataView
java.lang.Object
|
+----jclass.chart.ChartDataView
- public class ChartDataView
- extends Object
- implements Observer, Changeable, JCSerializable
ChartDataView contains the internal
representation of the chartable data.
Chart data is represented as
a series of ChartDataViewSeries objects
managed by a ChartDataView object. Note
that ChartDataView includes a mapping from
series number to series name.
A ChartDataView object can optionally be
connected to a ChartDataModel object. If
it is connected, ChartDataView becomes a
view on the ChartDataModel, and it relies
on the ChartDataModel for all chartable data.
If it is not connected, ChartDataView will
store the data internally.
A ChartDataView can also connect itself to
a Chartable or EditableChartable object.
ChartDataView is smart enough to figure out
if it is being given an Observable, and will
connect itself as an Observer.
ChartDataView also manages the
JCChartStyles for the data series. By
default, if no JCChartStyle is provided
by the developer, ChartDataView will
create a default JCChartStyle for the
data series.
Note that this means that ChartDataView is
not always a view - it is
capable of being a view, but that does not mean that it is
necessarily a view.
Properties
Name |
Method |
HoleValue
|
The HoleValue property is a floating point number used to represent
a hole in the data. Internally, ChartDataView places this value in
the x and y arrays to represent a missing data value.
|
IsBatched
|
The IsBatched property controls whether the ChartDataView is notified
immediately of data source changes, or if the changes are accumulated
and sent at a later date.
|
ChartType
|
The ChartType property of the ChartData, which determines how the chart
data is plotted. Currently-implemented values include JCChart.BAR,
JCChart.STACKING_BAR, JCChart.PIE, JCChart.PLOT and JCChart.SCATTER_PLOT.
|
Name
|
The Name property is used as an index for referencing particular
ChartDataView objects.
|
DrawingOrder
|
The DrawingOrder property determines the drawing order of items.
When the DrawingOrder property is changed, the order properties of all
ChartDataView instances managed by a single JCChart object are normalized.
|
DataSource
|
The DataSource property, if non-null, is used as a source for data
in the ChartDataView. The DataSource can refer to an object that
implements Chartable or EditableChartable, or it can refer to an
object that extends the abstract class ChartDataModel. JCChart will do
the "right thing" based on the object provided.
|
PointLabels
|
The PointLabels property is an indexed property consisting of a
series of strings representing the desired label for a particular
data point.
|
Series
|
The Series property is an indexed property that contains all data
series for a particular ChartDataView. The order of ChartDataViewSeries
objects in the series array corresponds to the drawing order. |
|
|
XAxis
|
The XAxis property determines the x axis against which the
data in ChartDataView is plotted.
|
YAxis
|
The YAxis property determines the y axis against which the
data in ChartDataView is plotted.
|
IsInverted
|
If the IsInverted property is set to true, the x axis becomes
vertical, and the y axis becomes horizontal.
|
PickFocus
|
The PickFocus property specifies how distance is determined for pick
operations. When set to PICK_FOCUS_XY, a pick operation will use the
actual distance between the point and the drawn data. When set to
values of PICK_FOCUS_X or PICK_FOCUS_Y, the distance only along the
X or Y axis is used.
|
IsShowingInLegend
|
The IsShowingInLegend property determines whether or not the view
name will appear in the chart legend.
|
-
PICK_FOCUS_LOCAL
-
-
PICK_FOCUS_X
-
-
PICK_FOCUS_XY
-
-
PICK_FOCUS_Y
-
-
series
-
-
ChartDataView()
-
-
addSeries(ChartDataViewSeries)
- Adds a ChartDataViewSeries to the view at the end of
the list.
-
addSeries(int)
- Adds a data series to the Series property at the specified
index.
-
calcTransientData()
-
-
coordToDataCoord(int, int)
- Same as map().
-
coordToDataIndex(int, int, int)
- Similar to pick() for a specific data view.
-
dataCoordToCoord(double, double)
- Same as unmap().
-
dataIndexToCoord(JCDataIndex)
- Similar to unpick() for a specific data view.
-
getBarChartFormat()
- Gets the value of the BarChartFormat property for the
ChartDataView instance.
-
getChanged()
-
-
getChartStyle()
- Gets the value of the ChartStyle property.
-
getChartStyle(int)
- Gets the value of the ChartStyle property.
-
getChartType()
- Gets the ChartType property of the ChartData, which determines
how the chart data is plotted.
-
getDataSource()
- Gets the DataSource property for ChartDataView.
-
getDrawingOrder()
- Gets the DrawingOrder property.
-
getFirstLast()
- Calculates the set of points to be covered by a bar chart by
finding the largest FirstPoint value and the smallest LastPoint
value.
-
getHoleValue()
- Returns the hole value for the chart data.
-
getIsBatched()
- Gets the IsBatched property.
-
getIsInverted()
- Sets the IsInverted property of the data view.
-
getIsShowingInLegend()
- Gets the IsShowingInLegend property.
-
getName()
- Gets the Name property of the ChartData object.
-
getNumPointLabels()
-
-
getNumSeries()
- Gets the value of the NumSeries parameter, which determines
how many data series there are in a ChartDataView.
-
getPickFocus()
- Gets the PickFocus property of the data view.
-
getPieChartFormat()
- Gets the value of the PieChartFormat property for the
ChartDataView instance.
-
getPointLabel(int)
- Gets a particular PointLabel from the PointLabels property.
-
getPointLabels()
- Gets the PointLabels property for the ChartDataView object.
-
getSeries()
- Gets the value of the Series property for this ChartDataView
instance.
-
getSeries(int)
- Gets the value of the Series property at a particular index.
-
getSeriesIndex(ChartDataViewSeries)
- A convenience method to retrieve a data series index given data series
itself.
-
getSeriesIndex(String)
- A convenience method to retrieve a data series index given the
name of the data series.
-
getVisibleDataSeries()
-
-
getXAxis()
- Gets the value of the XAxis property.
-
getXLimits()
-
-
getYAxis()
- Gets the value of the YAxis property.
-
getYLimits()
-
-
isChanged()
-
-
map(int, int)
- Performs a map operation by mapping the provided screen pixel
information to data values along the x and y axes of the
ChartDataView instance.
-
removeSeries(int)
- Removes a single data series from the Series property of
the ChartDataView instance.
-
setChanged(boolean)
- Sets the value of the Changed property
The Changed property manages whether the data view
requires recalculation.
-
setChanged(boolean, boolean)
- Sets the value of the Changed property, with option to
prevent parent updating via the updateParent parameter.
-
setChartStyle(int, JCChartStyle)
- Sets the value of the ChartStyle property.
-
setChartStyle(JCChartStyle[])
- Sets the value of the ChartStyle property.
-
setChartType(int)
- Sets the ChartType property of the ChartData, which determines
how the chart data is plotted.
-
setDataSource(Chartable)
- Sets the DataSource property for ChartDataView.
-
setDrawingOrder(int)
- Gets the DrawingOrder property of the ChartDataView object.
-
setHoleValue(double)
- Sets the hole value for the chart data.
-
setIsBatched(boolean)
- Sets the IsBatched property.
-
setIsInverted(boolean)
- Sets the IsInverted property of the data view.
-
setIsShowingInLegend(boolean)
- Sets the IsShowingInLegend property.
-
setName(String)
- Sets the Name property of the ChartData object.
-
setPickFocus(int)
- Sets the PickFocus property of the data view, which specifies how
distance is determined for pick operations.
-
setPointLabel(int, String)
- Sets a particular PointLabel from the PointLabels property.
-
setPointLabels(String[])
- Sets the PointLabels property for the ChartDataView object.
-
setSeries(ChartDataViewSeries[])
- Sets the value of the Series property for this ChartDataView
instance.
-
setSeries(int, ChartDataViewSeries)
- Sets the value of the Series property at a particular index.
-
setXAxis(JCAxis)
- Sets the value of the XAxis property.
-
setYAxis(JCAxis)
- Sets the value of the YAxis property.
-
toString()
- Output routine used for debugging.
-
unmap(double, double)
- Performs an unmap operation by taking floating-point x and
y values meant to represent a point along the x
and y axes of the data.
-
update(Observable, Object)
- Callback routine from the dataModel.
series
protected JCVector series
PICK_FOCUS_LOCAL
public static final int PICK_FOCUS_LOCAL
PICK_FOCUS_XY
public static final int PICK_FOCUS_XY
PICK_FOCUS_X
public static final int PICK_FOCUS_X
PICK_FOCUS_Y
public static final int PICK_FOCUS_Y
ChartDataView
public ChartDataView()
update
public void update(Observable model,
Object arg)
- Callback routine from the dataModel. When the dataModel
has new data for ChartDataView, it will call this method.
- Parameters:
- model - model making the call
- arg - argument passed by the model. Contains
information on the change that has been made.
- See Also:
- ChartDataModelUpdate
getHoleValue
public double getHoleValue()
- Returns the hole value for the chart data. The hole value is
a floating point number used to represent a hole in the data.
Internally, ChartData places this value in the x and
y arrays to represent a missing data value.
- Returns:
- floating-point value used as a placeholder for missing
values
setHoleValue
public synchronized void setHoleValue(double val)
- Sets the hole value for the chart data. The hole value is
a floating point number used to represent a hole in the data.
Internally, ChartData places this value in the x and
y arrays to represent a missing data value. Changing the
hole value entails replacing all the "current" holes with the new value.
- Parameters:
- val - floating-point value used as a placeholder for missing
values
getIsBatched
public boolean getIsBatched()
- Gets the IsBatched property. ChartData is a model for the
ChartGroup object. The IsBatched property controls whether
the ChartGroup is notified immediately of ChartData changes, or
if the changes are accumulated and sent at a later date.
- Returns:
- true if changes are accumulated, false otherwise.
setIsBatched
public synchronized void setIsBatched(boolean batched)
- Sets the IsBatched property. ChartData is a model for the
ChartGroup object. The IsBatched property controls whether
the ChartGroup is notified immediately of ChartData changes, or
if the changes are accumulated and sent at a later date.
- Parameters:
- batched - true if changes are accumulated, false
otherwise
getChartType
public int getChartType()
- Gets the ChartType property of the ChartData, which determines
how the chart data is plotted.
- Returns:
- enumeration specifying the chart type
setChartType
public synchronized void setChartType(int tp)
- Sets the ChartType property of the ChartData, which determines
how the chart data is plotted.
- Parameters:
- tp - enumeration specifying the chart type.
- Throws: IllegalArgumentException
- If the new chart type is either
invalid or not currently supported.
getName
public String getName()
- Gets the Name property of the ChartData object. The
Name property is used as an index for referencing particular
ChartData objects.
- Returns:
- name of the ChartData object
setName
public synchronized void setName(String nm)
- Sets the Name property of the ChartData object. The
Name property is used as an index for referencing particular
ChartData objects.
- Parameters:
- nm - name of the ChartData object
getDrawingOrder
public int getDrawingOrder()
- Gets the DrawingOrder property.
The DrawingOrder property determines the drawing order of items.
When the DrawingOrder property is changed, the order properties
of all ChartDataView instances managed by a single JCChart object
are normalized.
- Returns:
- Integer representing order.
setDrawingOrder
public synchronized void setDrawingOrder(int neword)
- Gets the DrawingOrder property of the ChartDataView object. The
DrawingOrder property determines the drawing order of items.
When the DrawingOrder property is changed, the order properties
of all ChartDataView instances managed by a single JCChart object
are normalized.
- Parameters:
- neword - new position of the ChartDataView object
getDataSource
public Chartable getDataSource()
- Gets the DataSource property for ChartDataView. The
DataSource property, if non-null, is used as a source for
data in the ChartDataView. The DataSource can refer to
an object that implements Chartable or EditableChartable, or
it can refer to an object that extends the abstract class
ChartDataModel. JCChart will do the "right thing" based on
the object provided.
- Returns:
- object acting as a data source for ChartDataView.
This object can either implement Chartable, implement
EditableChartable, or be a subclass of ChartDataModel.
setDataSource
public synchronized void setDataSource(Chartable src)
- Sets the DataSource property for ChartDataView. The
DataSource property, if non-null, is used as a source for
data in the ChartDataView. The DataSource can refer to
an object that implements Chartable or EditableChartable, or
it can refer to an object that extends the abstract class
ChartDataModel. JCChart will do the correct operation based on
the object provided.
- Parameters:
- src - object acting as a data source for ChartDataView.
This object can either implement Chartable, implement
EditableChartable, or be a subclass of ChartDataModel.
getPointLabel
public String getPointLabel(int index)
- Gets a particular PointLabel from the PointLabels property.
The PointLabels property is an indexed property consisting of
a series of strings representing the desired label for a particular
data point.
- Parameters:
- index - index of the desired point
- Returns:
- string representing the requested point label
- Throws: IllegalArgumentException
- If the point label index does
not address a valid point label.
setPointLabel
public synchronized void setPointLabel(int index,
String label)
- Sets a particular PointLabel from the PointLabels property.
The PointLabels property is an indexed property consisting of
a series of strings representing the desired label for a particular
data point.
- Parameters:
- index - index of the desired point
- label - string representing the requested point label
- Throws: IllegalArgumentException
- If the point label index does
not address a valid point label.
getPointLabels
public String[] getPointLabels()
- Gets the PointLabels property for the ChartDataView object.
The PointLabels property is an indexed property consisting of
a series of strings representing the desired label for a particular
data point.
- Returns:
- array of String objects representing the point labels
getNumPointLabels
public int getNumPointLabels()
setPointLabels
public synchronized void setPointLabels(String labels[])
- Sets the PointLabels property for the ChartDataView object.
The PointLabels property is an indexed property consisting of
a series of strings representing the desired label for a particular
data point.
- Parameters:
- labels - array of String objects representing the point labels
getSeries
public ChartDataViewSeries[] getSeries()
- Gets the value of the Series property for this ChartDataView
instance. The Series property is an indexed property that
contains all data series for a particular ChartDataView.
The order of ChartDataViewSeries objects in the series
array corresponds to the drawing order.
- Returns:
- ChartDataViewSeries instance representing the
requested data series
getSeries
public ChartDataViewSeries getSeries(int index)
- Gets the value of the Series property at a particular index.
The Series property is an indexed property that
contains all data series for a particular ChartDataView.
The order of ChartDataViewSeries objects in the Series
array corresponds to the drawing order.
- Parameters:
- index - index of the data series to retrieve.
- Throws: IllegalArgumentException
- If the provided index does
not address an existing ChartDataViewSeries.
setSeries
public synchronized void setSeries(ChartDataViewSeries newseries[])
- Sets the value of the Series property for this ChartDataView
instance. The Series property is an indexed property that
contains all data series for a particular ChartDataView.
The order of ChartDataViewSeries objects in the Series
array corresponds to the drawing order.
- Parameters:
- newseries - array of ChartDataViewSeries
instances in the desired drawing order. The existing
series property will be replaced.
setSeries
public synchronized void setSeries(int index,
ChartDataViewSeries s)
- Sets the value of the Series property at a particular index.
The Series property is an indexed property that
contains all data series for a particular ChartDataView.
The order of ChartDataViewSeries objects in the Series
array corresponds to the drawing order.
- Parameters:
- index - index of the data series to retrieve.
- Throws: IllegalArgumentException
- If the provided index does
not address an existing ChartDataViewSeries.
addSeries
public ChartDataViewSeries addSeries(int index)
- Adds a data series to the Series property at the specified
index. addSeries() creates a new ChartDataViewSeries
instance and adds it to the ChartDataView instance at the
requested position if possible.
- Parameters:
- index - desired position of the new data series
- Returns:
- new ChartDataViewSeries instance representing
the new data series.
addSeries
public synchronized void addSeries(ChartDataViewSeries s)
- Adds a ChartDataViewSeries to the view at the end of
the list.
removeSeries
public synchronized void removeSeries(int index)
- Removes a single data series from the Series property of
the ChartDataView instance. Once the item is removed, the
order properties for each ChartDataViewSeries are normalized
so that they correspond exactly to their index in the series
array.
- Parameters:
- index - position of the ChartDataViewSeries instance
that is to be removed
- Throws: IllegalArgumentException
- If the index does not address
a valid ChartDataViewSeries.
getSeriesIndex
public int getSeriesIndex(String name)
- A convenience method to retrieve a data series index given the
name of the data series.
- Parameters:
- name - name of the ChartDataViewSeries instance.
- Returns:
- index of the data series
name; -1 if none found
getSeriesIndex
public int getSeriesIndex(ChartDataViewSeries srs)
- A convenience method to retrieve a data series index given data series
itself.
- Parameters:
- srs - the ChartDataViewSeries instance.
- Returns:
- index of the data series; -1 if none found
getPieChartFormat
public JCPieChartFormat getPieChartFormat()
- Gets the value of the PieChartFormat property for the
ChartDataView instance. Unless the ChartType property is a pie
chart, the pieChartFormat property is null.
- Returns:
- JCPieChartFormat object that controls pie chart
specific formatting information
getBarChartFormat
public JCBarChartFormat getBarChartFormat()
- Gets the value of the BarChartFormat property for the
ChartDataView instance. Unless the ChartType property is a bar
chart, the BarChartFormat property is null.
- Returns:
- BarChartFormat object that controls bar chart
specific formatting information
getXAxis
public JCAxis getXAxis()
- Gets the value of the XAxis property. The XAxis property determines
the x axis against which the data in ChartDataView is plotted.
- Returns:
- JCAxis object representing the x axis for the data
setXAxis
public synchronized void setXAxis(JCAxis ax)
- Sets the value of the XAxis property. The XAxis property determines
the x axis against which the data in ChartDataView is plotted.
- Parameters:
- ax - JCAxis object representing the x axis for the data
getYAxis
public JCAxis getYAxis()
- Gets the value of the YAxis property. The YAxis property determines
the y axis against which the data in ChartDataView is plotted.
- Returns:
- JCAxis object representing the y axis for the data
setYAxis
public synchronized void setYAxis(JCAxis ax)
- Sets the value of the YAxis property. The YAxis property determines
the y axis against which the data in ChartDataView is plotted.
- Parameters:
- ax - JCAxis object representing the y axis for the data
map
public JCDataCoord map(int x,
int y)
- Performs a map operation by mapping the provided screen pixel
information to data values along the x and y axes of the
ChartDataView instance.
- Parameters:
- x - x value in screen pixels
- y - y value in screen pixels
- Returns:
- JCDataCoord instance
- See Also:
- JCDataCoord
unmap
public Point unmap(double xval,
double yval)
- Performs an unmap operation by taking floating-point x and
y values meant to represent a point along the x
and y axes of the data.
- Parameters:
- xval - floating-point x value.
- yval - floating-point y value.
- Returns:
- AWT Point object representing the location in screen
pixels (relative to the Chart component)
coordToDataCoord
public JCDataCoord coordToDataCoord(int x,
int y)
- Same as map(). Converts pixel coordinates to data coordinates.
- Parameters:
- x - x value in screen pixels
- y - y value in screen pixels
- Returns:
- JCDataCoord instance
- See Also:
- JCDataCoord
dataCoordToCoord
public Point dataCoordToCoord(double xval,
double yval)
- Same as unmap(). Converts data coordinates to pixel coordinates.
- Parameters:
- xval - floating-point x value.
- yval - floating-point y value.
- Returns:
- AWT Point object representing the location in screen
pixels (relative to the Chart component)
dataIndexToCoord
public Point dataIndexToCoord(JCDataIndex di)
- Similar to unpick() for a specific data view. Converts a JCDataIndex
instance (containing a data view, series, point) to pixel values
relative to the Chart component.
- Parameters:
- di - JCDataIndex instance containing data view, series, and point.
- Returns:
- AWT Point object representing the location is screen pixels
relative to the Chart component.
coordToDataIndex
public JCDataIndex coordToDataIndex(int x,
int y,
int focus)
- Similar to pick() for a specific data view. Converts pixel values
relative to the Chart component to a JCDataIndex instance containing the
data series and point closest to that location.
- Parameters:
- x - x value of screen position
- y - y value of screen position
- focus - pick focus value used to determine distance between point
and the data drawn by the chart. If equal to ChartDataView.PICK_FOCUS_LOCAL
the pickFocus property of the ChartDataView will be used.
- di - JCDataIndex instance containing data view, series, and point.
getNumSeries
public int getNumSeries()
- Gets the value of the NumSeries parameter, which determines
how many data series there are in a ChartDataView. Used in
conjunction with getSeries(int index) to retrieve data series
- Returns:
- number of data series managed by ChartDataView
toString
public String toString()
- Output routine used for debugging.
- Overrides:
- toString in class Object
getXLimits
public MinMax getXLimits()
getYLimits
public MinMax getYLimits()
isChanged
public boolean isChanged()
getChanged
public boolean getChanged()
setChanged
public synchronized void setChanged(boolean b)
- Sets the value of the Changed property
The Changed property manages whether the data view
requires recalculation. If set to true, a recalculation
may be triggered.
setChanged
public void setChanged(boolean b,
boolean updateParent)
- Sets the value of the Changed property, with option to
prevent parent updating via the updateParent parameter.
Note that updateParent is independent of IsBatched.
getFirstLast
public Point getFirstLast()
- Calculates the set of points to be covered by a bar chart by
finding the largest FirstPoint value and the smallest LastPoint
value. Both values will be tempered by the smallest array of
points.
getVisibleDataSeries
public int getVisibleDataSeries()
calcTransientData
public synchronized void calcTransientData()
setIsInverted
public synchronized void setIsInverted(boolean inv)
- Sets the IsInverted property of the data view. If the IsInverted
property is set, the x axis becomes vertical, and the y axis
becomes horizontal
- Parameters:
- inv - true if the data is to be inverted, false otherwise.
getIsInverted
public boolean getIsInverted()
- Sets the IsInverted property of the data view. If the IsInverted
property is set, the x axis becomes vertical, and the y axis
becomes horizontal
- Returns:
- true if the data is to be inverted, false otherwise.
setPickFocus
public synchronized void setPickFocus(int foc)
- Sets the PickFocus property of the data view, which specifies how
distance is determined for pick operations. When set to PICK_FOCUS_XY,
a pick operation will use the actual distance between the point and
the drawn data. When set to values of PICK_FOCUS_X or PICK_FOCUS_Y,
the distance only along the X or Y axis is used.
- Parameters:
- foc - the value to set the pick focus to.
getPickFocus
public int getPickFocus()
- Gets the PickFocus property of the data view. Possible values are
PICK_FOCUS_XY, PICK_FOCUS_X, and PICK_FOCUS_Y.
- Returns:
- the PickFocus property.
getIsShowingInLegend
public boolean getIsShowingInLegend()
- Gets the IsShowingInLegend property. This property determines
whether or not the view name will appear in the chart legend.
- Returns:
- "true" if the name will appear in the legend
setIsShowingInLegend
public synchronized void setIsShowingInLegend(boolean shn)
- Sets the IsShowingInLegend property. This property determines
whether or not the view name will appear in the chart legend.
setChartStyle
public synchronized void setChartStyle(int index,
JCChartStyle value)
- Sets the value of the ChartStyle property.
The ChartStyle property contains all the ChartStyles for the
data series in this data view.
- Parameters:
- index - index of the ChartStyle to set
getChartStyle
public JCChartStyle getChartStyle(int index)
- Gets the value of the ChartStyle property.
The ChartStyle property contains all the ChartStyles for the
data series in this data view.
- Parameters:
- index - index of the ChartStyle to retrieve
- Returns:
- ChartStyle at the specified index.
getChartStyle
public JCChartStyle[] getChartStyle()
- Gets the value of the ChartStyle property.
The ChartStyle property contains all the ChartStyles for the
data series in this data view.
- Returns:
- array of JCChartStyle instances used for this data view
setChartStyle
public synchronized void setChartStyle(JCChartStyle cs[])
- Sets the value of the ChartStyle property.
The ChartStyle property contains all the ChartStyles for the
data series in this data view.
- Parameters:
- cs - array of JCChartStyle instances used for this data view
All Packages Class Hierarchy This Package Previous Next Index