Data Methods

clearDataLabels()

This method clears the labels in the chart look but not in the data that defines the chart.

SYNTAX:

void clearDataLabels();

INPUT:

None

RETURN:

void;

clearDataStorage()

This method clears all data and labels from a chart.

SYNTAX:

void clearDataStorage ();

INPUT:

None

RETURN:

void;

EXAMPLE:

clearDataStorage();
setData(0, 0, 10);
setData(0, 1, 01);
setData(0, 2, 02);
setDataRangeToExtent();

clearGroupLabels()

This method clears all group labels.

SYNTAX:

void clearGroupLabels();

INPUT:

None

RETURN:

void;

EXAMPLE:

clearGroupLabels();
setViewableGroups(3);
setDataScrollerPresenceGroups(0);
setViewableSeries(3);
setDepthRadius(0);

ALSO SEE:

clearSeriesLabels()

clearSeriesLabels()

This method clears all series labels.

SYNTAX:

void clearSeriesLabels();

INPUT:

None

RETURN:

void;

EXAMPLE:

clearSeriesLabels();
setViewableGroups(3);
setDataScrollerPresenceGroups(0);
setViewableSeries(3);
setDepthRadius(0);

ALSO SEE:

clearGroupLabels()

clearZoomList()

This function clears all state entries in the zoom list. When zooming is enabled with doZoomIn() and doZoomOut(), the current state of zooming is maintained in a zoom list. For example, the initial, un-zoomed state is "state 0". When doZoomIn() is called (through the UI or the API), "state 1" specifies the zoomed-in state. When doZoomIn() is called again, "state 2" is appended to the list. The setZoomIndex() function can be used to change the state back to "state 1" (for example). If doZoomOut() is called, the old "state 2" is eliminated from the list (all states ABOVE the current one are eliminated), and the new zoomed-out state becomes state 2. This function will clear all entries in the zoom list and restore the list and the chart to its initial, un-zoomed state.

SYNTAX:

void clearZoomList();

INPUT:

None

RETURN:

void;

ALSO SEE:

ZoomPercentage, doZoomIn(), doZoomOut(), getZoomIndex(), setZoomIndex()

doZoomIn()

This method zooms in on the data in a chart by the value of ZoomPercentage. ZoomDirection defines whether zooming is performed on the Y-axis, X-axis, or both.

SYNTAX:

void doZoomIn ();
void doZoomIn (int x, int y);
void doZoomIn (java.awt.Point pt);
void doZoomIn (java.awt.Rectangle r);

INPUT:

x, y: X/Y coordinates of a point specified in virtual coordinates.

pt: A POINT Java object

r: A Java rectangle specified in Perspective virtual coordinates

RETURN:

void;

NOTES:

This method is not currently supported for 3D graph types.

ALSO SEE:

ZoomDirection, ZoomPercentage, get/setZoomIndex(), clearZoomList()

doZoomOut()

This method zooms out from the data in the chart by the value of ZoomPercentage. ZoomDirection defines whether zooming is performed on the Y-axis, X-axis, or both.

SYNTAX:

void doZoomOut();
void doZoomOut(int x, int y);
void doZoomOut(java.awt.Point pt);

INPUT:

x, y: X/Y coordinates of a point specified in virtual coordinates.

pt: A POINT Java object

RETURN:

void;

NOTES:

ALSO SEE:

ZoomDirection, ZoomPercentage, doZoomIn(), get/setZoomIndex(), clearZoomList()

getChartDataValid()

This method returns a boolean that identifies whether or not chart data is valid.

SYNTAX:

boolean getChartDataValid();

INPUT:

None

RETURN:

boolean; true/false; true = Chart data is valid, false = Data not valid

getDataAsDouble()

This method returns the numeric value for any row/column intersection.

SYNTAX:

double getDataAsDouble ( int row,  int col ); 

INPUT:

row; Row from which to retrieve data

col; Column from which to retrieve data

RETURN:

double; the data at the specified row and column

ALSO SEE:

