ObjectAtPointer PowerScript function
Description
Finds out where the user clicked in a graph. ObjectAtPointer reports
the region of the graph under the pointer and stores the associated
series and data point numbers in the designated variables.
Controls
Graph controls in windows and user objects, and graphs in
DataWindow controls
Syntax
|
1 |
<span>controlname</span>.<span>ObjectAtPointer</span> ( { <span>graphcontrol</span>, } <span>seriesnumber</span>, <span>datapoint</span> ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the graph object for which |
|
graphcontrol (DataWindow control |
(Optional) A string whose value is the |
|
seriesnumber |
An integer variable in which you want |
|
datapoint |
An integer variable in which you want |
Return Values
grObjectType. Returns a value of the grObjectType enumerated
datatype if the user clicks anywhere in the graph (including an
empty area) and a null value if the user clicks
outside the graph.
Values of grObjectType and the parts of the graph associated
with them are:
-
TypeCategory! – A
label for a category -
TypeCategoryAxis! – The category axis or
between the category labels -
TypeCategoryLabel! – The label of the category
axis -
TypeData! – A data point or other data
marker -
TypeGraph! – Any place within the graph
control that is not another grObjectType -
TypeLegend! – Within the legend box, but
not on a series label -
TypeSeries! – The line that connects the
data points of a series when the graph’s type is line or
on the series label in the legend box -
TypeSeriesAxis! – The series axis of a
3D graph -
TypeSeriesLabel! – The label of the series
axis of a 3D graph -
TypeTitle! – The title of the graph
-
TypeValueAxis! – The value axis, including
on the value labels -
TypeValueLabel! – The user clicked the
label of the value axis
Usage
The ObjectAtPointer function allows you
to find out how the user is interacting with the graph. The function
returns a value of the grObjectType enumerated datatype identifying
the part of the graph. When the user clicks in a series, data point,
or category, ObjectAtPointer stores the series
and/or data point numbers in designated variables.
When the user clicks a data point (or other data mark, such
as line or bar), or on the series labels in the legend, ObjectAtPointer stores
the series number in the designated variable.
When the user clicks on a data point or category tickmark
label, ObjectAtPointer stores the data point
number in the designated variable.
When the user clicks in a series, but not on the actual data
point, ObjectAtPointer stores 0 in datapoint and
when the user clicks in a category, ObjectAtPointer stores
0 in seriesnumber. When the user clicks other
parts of the graph, ObjectAtPointer stores 0
in both variables.
Call ObjectAtPointer first
ObjectAtPointer is most effective as the
first function call in the script for the Clicked event for the
graph control. Make sure you enable the graph control (the default
is disabled). Otherwise, the Clicked event script is never run.
Examples
These statements store the series number and data
point number at the pointer location in the graph named gr_product in SeriesNbr and ItemNbr.
If the object type is TypeSeries! they obtain the series name, and
if it is TypeData! they get the data value:
|
1 |
integer SeriesNbr, ItemNbr |
|
1 |
double data_value |
|
1 |
grObjectTypeobject_type |
|
1 |
string SeriesName |
|
1 |
|
1 |
object_type = & |
|
1 |
gr_product.<span>ObjectAtPointer</span>(SeriesNbr, ItemNbr) |
|
1 |
IF object_type = TypeSeries! THEN |
|
1 |
SeriesName = & |
|
1 |
gr_product.SeriesName(SeriesNbr) |
|
1 |
ELSEIF object_type = TypeData! THEN |
|
1 |
data_value = & |
|
1 |
gr_product.GetData(SeriesNbr, ItemNbr) |
|
1 |
END IF |
These statements store the series number and data
point number at the pointer location in the graph named gr_computers in
the DataWindow control dw_equipment in SeriesNbr and ItemNbr:
|
1 |
integer SeriesNbr, ItemNbr |
|
1 |
dw_equipment.<span>ObjectAtPointer</span>("gr_computers", & |
|
1 |
<span></span> SeriesNbr, ItemNbr) |