Graph controls in a window can be enabled or disabled, visible or invisible, and can be used in drag and drop. You can also write code that uses events of graph controls and additional graph functions.
You can access (and optionally modify) a graph by addressing its properties in code at runtime. There are two kinds of graph properties:
Properties of the graph definition itself These properties are initially set in the painter when you create a graph. They include a graph’s type, title, axis labels, whether axes have major divisions, and so on. For 3D graphs, this includes the Render 3D property that uses transparency rather than overlays to enhance a graph’s appearence and give it a more sophisticated look.
Properties of the data These properties are relevant only at runtime, when data has been loaded into the graph. They include the number of series in a graph (series are created at runtime), colors of bars or columns for a series, whether the series is an overlay, text that identifies the categories (categories are created at runtime), and so on.
Graph controls have the events listed in Table 15-1.
Clicked |
DragLeave |
Constructor |
DragWithin |
Destructor |
GetFocus |
DoubleClicked |
LoseFocus |
DragDrop |
Other |
DragEnter |
RButtonDown |
So, for example, you can write a script that is invoked when a user clicks a graph or drags an object on a graph (as long as the graph is enabled).
You use the PowerScript graph functions in Table 15-2 to manipulate data in a graph.
Function |
Action |
---|---|
AddCategory |
Adds a category |
AddData |
Adds a data point |
AddSeries |
Adds a series |
DeleteCategory |
Deletes a category |
DeleteData |
Deletes a data point |
DeleteSeries |
Deletes a series |
ImportClipboard |
Copies data from the clipboard to a graph |
ImportFile |
Copies the data in a text file to a graph |
ImportString |
Copies the contents of a string to a graph |
InsertCategory |
Inserts a category before another category |
InsertData |
Inserts a data point before another data point in a series |
InsertSeries |
Inserts a series before another series |
ModifyData |
Changes the value of a data point |
Reset |
Resets the graph’s data |