getDataAsString()

getDataAsString()

This method returns a value for any series/group intersection and converts it to a string.

SYNTAX:

string getDataAsString (int row, int col); 

INPUT:

row; row from which to get value

col; column from which to get value

RETURN:

string; string at row, col

EXAMPLE:

setScrollOffsetGroup(0);
setScrollOffsetSeries(0);
setViewableGroups(3);
setViewableSeries(3);
setDataScrollerPresenceGroups(0);
setDataScrollerPresenceSeries(0);
setGroupLabel(0, getDataAsString(0, 0));
setGroupLabel(1, getDataAsString(0, 1));
setGroupLabel(2, getDataAsString(0, 2));
setLegendDisplay(false);

ALSO SEE:

getDataAsDouble()

getDataCoord()

This method can be used to determine the location of an object in a chart.

SYNTAX:

int getDataCoord (IdentObj id);
int getDataCoord(IdentObj id, DataItem item, boolean bCumulative);

INPUT:

id; object ID returned by a getObject() method (e.g., getFrame())

item; data item

bCumulative; true/false

RETURN:

int; The x, y coordinates of an object in a chart

ALSO SEE:

getDataFromCoord()

getDataExtents()

This method returns the column starting position and number of columns and rows of data that are used to draw the chart.

SYNTAX:

Rectangle getDataExtents();

INPUT:

None

RETURN:

Rectangle; data extents dimension type.

getDataFromCoord()

This method returns a data value for an object at a specified coordinates in a chart.

SYNTAX:

double getDataFromCoord ( IdentObj id,  int nCoordVC );
double getDataFromCoord(IdentObj id, DataItem item, int nCoordVC);

INPUT:

id; object ID returned by a getObject() method (e.g., getY1Axis())

nCoordVC; Virtual coordinance of object

item; data item

RETURN:

double; the data at the specified coordinates

ALSO SEE:

getDataCoord()

get/setDataLabel()

These methods get/set a label string for a specified series (s) and group (g).

SYNTAX:

String getDataLabel ( int s, int g );
void setDataLabel ( int s,  int g, String newValue );

INPUT:

s; Series number

g; Group number

newValue; Data label string

RETURN:

String; the data label at series (s)/group (g)

EXAMPLE:

setDataLabel(0, 0, "My New Group 0 Label");
setDataLabel(0, 1, "My New Group 1 Label");
setGroupLabel(0, getDataLabel(0, 0));
setGroupLabel(1, getDataLabel(0, 1));
setDataRange(0, 0, 3, 1);

ALSO SEE:

get/setGroupLabel(), get/setSeriesLabel(), For HTML ONLY, see setSeriesLabelArray() and setGroupLabelArray() in the Perspective for Java Programmer's Manual.

get/setDataRange()

The getDataRange() method returns a rectangle that represents the current range of data viewed/charted in a graph. The setDataRange() method is used to establish the range of data that will be used in a chart.

SYNTAX:

java.awt.extents getDataRange ();
void setDataRange(int rowStop, int colStop);
void setDataRange(int rowStart, int colStart, int rowStop, int colStop);

INPUT:

rowStop; last row number

colStop; last column number

rowStart; first row number (0 if not specified)

colStart; first column number (0 if not specified)

RETURN:

Rectangle.x, Rectangle.y; Starting Row, Column

Rectangle.width, Rectangle.height; Ending Row, Column

EXAMPLE:

setDataRange(1, 1, 2, 2);

ALSO SEE:

setData(), setDataFileURL(), setDataFromCallBack(), setDataFromDataGrid(), setDataFromResultSet(), setDataFromSQL(), setDataRangeToExtent()

get/setDataValue()

These methods get/set a data value for a data object (riser) in a chart.

SYNTAX:

double getDataValue (IdentObj id);
void setDataValue(IdentObj id,  double newValue );

INPUT:

id; object ID returned by a getObject() method (e.g., getSeriesGroup())

newValue; data value to be assigned to the object

RETURN:

