ObjectAtPointer

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.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls

Syntax

controlname.ObjectAtPointer ( { graphcontrol, } seriesnumber, datapoint )

Argument

Description

controlname

The name of the graph object for which you want the object under the pointer, or the DataWindow control containing the graph

graphcontrol (DataWindow control only)

(Optional) A string whose value is the name of the graph in the DataWindow control for which you want the object under the pointer

seriesnumber

An integer variable in which you want to store the number of the series under the pointer

datapoint

An integer variable in which you want to store the number of the data point under the pointer


Return value

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:

integer SeriesNbr, ItemNbr
double data_value
grObjectType object_type
string SeriesName
 
object_type = &
      gr_product.ObjectAtPointer(SeriesNbr, ItemNbr)
IF object_type = TypeSeries! THEN
      SeriesName = &
         gr_product.SeriesName(SeriesNbr)
ELSEIF object_type = TypeData! THEN
      data_value = &
         gr_product.GetData(SeriesNbr, ItemNbr)
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:

integer SeriesNbr, ItemNbr
dw_equipment.ObjectAtPointer("gr_computers", &
      SeriesNbr, ItemNbr)

See also

AddData

AddSeries