OnGraphClick
A feature proposed for Analytica 5.5
OnGraphClick
The OnGraphClick attribute holds an expression that is evaluated when an end-user clicks the mouse on the variable's result graph. Information about where the click occurred is through several local variables that are set before the expression is evaluated.
Your expression should return true
if you want the normal processing of the mouse click to continue. It should return false
if you want to suspend the normal processing. If you suspend processing of the click, then datum balloons won't show, key items won't toggle, and zooming by dragging a rubber band rectangle won't work (unless you hold the shift key while dragging).
Special local variables
Several local variables are set so that your expression can figure out what was clicked on. The set of locals that are meaningful depends on which part of the graph the user clicked.
where
: Indicates which part of the graph was clicked on. Possible values are: "plotArea", "key", "axisTitle", "axisLabels" and "background".click_x
andclick_y
: The pixel coordinates of the mouse click relative to the top-left corner.dim
: An index used when specifying a data coordinate. The elements are handles of the indexes that are present in the graph (a subset of all the indexes, depending on what's clicked on).coord
: The coordinate (by IndexValues) of the data point that was clicked on, ornull
in the click was not on a datum. This is a one-dimensional array indexed bydim
. The cell corresponding to the index indim
contains the value of the index.coordPos
: The coordinate (by positions) of the data point that was clicked on, ornull
in the click was not on a datum. This is a one-dimensional array indexed bydim
. The cell corresponding to the index indim
contains the position within the given index.info
: This is the same as for OnGraphDraw.roles
: This is the same as for OnGraphDraw.
Clicking in the plot area
The plot area is the rectangle bounded by and contained within the horizontal and vertical axes.
You can test for this case using If where="plotArea" Then
.
When you click in the plot area, the click may fall either on a data point (which includes within the bar area in a bar chart), on a line segment between two data points (which includes in the fill area in a filled line chart), or on the background of the plot area.
When the click falls on a data point, the locals coord
and coordPos
provide the index coordinates of the data point. coord
has the IndexValues whereas coordPos
has the positions along the indexes.
Clicking in a key
Clicking on an axis title
Clicking in the axis label area
Clicking on the background
The background is any area outside of the plot area rectangle, outside of any key, and outside of the axis title or label areas.
You can test for this case using If where="background" Then
.
The locals dim
, coord
and coordPos
are null.
Enable comment auto-refresher