double; data value at id

EXAMPLE:

setDataRange(1, 1, 2, 2);
setDataTextDisplay(true);
setDataTextPosition(0);
setDataTextRadius(0, 0, 20);
setDataTextRadius(0, 1, 20);
setDataTextRadius(1, 0, 20);
setDataTextRadius(1, 1, 20);
setDataValue(getSeriesGroup(0, 0), 100);
setDataValue(getSeriesGroup(0, 1), 50);
setDataValue(getSeriesGroup(1, 0), 25);
setDataValue(getSeriesGroup(1, 1), 5); 
setDepthRadius(0);

get/setGroupLabel()

These methods get/set a data value for a data object (riser) in a chart.

SYNTAX:

String getGroupLabel();
String getGroupLabel(IdentObj id);
String getGroupLabel(int groupID);
void setGroupLabel(IdentObj id, String newValue);
void setGroupLabel(int g, String newValue);
void setGroupLabel(String newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getGroup())

groupID; a group number

RETURN:

String; group label

EXAMPLE:

setDepthRadius(0);
setGroupLabel(0, "Fish");
setGroupLabel(1, "Birds");
setGroupLabel(2, "Cats");
setGroupLabel(3, "Puppies");
setGroupLabel(4, "Parrots");
setGroupLabel(5, "Spiders");
setTitleString("Jake's Pet Store");

NOTES:

If an object ID or group number is not specified, newValue is assigned to the first item in the selection list (if applicable).

ALSO SEE:

get/setDataLabel(), get/setSeriesLabel()

get/setSeriesLabel()

These methods get/set a label string associated with a series in a chart.

SYNTAX:

string getSeriesLabel();
string getSeriesLabel(IdentObj id);
string getSeriesLabel(int seriesID);
void setSeriesLabel(String newValue);
void setSeriesLabel(IdentObj id, String newValue);
void setSeriesLabel(int seriesID, String newValue);

INPUT:

seriesID; Any valid series number

id; object ID returned by a getObject() method (e.g., getSeries())

newValue: series label string

RETURN:

String; series label

EXAMPLE:

setUseSampleData(false);
setDepthRadius(0);
setData(0, 0, .5); // Row 0/Column 0
setData(0, 1, 1); // Row 0/Column 1
setData(0, 2, 2); // Row 0/Column 2
setData(0, 3, 3); // Row 0/Column 3
setData(1, 0, 10); // Row 1/Column 0
setData(1, 1, 11); // Row 1/Column 1
setData(1, 2, 12); // Row 1/Column 2
setData(1, 3, 13); // Row 1/Column 3
setDataRangeToExtent();
setSeriesLabel(0, "Series 0");
setSeriesLabel(1, "Series 1");
setGroupLabel(0, "Group 0");
setGroupLabel(1, "Group 1");
setGroupLabel(2, "Group 2");
setGroupLabel(3, "Group 3");
setSeriesAreRows(true, true);

NOTES:

If a specific object is not identified with the input parameters id or seriesID, these methods get/set the associated value (if any) for the first item in the selection list.

ALSO SEE:

getSelSeries()

get/setTextString()

These methods get/set a text string for a specified text object.

SYNTAX:

string getTextString();
string getTextString(IdentObj id);
void setTextString(String newValue);
void setTextString(IdentObj id, String newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getTitle())

newValue; string to assign to a text object

RETURN:

string; string assigned to the text object

EXAMPLE:

setDepthRadius(0);
setUseSampleData(false);
setData(0, 0, 20);
setData(0, 1, 36);
setData(1, 0, 33);
setData(1, 1, 39);
setDataRangeToExtent();
setTextString(getFootnote(),  "THE CHART FOOTNOTE");

NOTES:

If a specific object is not identified with the input parameter id, these methods get/set the associated value (if any) for the first item in the selection list.

ALSO SEE:

FootnoteString, O1TitleString, O2TitleString, SubtitleString, TitleString, X1TitleString, Y1TitleString, Y2TitleString

