Working with graph controls in code

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.

Properties of graph controls

You can access (and optionally modify) a graph by addressing its properties in code at runtime. There are two kinds of graph properties:

Events of graph controls

Graph controls have the events listed in Table 7-1.

Table 7-1: Graph control events

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

Functions for graph controls

You use the PowerScript graph functions in Table 7-2 to manipulate data in a graph.

Table 7-2: PowerScript graph functions

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