JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart
Class ChartDataView

java.lang.Object
  |
  +--com.klg.jclass.chart.ChartDataView
All Implemented Interfaces:
Changeable, Changeable, ChartDataListener, EventListener, com.klg.jclass.util.JCName, Serializable

public class ChartDataView
extends Object
implements Changeable, ChartDataListener, Serializable, com.klg.jclass.util.JCName

Class containing the internal representation of the chartable data. Chart data is represented as a series of ChartDataViewSeries objects, managed by a ChartDataView object.

Note: ChartDataView includes a mapping from series number to series name.

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: This means that ChartDataView is not always a view -- it is capable of being a view, but is not necessarily a view.

See Also:
Serialized Form

Field Summary
protected  boolean allowPick
           
protected  boolean autoLabel
           
protected  boolean batched
           
protected  boolean bufferPlotData
           
protected  boolean changed
           
protected  int changedFlag
           
protected  com.klg.jclass.chart.JCChart chart
           
protected  int chartType
           
protected  com.klg.jclass.util.ImageMapInfo[] clusterImageMapInfo
           
protected  com.klg.jclass.chart.JCDrawableColorHandler colorHandler
           
protected  com.klg.jclass.chart.DataHandler dataHandler
           
protected  com.klg.jclass.chart.ChartDataModel dataSource
           
protected static int dataViewNum
           
protected  boolean drawFrontPlane
           
protected  int drawingOrder
           
static String ERRMSG_INVALID_SERIES_INDEX
          Error message for invalid series index.
protected  boolean fastUpdate
           
static String[] format_class_names
          Class names of format classes.
protected  Hashtable formatClassHashtable
           
protected  double holeValue
           
protected  com.klg.jclass.util.ImageMapInfo imageMapInfo
           
protected  boolean inverted
           
protected  Locale locale
           
protected  String name
           
protected  com.klg.jclass.chart.JCLineStyle outlineStyle
           
protected  com.klg.jclass.util.io.OutputDataProperties outputDataProperties
           
static int PICK_FOCUS_LOCAL
          Enum values for pick focus.
static int PICK_FOCUS_X
           
static int PICK_FOCUS_XY
           
static int PICK_FOCUS_Y
           
protected  int pickFocus
           
protected  List pointLabels
           
protected  Vector series
           
protected  double step
           
protected  boolean visible
           
protected  boolean visibleInLegend
           
protected  boolean visibleInLegendChanged
           
protected  com.klg.jclass.chart.JCAxis xaxis
           
protected  com.klg.jclass.chart.MinMax xLimits
           
protected  com.klg.jclass.chart.JCAxis yaxis
           
protected  com.klg.jclass.chart.MinMax yLimits
           
 
Fields inherited from interface com.klg.jclass.chart.Changeable
BASIC_CHANGE_MASK, NOTIFY_AXES_RECALC, NOTIFY_AXES_REDRAW, NOTIFY_CA_RECALC, NOTIFY_CA_REDRAW, NOTIFY_LEGEND_RECALC, NOTIFY_LEGEND_REDRAW
 
Fields inherited from interface com.klg.jclass.util.Changeable
LAYOUT, NO_CHANGE, NOTIFY_PARENT_LAYOUT, RECALC, REDRAW
 
Constructor Summary
ChartDataView()
          Constructor.
 
Method Summary
 void addSeries(com.klg.jclass.chart.ChartDataViewSeries s)
          Adds a ChartDataViewSeries to the view at the end of the list.
 com.klg.jclass.chart.ChartDataViewSeries addSeries(int index)
          Adds a data series to the Series property at the specified index.
 void calcTransientData()
          Calculates data associated with view data.
 void chartDataChange(com.klg.jclass.chart.ChartDataEvent evt)
          Implements the ChartDataListener interface.
 boolean checkNewPoints(int npoints)
          Checks newly added points to see if they fit inside current axis bounds.
 com.klg.jclass.chart.JCDataCoord coordToDataCoord(int x, int y)
          Same as map().
 com.klg.jclass.chart.JCDataIndex coordToDataIndex(int x, int y, int focus)
          Similar to pick() for a specific data view.
 Point dataCoordToCoord(double xval, double yval)
          Same as unmap().
 Point dataIndexToCoord(com.klg.jclass.chart.JCDataIndex di)
          Similar to unpick() for a specific data view.
 boolean doFastUpdate(int column, int nPoints)
          Performs a fast update to the chart by just drawing over the current chart without doing a lot of recalcing and redrawing of existing points.
 boolean getAutoLabel()
          Gets the AutoLabel property, which determines if a chart automatically generates labels for each point in each series.
 boolean getBufferPlotData()
          Gets the BufferPlotData property.
 boolean getChanged()
          Returns the value of the Changed property.
 boolean getChanged(int mask)
          Checks for the existence of the specified flag in the ChangedFlag property.
 com.klg.jclass.chart.JCChartTypeFormat getChartFormat()
          Gets the Format class for the current chart type.
 com.klg.jclass.chart.JCChartTypeFormat getChartFormat(int type)
          Gets the Format class for the specified chart type.
 List getChartStyle()
          Gets the value of the ChartStyle property.
 com.klg.jclass.chart.JCChartStyle getChartStyle(int index)
          Gets the value of the ChartStyle property.
 int getChartType()
          Gets the ChartType property of the ChartData object, which determines how the chart data is plotted.
 com.klg.jclass.util.ImageMapInfo[] getClusterImageMapInfo()
          Retrieves an array of image map information, one for each point cluster.
 com.klg.jclass.chart.JCDrawableColorHandler getColorHandler()
          Gets the values of the ColorHandler property.