getViewableDataRange()

This method returns a rectangle that represents the current viewable range of data charted in a graph.

SYNTAX:

DataRange getViewableDataRange();

INPUT:

None

RETURN:

Rectangle.x; Starting Row

Rectangle.y; Starting Column

Rectangle.width; Ending Row

Rectangle.height; Ending Column

ALSO SEE:

getDataRange(), getViewableDataRangeSG()

getViewableDataRangeSG()

This method returns a rectangle that represents the current viewable range of data charted in a graph in series in groups.

SYNTAX:

DataRange getViewableDataRangeSG();

INPUT:

None

RETURN:

Rectangle.x; Starting Series

Rectangle.y; Starting Group

Rectangle.width; Ending Series

Rectangle.height; Ending Groups

ALSO SEE:

getViewableDataRange()

get/setZoomIndex()

These methods get/set the current zoom state. When data zooming is enabled with the zoom properties/methods or via the user interface (setSelectionEnable(5)), Perspective will maintain a Zoom Index that keeps track of the number of times a chart has been zoomed in and the state of zooming. As an example, assume ZoomPercentage is set to 10%, and the user clicks ONCE. The chart is now zoomed to 90% of its original values, and the Zoom Index is now 1. Now the user clicks A SECOND TIME. The chart is now zoomed to 80% of its orignal values, and the zoom index now is 2. Or, actually, the zoom index now has TWO entries: one for the first, 90% state, and a second for the second, 80% state. You can keep adding to the zoom index as the user contines to click. Continuing with the example and the same values, assume the user has clicked eight consecutive times. The Zoom index now contains eight items:

  1. First Level: Zoom Factor 90%
  2. Second Level: Zoom Factor 80%
  3. Third Level: Zoom Factor 70%
  4. Fourth Level: Zoom Factor 60%
  5. Fifth Level: Zoom Factor 50%
  6. Sixth Level: Zoom Factor 40%
  7. Seventh Level: Zoom Factor 30%
  8. Eighth Level: Zoom Factor 20%

Your application can go back and forth in this list. For example, assume you want to switch from the "current" level (the last level the user clicked, the eighth zoom level which currently shows 20% of the original unzooomed state). You could use setZoomIndex(4) to IMMEDIATELY switch to the FOURTH level which had a zoom factor of 60%. You can use setZoomIndex() to switch back and forth between any zoom level set.

SYNTAX:

int getZoomIndex ();
void setZoomIndex(int index );

INPUT:

index; the new zoom index value

RETURN:

int: the index for the current zoom state (0=zooming is not enabled).

ALSO SEE:

isValidZoomIndex(), isZoomingArmed(), doZoomIn(), doZoomOut()

isSQLTypeNumeric()

This method can be used to determine whether or not an SQL data type is numeric.

SYNTAX:

boolean isSQLTypeNumeric (int sqlType);

INPUT:

sqlType: an SQL data type

RETURN:

boolean; true = sqlType is one of: TINYINT, SMALLINT, INTEGER, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, false = sqlType is not a numeric data type

ALSO SEE:

isSQLTypeString()

isSQLTypeString()

This method can be used to determine whether or not an SQL data type is a string.

SYNTAX:

boolean isSQLTypeString (int sqlType);

INPUT:

sqlType: an SQL data type

RETURN:

boolean: true = sqlType is one of: CHAR, VARCHAR, or LONGVARCHAR, false = sqlType is not a string

ALSO SEE:

isSQLTypeNumeric()

isValidZoomIndex()

This method returns a boolean value indicating whether or not the zoom index identified by the input parameter, index, is valid. Use getZoomIndex() to get the current zoom index.

SYNTAX:

boolean isValidZoomIndex(int index);

INPUT:

index: a zoom index number

RETURN:

boolean: true = index is valid, false = index is not valid

ALSO SEE:

getZoomIndex()

isZoomingArmed()

This method returns a boolean value indicating whether or not data zooming has been enabled by a doZoomIn() or doZoomOut().

