Accessing data properties
To access properties related to a graph’s data during
execution, you use PowerScript graph functions. The graph functions related
to data fall into several categories:
- Functions that provide information about a graph’s
data - Functions that save data from a graph
- Functions that change the color, fill patterns,
and other visual properties of data
How to use the functions
To call functions for a graph in a graph control, use the
following syntax:
1 |
<i>graphControlName.FunctionName</i> ( <i>Arguments</i> ) |
For example, to get a count of the categories in the window
graph gr_printer, code:
1 |
Ccount = gr_printer.CategoryCount() |
Different syntax for graphs in DataWindows The syntax for the same functions is more complex when the
graph is in a DataWindow, like this:
1 |
<i>DataWindowName.FunctionName</i> ( "<i>graphName</i>", <i>otherArguments...</i> ) |
For more information, see the DataWindow Programmer’s
Guide
.
Getting information about the data
The following PowerScript functions allow you to get information
about data in a graph at execution time:
Function | Information provided |
---|---|
CategoryCount | The number of categories in a graph |
CategoryName | The name of a category given its number |
DataCount | The number of data points in a series |
FindCategory | The number of a category given its name |
FindSeries | The number of a series given its name |
GetData | The value of a data point given its series and position (superseded by GetDataValue, which is more flexible) |
GetDataPieExplode | The percentage that a pie slice is exploded |
GetDataStyle | The color, fill pattern, or other visual property of a specified data point |
GetDataValue | The value of a data point given its series and position |
GetSeriesStyle | The color, fill pattern, or other visual property of a specified series |
ObjectAtPointer | The graph element the mouse was positioned over when it was clicked |
SeriesCount | The number of series in a graph |
SeriesName | The name of a series given its number |
Saving graph data
The following PowerScript functions allow you to save data
from the graph:
Function | Action |
---|---|
Clipboard | Copies a bitmap image of the specified graph to the clipboard |
SaveAs | Saves the data in the underlying graph to the clipboard or to a file in one of a number of formats |
Modifying colors, fill patterns, and other data
The following PowerScript functions allow you to modify the
appearance of data in a graph:
Function | Action |
---|---|
ResetDataColors | Resets the color for a specific data point |
SetDataPieExplode | Explodes a slice in a pie graph |
SetDataStyle | Sets the color, fill pattern, or other visual property for a specific data point |
SetSeriesStyle | Sets the color, fill pattern, or other visual property for a series |