protected  com.klg.jclass.chart.DataHandler getDataHandler()
          Gets the current DataHandler object.
 com.klg.jclass.chart.ChartDataModel getDataSource()
          Gets the DataSource property for ChartDataView.
 boolean getDrawFrontPlane()
          Gets the DrawFrontPlane property.
 int getDrawingOrder()
          Gets the DrawingOrder property.
 com.klg.jclass.chart.JCChartTypeFormat getExistingChartFormat(int type)
          Gets the Format class for the specified chart type if it exists.
 boolean getFastUpdate()
          Gets the FastUpdate property.
 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.
protected static int[] getFirstLastPoints(com.klg.jclass.chart.ChartDataView dv)
          Used for Radar charts.
 double getHoleValue()
          Returns the hole value for the chart data.
 com.klg.jclass.util.ImageMapInfo getImageMapInfo()
          Retrieve the image map information for this ChartDataView.
 Locale getLocale()
          Retrieve the local for this axis.
 String getName()
          Gets the Name property of the ChartData object.
 int getNumPointLabels()
          Gets the number of point labels set on this view.
 int getNumSeries()
          Gets the value of the NumSeries parameter, which determines how many data series there are in a ChartDataView.
 int getNumSeriesPerData()
          Returns the number of actual series that comprise one item to be drawn.
 int getOutlineCap()
          Gets the cap attribute of the outline around a filled chart item (for example, bar, pie).
 Color getOutlineColor()
          Gets the value of the OutlineColor property.
 int getOutlineJoin()
          Gets the join attribute of the outline around a filled chart item (for example, bar, pie).
 int getOutlinePattern()
          Gets the pattern of the outline around a filled chart item (for example, bar, pie).
 com.klg.jclass.chart.JCLineStyle getOutlineStyle()
          Gets the OutlineStyle property.
 int getOutlineWidth()
          Gets the width of the outline around a filled chart item (for example, bar, pie).
 com.klg.jclass.util.io.OutputDataProperties getOutputDataProperties()
          Get the current object which holds the output properties for writing data to a file and to html/xml properties.
 com.klg.jclass.chart.JCChart getParent()
          Gets the JCChart object with which a ChartDataView instance is associated.
 int getPickFocus()
          Gets the PickFocus property of the data view.
 String getPointLabel(int index)
          Gets a particular PointLabel from the PointLabels property.
 List getPointLabels()
          Gets the PointLabels property for the ChartDataView object.
 List getSeries()
          Gets the value of the Series property for this ChartDataView instance.
 com.klg.jclass.chart.ChartDataViewSeries getSeries(int index)
          Gets the value of the Series property at a particular index.
 int getSeriesIndex(com.klg.jclass.chart.ChartDataViewSeries srs)
          A convenience method to retrieve a data series index given data series itself.
 int getSeriesIndex(String name)
          A convenience method to retrieve a data series index given the name of the data series.
 int getVisibleDataSeries()
          Returns the number of children data series that are marked as visible.
 double[] getXArrayCopy()
          Gets a copy of the X values array currently used by this data view.
 com.klg.jclass.chart.JCAxis getXAxis()
          Gets the value of the XAxis property.
 com.klg.jclass.chart.MinMax getXLimits()
          Gets the the min and max X values in this data view.
 com.klg.jclass.chart.JCAxis getYAxis()
          Gets the value of the YAxis property.
 com.klg.jclass.chart.MinMax getYLimits()
          Gets the the min and max Y values in this data view.
 boolean hasVisibleInLegendChanged()
          Internal Use Only.
 boolean is3DChartType()
          Determines if chart type of this view is a 3D type.
 boolean isArrayData()
          This method returns true if the ChartDataView contains array data.
 boolean isBatched()
          Gets the Batched property.
 boolean isChanged()
          Determines if view has been marked as changed.
 boolean isChanged(int mask)
          Determines if view has been marked for a particular type of change.
 boolean isInverted()
          Sets the Inverted property of the data view.
 boolean isUsingDoublePixels()
           
 boolean isVisible()
          Gets whether the data view is showing or not.
 boolean isVisibleInLegend()
          Gets the VisibleInLegend property.
 com.klg.jclass.chart.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.
 void outputData(OutputStream stream)
          Saves the raw Data to the given output stream.
 void removeSeries(int index)
          Removes a single data series from the Series property of the ChartDataView instance.
 void setAutoLabel(boolean auto)
          Sets the AutoLabel property, which determines if a chart automatically generates labels for each point in each series.
 void setBatched(boolean isBatched)
          Sets the Batched property.
 void setBufferPlotData(boolean buffer)
          Sets the BufferPlotData property.