SYNTAX:

boolean isZoomingArmed();

INPUT:

None

RETURN:

boolean; true = Zooming is enabled and graph has been zoomed in or out, false = Zooming is not enabled

ALSO SEE:

doZoomIn(), doZoomOut()

optimizeData()

This method asks the chart to optimize the data. In general, this results in a no operation. But some charts can apply optimization methods.

SYNTAX:

boolean optimizeData();

INPUT:

None

RETURN:

boolean; true = Data is optimized, false = Data is not optimized.

ALSO SEE:

reloadOriginalData()

reloadOriginalData()

This method can be called when the "original data" should be reloaded into the chart.

SYNTAX:

void reloadOriginalData();

INPUT:

None

RETURN:

void;

ALSO SEE:

optimizeData()

setData()

This method sets the data value for a series/group intersection. This is THE master method for setting data in charts. You may also specify whether or not the chart should be repainted when the new value is assigned. You MUST use setDataRangeToExtent() or setDataRange() after the last setData() in order to include the data in the chart.

SYNTAX:

void setData (int row, int col, double fValue);
void setData (int row, int col, double fValue, boolean bRecalc);
void setData (int row, int col, Object obj);
void setData (int row, int col, Object obj, boolean bRecalc);
void setData (int row, int col, int nMonth, int nDay, int nYear);

INPUT:

row; Row number

col; Column number

obj; Object ID

fValue; Data value to set at row/column

bRecalc; boolean - true = Recalculate/Repaint the chart when the new data value is assigned, false = Don't repaint the chart.

nMonth; For gantt and time scale axis charts, a month number (1...12)

nDay; For gantt and time scale axis charts, a day number (1...31)

nYear; For gantt and time scale axis charts, a 4-digit year number

RETURN:

void

EXAMPLE:

setUseSampleData(false);
setData(0, 0, .5);
setData(0, 1, 1); 
setData(0, 2, 2); 
setData(0, 3, 3); 
setData(0, 4, 4);
setData(0, 5, 5); 
setData(1, 0, .5); 
setData(1, 1, 1); 
setData(1, 2, 2); 
setData(1, 3, 3); 
setData(1, 4, 4); 
setData(1, 5, 5); 
setDataRangeToExtent();

setGraphType(99);
setTitleString ("Gantt Chart");
setSubtitleDisplay(false);
setFootnoteDisplay(false);
setLegendDisplay(false);
setData(0, 0, 8, 1, 2003);
setData(0, 1, 8, 2, 2003);
setData(0, 2, 25.0);
setData(0, 3, 8, 3, 2003);
setData(0, 4, 8, 4, 2003);
setData(0, 5, 1);
setData(0, 6, -1);
setSeriesLabel(0, "Task 1 - Wash Dog");
setData(1, 0, 8, 5, 2003);
setData(1, 1, 8, 6, 2003);
setData(1, 2, 50.0);
setData(1, 3, 8, 7, 2003);
setData(1, 4, 8, 8, 2003);
setData(1, 5, 2);
setData(1, 6, -1);
setSeriesLabel(1, "Task 2 - Wash Cat");
setStartDate(8, 1, 2003);
setCurrentDate(8, 11, 2003);
setEndDate(8, 30, 2003);
setDataRange(0, 0, 1, 6);

ALSO SEE:

setDataFileURL(), setDataFromCallBack(), setDataFromDataGrid(), setDataFromResultSet(), setDataFromSQL(),
setDataRange(), setDataRangeToExtent(), "Data Requirements for Different Chart Types"

setDataFile()

You can load any text file into Perspective. This can be done by using setDataFile() which takes any valid file location. The text file needs to be organized in "spreadsheet" fashion, with rows of number for series, and columns of numbers for groups. You can optionally supply row and/or column headers which will be used for labeling the series and groups. Each value must be in quotes and separated by a comma. If you ARE supplying row and column headers, the very first word in the file must be "labels", in quotes, separated by a comma.

SYNTAX:

void setDataFile (String inFilePath);

