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.


Variable Index

 o PICK_FOCUS_LOCAL
 o PICK_FOCUS_X
 o PICK_FOCUS_XY
 o PICK_FOCUS_Y
 o series

Constructor Index

 o ChartDataView()

Method Index

 o addSeries(ChartDataViewSeries)
Adds a ChartDataViewSeries to the view at the end of the list.
 o addSeries(int)
Adds a data series to the Series property at the specified index.
 o calcTransientData()
 o coordToDataCoord(int, int)
Same as map().
 o coordToDataIndex(int, int, int)
Similar to pick() for a specific data view.
 o dataCoordToCoord(double, double)
Same as unmap().
 o dataIndexToCoord(JCDataIndex)
Similar to unpick() for a specific data view.
 o getBarChartFormat()
Gets the value of the BarChartFormat property for the ChartDataView instance.
 o getChanged()
 o getChartStyle()
Gets the value of the ChartStyle property.
 o getChartStyle(int)
Gets the value of the ChartStyle property.
 o getChartType()
Gets the ChartType property of the ChartData, which determines how the chart data is plotted.
 o getDataSource()
Gets the DataSource property for ChartDataView.
 o getDrawingOrder()
Gets the DrawingOrder property.
 o getFirstLast()
Calculates the set of points to be covered by a bar chart by finding the largest FirstPoint value and the smallest LastPoint value.
 o getHoleValue()
Returns the hole value for the chart data.
 o getIsBatched()
Gets the IsBatched property.
 o getIsInverted()
Sets the IsInverted property of the data view.
 o getIsShowingInLegend()
Gets the IsShowingInLegend property.
 o getName()
Gets the Name property of the ChartData object.
 o getNumPointLabels()
 o getNumSeries()
Gets the value of the NumSeries parameter, which determines how many data series there are in a ChartDataView.
 o getPickFocus()
Gets the PickFocus property of the data view.
 o getPieChartFormat()
Gets the value of the PieChartFormat property for the ChartDataView instance.
 o getPointLabel(int)
Gets a particular PointLabel from the PointLabels property.
 o getPointLabels()
Gets the PointLabels property for the ChartDataView object.
 o getSeries()
Gets the value of the Series property for this ChartDataView instance.
 o getSeries(int)
Gets the value of the Series property at a particular index.
 o getSeriesIndex(ChartDataViewSeries)
A convenience method to retrieve a data series index given data series itself.
 o getSeriesIndex(String)
A convenience method to retrieve a data series index given the name of the data series.
 o getVisibleDataSeries()
 o getXAxis()
Gets the value of the XAxis property.
 o getXLimits()
 o getYAxis()
Gets the value of the YAxis property.
 o getYLimits()
 o isChanged()
 o 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.
 o removeSeries(int)
Removes a single data series from the Series property of the ChartDataView instance.
 o setChanged(boolean)
Sets the value of the Changed property The Changed property manages whether the data view requires recalculation.
 o setChanged(boolean, boolean)
Sets the value of the Changed property, with option to prevent parent updating via the updateParent parameter.
 o setChartStyle(int, JCChartStyle)
Sets the value of the ChartStyle property.
 o setChartStyle(JCChartStyle[])
Sets the value of the ChartStyle property.
 o setChartType(int)
Sets the ChartType property of the ChartData, which determines how the chart data is plotted.
 o setDataSource(Chartable)
Sets the DataSource property for ChartDataView.
 o setDrawingOrder(int)
Gets the DrawingOrder property of the ChartDataView object.
 o setHoleValue(double)
Sets the hole value for the chart data.
 o setIsBatched(boolean)
Sets the IsBatched property.
 o setIsInverted(boolean)
Sets the IsInverted property of the data view.
 o setIsShowingInLegend(boolean)
Sets the IsShowingInLegend property.
 o setName(String)
Sets the Name property of the ChartData object.
 o setPickFocus(int)
Sets the PickFocus property of the data view, which specifies how distance is determined for pick operations.
 o setPointLabel(int, String)
Sets a particular PointLabel from the PointLabels property.
 o setPointLabels(String[])
Sets the PointLabels property for the ChartDataView object.
 o setSeries(ChartDataViewSeries[])
Sets the value of the Series property for this ChartDataView instance.
 o setSeries(int, ChartDataViewSeries)
Sets the value of the Series property at a particular index.
 o setXAxis(JCAxis)
Sets the value of the XAxis property.
 o setYAxis(JCAxis)
Sets the value of the YAxis property.
 o toString()
Output routine used for debugging.
 o 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.
 o update(Observable, Object)
Callback routine from the dataModel.

Variables

 o series
 protected JCVector series
 o PICK_FOCUS_LOCAL
 public static final int PICK_FOCUS_LOCAL
 o PICK_FOCUS_XY
 public static final int PICK_FOCUS_XY
 o PICK_FOCUS_X
 public static final int PICK_FOCUS_X
 o PICK_FOCUS_Y
 public static final int PICK_FOCUS_Y

Constructors

 o ChartDataView
 public ChartDataView()

Methods

 o 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
 o 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
 o 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
 o 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.
 o 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
 o 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
 o 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.
 o 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
 o 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
 o 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.
 o 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
 o 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.
 o 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.
 o 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.
 o 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.
 o 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
 o getNumPointLabels
 public int getNumPointLabels()
 o 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
 o 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
 o 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.
 o 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.
 o 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.
 o 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.
 o addSeries
 public synchronized void addSeries(ChartDataViewSeries s)
Adds a ChartDataViewSeries to the view at the end of the list.

 o 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.
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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)
 o 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
 o 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)
 o 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.
 o 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.
 o 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
 o toString
 public String toString()
Output routine used for debugging.

Overrides:
toString in class Object
 o getXLimits
 public MinMax getXLimits()
 o getYLimits
 public MinMax getYLimits()
 o isChanged
 public boolean isChanged()
 o getChanged
 public boolean getChanged()
 o 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.

 o 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.

 o 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.

 o getVisibleDataSeries
 public int getVisibleDataSeries()
 o calcTransientData
 public synchronized void calcTransientData()
 o 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.
 o 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.
 o 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.
 o 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.
 o 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
 o 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.

 o 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
 o 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.
 o 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
 o 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