protected  void setChanged(boolean b)
          Convenience method used to set the changed state without update.
 void setChanged(boolean b, int cf)
          Sets the value of the Changed property.
 void setChanged(boolean b, int cf, boolean updateParent)
          Sets the value of the Changed property, with option to prevent parent updating via the updateParent parameter.
 void setChartStyle(int index, com.klg.jclass.chart.JCChartStyle value)
          Sets the value of the ChartStyle property.
 void setChartStyle(List cs)
          Sets the value of the ChartStyle property.
 void setChartType(int tp)
          Sets the ChartType property of the ChartData object, which specifies the type of chart used to plot the data.
 void setClusterImageMapInfo(com.klg.jclass.util.ImageMapInfo[] clusterImageMapInfo)
          Sets an array of image map information, one for each point cluster.
 void setColorHandler(com.klg.jclass.chart.JCDrawableColorHandler dch)
          Sets the values of the ColorHandler property.
 void setDataSource(com.klg.jclass.chart.ChartDataModel src)
          Sets the data source for this ChartDataView.
 void setDrawFrontPlane(boolean front)
          Gets the DrawFrontPlane property.
 void setDrawingOrder(int neword)
          Sets the DrawingOrder property of the ChartDataView object.
 void setFastUpdate(boolean fast)
          Sets the FastUpdate property.
 void setHoleValue(double val)
          Sets the hole value for the chart data.
 void setImageMapInfo(com.klg.jclass.util.ImageMapInfo imageMapInfo)
          Set the image map information for this ChartDataView.
 void setInverted(boolean inv)
          Sets the Inverted property of the data view.
 void setLocale(Locale locale)
          Set the locale for this axis.
 void setName(String nm)
          Sets the Name property of the ChartData object.
 void setOutlineCap(int cap)
          Sets the cap attribute of the outline around a filled chart item (for example, bar, pie).
 void setOutlineColor(Color c)
          Sets the value of the OutlineColor property.
 void setOutlineJoin(int join)
          Sets the join attribute of the outline around a filled chart item (for example, bar, pie).
 void setOutlinePattern(int pattern)
          Sets the pattern of the outline around a filled chart item (for example, bar, pie).
 void setOutlineStyle(com.klg.jclass.chart.JCLineStyle lineStyle)
          Sets the OutlineStyle property.
 void setOutlineWidth(int width)
          Sets the width of the outline around a filled chart item (for example, bar, pie).
 void setOutputDataProperties(com.klg.jclass.util.io.OutputDataProperties outputDataProperties)
          Set the current object which holds the output properties for writing data to a file and to html/xml properties.
 void setParent(com.klg.jclass.chart.JCChart parent)
          Sets the JCChart object with which a ChartDataView instance is associated.
 void setPickFocus(int foc)
          Sets the PickFocus property of the data view, which specifies how distance is determined for pick operations.
 void setPointLabel(int index, String label)
          Sets a particular PointLabel from the PointLabels property.
 void setPointLabels(List labels)
          Sets the PointLabels property for the ChartDataView object.
 void setSeries(int index, com.klg.jclass.chart.ChartDataViewSeries s)
          Sets the value of the Series property at a particular index.
 void setSeries(List newseries)
          Sets the value of the Series property for this ChartDataView instance.
 void setVisible(boolean showing)
          Sets whether the dataview is showing or not.
 void setVisibleInLegend(boolean shn)
          Sets the VisibleInLegend property.
 void setVisibleInLegendChanged(boolean changed)
          Internal Use Only.
 void setXAxis(com.klg.jclass.chart.JCAxis ax)
          Sets the value of the XAxis property.
 void setYAxis(com.klg.jclass.chart.JCAxis ax)
          Sets the value of the YAxis property.
 String toString()
          Output routine used for debugging.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

series

protected Vector series

PICK_FOCUS_LOCAL

public static final int PICK_FOCUS_LOCAL
Enum values for pick focus.

See Also:
Constant Field Values

PICK_FOCUS_XY

public static final int PICK_FOCUS_XY
See Also:
Constant Field Values

PICK_FOCUS_X

public static final int PICK_FOCUS_X
See Also:
Constant Field Values

PICK_FOCUS_Y

public static final int PICK_FOCUS_Y
See Also:
Constant Field Values