INPUT:

inFilePath; any valid file location

RETURN:

void

EXAMPLE:

restoreDefaults();
setGraphType(41);
setDepthAngle(0);
setDepthRadius(0);
setUseSampleData(false);
setDataFile("A:/dataset1.txt");

The dataset1.txt file contains the following values:

"labels", "Group 
1", "Group 2", "Group 3", "Group 4", "Group 
5", "Group 6", "Group 7"
"Series 1", 2, 4, 6, 8, 6, 2, 8
"Series 2", 4, 6, 8, 6, 4, 4, 6
"Series 3", 6, 8, 6, 4, 2, 6, 4
"Series 4", 8, 6, 4, 2, 4, 8, 2
"Series 5", 6, 4, 2, 4, 6, 6, 4

NOTES:

This method will NOT work in a secure environment where files cannot just be accessed (like an applet in a browser's sandbox).

setDataFileURL()

You can load any text file into a Perspective applet. This can be done by using setDataFileURL() which takes any valid file location or Internet URL as input or setDataStream() which takes a stream as input. The text file needs to be organized in "spreadsheet" fashion, with rows of number for series, and columns of numbers for groups. You can optionally supply row and/or column headers which will be used for labeling the series and groups. Each value must be in quotes and separated by a comma. If you ARE supplying row and column headers, the very first word in the file must be "labels", in quotes, separated by a comma.

SYNTAX:

void setDataFileURL (String aDataFileURL);

INPUT:

aDataFileURL; any valid file location or Internet URL

RETURN:

void

ALSO SEE:

setData(), setDataFromCallBack(), setDataFromDataGrid(), setDataFromResultSet(), setDataFromSQL(), setDataStream()

setDataFromDataGrid()

TDGDataGrid is series of methods that must be implemented in an object. This method tells the charting engine to use TDGDataGrid to collect data for the chart.

SYNTAX:

void setDataFromDataGrid (TDGDataGrid grid);

INPUT:

grid; This parameter must identify an interface that represents an abstract data model that is one way of preparing data for graphing.

RETURN:

void

ALSO SEE:

setDataFromCallBack. See TDGDataGrid Methods for a description of the methods in the TDGDataGrid.

setDataFromResultSet()

This method graphs columns and rows in the given result set. The result set is not closed.

SYNTAX:

void setDataFromResultSet (java.sql.ResultSet rs);

INPUT:

rs; SQL Result Set

RETURN:

void

ALSO SEE:

setDataFromSQL()

setDataFromSQL()

This method graphs columns and rows in the given query. It creates a result set and closes the result set.

SYNTAX:

void setDataFromSQL (String SQLQuery, java.sql.Statement aStmt);

INPUT:

SQLQuery; A Java SQLQuery string

aStmt; An SQL statement

RETURN:

void

ALSO SEE:

setDataFromResultSet()

setDataRangeToExtent()

This method sets the range of data to be used in the chart according to the number of values identified by the setData() method. It will override values that may be set by setDataRange().

SYNTAX:

void setDataRangeToExtent ();

INPUT:

None

RETURN:

void

ALSO SEE:

setData(), setDataFileURL(), setDataFromCallBack(), setDataFromDataGrid(), setDataFromResultSet(), setDataFromSQL(), setDataRange()

setDataStream()

You can load any text file into a Perspective applet. This can be done by using setDataStream() which takes a stream as input or setDataFileURL() which takes any valid file location or Internet URL as input. The text file needs to be organized in "spreadsheet" fashion, with rows of number for series, and columns of numbers for groups. You can optionally supply row and/or column headers which will be used for labeling the series and groups. Each value must be in quotes and separated by a comma. If you ARE supplying row and column headers, the very first word in the file must be "labels", in quotes, separated by a comma.

SYNTAX:

void setDataStream(java.io.InputStream in);
     throws tdg.AssertionException

INPUT:

in; Input Stream in which to load data.

RETURN:

void

ALSO SEE:

setDataFileURL()