ERRMSG_INVALID_SERIES_INDEX

public static final String ERRMSG_INVALID_SERIES_INDEX
Error message for invalid series index.

See Also:
Constant Field Values

batched

protected boolean batched

fastUpdate

protected boolean fastUpdate

bufferPlotData

protected boolean bufferPlotData

holeValue

protected double holeValue

chartType

protected int chartType

name

protected String name

drawingOrder

protected int drawingOrder

drawFrontPlane

protected boolean drawFrontPlane

dataSource

protected com.klg.jclass.chart.ChartDataModel dataSource

xaxis

protected com.klg.jclass.chart.JCAxis xaxis

yaxis

protected com.klg.jclass.chart.JCAxis yaxis

pointLabels

protected List pointLabels

clusterImageMapInfo

protected com.klg.jclass.util.ImageMapInfo[] clusterImageMapInfo

imageMapInfo

protected com.klg.jclass.util.ImageMapInfo imageMapInfo

inverted

protected boolean inverted

pickFocus

protected int pickFocus

visibleInLegend

protected boolean visibleInLegend

visibleInLegendChanged

protected boolean visibleInLegendChanged

autoLabel

protected boolean autoLabel

outlineStyle

protected com.klg.jclass.chart.JCLineStyle outlineStyle

colorHandler

protected com.klg.jclass.chart.JCDrawableColorHandler colorHandler

outputDataProperties

protected com.klg.jclass.util.io.OutputDataProperties outputDataProperties

dataHandler

protected transient com.klg.jclass.chart.DataHandler dataHandler

visible

protected boolean visible

changed

protected boolean changed

changedFlag

protected int changedFlag

allowPick

protected boolean allowPick

step

protected double step

chart

protected com.klg.jclass.chart.JCChart chart

xLimits

protected com.klg.jclass.chart.MinMax xLimits

yLimits

protected com.klg.jclass.chart.MinMax yLimits

locale

protected Locale locale

format_class_names

public static final String[] format_class_names
Class names of format classes. These names should correspond in position in the array to the chart types in JCChart.


formatClassHashtable

protected Hashtable formatClassHashtable

dataViewNum

protected static int dataViewNum
Constructor Detail

ChartDataView

public ChartDataView()
Constructor. Default chart type of PLOT. Default name generated.

Method Detail

setParent

public void setParent(com.klg.jclass.chart.JCChart parent)
Sets the JCChart object with which a ChartDataView instance is associated.

Parameters:
parent -

getParent

public com.klg.jclass.chart.JCChart getParent()
Gets the JCChart object with which a ChartDataView instance is associated.

Returns:
JCChart object

setLocale

public void setLocale(Locale locale)
Set the locale for this axis.


getLocale

public Locale getLocale()
Retrieve the local for this axis.


chartDataChange

public void chartDataChange(com.klg.jclass.chart.ChartDataEvent evt)
Implements the ChartDataListener interface. This method will be called after chart data has changed.

Specified by:
chartDataChange in interface ChartDataListener
Parameters:
evt - the chart data event object

doFastUpdate

public boolean doFastUpdate(int column,
                            int nPoints)
Performs a fast update to the chart by just drawing over the current chart without doing a lot of recalcing and redrawing of existing points. Called internally; not intended to be called externally. A call to this method is generated by sending an APPEND_DATA event to chart when the FastUpdate property of the view has been turned on.
NOTE: This will cause problems with internal frames, drop down menus, and other such items that might be in the way when a draw happens.

Parameters:
column - column number of data array with new data
nPoints - Number of points added
Returns:
true if fast update drawn; false otherwise

checkNewPoints

public boolean checkNewPoints(int npoints)
Checks newly added points to see if they fit inside current axis bounds.

Parameters:
npoints - the number of points to check; it refers to the number of points newly added to the end of all series
Returns:
true if all points sit inside the current axis bounds, which are set to the default values; false if any point sits outside a current axis bound that is set to a default value

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 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. The hole value should not be set to Double.NAN.

If the hole value is changed, previously designated hole values will be drawn at their actual set value (that is, the old hole value). If this old hole value is the default hole Double.MAX_VALUE, chart will experience severe drawing slowness, as it will be trying to scale its values to such a great range. If you are using this method to change hole values, it is suggested that you first change the previous hole values inside the data to something realistic or to the new hole value you are about to set.

Parameters:
val - floating-point value used as a placeholder for missing values

isBatched

public boolean isBatched()
Gets the Batched property. ChartData is a model for the ChartGroup object. The Batched property controls whether the ChartGroup is notified immediately of ChartData changes, or if the changes are accumulated and sent at a later date.

Specified by:
isBatched in interface Changeable
Returns:
true if changes are accumulated; false otherwise

setBatched

public void setBatched(boolean isBatched)
Sets the Batched property. ChartData is a model for the ChartGroup object. The Batched property controls whether the ChartGroup is notified immediately of ChartData changes, or if the changes are accumulated and sent at a later date.

Parameters:
isBatched - true if changes are accumulated; false otherwise

getFastUpdate

public boolean getFastUpdate()
Gets the FastUpdate property. This property determines whether column appends are done quickly, only recalculating and redrawing the new data.

Returns:
true if column appends are done quickly

setFastUpdate

public void setFastUpdate(boolean fast)
Sets the FastUpdate property. This property determines whether column appends are done quickly, only recalculating and redrawing the new data.

Parameters:
fast - true if appends are to be done quickly

getBufferPlotData

public boolean getBufferPlotData()
Gets the BufferPlotData property. This property determines whether calculated plot data will be buffered to speed up drawing.

Returns:
true if buffering is to be performed

setBufferPlotData

public void setBufferPlotData(boolean buffer)
Sets the BufferPlotData property. This property determines whether calculated plot data will be buffered to speed up drawing.

Parameters:
buffer - if buffering is to be performed

getChartType

public int getChartType()
Gets the ChartType property of the ChartData object, which determines how the chart data is plotted.

Returns:
enumeration specifying the chart type

setChartType

public void setChartType(int tp)
Sets the ChartType property of the ChartData object, which specifies the type of chart used to plot the data.

Parameters:
tp - enumeration specifying the chart type; valid values are: JCChart.AREA, JCChart.AREA_RADAR, JCChart.BAR, JCChart.CANDLE, JCChart.HILO, JCChart.HILO_OPEN_CLOSE, JCChart.PIE, JCChart.PLOT, JCChart.POLAR, JCChart.RADAR, JCChart.SCATTER_PLOT, JCChart.STACKING_AREA, and JCChart.STACKING_BAR.
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.

Specified by:
getName in interface com.klg.jclass.util.JCName
Returns:
name of the ChartData object

setName

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

Specified by:
setName in interface com.klg.jclass.util.JCName
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 void setDrawingOrder(int neword)
Sets 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

getDrawFrontPlane

public boolean getDrawFrontPlane()
Gets the DrawFrontPlane property. DrawFrontPlane determines whether a data view that has both axes on the front plane of a 3d graph will draw on the front or back plane of that graph. If true, it will draw on the front plane; if false, it will draw on the back plane. If either axis associated with the data view is on the back plane, this property will be ignored and the data view will automatically be drawn on the back plane. This property is also ignored for 3d chart types such as bar and stacking bar that automatically appear on the front plane.

Returns:
boolean representing whether to try to draw on the front or back plane of a 3d chart

setDrawFrontPlane

public void setDrawFrontPlane(boolean front)
Gets the DrawFrontPlane property. DrawFrontPlane determines whether a data view that has both axes on the front plane of a 3d graph will draw on the front or back plane of that graph. If true, it will draw on the front plane; if false, it will draw on the back plane. If either axis associated with the data view is on the back plane, this property will be ignored and the data view will automatically be drawn on the back plane. This property is also ignored for 3d chart types such as bar and stacking bar that automatically appear on the front plane.

Parameters:
front - true if trying to draw on front plane of 3d chart; false otherwise

getDataSource

public com.klg.jclass.chart.ChartDataModel getDataSource()
Gets the DataSource property for ChartDataView. This DataSource property represents the class used to load data into the ChartDataView class. The DataSource property holds this populating class if it implements either EditableChartDataModel or ChartDataManageable. If the DataSource property is null, that means that the populating data source class was discarded because it was no longer needed.

Returns:
object acting as a data source for ChartDataView; this object implements either EditableChartDataModel or ChartDataManageable

setDataSource

public void setDataSource(com.klg.jclass.chart.ChartDataModel src)
Sets the data source for this ChartDataView. The data source class must implement either ChartDataModel or EditableChartDataModel. JClass Chart will do the correct operation based on the object provided. If this data source class implements ChartDataManageable, this data view will be registered as a listener for data changes. The data source class will be saved in the DataSource property for future reference if it implements either ChartDataManageable or EditableChartDataModel. Otherwise, since it is only needed to load data once, the DataSource property will be set to null.

Parameters:
src - object acting as a data source for ChartDataView; this object must implement either ChartDataModel or EditableChartDataModel

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 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 List 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:
vector of String objects representing the point labels

getNumPointLabels

public int getNumPointLabels()
Gets the number of point labels set on this view.

Returns:
number of point labels set on this view

setPointLabels

public void setPointLabels(List 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 - collection of String objects representing the point labels

getClusterImageMapInfo

public com.klg.jclass.util.ImageMapInfo[] getClusterImageMapInfo()
Retrieves an array of image map information, one for each point cluster.

Returns:
The current cluster image map information array.

setClusterImageMapInfo

public void setClusterImageMapInfo(com.klg.jclass.util.ImageMapInfo[] clusterImageMapInfo)
Sets an array of image map information, one for each point cluster.

Parameters:
clusterImageMapInfo - The new cluster image map information array.

getImageMapInfo

public com.klg.jclass.util.ImageMapInfo getImageMapInfo()
Retrieve the image map information for this ChartDataView. This object is used to store the legend title image map information.

Returns:
The current image map information.

setImageMapInfo

public void setImageMapInfo(com.klg.jclass.util.ImageMapInfo imageMapInfo)
Set the image map information for this ChartDataView. This object is used to store the legend title image map information.

Parameters:
imageMapInfo - The new image map information.

getSeries

public List 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:
list object containing ChartDataViewSeries instances representing the requested data series

getSeries

public com.klg.jclass.chart.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
Returns:
values of the Series property at a particular index
Throws:
IllegalArgumentException - If the provided index does not address an existing ChartDataViewSeries.

setSeries

public void setSeries(List 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 - list object containing ChartDataViewSeries instances in the desired drawing order; the existing series property will be replaced

setSeries

public void setSeries(int index,
                      com.klg.jclass.chart.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
s -
Throws:
IllegalArgumentException - If the provided index does not address an existing ChartDataViewSeries.

addSeries

public com.klg.jclass.chart.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 void addSeries(com.klg.jclass.chart.ChartDataViewSeries s)
Adds a ChartDataViewSeries to the view at the end of the list.

Parameters:
s -

removeSeries

public 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(com.klg.jclass.chart.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

getChartFormat

public com.klg.jclass.chart.JCChartTypeFormat getChartFormat()
Gets the Format class for the current chart type. If the current chart type should have a format class but has not been created yet, one will be created and returned.

Returns:
the Format class for the current chart type; one of JCAreaChartFormat, JCBarChartFormat, JCCandleChartFormat, JCHLOCChartFormat, JCHiloChartFormat, JCPieChartFormat, or JCPolarRadarChartFormat depending on the chart type, or null if the current chart type should not have a format class

getChartFormat

public com.klg.jclass.chart.JCChartTypeFormat getChartFormat(int type)
Gets the Format class for the specified chart type. If the specified chart type should have a format class but has not been created yet, one will be created and returned.

Parameters:
type - the chart type
Returns:
the Format class for the specified chart type; one of JCAreaChartFormat, JCBarChartFormat, JCCandleChartFormat, JCHLOCChartFormat, JCHiloChartFormat, JCPieChartFormat, or JCPolarRadarChartFormat depending on the chart type, or null if the specified chart type should not have a format class

getExistingChartFormat

public com.klg.jclass.chart.JCChartTypeFormat getExistingChartFormat(int type)
Gets the Format class for the specified chart type if it exists. Does not create a new format class if it doesn't exist.

Parameters:
type - the chart type
Returns:
the Format class for the specified chart type; one of JCAreaChartFormat, JCBarChartFormat, JCCandleChartFormat, JCHLOCChartFormat, JCHiloChartFormat, JCPieChartFormat, or JCPolarRadarChartFormat depending on the chart type, or null if the specified chart type should not have a format class

getXAxis

public com.klg.jclass.chart.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 void setXAxis(com.klg.jclass.chart.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 com.klg.jclass.chart.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 void setYAxis(com.klg.jclass.chart.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 com.klg.jclass.chart.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 com.klg.jclass.chart.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(com.klg.jclass.chart.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 com.klg.jclass.chart.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
Returns:
JCDataIndex instance containing data view, series, and point

is3DChartType

public boolean is3DChartType()
Determines if chart type of this view is a 3D type. Currently, this is limited to either bar or stacking bar charts.
NOTE: Pie charts are technically 3D, but are handled differently.

Returns:
true if the chart type of this view is either BAR or STACKING_BAR

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
Returns:

getXLimits

public com.klg.jclass.chart.MinMax getXLimits()
Gets the the min and max X values in this data view.

Returns:
min and max X values in this data view

getYLimits

public com.klg.jclass.chart.MinMax getYLimits()
Gets the the min and max Y values in this data view.

Returns:
min and max Y values in this data view

isChanged

public boolean isChanged()
Determines if view has been marked as changed.

Specified by:
isChanged in interface Changeable
Returns:
true if view has been marked as changed

isChanged

public boolean isChanged(int mask)
Determines if view has been marked for a particular type of change.

Specified by:
isChanged in interface Changeable
Parameters:
mask - the type of change to check for; see Changeable for a list of masks
Returns:
true if view has been marked as changed

getChanged

public boolean getChanged()
Returns the value of the Changed property.

Specified by:
getChanged in interface Changeable
Returns:
value of the Changed property

getChanged

public boolean getChanged(int mask)
Checks for the existence of the specified flag in the ChangedFlag property.

Specified by:
getChanged in interface Changeable
Parameters:
mask - the type of change to check for; see Changeable for a list of masks
Returns:

setChanged

protected void setChanged(boolean b)
Convenience method used to set the changed state without update.

Parameters:
b -

setChanged

public void setChanged(boolean b,
                       int cf)
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.

Specified by:
setChanged in interface Changeable
Parameters:
b -
cf -

setChanged

public void setChanged(boolean b,
                       int cf,
                       boolean updateParent)
Sets the value of the Changed property, with option to prevent parent updating via the updateParent parameter.
Note: updateParent is independent of Batched

Specified by:
setChanged in interface Changeable
Parameters:
b -
cf -
updateParent -

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.

Returns:

getVisibleDataSeries

public int getVisibleDataSeries()
Returns the number of children data series that are marked as visible.

Returns:
number of children data series that are marked as visible

calcTransientData

public void calcTransientData()
Calculates data associated with view data. For example, pie charts need percentage data to be calculated based on the x,y data specified here.


setInverted

public void setInverted(boolean inv)
Sets the Inverted property of the data view. If the Inverted 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

isInverted

public boolean isInverted()
Sets the Inverted property of the data view. If the Inverted 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 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

isVisibleInLegend

public boolean isVisibleInLegend()
Gets the VisibleInLegend property. This property determines whether or not the view name and its series will appear in the chart legend.

Returns:
true if the name will appear in the legend

setVisibleInLegend

public void setVisibleInLegend(boolean shn)
Sets the VisibleInLegend property. This property determines whether or not the view name and its series will appear in the chart legend.

Parameters:
shn -

hasVisibleInLegendChanged

public boolean hasVisibleInLegendChanged()
Internal Use Only. Return the boolean that tracks whether the user has changed the VisibleInLagend property or whether it is still coupled to the Visible property.


setVisibleInLegendChanged

public void setVisibleInLegendChanged(boolean changed)
Internal Use Only. Return the boolean that tracks whether the user has changed the VisibleInLagend property or whether it is still coupled to the Visible property.


getAutoLabel

public boolean getAutoLabel()
Gets the AutoLabel property, which determines if a chart automatically generates labels for each point in each series. The default is false. The labels are stored in the AutoLabelList property. They are created using the Label property of each series.

Returns:
the AutoLabel property

setAutoLabel

public void setAutoLabel(boolean auto)
Sets the AutoLabel property, which determines if a chart automatically generates labels for each point in each series. The labels are stored in the AutoLabelList property. They are created using the Label property of each series.

Parameters:
auto - the value to set the AutoLabel property to

getOutlineColor

public Color getOutlineColor()
Gets the value of the OutlineColor property. The OutlineColor property determines the color with which to draw the outline around a filled chart item (for example, bar, pie).

Returns:
Color instance indicating the color that the outline will be drawn in. If the property has not been set and a parent chart exists, the default color of the chart's forground color will be returned; otherwise, null is returned.

setOutlineColor

public void setOutlineColor(Color c)
Sets the value of the OutlineColor property. The OutlineColor property determines the color with which to draw the outline around a filled chart item (for example, bar, pie).

Parameters:
c - the color to draw the outline in

getOutlineWidth

public int getOutlineWidth()
Gets the width of the outline around a filled chart item (for example, bar, pie).

Returns:
the pixel width of chart outlines

setOutlineWidth

public void setOutlineWidth(int width)
Sets the width of the outline around a filled chart item (for example, bar, pie).

Parameters:
width - pixel width of the outline

getOutlinePattern

public int getOutlinePattern()
Gets the pattern of the outline around a filled chart item (for example, bar, pie).

Returns:
one of JCLineStyle.NONE, JCLineStyle.SOLID, JCLineStyle.LONG_DASH, JCLineStyle.SHORT_DASH, JCLineStyle.LSL_DASH, or JCLineStyle.DASH_DOT

setOutlinePattern

public void setOutlinePattern(int pattern)
Sets the pattern of the outline around a filled chart item (for example, bar, pie).

Parameters:
pattern - one of JCLineStyle.NONE, JCLineStyle.SOLID, JCLineStyle.LONG_DASH, JCLineStyle.SHORT_DASH, JCLineStyle.LSL_DASH, or JCLineStyle.DASH_DOT

getOutlineJoin

public int getOutlineJoin()
Gets the join attribute of the outline around a filled chart item (for example, bar, pie).

Returns:
one of BasicStroke.JOIN_MITER, BasicStroke.JOIN_BEVEL, or BasicStroke.JOIN_ROUND

setOutlineJoin

public void setOutlineJoin(int join)
Sets the join attribute of the outline around a filled chart item (for example, bar, pie).

Parameters:
join - one of BasicStroke.JOIN_MITER, BasicStroke.JOIN_BEVEL, or BasicStroke.JOIN_ROUND

getOutlineCap

public int getOutlineCap()
Gets the cap attribute of the outline around a filled chart item (for example, bar, pie).

Returns:
one of BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, or BasicStroke.CAP_SQUARE

setOutlineCap

public void setOutlineCap(int cap)
Sets the cap attribute of the outline around a filled chart item (for example, bar, pie).

Parameters:
cap - one of BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, or BasicStroke.CAP_SQUARE

getOutlineStyle

public com.klg.jclass.chart.JCLineStyle getOutlineStyle()
Gets the OutlineStyle property. The OutlineStyle property determines the color, width, and pattern (SOLID, LONG_DASH, DASH_DOT, etc.) of an outline around a filled chart item (for example, bar, pie).

Returns:
a JCLineStyle object

setOutlineStyle

public void setOutlineStyle(com.klg.jclass.chart.JCLineStyle lineStyle)
Sets the OutlineStyle property. The OutlineStyle property determines the color, width, and pattern (SOLID, LONG_DASH, DASH_DOT, etc.) of an outline around a filled chart item (for example, bar, pie).

Parameters:
lineStyle - a JCLineStyle object

setChartStyle

public void setChartStyle(int index,
                          com.klg.jclass.chart.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
value -

getChartStyle

public com.klg.jclass.chart.JCChartStyle getChartStyle(int index)
Gets the value of the ChartStyle property. The ChartStyle property contains all of 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 List getChartStyle()
Gets the value of the ChartStyle property. The ChartStyle property contains all the ChartStyles for the data series in this data view.

Returns:
List object containing JCChartStyle instances used for this data view

setChartStyle

public void setChartStyle(List 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 - List object containing JCChartStyle instances used for this data view

setColorHandler

public void setColorHandler(com.klg.jclass.chart.JCDrawableColorHandler dch)
Sets the values of the ColorHandler property. The ColorHandler property references a class that implements the JCDrawableColorHandler interface to override the default color for drawing chart data. Currently, the color handler is only used by Plot charts. A null value for this property indicates that the default series color is to be used.

Parameters:
dch - a class implementing the JCDrawableColorHandler interface

getColorHandler

public com.klg.jclass.chart.JCDrawableColorHandler getColorHandler()
Gets the values of the ColorHandler property. The ColorHandler property references a class that implements the JCDrawableColorHandler interface to override the default color for drawing chart data. Currently, the color handler is only used by Plot charts. A null value for this property indicates that the default series color is to be used.

Returns:
the color handler, a class implementing the JCDrawableColorHandler interface, or null

getOutputDataProperties

public com.klg.jclass.util.io.OutputDataProperties getOutputDataProperties()
Get the current object which holds the output properties for writing data to a file and to html/xml properties.

Returns:
The current data output properties object

setOutputDataProperties

public void setOutputDataProperties(com.klg.jclass.util.io.OutputDataProperties outputDataProperties)
Set the current object which holds the output properties for writing data to a file and to html/xml properties.

Parameters:
outputDataProperties - The new ata output properties object

getXArrayCopy

public double[] getXArrayCopy()
Gets a copy of the X values array currently used by this data view.

Returns:
a new array containing a copy of the X values array currently used by this data view

isArrayData

public boolean isArrayData()
This method returns true if the ChartDataView contains array data.


getNumSeriesPerData

public int getNumSeriesPerData()
Returns the number of actual series that comprise one item to be drawn. For most chart types, this is a one to one relationship. For Hi-Lo charts, 2 series are needed for one item. FOR Hi-Lo-Open-Close and Candle charts, 4 series are needed.

Returns:
number of acutal series that comprise one item to be drawn

setVisible

public void setVisible(boolean showing)
Sets whether the dataview is showing or not.
Note: This will also set VisibleInLegend to the same value. If you wish VisibleInLegend to have a different value, please call setVisibleInLegend() following setVisible().

Parameters:
showing -

isVisible

public boolean isVisible()
Gets whether the data view is showing or not.

Returns:
whether the data view is showing or not

outputData

public void outputData(OutputStream stream)
Saves the raw Data to the given output stream. The data written should be readable by InputStreamDataSource.

Parameters:
stream - the OutputStream to write the data to

getDataHandler

protected com.klg.jclass.chart.DataHandler getDataHandler()
Gets the current DataHandler object.

Returns:
current DataHandles object

getFirstLastPoints

protected static int[] getFirstLastPoints(com.klg.jclass.chart.ChartDataView dv)
Used for Radar charts. This method searches all of the data series for the highest value of firstPoint and lowest value of lastPoint. If no error occurs, a two-element integer array is returned. The first array element is the value of firstPoint. The second array element is the value of lastPoint. If an error occurs, null is returned.

Parameters:
dv -
Returns:
If no error occurs, a two-element integer array is returned. The first array element is the value of firstPoint. The second array element is the value of lastPoint. If an error occurs, null is returned.

isUsingDoublePixels

public boolean isUsingDoublePixels()

Copyright © 2004 Quest Software Inc..
All rights reserved.